Rollup merge of #108575 - compiler-errors:erase, r=estebank
Erase **all** regions when probing for associated types on ambiguity in astconv Fixes #108562
This commit is contained in:
commit
91dafebc91
3 changed files with 21 additions and 2 deletions
|
@ -2399,8 +2399,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
infcx
|
||||
.can_eq(
|
||||
ty::ParamEnv::empty(),
|
||||
tcx.erase_regions(impl_.self_ty()),
|
||||
tcx.erase_regions(qself_ty),
|
||||
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.impl_polarity(impl_def_id) != ty::ImplPolarity::Negative
|
||||
|
|
8
tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.rs
Normal file
8
tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
pub struct Bar<S>(S);
|
||||
|
||||
pub trait Foo {}
|
||||
|
||||
impl<S> Foo for Bar<S> where for<'a> <&'a S>::Item: Foo {}
|
||||
//~^ ERROR ambiguous associated type
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,9 @@
|
|||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/suggest-trait-in-ufcs-in-hrtb.rs:5:38
|
||||
|
|
||||
LL | impl<S> Foo for Bar<S> where for<'a> <&'a S>::Item: Foo {}
|
||||
| ^^^^^^^^^^^^^ help: use the fully-qualified path: `<&'a S as IntoIterator>::Item`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0223`.
|
Loading…
Add table
Reference in a new issue