Erase escaping late-bound regions when probing for ambiguous associated types
This commit is contained in:
parent
c50c62d225
commit
79ad7cca45
@ -2396,13 +2396,24 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
tcx,
|
||||
infcx.fresh_substs_for_item(DUMMY_SP, impl_def_id),
|
||||
);
|
||||
// I guess we don't need to make a universe unless we need it,
|
||||
// but also we're on the error path, so it doesn't matter here.
|
||||
let universe = infcx.create_next_universe();
|
||||
infcx
|
||||
.can_eq(
|
||||
ty::ParamEnv::empty(),
|
||||
impl_.self_ty(),
|
||||
// Must fold past escaping bound vars too,
|
||||
// since we have those at this point in astconv.
|
||||
tcx.fold_regions(qself_ty, |_, _| tcx.lifetimes.re_erased),
|
||||
tcx.replace_escaping_bound_vars_uncached(qself_ty, ty::fold::FnMutDelegate {
|
||||
regions: &mut |_| tcx.lifetimes.re_erased,
|
||||
types: &mut |bv| tcx.mk_placeholder(ty::PlaceholderType {
|
||||
universe,
|
||||
name: bv.kind,
|
||||
}),
|
||||
consts: &mut |bv, ty| tcx.mk_const(ty::PlaceholderConst {
|
||||
universe,
|
||||
name: bv
|
||||
}, ty),
|
||||
})
|
||||
)
|
||||
})
|
||||
&& tcx.impl_polarity(impl_def_id) != ty::ImplPolarity::Negative
|
||||
|
11
tests/ui/traits/non_lifetime_binders/missing-assoc-item.rs
Normal file
11
tests/ui/traits/non_lifetime_binders/missing-assoc-item.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![feature(non_lifetime_binders)]
|
||||
//~^ WARN the feature `non_lifetime_binders` is incomplete
|
||||
|
||||
fn f()
|
||||
where
|
||||
for<B> B::Item: Send,
|
||||
//~^ ERROR ambiguous associated type
|
||||
{
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,18 @@
|
||||
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/missing-assoc-item.rs:1:12
|
||||
|
|
||||
LL | #![feature(non_lifetime_binders)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/missing-assoc-item.rs:6:12
|
||||
|
|
||||
LL | for<B> B::Item: Send,
|
||||
| ^^^^^^^ help: use the fully-qualified path: `<B as IntoIterator>::Item`
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0223`.
|
Loading…
x
Reference in New Issue
Block a user