Skip to content

Commit 1713f89

Browse files
committed
rustc: make type_alias_missing_bounds warn-by-default.
1 parent e243158 commit 1713f89

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

src/librustc/lint/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ declare_lint! {
340340

341341
declare_lint! {
342342
pub TYPE_ALIAS_MISSING_BOUNDS,
343-
Deny,
343+
Warn,
344344
"type aliases missing bounds required by the type being aliased, are now deprecated"
345345
}
346346

src/test/ui/type/issue-51626.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![deny(type_alias_missing_bounds)]
12+
1113
pub trait Trait {}
1214

1315
pub struct Foo<T: Trait>(T);

src/test/ui/type/issue-51626.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
error: the trait bound `T: Trait` is not satisfied
2-
--> $DIR/issue-51626.rs:17:25
2+
--> $DIR/issue-51626.rs:19:25
33
|
44
LL | pub type Bar<T = Qux> = Foo<T>;
55
| ^^^^^^ the trait `Trait` is not implemented for `T`
66
|
7-
= note: #[deny(type_alias_missing_bounds)] on by default
7+
note: lint level defined here
8+
--> $DIR/issue-51626.rs:11:9
9+
|
10+
LL | #![deny(type_alias_missing_bounds)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
812
= help: consider adding a `where T: Trait` bound
913
= help: missing bounds in type aliases were previously allowed
1014
= help: this is a hard error in Rust 2018
1115

1216
error: the trait bound `Qux: Trait` is not satisfied
13-
--> $DIR/issue-51626.rs:20:1
17+
--> $DIR/issue-51626.rs:22:1
1418
|
1519
LL | pub type Baz<T: Trait = Qux> = Foo<T>;
1620
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `Qux`

src/test/ui/type/type-alias-bounds-err.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![allow(dead_code)]
12+
#![deny(type_alias_missing_bounds)]
1213

1314
// This test contains examples originally in `type-alias-bounds.rs`,
1415
// that now produce errors instead of being silently accepted.

src/test/ui/type/type-alias-bounds-err.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
error: `T` cannot be sent between threads safely
2-
--> $DIR/type-alias-bounds-err.rs:18:22
2+
--> $DIR/type-alias-bounds-err.rs:19:22
33
|
44
LL | type MySendable<T> = Sendable<T>;
55
| ^^^^^^^^^^^ `T` cannot be sent between threads safely
66
|
7-
= note: #[deny(type_alias_missing_bounds)] on by default
7+
note: lint level defined here
8+
--> $DIR/type-alias-bounds-err.rs:12:9
9+
|
10+
LL | #![deny(type_alias_missing_bounds)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
812
= help: the trait `std::marker::Send` is not implemented for `T`
913
= help: consider adding a `where T: std::marker::Send` bound
1014
= help: missing bounds in type aliases were previously allowed
1115
= help: this is a hard error in Rust 2018
1216

1317
error: the trait bound `U: Bound` is not satisfied
14-
--> $DIR/type-alias-bounds-err.rs:22:14
18+
--> $DIR/type-alias-bounds-err.rs:23:14
1519
|
1620
LL | type T4<U> = <U as Bound>::Assoc;
1721
| ^^^^^^^^^^^^^^^^^^^ the trait `Bound` is not implemented for `U`

0 commit comments

Comments
 (0)