-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it crystal clear what lint type_alias_bounds
actually signifies
#126575
Changes from 1 commit
ef121f2
898448c
3c8b108
02a2f02
63a54d9
a8b3dfd
fdf8f02
d67b616
5859dff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,13 +139,18 @@ lint_builtin_special_module_name_used_main = found module declaration for main.r | |
|
||
lint_builtin_trivial_bounds = {$predicate_kind_name} bound {$predicate} does not depend on any type or lifetime parameters | ||
|
||
lint_builtin_type_alias_bounds_help = use fully disambiguated paths (i.e., `<T as Trait>::Assoc`) to refer to associated types in type aliases | ||
|
||
lint_builtin_type_alias_generic_bounds = bounds on generic parameters are not enforced in type aliases | ||
.suggestion = the bound will not be checked when the type alias is used, and should be removed | ||
|
||
lint_builtin_type_alias_where_clause = where clauses are not enforced in type aliases | ||
.suggestion = the clause will not be checked when the type alias is used, and should be removed | ||
lint_builtin_type_alias_bounds_enable_feat_help = add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics | ||
lint_builtin_type_alias_bounds_label = will not be checked at usage sites of the type alias | ||
lint_builtin_type_alias_bounds_limitation_note = this is a known limitation of the type checker that may be lifted in a future edition. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, well actually this has a newline... hm.... i don't know how to best render this then |
||
see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information | ||
lint_builtin_type_alias_bounds_param_bounds = bounds on generic parameters in type aliases are not enforced | ||
.suggestion = remove {$count -> | ||
[one] this bound | ||
*[other] these bounds | ||
} | ||
lint_builtin_type_alias_bounds_qualify_assoc_tys_sugg = fully qualify this associated type | ||
lint_builtin_type_alias_bounds_where_clause = where clauses on type aliases are not enforced | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moving "in[/on] type aliases" before "not enforced" was not a stylistic decision. |
||
.suggestion = remove this where clause | ||
|
||
lint_builtin_unpermitted_type_init_label = this code causes undefined behavior when executed | ||
lint_builtin_unpermitted_type_init_label_suggestion = help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
warning: bounds on generic parameters are not enforced in type aliases | ||
warning: bounds on generic parameters in type aliases are not enforced | ||
--> $DIR/type-alias-bounds.rs:21:19 | ||
| | ||
LL | pub type Alias<T: Bound> = (Source<T>::Assoc,); | ||
| ^^^^^ | ||
| --^^^^^ | ||
| | | | ||
| | will not be checked at usage sites of the type alias | ||
| help: remove this bound | ||
| | ||
= note: this is a known limitation of the type checker that may be lifted in a future edition. | ||
see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information | ||
= help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics | ||
= 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 | ||
| | ||
LL - pub type Alias<T: Bound> = (Source<T>::Assoc,); | ||
LL + pub type Alias<T> = (Source<T>::Assoc,); | ||
| | ||
|
||
warning: 1 warning emitted | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type checker / type system (implementation vs specification), it's not as clear-cut in Rust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could just leave out the
of the type checker
part