Auto merge of #130269 - Zalathar:rollup-coxzt2t, r=Zalathar
Rollup of 8 pull requests Successful merges: - #125060 (Expand documentation of PathBuf, discussing lack of sanitization) - #129367 (Fix default/minimum deployment target for Aarch64 simulator targets) - #130156 (Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd) - #130160 (Fix `slice::first_mut` docs) - #130235 (Simplify some nested `if` statements) - #130250 (Fix `clippy::useless_conversion`) - #130252 (Properly report error on `const gen fn`) - #130256 (Re-run coverage tests if `coverage-dump` was modified) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
394c4060d2
90 changed files with 742 additions and 763 deletions
|
@ -444,10 +444,11 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
// the `-Z force-unstable-if-unmarked` flag present (we're
|
||||
// compiling a compiler crate), then let this missing feature
|
||||
// annotation slide.
|
||||
if feature == sym::rustc_private && issue == NonZero::new(27812) {
|
||||
if self.sess.opts.unstable_opts.force_unstable_if_unmarked {
|
||||
return EvalResult::Allow;
|
||||
}
|
||||
if feature == sym::rustc_private
|
||||
&& issue == NonZero::new(27812)
|
||||
&& self.sess.opts.unstable_opts.force_unstable_if_unmarked
|
||||
{
|
||||
return EvalResult::Allow;
|
||||
}
|
||||
|
||||
if matches!(allow_unstable, AllowUnstable::Yes) {
|
||||
|
|
|
@ -448,22 +448,20 @@ impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes>
|
|||
bad: uninit_range,
|
||||
}))
|
||||
})?;
|
||||
if !Prov::OFFSET_IS_ADDR {
|
||||
if !self.provenance.range_empty(range, cx) {
|
||||
// Find the provenance.
|
||||
let (offset, _prov) = self
|
||||
.provenance
|
||||
.range_get_ptrs(range, cx)
|
||||
.first()
|
||||
.copied()
|
||||
.expect("there must be provenance somewhere here");
|
||||
let start = offset.max(range.start); // the pointer might begin before `range`!
|
||||
let end = (offset + cx.pointer_size()).min(range.end()); // the pointer might end after `range`!
|
||||
return Err(AllocError::ReadPointerAsInt(Some(BadBytesAccess {
|
||||
access: range,
|
||||
bad: AllocRange::from(start..end),
|
||||
})));
|
||||
}
|
||||
if !Prov::OFFSET_IS_ADDR && !self.provenance.range_empty(range, cx) {
|
||||
// Find the provenance.
|
||||
let (offset, _prov) = self
|
||||
.provenance
|
||||
.range_get_ptrs(range, cx)
|
||||
.first()
|
||||
.copied()
|
||||
.expect("there must be provenance somewhere here");
|
||||
let start = offset.max(range.start); // the pointer might begin before `range`!
|
||||
let end = (offset + cx.pointer_size()).min(range.end()); // the pointer might end after `range`!
|
||||
return Err(AllocError::ReadPointerAsInt(Some(BadBytesAccess {
|
||||
access: range,
|
||||
bad: AllocRange::from(start..end),
|
||||
})));
|
||||
}
|
||||
Ok(self.get_bytes_unchecked(range))
|
||||
}
|
||||
|
|
|
@ -208,12 +208,10 @@ fn dump_path<'tcx>(
|
|||
|
||||
let pass_num = if tcx.sess.opts.unstable_opts.dump_mir_exclude_pass_number {
|
||||
String::new()
|
||||
} else if pass_num {
|
||||
format!(".{:03}-{:03}", body.phase.phase_index(), body.pass_count)
|
||||
} else {
|
||||
if pass_num {
|
||||
format!(".{:03}-{:03}", body.phase.phase_index(), body.pass_count)
|
||||
} else {
|
||||
".-------".to_string()
|
||||
}
|
||||
".-------".to_string()
|
||||
};
|
||||
|
||||
let crate_name = tcx.crate_name(source.def_id().krate);
|
||||
|
|
|
@ -396,7 +396,7 @@ impl<'tcx> Const<'tcx> {
|
|||
Ok((tcx.type_of(unevaluated.def).instantiate(tcx, unevaluated.args), c))
|
||||
}
|
||||
Ok(Err(bad_ty)) => Err(Either::Left(bad_ty)),
|
||||
Err(err) => Err(Either::Right(err.into())),
|
||||
Err(err) => Err(Either::Right(err)),
|
||||
}
|
||||
}
|
||||
ConstKind::Value(ty, val) => Ok((ty, val)),
|
||||
|
|
|
@ -2606,33 +2606,31 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
/// With `cfg(debug_assertions)`, assert that args are compatible with their generics,
|
||||
/// and print out the args if not.
|
||||
pub fn debug_assert_args_compatible(self, def_id: DefId, args: &'tcx [ty::GenericArg<'tcx>]) {
|
||||
if cfg!(debug_assertions) {
|
||||
if !self.check_args_compatible(def_id, args) {
|
||||
if let DefKind::AssocTy = self.def_kind(def_id)
|
||||
&& let DefKind::Impl { of_trait: false } = self.def_kind(self.parent(def_id))
|
||||
{
|
||||
bug!(
|
||||
"args not compatible with generics for {}: args={:#?}, generics={:#?}",
|
||||
self.def_path_str(def_id),
|
||||
args,
|
||||
// Make `[Self, GAT_ARGS...]` (this could be simplified)
|
||||
self.mk_args_from_iter(
|
||||
[self.types.self_param.into()].into_iter().chain(
|
||||
self.generics_of(def_id)
|
||||
.own_args(ty::GenericArgs::identity_for_item(self, def_id))
|
||||
.iter()
|
||||
.copied()
|
||||
)
|
||||
if cfg!(debug_assertions) && !self.check_args_compatible(def_id, args) {
|
||||
if let DefKind::AssocTy = self.def_kind(def_id)
|
||||
&& let DefKind::Impl { of_trait: false } = self.def_kind(self.parent(def_id))
|
||||
{
|
||||
bug!(
|
||||
"args not compatible with generics for {}: args={:#?}, generics={:#?}",
|
||||
self.def_path_str(def_id),
|
||||
args,
|
||||
// Make `[Self, GAT_ARGS...]` (this could be simplified)
|
||||
self.mk_args_from_iter(
|
||||
[self.types.self_param.into()].into_iter().chain(
|
||||
self.generics_of(def_id)
|
||||
.own_args(ty::GenericArgs::identity_for_item(self, def_id))
|
||||
.iter()
|
||||
.copied()
|
||||
)
|
||||
);
|
||||
} else {
|
||||
bug!(
|
||||
"args not compatible with generics for {}: args={:#?}, generics={:#?}",
|
||||
self.def_path_str(def_id),
|
||||
args,
|
||||
ty::GenericArgs::identity_for_item(self, def_id)
|
||||
);
|
||||
}
|
||||
)
|
||||
);
|
||||
} else {
|
||||
bug!(
|
||||
"args not compatible with generics for {}: args={:#?}, generics={:#?}",
|
||||
self.def_path_str(def_id),
|
||||
args,
|
||||
ty::GenericArgs::identity_for_item(self, def_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1183,10 +1183,10 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: SpecAbi) ->
|
|||
//
|
||||
// This is not part of `codegen_fn_attrs` as it can differ between crates
|
||||
// and therefore cannot be computed in core.
|
||||
if tcx.sess.opts.unstable_opts.panic_in_drop == PanicStrategy::Abort {
|
||||
if tcx.is_lang_item(did, LangItem::DropInPlace) {
|
||||
return false;
|
||||
}
|
||||
if tcx.sess.opts.unstable_opts.panic_in_drop == PanicStrategy::Abort
|
||||
&& tcx.is_lang_item(did, LangItem::DropInPlace)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1526,7 +1526,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
|
|||
|
||||
let precedence = |binop: rustc_middle::mir::BinOp| {
|
||||
use rustc_ast::util::parser::AssocOp;
|
||||
AssocOp::from_ast_binop(binop.to_hir_binop().into()).precedence()
|
||||
AssocOp::from_ast_binop(binop.to_hir_binop()).precedence()
|
||||
};
|
||||
let op_precedence = precedence(op);
|
||||
let formatted_op = op.to_hir_binop().as_str();
|
||||
|
@ -3361,10 +3361,8 @@ pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<Symbol> {
|
|||
// name.
|
||||
//
|
||||
// Any stable ordering would be fine here though.
|
||||
if *v.get() != symbol {
|
||||
if v.get().as_str() > symbol.as_str() {
|
||||
v.insert(symbol);
|
||||
}
|
||||
if *v.get() != symbol && v.get().as_str() > symbol.as_str() {
|
||||
v.insert(symbol);
|
||||
}
|
||||
}
|
||||
Vacant(v) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue