forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the environment round here is awfully empty
capitalism
- Loading branch information
Showing
4 changed files
with
49 additions
and
23 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
22 changes: 22 additions & 0 deletions
22
src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.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,22 @@ | ||
#![feature(const_generics, const_evaluatable_checked)] | ||
#![allow(incomplete_features)] | ||
|
||
// This tests that during error handling for the "trait not implemented" error | ||
// we dont try to evaluate std::mem::size_of::<Self::Assoc> causing an ICE | ||
|
||
struct Adt; | ||
|
||
trait Foo { | ||
type Assoc; | ||
fn foo() | ||
where | ||
[Adt; std::mem::size_of::<Self::Assoc>()]: , | ||
{ | ||
<[Adt; std::mem::size_of::<Self::Assoc>()] as Foo>::bar() | ||
//~^ Error: the trait bound | ||
} | ||
|
||
fn bar() {} | ||
} | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.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[E0277]: the trait bound `[Adt; _]: Foo` is not satisfied | ||
--> $DIR/dont-evaluate-array-len-on-err-1.rs:15:9 | ||
| | ||
LL | <[Adt; std::mem::size_of::<Self::Assoc>()] as Foo>::bar() | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[Adt; _]` | ||
... | ||
LL | fn bar() {} | ||
| -------- required by `Foo::bar` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |