1
Fork 0

Auto merge of #136225 - fmease:rollup-fm7m744, r=fmease

Rollup of 7 pull requests

Successful merges:

 - #135625 ([cfg_match] Document the use of expressions.)
 - #135902 (Do not consider child bound assumptions for rigid alias)
 - #135943 (Rename `Piece::String` to `Piece::Lit`)
 - #136104 (Add mermaid graphs of NLL regions and SCCs to polonius MIR dump)
 - #136143 (Update books)
 - #136147 (ABI-required target features: warn when they are missing in base CPU)
 - #136164 (Refactor FnKind variant to hold &Fn)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-01-29 05:00:20 +00:00
commit ccc9ba5c30
66 changed files with 580 additions and 412 deletions

View file

@ -196,7 +196,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
let item_def_id = self.tcx.associated_item_def_ids(future_trait)[0];
self.tcx
.explicit_item_super_predicates(def_id)
.explicit_item_self_bounds(def_id)
.iter_instantiated_copied(self.tcx, args)
.find_map(|(predicate, _)| {
predicate

View file

@ -293,7 +293,7 @@ impl<T> Trait<T> for X {
(ty::Dynamic(t, _, ty::DynKind::Dyn), ty::Alias(ty::Opaque, alias))
if let Some(def_id) = t.principal_def_id()
&& tcx
.explicit_item_super_predicates(alias.def_id)
.explicit_item_self_bounds(alias.def_id)
.skip_binder()
.iter()
.any(|(pred, _span)| match pred.kind().skip_binder() {
@ -422,7 +422,7 @@ impl<T> Trait<T> for X {
ty::Alias(..) => values.expected,
_ => values.found,
};
let preds = tcx.explicit_item_super_predicates(opaque_ty.def_id);
let preds = tcx.explicit_item_self_bounds(opaque_ty.def_id);
for (pred, _span) in preds.skip_binder() {
let ty::ClauseKind::Trait(trait_predicate) = pred.kind().skip_binder()
else {

View file

@ -799,7 +799,7 @@ impl<'tcx> OnUnimplementedFormatString {
let mut result = Ok(());
for token in &mut parser {
match token {
Piece::String(_) => (), // Normal string, no need to check it
Piece::Lit(_) => (), // Normal string, no need to check it
Piece::NextArgument(a) => {
let format_spec = a.format;
if self.is_diagnostic_namespace_variant
@ -950,7 +950,7 @@ impl<'tcx> OnUnimplementedFormatString {
let item_context = (options.get(&sym::ItemContext)).unwrap_or(&empty_string);
let constructed_message = (&mut parser)
.map(|p| match p {
Piece::String(s) => s.to_owned(),
Piece::Lit(s) => s.to_owned(),
Piece::NextArgument(a) => match a.position {
Position::ArgumentNamed(arg) => {
let s = Symbol::intern(arg);

View file

@ -1087,28 +1087,27 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
sig_parts.map_bound(|sig| sig.tupled_inputs_ty.tuple_fields().as_slice()),
))
}
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => self
.tcx
.item_super_predicates(def_id)
.instantiate(self.tcx, args)
.iter()
.find_map(|pred| {
if let ty::ClauseKind::Projection(proj) = pred.kind().skip_binder()
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => {
self.tcx.item_self_bounds(def_id).instantiate(self.tcx, args).iter().find_map(
|pred| {
if let ty::ClauseKind::Projection(proj) = pred.kind().skip_binder()
&& self
.tcx
.is_lang_item(proj.projection_term.def_id, LangItem::FnOnceOutput)
// args tuple will always be args[1]
&& let ty::Tuple(args) = proj.projection_term.args.type_at(1).kind()
{
Some((
DefIdOrName::DefId(def_id),
pred.kind().rebind(proj.term.expect_type()),
pred.kind().rebind(args.as_slice()),
))
} else {
None
}
}),
{
Some((
DefIdOrName::DefId(def_id),
pred.kind().rebind(proj.term.expect_type()),
pred.kind().rebind(args.as_slice()),
))
} else {
None
}
},
)
}
ty::Dynamic(data, _, ty::Dyn) => data.iter().find_map(|pred| {
if let ty::ExistentialPredicate::Projection(proj) = pred.skip_binder()
&& self.tcx.is_lang_item(proj.def_id, LangItem::FnOnceOutput)

View file

@ -1620,9 +1620,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// projections, we will never be able to equate, e.g. `<T as Tr>::A`
// with `<<T as Tr>::A as Tr>::A`.
let relevant_bounds = if in_parent_alias_type {
self.tcx().item_non_self_assumptions(alias_ty.def_id)
self.tcx().item_non_self_bounds(alias_ty.def_id)
} else {
self.tcx().item_super_predicates(alias_ty.def_id)
self.tcx().item_self_bounds(alias_ty.def_id)
};
for bound in relevant_bounds.instantiate(self.tcx(), alias_ty.args) {