-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finishing touches, move fixed ICEs to ui tests
- Loading branch information
Showing
19 changed files
with
182 additions
and
65 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
15 changes: 15 additions & 0 deletions
15
tests/ui/rfcs/rfc-2632-const-trait-impl/ice-119717-constant-lifetime.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,15 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(const_trait_impl, effects, try_trait_v2)] | ||
|
||
use std::ops::FromResidual; | ||
|
||
impl<T> const FromResidual for T { | ||
//~^ ERROR const `impl` for trait `FromResidual` which is not marked with `#[const_trait]` | ||
//~| type parameter `T` must be used as the type parameter for some local type | ||
fn from_residual(t: T) -> _ { | ||
//~^ the placeholder `_` is not allowed | ||
t | ||
} | ||
} | ||
|
||
fn main() {} |
33 changes: 33 additions & 0 deletions
33
tests/ui/rfcs/rfc-2632-const-trait-impl/ice-119717-constant-lifetime.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,33 @@ | ||
error: const `impl` for trait `FromResidual` which is not marked with `#[const_trait]` | ||
--> $DIR/ice-119717-constant-lifetime.rs:6:15 | ||
| | ||
LL | impl<T> const FromResidual for T { | ||
| ^^^^^^^^^^^^ | ||
| | ||
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` | ||
= note: adding a non-const method body in the future would be a breaking change | ||
|
||
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`) | ||
--> $DIR/ice-119717-constant-lifetime.rs:6:6 | ||
| | ||
LL | impl<T> const FromResidual for T { | ||
| ^ type parameter `T` must be used as the type parameter for some local type | ||
| | ||
= note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local | ||
= note: only traits defined in the current crate can be implemented for a type parameter | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions | ||
--> $DIR/ice-119717-constant-lifetime.rs:9:31 | ||
| | ||
LL | fn from_residual(t: T) -> _ { | ||
| ^ not allowed in type signatures | ||
| | ||
help: try replacing `_` with the type in the corresponding trait method signature | ||
| | ||
LL | fn from_residual(t: T) -> T { | ||
| ~ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0121, E0210. | ||
For more information about an error, try `rustc --explain E0121`. |
7 changes: 7 additions & 0 deletions
7
tests/ui/rfcs/rfc-2632-const-trait-impl/ice-123664-unexpected-bound-var.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,7 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(generic_const_exprs, const_trait_impl, effects)] | ||
|
||
const fn with_positive<F: ~const Fn()>() {} | ||
//~^ ERROR `~const` can only be applied to `#[const_trait]` traits | ||
|
||
pub fn main() {} |
8 changes: 8 additions & 0 deletions
8
tests/ui/rfcs/rfc-2632-const-trait-impl/ice-123664-unexpected-bound-var.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,8 @@ | ||
error: `~const` can only be applied to `#[const_trait]` traits | ||
--> $DIR/ice-123664-unexpected-bound-var.rs:4:34 | ||
| | ||
LL | const fn with_positive<F: ~const Fn()>() {} | ||
| ^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
14 changes: 14 additions & 0 deletions
14
tests/ui/rfcs/rfc-2632-const-trait-impl/ice-124857-combine-effect-const-infer-vars.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,14 @@ | ||
//@ compile-flags: -Znext-solver=coherence | ||
|
||
#![allow(incomplete_features)] | ||
#![feature(const_trait_impl, effects)] | ||
|
||
#[const_trait] | ||
trait Foo {} | ||
|
||
impl const Foo for i32 {} | ||
|
||
impl<T> const Foo for T where T: ~const Foo {} | ||
//~^ ERROR conflicting implementations of trait `Foo` for type `i32` | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
tests/ui/rfcs/rfc-2632-const-trait-impl/ice-124857-combine-effect-const-infer-vars.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 `Foo` for type `i32` | ||
--> $DIR/ice-124857-combine-effect-const-infer-vars.rs:11:1 | ||
| | ||
LL | impl const Foo for i32 {} | ||
| ---------------------- first implementation here | ||
LL | | ||
LL | impl<T> const Foo for T where T: ~const Foo {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
28 changes: 28 additions & 0 deletions
28
tests/ui/rfcs/rfc-2632-const-trait-impl/ice-126148-failed-to-normalize.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,28 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(const_trait_impl, effects, try_trait_v2, const_try)] | ||
use std::ops::{FromResidual, Try}; | ||
|
||
struct TryMe; | ||
struct Error; | ||
|
||
impl const FromResidual<Error> for TryMe {} | ||
//~^ ERROR const `impl` for trait `FromResidual` which is not marked with `#[const_trait]` | ||
//~| ERROR not all trait items implemented | ||
|
||
impl const Try for TryMe { | ||
//~^ ERROR const `impl` for trait `Try` which is not marked with `#[const_trait]` | ||
//~| ERROR not all trait items implemented | ||
type Output = (); | ||
type Residual = Error; | ||
} | ||
|
||
const fn t() -> TryMe { | ||
TryMe?; | ||
TryMe | ||
} | ||
|
||
const _: () = { | ||
t(); | ||
}; | ||
|
||
fn main() {} |
38 changes: 38 additions & 0 deletions
38
tests/ui/rfcs/rfc-2632-const-trait-impl/ice-126148-failed-to-normalize.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,38 @@ | ||
error: const `impl` for trait `FromResidual` which is not marked with `#[const_trait]` | ||
--> $DIR/ice-126148-failed-to-normalize.rs:8:12 | ||
| | ||
LL | impl const FromResidual<Error> for TryMe {} | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` | ||
= note: adding a non-const method body in the future would be a breaking change | ||
|
||
error[E0046]: not all trait items implemented, missing: `from_residual` | ||
--> $DIR/ice-126148-failed-to-normalize.rs:8:1 | ||
| | ||
LL | impl const FromResidual<Error> for TryMe {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_residual` in implementation | ||
| | ||
= help: implement the missing item: `fn from_residual(_: Error) -> Self { todo!() }` | ||
|
||
error: const `impl` for trait `Try` which is not marked with `#[const_trait]` | ||
--> $DIR/ice-126148-failed-to-normalize.rs:12:12 | ||
| | ||
LL | impl const Try for TryMe { | ||
| ^^^ | ||
| | ||
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` | ||
= note: adding a non-const method body in the future would be a breaking change | ||
|
||
error[E0046]: not all trait items implemented, missing: `from_output`, `branch` | ||
--> $DIR/ice-126148-failed-to-normalize.rs:12:1 | ||
| | ||
LL | impl const Try for TryMe { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_output`, `branch` in implementation | ||
| | ||
= help: implement the missing item: `fn from_output(_: <Self as Try>::Output) -> Self { todo!() }` | ||
= help: implement the missing item: `fn branch(self) -> ControlFlow<<Self as Try>::Residual, <Self as Try>::Output> { todo!() }` | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0046`. |