Skip to content

Commit 5fbef22

Browse files
committed
warn against 'specialization' feature
1 parent f315c35 commit 5fbef22

File tree

107 files changed

+635
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+635
-92
lines changed

src/librustc_feature/active.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,4 +596,5 @@ pub const INCOMPLETE_FEATURES: &[Symbol] = &[
596596
sym::raw_dylib,
597597
sym::const_trait_impl,
598598
sym::const_trait_bound_opt_out,
599+
sym::specialization,
599600
];

src/test/ui/associated-types/defaults-specialization.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Tests the interaction of associated type defaults and specialization.
22
33
#![feature(associated_type_defaults, specialization)]
4+
//~^ WARN the feature `specialization` is incomplete
45

56
trait Tr {
67
type Ty = u8;

src/test/ui/associated-types/defaults-specialization.stderr

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
warning: the feature `specialization` is incomplete and may be unsafe to use and/or cause compiler crashes
2+
--> $DIR/defaults-specialization.rs:3:38
3+
|
4+
LL | #![feature(associated_type_defaults, specialization)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
9+
110
error[E0053]: method `make` has an incompatible type for trait
2-
--> $DIR/defaults-specialization.rs:18:18
11+
--> $DIR/defaults-specialization.rs:19:18
312
|
413
LL | fn make() -> Self::Ty {
514
| -------- type in trait
@@ -11,7 +20,7 @@ LL | fn make() -> u8 { 0 }
1120
found fn pointer `fn() -> u8`
1221

1322
error[E0053]: method `make` has an incompatible type for trait
14-
--> $DIR/defaults-specialization.rs:34:18
23+
--> $DIR/defaults-specialization.rs:35:18
1524
|
1625
LL | fn make() -> Self::Ty {
1726
| -------- type in trait
@@ -26,7 +35,7 @@ LL | fn make() -> bool { true }
2635
found fn pointer `fn() -> bool`
2736

2837
error[E0308]: mismatched types
29-
--> $DIR/defaults-specialization.rs:9:9
38+
--> $DIR/defaults-specialization.rs:10:9
3039
|
3140
LL | type Ty = u8;
3241
| ------------- associated type defaults can't be assumed inside the trait defining them
@@ -40,7 +49,7 @@ LL | 0u8
4049
found type `u8`
4150

4251
error[E0308]: mismatched types
43-
--> $DIR/defaults-specialization.rs:25:29
52+
--> $DIR/defaults-specialization.rs:26:29
4453
|
4554
LL | fn make() -> Self::Ty { 0u8 }
4655
| -------- ^^^ expected associated type, found `u8`
@@ -53,7 +62,7 @@ LL | fn make() -> Self::Ty { 0u8 }
5362
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
5463

5564
error[E0308]: mismatched types
56-
--> $DIR/defaults-specialization.rs:43:29
65+
--> $DIR/defaults-specialization.rs:44:29
5766
|
5867
LL | default type Ty = bool;
5968
| ----------------------- expected this associated type
@@ -67,7 +76,7 @@ LL | fn make() -> Self::Ty { true }
6776
found type `bool`
6877

6978
error[E0308]: mismatched types
70-
--> $DIR/defaults-specialization.rs:86:32
79+
--> $DIR/defaults-specialization.rs:87:32
7180
|
7281
LL | let _: <B<()> as Tr>::Ty = 0u8;
7382
| ----------------- ^^^ expected associated type, found `u8`
@@ -77,13 +86,13 @@ LL | let _: <B<()> as Tr>::Ty = 0u8;
7786
= note: expected associated type `<B<()> as Tr>::Ty`
7887
found type `u8`
7988
help: a method is available that returns `<B<()> as Tr>::Ty`
80-
--> $DIR/defaults-specialization.rs:8:5
89+
--> $DIR/defaults-specialization.rs:9:5
8190
|
8291
LL | fn make() -> Self::Ty {
8392
| ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
8493

8594
error[E0308]: mismatched types
86-
--> $DIR/defaults-specialization.rs:87:32
95+
--> $DIR/defaults-specialization.rs:88:32
8796
|
8897
LL | let _: <B<()> as Tr>::Ty = true;
8998
| ----------------- ^^^^ expected associated type, found `bool`
@@ -93,13 +102,13 @@ LL | let _: <B<()> as Tr>::Ty = true;
93102
= note: expected associated type `<B<()> as Tr>::Ty`
94103
found type `bool`
95104
help: a method is available that returns `<B<()> as Tr>::Ty`
96-
--> $DIR/defaults-specialization.rs:8:5
105+
--> $DIR/defaults-specialization.rs:9:5
97106
|
98107
LL | fn make() -> Self::Ty {
99108
| ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
100109

101110
error[E0308]: mismatched types
102-
--> $DIR/defaults-specialization.rs:88:33
111+
--> $DIR/defaults-specialization.rs:89:33
103112
|
104113
LL | let _: <B2<()> as Tr>::Ty = 0u8;
105114
| ------------------ ^^^ expected associated type, found `u8`
@@ -109,13 +118,13 @@ LL | let _: <B2<()> as Tr>::Ty = 0u8;
109118
= note: expected associated type `<B2<()> as Tr>::Ty`
110119
found type `u8`
111120
help: a method is available that returns `<B2<()> as Tr>::Ty`
112-
--> $DIR/defaults-specialization.rs:8:5
121+
--> $DIR/defaults-specialization.rs:9:5
113122
|
114123
LL | fn make() -> Self::Ty {
115124
| ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
116125

117126
error[E0308]: mismatched types
118-
--> $DIR/defaults-specialization.rs:89:33
127+
--> $DIR/defaults-specialization.rs:90:33
119128
|
120129
LL | let _: <B2<()> as Tr>::Ty = true;
121130
| ------------------ ^^^^ expected associated type, found `bool`
@@ -125,12 +134,12 @@ LL | let _: <B2<()> as Tr>::Ty = true;
125134
= note: expected associated type `<B2<()> as Tr>::Ty`
126135
found type `bool`
127136
help: a method is available that returns `<B2<()> as Tr>::Ty`
128-
--> $DIR/defaults-specialization.rs:8:5
137+
--> $DIR/defaults-specialization.rs:9:5
129138
|
130139
LL | fn make() -> Self::Ty {
131140
| ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
132141

133-
error: aborting due to 9 previous errors
142+
error: aborting due to 9 previous errors; 1 warning emitted
134143

135144
Some errors have detailed explanations: E0053, E0308.
136145
For more information about an error, try `rustc --explain E0053`.

src/test/ui/consts/trait_specialization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Tests that specialization does not cause optimizations running on polymorphic MIR to resolve
66
// to a `default` implementation.
77

8-
#![feature(specialization)]
8+
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
99

1010
trait Marker {}
1111

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/trait_specialization.rs:8:12
3+
|
4+
LL | #![feature(specialization)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
9+
10+
warning: 1 warning emitted
11+

src/test/ui/impl-trait/equality-rpass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-pass
22

3-
#![feature(specialization)]
3+
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
44

55
trait Foo: std::fmt::Debug + Eq {}
66

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/equality-rpass.rs:3:12
3+
|
4+
LL | #![feature(specialization)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
9+
10+
warning: 1 warning emitted
11+

src/test/ui/impl-trait/equality.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(specialization)]
1+
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
22

33
trait Foo: Copy + ToString {}
44

src/test/ui/impl-trait/equality.stderr

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/equality.rs:1:12
3+
|
4+
LL | #![feature(specialization)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
9+
110
error[E0308]: mismatched types
211
--> $DIR/equality.rs:15:5
312
|
@@ -24,7 +33,7 @@ LL | n + sum_to(n - 1)
2433
|
2534
= help: the trait `std::ops::Add<impl Foo>` is not implemented for `u32`
2635

27-
error: aborting due to 2 previous errors
36+
error: aborting due to 2 previous errors; 1 warning emitted
2837

2938
Some errors have detailed explanations: E0277, E0308.
3039
For more information about an error, try `rustc --explain E0277`.

src/test/ui/impl-trait/equality2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(specialization)]
1+
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
22

33
trait Foo: Copy + ToString {}
44

src/test/ui/impl-trait/equality2.stderr

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/equality2.rs:1:12
3+
|
4+
LL | #![feature(specialization)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
9+
110
error[E0308]: mismatched types
211
--> $DIR/equality2.rs:25:18
312
|
@@ -58,6 +67,6 @@ LL | x.0);
5867
= note: expected opaque type `impl Foo` (`i32`)
5968
found opaque type `impl Foo` (`u32`)
6069

61-
error: aborting due to 4 previous errors
70+
error: aborting due to 4 previous errors; 1 warning emitted
6271

6372
For more information about this error, try `rustc --explain E0308`.

src/test/ui/overlap-doesnt-conflict-with-specialization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// run-pass
22

33
#![feature(marker_trait_attr)]
4-
#![feature(specialization)]
4+
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
55

66
#[marker]
77
trait MyMarker {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `specialization` is incomplete and may be unsafe to use and/or cause compiler crashes
2+
--> $DIR/overlap-doesnt-conflict-with-specialization.rs:4:12
3+
|
4+
LL | #![feature(specialization)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
9+
10+
warning: 1 warning emitted
11+

src/test/ui/parser/trait-item-with-defaultness-fail-semantic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(specialization)]
1+
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
22

33
fn main() {}
44

src/test/ui/parser/trait-item-with-defaultness-fail-semantic.stderr

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,14 @@ LL | default fn f2() {}
4646
| |
4747
| `default` because of this
4848

49-
error: aborting due to 6 previous errors
49+
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
50+
--> $DIR/trait-item-with-defaultness-fail-semantic.rs:1:12
51+
|
52+
LL | #![feature(specialization)]
53+
| ^^^^^^^^^^^^^^
54+
|
55+
= note: `#[warn(incomplete_features)]` on by default
56+
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
57+
58+
error: aborting due to 6 previous errors; 1 warning emitted
5059

src/test/ui/specialization/assoc-ty-graph-cycle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Make sure we don't crash with a cycle error during coherence.
44

5-
#![feature(specialization)]
5+
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
66

77
trait Trait<T> {
88
type Assoc;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `specialization` is incomplete and may be unsafe to use and/or cause compiler crashes
2+
--> $DIR/assoc-ty-graph-cycle.rs:5:12
3+
|
4+
LL | #![feature(specialization)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
9+
10+
warning: 1 warning emitted
11+

src/test/ui/specialization/cross-crate-defaults.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// aux-build:cross_crates_defaults.rs
44

5-
#![feature(specialization)]
5+
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
66

77
extern crate cross_crates_defaults;
88

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `specialization` is incomplete and may be unsafe to use and/or cause compiler crashes
2+
--> $DIR/cross-crate-defaults.rs:5:12
3+
|
4+
LL | #![feature(specialization)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
9+
10+
warning: 1 warning emitted
11+

src/test/ui/specialization/defaultimpl/allowed-cross-crate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
// aux-build:go_trait.rs
77

8-
#![feature(specialization)]
8+
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
99

1010
extern crate go_trait;
1111

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `specialization` is incomplete and may be unsafe to use and/or cause compiler crashes
2+
--> $DIR/allowed-cross-crate.rs:8:12
3+
|
4+
LL | #![feature(specialization)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
9+
10+
warning: 1 warning emitted
11+

src/test/ui/specialization/defaultimpl/out-of-order.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Test that you can list the more specific impl before the more general one.
44

5-
#![feature(specialization)]
5+
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
66

77
trait Foo {
88
type Out;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `specialization` is incomplete and may be unsafe to use and/or cause compiler crashes
2+
--> $DIR/out-of-order.rs:5:12
3+
|
4+
LL | #![feature(specialization)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
9+
10+
warning: 1 warning emitted
11+

src/test/ui/specialization/defaultimpl/overlap-projection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// projections involve specialization, so long as the associated type is
55
// provided by the most specialized impl.
66

7-
#![feature(specialization)]
7+
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
88

99
trait Assoc {
1010
type Output;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `specialization` is incomplete and may be unsafe to use and/or cause compiler crashes
2+
--> $DIR/overlap-projection.rs:7:12
3+
|
4+
LL | #![feature(specialization)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
9+
10+
warning: 1 warning emitted
11+

src/test/ui/specialization/defaultimpl/projection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// run-pass
22
#![allow(dead_code)]
33

4-
#![feature(specialization)]
4+
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
55

66
// Make sure we *can* project non-defaulted associated types
77
// cf compile-fail/specialization-default-projection.rs

0 commit comments

Comments
 (0)