-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3644c4a
commit ebfd56f
Showing
11 changed files
with
123 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tests/ui/traits/const-traits/overlap-const-with-nonconst.min_spec.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0119]: conflicting implementations of trait `Foo` for type `(_,)` | ||
--> $DIR/overlap-const-with-nonconst.rs:23:1 | ||
| | ||
LL | / impl<T> const Foo for T | ||
LL | | where | ||
LL | | T: ~const Bar, | ||
| |__________________- first implementation here | ||
... | ||
LL | impl<T> Foo for (T,) { | ||
| ^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_,)` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
38 changes: 38 additions & 0 deletions
38
tests/ui/traits/const-traits/overlap-const-with-nonconst.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//@ revisions: spec min_spec | ||
|
||
#![feature(const_trait_impl)] | ||
#![cfg_attr(spec, feature(specialization))] | ||
//[spec]~^ WARN the feature `specialization` is incomplete | ||
#![cfg_attr(min_spec, feature(min_specialization))] | ||
|
||
#[const_trait] | ||
trait Bar {} | ||
impl<T> const Bar for T {} | ||
|
||
#[const_trait] | ||
trait Foo { | ||
fn method(&self); | ||
} | ||
impl<T> const Foo for T | ||
where | ||
T: ~const Bar, | ||
{ | ||
default fn method(&self) {} | ||
} | ||
// specializing impl: | ||
impl<T> Foo for (T,) { | ||
//~^ ERROR conflicting implementations | ||
fn method(&self) { | ||
println!("hi"); | ||
} | ||
} | ||
|
||
const fn dispatch<T: ~const Bar + Copy>(t: T) { | ||
t.method(); | ||
} | ||
|
||
fn main() { | ||
const { | ||
dispatch(((),)); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/ui/traits/const-traits/overlap-const-with-nonconst.spec.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/overlap-const-with-nonconst.rs:4:27 | ||
| | ||
LL | #![cfg_attr(spec, feature(specialization))] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information | ||
= help: consider using `min_specialization` instead, which is more stable and complete | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error[E0119]: conflicting implementations of trait `Foo` for type `(_,)` | ||
--> $DIR/overlap-const-with-nonconst.rs:23:1 | ||
| | ||
LL | / impl<T> const Foo for T | ||
LL | | where | ||
LL | | T: ~const Bar, | ||
| |__________________- first implementation here | ||
... | ||
LL | impl<T> Foo for (T,) { | ||
| ^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_,)` | ||
|
||
error: aborting due to 1 previous error; 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
12 changes: 12 additions & 0 deletions
12
...const-traits/specialization/const-default-impl-non-const-specialized-impl.min_spec.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0119]: conflicting implementations of trait `Value` for type `FortyTwo` | ||
--> $DIR/const-default-impl-non-const-specialized-impl.rs:22:1 | ||
| | ||
LL | impl<T> const Value for T { | ||
| ------------------------- first implementation here | ||
... | ||
LL | impl Value for FortyTwo { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `FortyTwo` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...its/const-traits/specialization/const-default-impl-non-const-specialized-impl.spec.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/const-default-impl-non-const-specialized-impl.rs:5:27 | ||
| | ||
LL | #![cfg_attr(spec, feature(specialization))] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information | ||
= help: consider using `min_specialization` instead, which is more stable and complete | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error[E0119]: conflicting implementations of trait `Value` for type `FortyTwo` | ||
--> $DIR/const-default-impl-non-const-specialized-impl.rs:22:1 | ||
| | ||
LL | impl<T> const Value for T { | ||
| ------------------------- first implementation here | ||
... | ||
LL | impl Value for FortyTwo { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `FortyTwo` | ||
|
||
error: aborting due to 1 previous error; 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
8 changes: 0 additions & 8 deletions
8
...i/traits/const-traits/specialization/const-default-impl-non-const-specialized-impl.stderr
This file was deleted.
Oops, something went wrong.