You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The type_alias_bounds lint misfires when impl Trait is used in a portion of a type alias #94395
Compiling this code (Playground) produces the following diagnostics:
warning: bounds on generic parameters are not enforced in type aliases
--> src/lib.rs:3:15
|
3 | type Alias<T: Send> = (impl Send,);
| ^^^^
|
= note: `#[warn(type_alias_bounds)]` on by default
help: the bound will not be checked when the type alias is used, and should be removed
|
3 - type Alias<T: Send> = (impl Send,);
3 + type Alias<T> = (impl Send,);
|
I expected to see this happen: The compiler should not have suggested removing : Send from the type alias.
Instead, this happened: Removing : Send as per the compiler's suggestion breaks the code.
error[E0277]: `T` cannot be sent between threads safely
--> src/lib.rs:3:18
|
3 | type Alias<T> = (impl Send,);
| ^^^^^^^^^ `T` cannot be sent between threads safely
|
help: consider restricting type parameter `T`
|
3 | type Alias<T: std::marker::Send> = (impl Send,);
| +++++++++++++++++++
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground` due to previous error
changed the title [-]The `type_alias_bounds` lint misfires when `impl Trait` is used as a subcomponent of a type alias[/-][+]The `type_alias_bounds` lint misfires when `impl Trait` is used in a portion of a type alias[/+]on Feb 26, 2022
Activity
[-]The `type_alias_bounds` lint misfires when `impl Trait` is used as a subcomponent of a type alias[/-][+]The `type_alias_bounds` lint misfires when `impl Trait` is used in a portion of a type alias[/+]fmease commentedon Jan 24, 2024
Ah, I've fixed that one a while ago, namely in #114228. No longer warns. Closing as fixed.