Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2261,6 +2261,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
/// Float types, respectively). When comparing two ADTs, these rules apply recursively.
pub fn same_type_modulo_infer<T: relate::Relate<TyCtxt<'tcx>>>(&self, a: T, b: T) -> bool {
let (a, b) = self.resolve_vars_if_possible((a, b));
let (a, b) = ty::set_aliases_to_non_rigid(self.tcx, (a, b)).skip_norm_wip();
SameTypeModuloInfer(self).relate(a, b).is_ok()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Regression test for #158773.
// This test is cited from #158773.
//@ compile-flags: -Znext-solver=globally

trait HasLifetime {
type AtLifetime<'a>;
}

pub struct ExistentialLifetime<S: HasLifetime>(S::AtLifetime<'static>);

impl<S: HasLifetime> ExistentialLifetime<S> {
fn new() -> ExistentialLifetime<S> {
ExistentialLifetime(ExistentialLifetime(())) //~ ERROR: type mismatch resolving `<S as HasLifetime>::AtLifetime<'static> == ExistentialLifetime<_>` [E0271]
}
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error[E0271]: type mismatch resolving `<S as HasLifetime>::AtLifetime<'static> == ExistentialLifetime<_>`
--> $DIR/rigid-alias-in-same-type-modulo-infer-158773.rs:13:9
|
LL | ... ExistentialLifetime(ExistentialLifetime(()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ExistentialLifetime<_>`, found associated type
|
= note: expected struct `ExistentialLifetime<_>`
found associated type `<S as HasLifetime>::AtLifetime<'static>`
help: consider constraining the associated type `<S as HasLifetime>::AtLifetime<'static>` to `ExistentialLifetime<_>`
|
LL | impl<S: HasLifetime<AtLifetime<'static> = ExistentialLifetime<_>>> ExistentialLifetime<S> {
| ++++++++++++++++++++++++++++++++++++++++++++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0271`.
Loading