fix ICE in check_unique
This commit is contained in:
parent
73476d4990
commit
92f40b8059
@ -69,9 +69,18 @@ fn check_unique(
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore non-universal regions because they result in an error eventually.
|
||||
// FIXME(aliemjay): This logic will be rewritten in a later commit.
|
||||
let Some(r1) = self.universal_name(r1) else {
|
||||
continue;
|
||||
};
|
||||
let Some(r2) = self.universal_name(r2) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
infcx.dcx().emit_err(LifetimeMismatchOpaqueParam {
|
||||
arg: self.universal_name(r1).unwrap().into(),
|
||||
prev: self.universal_name(r2).unwrap().into(),
|
||||
arg: r1.into(),
|
||||
prev: r2.into(),
|
||||
span: a_ty.span,
|
||||
prev_span: b_ty.span,
|
||||
});
|
||||
|
16
tests/ui/type-alias-impl-trait/param_mismatch4.rs
Normal file
16
tests/ui/type-alias-impl-trait/param_mismatch4.rs
Normal file
@ -0,0 +1,16 @@
|
||||
//! This test checks that when checking for opaque types that
|
||||
//! only differ in lifetimes, we handle the case of non-generic
|
||||
//! regions correctly.
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type Opq<'a> = impl Sized;
|
||||
|
||||
// Two defining uses: Opq<'{empty}> and Opq<'a>.
|
||||
// This used to ICE.
|
||||
// issue: #122782
|
||||
fn build<'a>() -> Opq<'a> {
|
||||
let _: Opq<'_> = ();
|
||||
//~^ ERROR expected generic lifetime parameter, found `'_`
|
||||
}
|
||||
|
||||
fn main() {}
|
12
tests/ui/type-alias-impl-trait/param_mismatch4.stderr
Normal file
12
tests/ui/type-alias-impl-trait/param_mismatch4.stderr
Normal file
@ -0,0 +1,12 @@
|
||||
error[E0792]: expected generic lifetime parameter, found `'_`
|
||||
--> $DIR/param_mismatch4.rs:12:12
|
||||
|
|
||||
LL | type Opq<'a> = impl Sized;
|
||||
| -- this generic parameter must be used with a generic lifetime parameter
|
||||
...
|
||||
LL | let _: Opq<'_> = ();
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0792`.
|
Loading…
Reference in New Issue
Block a user