Auto merge of #133818 - matthiaskrgr:rollup-iav1wq7, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #132937 (a release operation synchronizes with an acquire operation) - #133681 (improve TagEncoding::Niche docs, sanity check, and UB checks) - #133726 (Add `core::arch::breakpoint` and test) - #133768 (Remove `generic_associated_types_extended` feature gate) - #133811 ([AIX] change AIX default codemodel=large) - #133812 (Update wasm-component-ld to 0.5.11) - #133813 (compiletest: explain that UI tests are expected not to compile by default) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
3b382642ab
51 changed files with 566 additions and 240 deletions
|
@ -328,10 +328,7 @@ pub fn dyn_compatibility_violations_for_assoc_item(
|
|||
.collect(),
|
||||
// Associated types can only be dyn-compatible if they have `Self: Sized` bounds.
|
||||
ty::AssocKind::Type => {
|
||||
if !tcx.features().generic_associated_types_extended()
|
||||
&& !tcx.generics_of(item.def_id).is_own_empty()
|
||||
&& !item.is_impl_trait_in_trait()
|
||||
{
|
||||
if !tcx.generics_of(item.def_id).is_own_empty() && !item.is_impl_trait_in_trait() {
|
||||
vec![DynCompatibilityViolation::GAT(item.name, item.ident(tcx).span)]
|
||||
} else {
|
||||
// We will permit associated types if they are explicitly mentioned in the trait object.
|
||||
|
|
|
@ -14,7 +14,7 @@ use rustc_middle::traits::select::OverflowError;
|
|||
use rustc_middle::traits::{BuiltinImplSource, ImplSource, ImplSourceUserDefinedData};
|
||||
use rustc_middle::ty::fast_reject::DeepRejectCtxt;
|
||||
use rustc_middle::ty::fold::TypeFoldable;
|
||||
use rustc_middle::ty::visit::{MaxUniverse, TypeVisitable, TypeVisitableExt};
|
||||
use rustc_middle::ty::visit::TypeVisitableExt;
|
||||
use rustc_middle::ty::{self, Term, Ty, TyCtxt, TypingMode, Upcast};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::symbol::sym;
|
||||
|
@ -179,35 +179,11 @@ pub(super) fn poly_project_and_unify_term<'cx, 'tcx>(
|
|||
) -> ProjectAndUnifyResult<'tcx> {
|
||||
let infcx = selcx.infcx;
|
||||
let r = infcx.commit_if_ok(|_snapshot| {
|
||||
let old_universe = infcx.universe();
|
||||
let placeholder_predicate = infcx.enter_forall_and_leak_universe(obligation.predicate);
|
||||
let new_universe = infcx.universe();
|
||||
|
||||
let placeholder_obligation = obligation.with(infcx.tcx, placeholder_predicate);
|
||||
match project_and_unify_term(selcx, &placeholder_obligation) {
|
||||
ProjectAndUnifyResult::MismatchedProjectionTypes(e) => Err(e),
|
||||
ProjectAndUnifyResult::Holds(obligations)
|
||||
if old_universe != new_universe
|
||||
&& selcx.tcx().features().generic_associated_types_extended() =>
|
||||
{
|
||||
// If the `generic_associated_types_extended` feature is active, then we ignore any
|
||||
// obligations references lifetimes from any universe greater than or equal to the
|
||||
// universe just created. Otherwise, we can end up with something like `for<'a> I: 'a`,
|
||||
// which isn't quite what we want. Ideally, we want either an implied
|
||||
// `for<'a where I: 'a> I: 'a` or we want to "lazily" check these hold when we
|
||||
// instantiate concrete regions. There is design work to be done here; until then,
|
||||
// however, this allows experimenting potential GAT features without running into
|
||||
// well-formedness issues.
|
||||
let new_obligations = obligations
|
||||
.into_iter()
|
||||
.filter(|obligation| {
|
||||
let mut visitor = MaxUniverse::new();
|
||||
obligation.predicate.visit_with(&mut visitor);
|
||||
visitor.max_universe() < new_universe
|
||||
})
|
||||
.collect();
|
||||
Ok(ProjectAndUnifyResult::Holds(new_obligations))
|
||||
}
|
||||
other => Ok(other),
|
||||
}
|
||||
});
|
||||
|
|
|
@ -626,7 +626,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
for assoc_type in assoc_types {
|
||||
let defs: &ty::Generics = tcx.generics_of(assoc_type);
|
||||
|
||||
if !defs.own_params.is_empty() && !tcx.features().generic_associated_types_extended() {
|
||||
if !defs.own_params.is_empty() {
|
||||
tcx.dcx().span_delayed_bug(
|
||||
obligation.cause.span,
|
||||
"GATs in trait object shouldn't have been considered",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue