Closed
Description
I tried this code:
#![feature(type_alias_impl_trait)]
trait Test {}
struct A;
impl Test for A {}
struct B<T> {
inner: T,
}
impl<T: Test> Test for B<T> {}
type TestImpl = impl Test;
fn test() -> TestImpl {
A
}
fn make_option() -> Option<TestImpl> {
Some(test())
}
fn make_option2() -> Option<TestImpl> {
let inner = make_option().unwrap();
B { inner }.into()
}
I expected to see this happen: compile error that said the make_option2
return type is wrong.
Instead, this happened: compiled without error
Meta
rustc --version --verbose
:
rustc 1.72.0-nightly (37998ab50 2023-06-11)
binary: rustc
commit-hash: 37998ab508d5d9fa0d465d7b535dc673087dda8f
commit-date: 2023-06-11
host: x86_64-pc-windows-msvc
release: 1.72.0-nightly
LLVM version: 16.0.5
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done