Open
Description
The following should compile:
#![feature(type_alias_impl_trait)]
trait Trait {
type Gat<'lt>;
}
impl Trait for u8 {
type Gat<'lt> = ();
}
fn dyn_hoops<T: Trait>(_: T) -> *const dyn FnOnce(T::Gat<'_>) {
loop {}
}
type Opaque = impl Sized;
fn define() -> Opaque {
dyn_hoops::<_>(0)
//~^ ERROR concrete type differs from previous defining opaque type use
// expected `*const (dyn FnOnce(()) + 'static)`,
// got `*const dyn for<'a> FnOnce(<u8 as Trait>::Gat<'a>)`
}
There are multiple places where we compare concrete types for equality. A regression test for this issue should cover them all:
#![feature(type_alias_impl_trait)]
trait Trait {
type Gat<'lt>;
}
impl Trait for u8 {
type Gat<'lt> = ();
}
fn dyn_hoops<T: Trait>(_: T) -> *const dyn FnOnce(T::Gat<'_>) {
loop {}
}
mod typeof_1 {
use super::*;
type Opaque = impl Sized;
fn define() -> Opaque {
dyn_hoops::<_>(0)
}
}
mod typeof_2 {
use super::*;
type Opaque = impl Sized;
fn define_1() -> Opaque { dyn_hoops::<_>(0) }
fn define_2() -> Opaque { dyn_hoops::<u8>(0) }
}
mod typeck {
use super::*;
type Opaque = impl Sized;
fn define() -> Option<Opaque> {
let _: Opaque = dyn_hoops::<_>(0);
let _: Opaque = dyn_hoops::<u8>(0);
None
}
}
mod borrowck {
use super::*;
type Opaque = impl Sized;
fn define() -> Option<Opaque> {
let _: Opaque = dyn_hoops::<_>(0);
None
}
}
fn main() {}
Metadata
Metadata
Assignees
Labels
Category: This is a bug.`#[feature(type_alias_impl_trait)]`Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.Fixed by the next-generation trait solver, `-Znext-solver`.