Rollup merge of #71420 - RalfJung:specialization-incomplete, r=matthewjasper

Specialization is unsound

As discussed in https://github.com/rust-lang/rust/issues/31844#issuecomment-617013949, it might be a good idea to warn users of specialization that the feature they are using is unsound.

I also expanded the "incomplete feature" warning to link the user to the tracking issue.
This commit is contained in:
Manish Goregaokar 2020-06-19 19:42:43 -07:00 committed by GitHub
commit 203305d095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
123 changed files with 748 additions and 130 deletions

View File

@ -19,7 +19,7 @@
#![feature(raw)]
#![feature(sort_internals)]
#![feature(slice_partition_at_index)]
#![feature(specialization)]
#![feature(min_specialization)]
#![feature(step_trait)]
#![feature(step_trait_ext)]
#![feature(str_internals)]

View File

@ -596,4 +596,5 @@ pub const INCOMPLETE_FEATURES: &[Symbol] = &[
sym::raw_dylib,
sym::const_trait_impl,
sym::const_trait_bound_opt_out,
sym::specialization,
];

View File

@ -1,6 +1,6 @@
// compile-fail
#![feature(specialization)]
//~^ WARN the feature `specialization` is incomplete
pub trait Foo {
fn foo();

View File

@ -1,6 +1,7 @@
//! Tests the interaction of associated type defaults and specialization.
#![feature(associated_type_defaults, specialization)]
//~^ WARN the feature `specialization` is incomplete
trait Tr {
type Ty = u8;

View File

@ -1,5 +1,14 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/defaults-specialization.rs:3:38
|
LL | #![feature(associated_type_defaults, specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0053]: method `make` has an incompatible type for trait
--> $DIR/defaults-specialization.rs:18:18
--> $DIR/defaults-specialization.rs:19:18
|
LL | fn make() -> Self::Ty {
| -------- type in trait
@ -11,7 +20,7 @@ LL | fn make() -> u8 { 0 }
found fn pointer `fn() -> u8`
error[E0053]: method `make` has an incompatible type for trait
--> $DIR/defaults-specialization.rs:34:18
--> $DIR/defaults-specialization.rs:35:18
|
LL | fn make() -> Self::Ty {
| -------- type in trait
@ -26,7 +35,7 @@ LL | fn make() -> bool { true }
found fn pointer `fn() -> bool`
error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:9:9
--> $DIR/defaults-specialization.rs:10:9
|
LL | type Ty = u8;
| ------------- associated type defaults can't be assumed inside the trait defining them
@ -40,7 +49,7 @@ LL | 0u8
found type `u8`
error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:25:29
--> $DIR/defaults-specialization.rs:26:29
|
LL | fn make() -> Self::Ty { 0u8 }
| -------- ^^^ expected associated type, found `u8`
@ -53,7 +62,7 @@ LL | fn make() -> Self::Ty { 0u8 }
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:43:29
--> $DIR/defaults-specialization.rs:44:29
|
LL | default type Ty = bool;
| ----------------------- expected this associated type
@ -67,7 +76,7 @@ LL | fn make() -> Self::Ty { true }
found type `bool`
error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:86:32
--> $DIR/defaults-specialization.rs:87:32
|
LL | let _: <B<()> as Tr>::Ty = 0u8;
| ----------------- ^^^ expected associated type, found `u8`
@ -77,13 +86,13 @@ LL | let _: <B<()> as Tr>::Ty = 0u8;
= note: expected associated type `<B<()> as Tr>::Ty`
found type `u8`
help: a method is available that returns `<B<()> as Tr>::Ty`
--> $DIR/defaults-specialization.rs:8:5
--> $DIR/defaults-specialization.rs:9:5
|
LL | fn make() -> Self::Ty {
| ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:87:32
--> $DIR/defaults-specialization.rs:88:32
|
LL | let _: <B<()> as Tr>::Ty = true;
| ----------------- ^^^^ expected associated type, found `bool`
@ -93,13 +102,13 @@ LL | let _: <B<()> as Tr>::Ty = true;
= note: expected associated type `<B<()> as Tr>::Ty`
found type `bool`
help: a method is available that returns `<B<()> as Tr>::Ty`
--> $DIR/defaults-specialization.rs:8:5
--> $DIR/defaults-specialization.rs:9:5
|
LL | fn make() -> Self::Ty {
| ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:88:33
--> $DIR/defaults-specialization.rs:89:33
|
LL | let _: <B2<()> as Tr>::Ty = 0u8;
| ------------------ ^^^ expected associated type, found `u8`
@ -109,13 +118,13 @@ LL | let _: <B2<()> as Tr>::Ty = 0u8;
= note: expected associated type `<B2<()> as Tr>::Ty`
found type `u8`
help: a method is available that returns `<B2<()> as Tr>::Ty`
--> $DIR/defaults-specialization.rs:8:5
--> $DIR/defaults-specialization.rs:9:5
|
LL | fn make() -> Self::Ty {
| ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:89:33
--> $DIR/defaults-specialization.rs:90:33
|
LL | let _: <B2<()> as Tr>::Ty = true;
| ------------------ ^^^^ expected associated type, found `bool`
@ -125,12 +134,12 @@ LL | let _: <B2<()> as Tr>::Ty = true;
= note: expected associated type `<B2<()> as Tr>::Ty`
found type `bool`
help: a method is available that returns `<B2<()> as Tr>::Ty`
--> $DIR/defaults-specialization.rs:8:5
--> $DIR/defaults-specialization.rs:9:5
|
LL | fn make() -> Self::Ty {
| ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
error: aborting due to 9 previous errors
error: aborting due to 9 previous errors; 1 warning emitted
Some errors have detailed explanations: E0053, E0308.
For more information about an error, try `rustc --explain E0053`.

View File

@ -4,6 +4,7 @@
//
// No we expect to run into a more user-friendly cycle error instead.
#![feature(specialization)]
//~^ WARN the feature `specialization` is incomplete
trait Trait<T> { type Assoc; }
//~^ ERROR E0391

View File

@ -1,16 +1,25 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:6:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0391]: cycle detected when building specialization graph of trait `Trait`
--> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:8:1
--> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:9:1
|
LL | trait Trait<T> { type Assoc; }
| ^^^^^^^^^^^^^^
|
= note: ...which again requires building specialization graph of trait `Trait`, completing the cycle
note: cycle used when coherence checking all impls of trait `Trait`
--> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:8:1
--> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:9:1
|
LL | trait Trait<T> { type Assoc; }
| ^^^^^^^^^^^^^^
error: aborting due to previous error
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0391`.

View File

@ -5,7 +5,7 @@
// Tests that specialization does not cause optimizations running on polymorphic MIR to resolve
// to a `default` implementation.
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Marker {}

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/trait_specialization.rs:8:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,4 +1,5 @@
#![feature(specialization)]
//~^ WARN the feature `specialization` is incomplete
trait SpaceLlama {
fn fly(&self);

View File

@ -1,5 +1,14 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/E0520.rs:1:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0520]: `fly` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/E0520.rs:16:5
--> $DIR/E0520.rs:17:5
|
LL | / impl<T: Clone> SpaceLlama for T {
LL | | fn fly(&self) {}
@ -11,6 +20,6 @@ LL | default fn fly(&self) {}
|
= note: to specialize, `fly` in the parent `impl` must be marked `default`
error: aborting due to previous error
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0520`.

View File

@ -1,6 +1,6 @@
// run-pass
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Foo: std::fmt::Debug + Eq {}

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/equality-rpass.rs:3:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,4 +1,4 @@
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Foo: Copy + ToString {}

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/equality.rs:1:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0308]: mismatched types
--> $DIR/equality.rs:15:5
|
@ -24,7 +33,7 @@ LL | n + sum_to(n - 1)
|
= help: the trait `std::ops::Add<impl Foo>` is not implemented for `u32`
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors; 1 warning emitted
Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.

View File

@ -1,4 +1,4 @@
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Foo: Copy + ToString {}

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/equality2.rs:1:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0308]: mismatched types
--> $DIR/equality2.rs:25:18
|
@ -58,6 +67,6 @@ LL | x.0);
= note: expected opaque type `impl Foo` (`i32`)
found opaque type `impl Foo` (`u32`)
error: aborting due to 4 previous errors
error: aborting due to 4 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,5 +1,6 @@
// check-pass
#![feature(specialization)]
//~^ WARN the feature `specialization` is incomplete
fn main() {}

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-35376.rs:2:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,5 +1,6 @@
// run-pass
#![feature(specialization)]
//~^ WARN the feature `specialization` is incomplete
trait Iterate<'a> {
type Ty: Valid;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-38091.rs:2:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,6 +1,6 @@
// run-pass
#![feature(specialization)]
//~^ WARN the feature `specialization` is incomplete
pub trait Foo {
fn abc() -> u32;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-55380.rs:2:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,7 +1,7 @@
// run-pass
#![feature(marker_trait_attr)]
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
#[marker]
trait MyMarker {}

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/overlap-doesnt-conflict-with-specialization.rs:4:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,6 +1,7 @@
// Semantically, we do not allow e.g., `static X: u8 = 0;` as an associated item.
#![feature(specialization)]
//~^ WARN the feature `specialization` is incomplete
fn main() {}

View File

@ -1,17 +1,17 @@
error: associated `static` items are not allowed
--> $DIR/assoc-static-semantic-fail.rs:9:5
--> $DIR/assoc-static-semantic-fail.rs:10:5
|
LL | static IA: u8 = 0;
| ^^^^^^^^^^^^^^^^^^
error: associated `static` items are not allowed
--> $DIR/assoc-static-semantic-fail.rs:11:5
--> $DIR/assoc-static-semantic-fail.rs:12:5
|
LL | static IB: u8;
| ^^^^^^^^^^^^^^
error: a static item cannot be `default`
--> $DIR/assoc-static-semantic-fail.rs:14:5
--> $DIR/assoc-static-semantic-fail.rs:15:5
|
LL | default static IC: u8 = 0;
| ^^^^^^^ `default` because of this
@ -19,13 +19,13 @@ LL | default static IC: u8 = 0;
= note: only associated `fn`, `const`, and `type` items can be `default`
error: associated `static` items are not allowed
--> $DIR/assoc-static-semantic-fail.rs:14:5
--> $DIR/assoc-static-semantic-fail.rs:15:5
|
LL | default static IC: u8 = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a static item cannot be `default`
--> $DIR/assoc-static-semantic-fail.rs:17:16
--> $DIR/assoc-static-semantic-fail.rs:18:16
|
LL | pub(crate) default static ID: u8;
| ^^^^^^^ `default` because of this
@ -33,25 +33,25 @@ LL | pub(crate) default static ID: u8;
= note: only associated `fn`, `const`, and `type` items can be `default`
error: associated `static` items are not allowed
--> $DIR/assoc-static-semantic-fail.rs:17:5
--> $DIR/assoc-static-semantic-fail.rs:18:5
|
LL | pub(crate) default static ID: u8;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: associated `static` items are not allowed
--> $DIR/assoc-static-semantic-fail.rs:24:5
--> $DIR/assoc-static-semantic-fail.rs:25:5
|
LL | static TA: u8 = 0;
| ^^^^^^^^^^^^^^^^^^
error: associated `static` items are not allowed
--> $DIR/assoc-static-semantic-fail.rs:26:5
--> $DIR/assoc-static-semantic-fail.rs:27:5
|
LL | static TB: u8;
| ^^^^^^^^^^^^^^
error: a static item cannot be `default`
--> $DIR/assoc-static-semantic-fail.rs:28:5
--> $DIR/assoc-static-semantic-fail.rs:29:5
|
LL | default static TC: u8 = 0;
| ^^^^^^^ `default` because of this
@ -59,13 +59,13 @@ LL | default static TC: u8 = 0;
= note: only associated `fn`, `const`, and `type` items can be `default`
error: associated `static` items are not allowed
--> $DIR/assoc-static-semantic-fail.rs:28:5
--> $DIR/assoc-static-semantic-fail.rs:29:5
|
LL | default static TC: u8 = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a static item cannot be `default`
--> $DIR/assoc-static-semantic-fail.rs:31:16
--> $DIR/assoc-static-semantic-fail.rs:32:16
|
LL | pub(crate) default static TD: u8;
| ^^^^^^^ `default` because of this
@ -73,25 +73,25 @@ LL | pub(crate) default static TD: u8;
= note: only associated `fn`, `const`, and `type` items can be `default`
error: associated `static` items are not allowed
--> $DIR/assoc-static-semantic-fail.rs:31:5
--> $DIR/assoc-static-semantic-fail.rs:32:5
|
LL | pub(crate) default static TD: u8;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: associated `static` items are not allowed
--> $DIR/assoc-static-semantic-fail.rs:38:5
--> $DIR/assoc-static-semantic-fail.rs:39:5
|
LL | static TA: u8 = 0;
| ^^^^^^^^^^^^^^^^^^
error: associated `static` items are not allowed
--> $DIR/assoc-static-semantic-fail.rs:40:5
--> $DIR/assoc-static-semantic-fail.rs:41:5
|
LL | static TB: u8;
| ^^^^^^^^^^^^^^
error: a static item cannot be `default`
--> $DIR/assoc-static-semantic-fail.rs:43:5
--> $DIR/assoc-static-semantic-fail.rs:44:5
|
LL | default static TC: u8 = 0;
| ^^^^^^^ `default` because of this
@ -99,13 +99,13 @@ LL | default static TC: u8 = 0;
= note: only associated `fn`, `const`, and `type` items can be `default`
error: associated `static` items are not allowed
--> $DIR/assoc-static-semantic-fail.rs:43:5
--> $DIR/assoc-static-semantic-fail.rs:44:5
|
LL | default static TC: u8 = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a static item cannot be `default`
--> $DIR/assoc-static-semantic-fail.rs:46:9
--> $DIR/assoc-static-semantic-fail.rs:47:9
|
LL | pub default static TD: u8;
| ^^^^^^^ `default` because of this
@ -113,13 +113,13 @@ LL | pub default static TD: u8;
= note: only associated `fn`, `const`, and `type` items can be `default`
error: associated `static` items are not allowed
--> $DIR/assoc-static-semantic-fail.rs:46:5
--> $DIR/assoc-static-semantic-fail.rs:47:5
|
LL | pub default static TD: u8;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: associated constant in `impl` without body
--> $DIR/assoc-static-semantic-fail.rs:11:5
--> $DIR/assoc-static-semantic-fail.rs:12:5
|
LL | static IB: u8;
| ^^^^^^^^^^^^^-
@ -127,7 +127,7 @@ LL | static IB: u8;
| help: provide a definition for the constant: `= <expr>;`
error: associated constant in `impl` without body
--> $DIR/assoc-static-semantic-fail.rs:17:5
--> $DIR/assoc-static-semantic-fail.rs:18:5
|
LL | pub(crate) default static ID: u8;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -135,13 +135,13 @@ LL | pub(crate) default static ID: u8;
| help: provide a definition for the constant: `= <expr>;`
error[E0449]: unnecessary visibility qualifier
--> $DIR/assoc-static-semantic-fail.rs:31:5
--> $DIR/assoc-static-semantic-fail.rs:32:5
|
LL | pub(crate) default static TD: u8;
| ^^^^^^^^^^
error: associated constant in `impl` without body
--> $DIR/assoc-static-semantic-fail.rs:40:5
--> $DIR/assoc-static-semantic-fail.rs:41:5
|
LL | static TB: u8;
| ^^^^^^^^^^^^^-
@ -149,7 +149,7 @@ LL | static TB: u8;
| help: provide a definition for the constant: `= <expr>;`
error: associated constant in `impl` without body
--> $DIR/assoc-static-semantic-fail.rs:46:5
--> $DIR/assoc-static-semantic-fail.rs:47:5
|
LL | pub default static TD: u8;
| ^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -157,11 +157,20 @@ LL | pub default static TD: u8;
| help: provide a definition for the constant: `= <expr>;`
error[E0449]: unnecessary visibility qualifier
--> $DIR/assoc-static-semantic-fail.rs:46:5
--> $DIR/assoc-static-semantic-fail.rs:47:5
|
LL | pub default static TD: u8;
| ^^^ `pub` not permitted here because it's implied
error: aborting due to 24 previous errors
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/assoc-static-semantic-fail.rs:3:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error: aborting due to 24 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0449`.

View File

@ -1,6 +1,7 @@
// Test successful and unsuccessful parsing of the `default` contextual keyword
#![feature(specialization)]
//~^ WARN the feature `specialization` is incomplete
trait Foo {
fn foo<T: Default>() -> T;

View File

@ -1,5 +1,5 @@
error: `default` is not followed by an item
--> $DIR/default.rs:22:5
--> $DIR/default.rs:23:5
|
LL | default pub fn foo<T: Default>() -> T { T::default() }
| ^^^^^^^ the `default` qualifier
@ -7,7 +7,7 @@ LL | default pub fn foo<T: Default>() -> T { T::default() }
= note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default`
error: non-item in item list
--> $DIR/default.rs:22:13
--> $DIR/default.rs:23:13
|
LL | impl Foo for u32 {
| - item list starts here
@ -18,13 +18,22 @@ LL | }
| - item list ends here
error[E0449]: unnecessary visibility qualifier
--> $DIR/default.rs:16:5
--> $DIR/default.rs:17:5
|
LL | pub default fn foo<T: Default>() -> T {
| ^^^ `pub` not permitted here because it's implied
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/default.rs:3:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0046]: not all trait items implemented, missing: `foo`
--> $DIR/default.rs:21:1
--> $DIR/default.rs:22:1
|
LL | fn foo<T: Default>() -> T;
| -------------------------- `foo` from trait
@ -32,7 +41,7 @@ LL | fn foo<T: Default>() -> T;
LL | impl Foo for u32 {
| ^^^^^^^^^^^^^^^^ missing `foo` in implementation
error: aborting due to 4 previous errors
error: aborting due to 4 previous errors; 1 warning emitted
Some errors have detailed explanations: E0046, E0449.
For more information about an error, try `rustc --explain E0046`.

View File

@ -1,4 +1,4 @@
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
fn main() {}

View File

@ -46,5 +46,14 @@ LL | default fn f2() {}
| |
| `default` because of this
error: aborting due to 6 previous errors
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/trait-item-with-defaultness-fail-semantic.rs:1:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error: aborting due to 6 previous errors; 1 warning emitted

View File

@ -2,7 +2,7 @@
// Make sure we don't crash with a cycle error during coherence.
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Trait<T> {
type Assoc;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/assoc-ty-graph-cycle.rs:5:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -2,7 +2,7 @@
// aux-build:cross_crates_defaults.rs
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
extern crate cross_crates_defaults;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/cross-crate-defaults.rs:5:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -5,7 +5,7 @@
// aux-build:go_trait.rs
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
extern crate go_trait;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/allowed-cross-crate.rs:8:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -2,7 +2,7 @@
// Test that you can list the more specific impl before the more general one.
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Foo {
type Out;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/out-of-order.rs:5:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -4,7 +4,7 @@
// projections involve specialization, so long as the associated type is
// provided by the most specialized impl.
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Assoc {
type Output;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/overlap-projection.rs:7:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,7 +1,7 @@
// run-pass
#![allow(dead_code)]
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Make sure we *can* project non-defaulted associated types
// cf compile-fail/specialization-default-projection.rs

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/projection.rs:4:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,4 +1,4 @@
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Check a number of scenarios in which one impl tries to override another,
// without correctly using `default`.

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-no-default.rs:1:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/specialization-no-default.rs:20:5
|
@ -65,6 +74,6 @@ LL | fn redundant(&self) {}
|
= note: to specialize, `redundant` in the parent `impl` must be marked `default`
error: aborting due to 5 previous errors
error: aborting due to 5 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0520`.

View File

@ -3,7 +3,7 @@
// Tests that we can combine a default impl that supplies one method with a
// full impl that supplies the other, and they can invoke one another.
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Foo {
fn foo_one(&self) -> &'static str;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-trait-item-not-implemented-rpass.rs:6:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,6 +1,6 @@
// Tests that default impls do not have to supply all items but regular impls do.
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Foo {
fn foo_one(&self) -> &'static str;

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-trait-item-not-implemented.rs:3:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0046]: not all trait items implemented, missing: `foo_two`
--> $DIR/specialization-trait-item-not-implemented.rs:18:1
|
@ -7,6 +16,6 @@ LL | fn foo_two(&self) -> &'static str;
LL | impl Foo for MyStruct {}
| ^^^^^^^^^^^^^^^^^^^^^ missing `foo_two` in implementation
error: aborting due to previous error
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0046`.

View File

@ -2,7 +2,7 @@
// - default impls do not have to supply all items and
// - a default impl does not count as an impl (in this case, an incomplete default impl).
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Foo {
fn foo_one(&self) -> &'static str;

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-trait-not-implemented.rs:5:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0599]: no method named `foo_one` found for struct `MyStruct` in the current scope
--> $DIR/specialization-trait-not-implemented.rs:22:29
|
@ -19,6 +28,6 @@ note: `Foo` defines an item `foo_one`, perhaps you need to implement it
LL | trait Foo {
| ^^^^^^^^^
error: aborting due to previous error
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0599`.

View File

@ -1,6 +1,6 @@
// Tests that a default impl still has to have a WF trait ref.
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Foo<'a, T: Eq + 'a> { }

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-wfcheck.rs:3:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0277]: the trait bound `U: std::cmp::Eq` is not satisfied
--> $DIR/specialization-wfcheck.rs:7:17
|
@ -12,6 +21,6 @@ help: consider restricting type parameter `U`
LL | default impl<U: std::cmp::Eq> Foo<'static, U> for () {}
| ^^^^^^^^^^^^^^
error: aborting due to previous error
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,5 +1,5 @@
#![feature(negative_impls)]
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
struct S;
struct Z;

View File

@ -8,6 +8,15 @@ LL | default impl S {}
|
= note: only trait implementations may be annotated with `default`
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/validation.rs:2:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error: impls of auto traits cannot be default
--> $DIR/validation.rs:9:21
|
@ -36,6 +45,6 @@ error[E0750]: negative impls cannot be default impls
LL | default impl !Tr for S {}
| ^^^^^^^ ^
error: aborting due to 5 previous errors
error: aborting due to 5 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0750`.

View File

@ -1,5 +1,5 @@
// check-pass
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
pub struct Cloned<I>(I);

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-36804.rs:2:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,4 +1,4 @@
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Regression test for a specialization-related ICE (#39448).

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-39448.rs:1:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0275]: overflow evaluating the requirement `T: FromA<U>`
--> $DIR/issue-39448.rs:45:13
|
@ -7,6 +16,6 @@ LL | x.foo(y.to()).to()
= note: required because of the requirements on the impl of `FromA<U>` for `T`
= note: required because of the requirements on the impl of `ToA<T>` for `U`
error: aborting due to previous error
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0275`.

View File

@ -4,7 +4,7 @@
// check-pass
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Foo {
fn foo(&self);

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-39618.rs:7:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,6 +1,6 @@
// run-pass
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
pub trait Foo {
fn foo();

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-50452.rs:3:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,4 +1,4 @@
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Regression test for #52050: when inserting the blanket impl `I`
// into the tree, we had to replace the child node for `Foo`, which

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-52050.rs:1:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0119]: conflicting implementations of trait `IntoPyDictPointer` for type `()`:
--> $DIR/issue-52050.rs:28:1
|
@ -13,6 +22,6 @@ LL | impl IntoPyDictPointer for ()
|
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
error: aborting due to previous error
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0119`.

View File

@ -4,7 +4,7 @@
// check-pass
// edition:2018
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
fn main() {}

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-63716-parse-async.rs:7:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,4 +1,4 @@
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// check-pass

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-70442.rs:1:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,4 +1,5 @@
#![feature(specialization, associated_type_defaults)]
//~^ WARN the feature `specialization` is incomplete
// Test that attempting to override a non-default method or one not in the
// parent impl causes an error.

View File

@ -1,5 +1,14 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/non-defaulted-item-fail.rs:1:12
|
LL | #![feature(specialization, associated_type_defaults)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0520]: `Ty` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/non-defaulted-item-fail.rs:29:5
--> $DIR/non-defaulted-item-fail.rs:30:5
|
LL | / impl<T> Foo for Box<T> {
LL | | type Ty = bool;
@ -14,7 +23,7 @@ LL | type Ty = Vec<()>;
= note: to specialize, `Ty` in the parent `impl` must be marked `default`
error[E0520]: `CONST` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/non-defaulted-item-fail.rs:31:5
--> $DIR/non-defaulted-item-fail.rs:32:5
|
LL | / impl<T> Foo for Box<T> {
LL | | type Ty = bool;
@ -29,7 +38,7 @@ LL | const CONST: u8 = 42;
= note: to specialize, `CONST` in the parent `impl` must be marked `default`
error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/non-defaulted-item-fail.rs:33:5
--> $DIR/non-defaulted-item-fail.rs:34:5
|
LL | / impl<T> Foo for Box<T> {
LL | | type Ty = bool;
@ -44,7 +53,7 @@ LL | fn foo(&self) -> bool { true }
= note: to specialize, `foo` in the parent `impl` must be marked `default`
error[E0520]: `Ty` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/non-defaulted-item-fail.rs:45:5
--> $DIR/non-defaulted-item-fail.rs:46:5
|
LL | impl<T> Foo for Vec<T> {}
| ------------------------- parent `impl` is here
@ -55,7 +64,7 @@ LL | type Ty = Vec<()>;
= note: to specialize, `Ty` in the parent `impl` must be marked `default`
error[E0520]: `CONST` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/non-defaulted-item-fail.rs:47:5
--> $DIR/non-defaulted-item-fail.rs:48:5
|
LL | impl<T> Foo for Vec<T> {}
| ------------------------- parent `impl` is here
@ -66,7 +75,7 @@ LL | const CONST: u8 = 42;
= note: to specialize, `CONST` in the parent `impl` must be marked `default`
error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/non-defaulted-item-fail.rs:49:5
--> $DIR/non-defaulted-item-fail.rs:50:5
|
LL | impl<T> Foo for Vec<T> {}
| ------------------------- parent `impl` is here
@ -76,6 +85,6 @@ LL | fn foo(&self) -> bool { true }
|
= note: to specialize, `foo` in the parent `impl` must be marked `default`
error: aborting due to 6 previous errors
error: aborting due to 6 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0520`.

View File

@ -5,7 +5,7 @@
// aux-build:go_trait.rs
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
extern crate go_trait;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-allowed-cross-crate.rs:8:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -2,7 +2,7 @@
// Test that non-method associated functions can be specialized
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Foo {
fn mk() -> Self;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-assoc-fns.rs:5:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,6 +1,6 @@
// run-pass
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Tests a variety of basic specialization scenarios and method
// dispatch for them.

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-basics.rs:3:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -2,7 +2,7 @@
// aux-build:specialization_cross_crate.rs
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
extern crate specialization_cross_crate;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-cross-crate.rs:5:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,6 +1,6 @@
// run-pass
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Test that default methods are cascaded correctly

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-default-methods.rs:3:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,4 +1,4 @@
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Make sure we can't project defaulted associated types

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-default-projection.rs:1:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0308]: mismatched types
--> $DIR/specialization-default-projection.rs:21:5
|
@ -28,6 +37,6 @@ LL | generic::<()>()
= help: consider constraining the associated type `<() as Foo>::Assoc` to `()`
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0308`.

View File

@ -2,7 +2,7 @@
// associated type in the impl defining it -- otherwise, what happens
// if it's overridden?
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Example {
type Output;

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-default-types.rs:5:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0308]: mismatched types
--> $DIR/specialization-default-types.rs:15:9
|
@ -24,6 +33,6 @@ LL | Example::generate(t)
= help: consider constraining the associated type `<T as Example>::Output` to `std::boxed::Box<T>`
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,4 +1,4 @@
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Check a number of scenarios in which one impl tries to override another,
// without correctly using `default`.

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-no-default.rs:1:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/specialization-no-default.rs:20:5
|
@ -65,6 +74,6 @@ LL | default fn redundant(&self) {}
|
= note: to specialize, `redundant` in the parent `impl` must be marked `default`
error: aborting due to 5 previous errors
error: aborting due to 5 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0520`.

View File

@ -1,7 +1,7 @@
// run-pass
#![allow(dead_code)]
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Ensure that specialization works for impls defined directly on a projection

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-on-projection.rs:4:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -2,7 +2,7 @@
// Test that you can list the more specific impl before the more general one.
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Foo {
type Out;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-out-of-order.rs:5:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,5 +1,5 @@
#![feature(negative_impls)]
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait MyTrait {}

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-overlap-negative.rs:2:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0751]: found both positive and negative implementation of trait `std::marker::Send` for type `TestType<_>`:
--> $DIR/specialization-overlap-negative.rs:9:1
|
@ -6,6 +15,6 @@ LL | unsafe impl<T: Clone> Send for TestType<T> {}
LL | impl<T: MyTrait> !Send for TestType<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here
error: aborting due to previous error
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0751`.

View File

@ -4,7 +4,7 @@
// projections involve specialization, so long as the associated type is
// provided by the most specialized impl.
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Assoc {
type Output;

View File

@ -0,0 +1,11 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-overlap-projection.rs:7:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
warning: 1 warning emitted

View File

@ -1,4 +1,4 @@
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
trait Foo { fn foo() {} }
impl<T: Clone> Foo for T {}

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-overlap.rs:1:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0119]: conflicting implementations of trait `Foo` for type `std::vec::Vec<_>`:
--> $DIR/specialization-overlap.rs:5:1
|
@ -30,6 +39,6 @@ LL | impl<T: Clone> Qux for T {}
LL | impl<T: Eq> Qux for T {}
| ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error: aborting due to 4 previous errors
error: aborting due to 4 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0119`.

View File

@ -2,7 +2,7 @@
#![feature(optin_builtin_traits)]
#![feature(negative_impls)]
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
auto trait Foo {}

View File

@ -1,3 +1,12 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-polarity.rs:5:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
error[E0751]: found both positive and negative implementation of trait `Foo` for type `u8`:
--> $DIR/specialization-polarity.rs:10:1
|
@ -14,6 +23,6 @@ LL | impl<T> !Bar for T {}
LL | impl Bar for u8 {}
| ^^^^^^^^^^^^^^^ positive implementation here
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0751`.

View File

@ -2,7 +2,7 @@
#![allow(dead_code)]
#![allow(unused_variables)]
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Regression test for ICE when combining specialized associated types and type
// aliases

Some files were not shown because too many files have changed in this diff Show More