Closed
Description
#![feature(type_alias_impl_trait)]
pub trait Foo {}
pub trait Bar {
type Foo: Foo;
fn foo() -> Self::Foo;
}
pub trait Baz {
type Foo: Foo;
type Bar: Bar<Foo = Self::Foo>;
fn foo() -> Self::Foo;
fn bar() -> Self::Bar;
}
impl Foo for () {}
impl Bar for () {
type Foo = FooImpl;
fn foo() -> Self::Foo {
()
}
}
pub type FooImpl = impl Foo;
pub type BarImpl = impl Bar<Foo = FooImpl>;
impl Baz for () {
type Foo = FooImpl;
type Bar = BarImpl;
fn foo() -> Self::Foo {
()
}
fn bar() -> Self::Bar {
()
}
}
error: internal compiler error: errors selecting obligation during MIR typeck: [FulfillmentError(Obligation(predicate=Binder(ProjectionPredicate(ProjectionTy { substs: [()], item_def_id: DefId(0:14 ~ playground[6e48]::Bar[0]::Foo[0]) }, ())), depth=0),MismatchedProjectionTypes(Sorts(ExpectedFound { expected: FooImpl, found: () })))]
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:361:17
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:47
3: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:36
4: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:200
5: std::panicking::default_hook
at src/libstd/panicking.rs:214
6: rustc::util::common::panic_hook
7: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:481
8: std::panicking::begin_panic
9: <rustc_errors::Handler as core::ops::drop::Drop>::drop
10: core::ptr::real_drop_in_place
11: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
12: core::ptr::real_drop_in_place
13: rustc_interface::interface::run_compiler_in_existing_thread_pool
14: std::thread::local::LocalKey<T>::with
15: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
end of query stack
changing type Foo = FooImpl;
into type Foo = ();
inside impl Bar for ()
will successfully compile
Metadata
Metadata
Assignees
Labels
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#[feature(type_alias_impl_trait)]`Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.This issue requires a nightly compiler in some way.
Type
Projects
Status
Done