Closed
Description
Given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=38b4af731292bf171e1011d9e54abd70
A type alias with at least one lifetime or type parameter:
#![feature(type_alias_impl_trait)]
type Ty<T> = impl Sized;
fn defining<T>(s: T) -> Ty<T> { s }
trait Tr {}
impl<T> Tr for Ty<T> {}
The current output is:
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
--> src/lib.rs:7:6
|
7 | impl<T> Tr for Ty<T> {}
| ^ unconstrained type parameter
Ideally the output should look like when the type alias has no lifetime of type paramters:
error: cannot implement trait on type alias impl trait
--> src/lib.rs:7:13
|
7 | impl<T> Tr for Ty<T> {}
| ^^^^^^
|
note: type alias impl trait defined here
--> src/lib.rs:3:14
|
3 | type Ty<T> = impl Sized;
| ^^^^^^^^^^
These diagnostics where introduced in #95973. cc @oli-obk.
@rustbot label T-compiler F-type_alias_impl_trait
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done