Auto merge of #113474 - compiler-errors:rollup-07x1up7, r=compiler-errors
Rollup of 8 pull requests Successful merges: - #113413 (Add needs-triage to all new issues) - #113426 (Don't ICE in `resolve_bound_vars` when associated return-type bounds are in bad positions) - #113427 (Remove `variances_of` on RPITIT GATs, remove its one use-case) - #113441 (miri: check that assignments do not self-overlap) - #113453 (Remove unused from_method from rustc_on_unimplemented) - #113456 (Avoid calling report_forbidden_specialization for RPITITs) - #113466 (Update cargo) - #113467 (Fix comment of `fn_can_unwind`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
ce519c5945
20 changed files with 251 additions and 57 deletions
|
@ -722,7 +722,14 @@ pub(super) fn check_specialization_validity<'tcx>(
|
|||
let result = opt_result.unwrap_or(Ok(()));
|
||||
|
||||
if let Err(parent_impl) = result {
|
||||
report_forbidden_specialization(tcx, impl_item, parent_impl);
|
||||
if !tcx.is_impl_trait_in_trait(impl_item) {
|
||||
report_forbidden_specialization(tcx, impl_item, parent_impl);
|
||||
} else {
|
||||
tcx.sess.delay_span_bug(
|
||||
DUMMY_SP,
|
||||
format!("parent item: {:?} not marked as default", parent_impl),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1485,7 +1492,9 @@ fn opaque_type_cycle_error(
|
|||
}
|
||||
|
||||
for closure_def_id in visitor.closures {
|
||||
let Some(closure_local_did) = closure_def_id.as_local() else { continue; };
|
||||
let Some(closure_local_did) = closure_def_id.as_local() else {
|
||||
continue;
|
||||
};
|
||||
let typeck_results = tcx.typeck(closure_local_did);
|
||||
|
||||
let mut label_match = |ty: Ty<'_>, span| {
|
||||
|
|
|
@ -22,7 +22,7 @@ use rustc_middle::ty::{self, TyCtxt, TypeSuperVisitable, TypeVisitor};
|
|||
use rustc_session::lint;
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::symbol::{sym, Ident};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use std::fmt;
|
||||
|
||||
use crate::errors;
|
||||
|
@ -338,7 +338,17 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
|
|||
|
||||
Scope::TraitRefBoundary { .. } => {
|
||||
// We should only see super trait lifetimes if there is a `Binder` above
|
||||
assert!(supertrait_bound_vars.is_empty());
|
||||
// though this may happen when we call `poly_trait_ref_binder_info` with
|
||||
// an (erroneous, #113423) associated return type bound in an impl header.
|
||||
if !supertrait_bound_vars.is_empty() {
|
||||
self.tcx.sess.delay_span_bug(
|
||||
DUMMY_SP,
|
||||
format!(
|
||||
"found supertrait lifetimes without a binder to append \
|
||||
them to: {supertrait_bound_vars:?}"
|
||||
),
|
||||
);
|
||||
}
|
||||
break (vec![], BinderScopeType::Normal);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use rustc_arena::DroplessArena;
|
|||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{self, CrateVariancesMap, ImplTraitInTraitData, SubstsRef, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{self, CrateVariancesMap, SubstsRef, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{TypeSuperVisitable, TypeVisitable};
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
|
@ -59,13 +59,6 @@ fn variances_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Variance] {
|
|||
DefKind::OpaqueTy | DefKind::ImplTraitPlaceholder => {
|
||||
return variance_of_opaque(tcx, item_def_id);
|
||||
}
|
||||
DefKind::AssocTy => {
|
||||
if let Some(ImplTraitInTraitData::Trait { .. }) =
|
||||
tcx.opt_rpitit_info(item_def_id.to_def_id())
|
||||
{
|
||||
return variance_of_opaque(tcx, item_def_id);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
@ -125,7 +118,8 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
|
|||
// FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty) check whether this is necessary
|
||||
// at all for RPITITs.
|
||||
ty::Alias(_, ty::AliasTy { def_id, substs, .. })
|
||||
if self.tcx.is_impl_trait_in_trait(*def_id) =>
|
||||
if self.tcx.is_impl_trait_in_trait(*def_id)
|
||||
&& !self.tcx.lower_impl_trait_in_trait_to_assoc_ty() =>
|
||||
{
|
||||
self.visit_opaque(*def_id, substs)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue