-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Showing
5 changed files
with
28 additions
and
13 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
14 changes: 14 additions & 0 deletions
14
...est/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.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 @@ | ||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
|
||
type Arr<const N: usize> = [u8; N - 1]; | ||
|
||
fn test<const N: usize>() -> Arr<N> where Arr<N>: Default { | ||
//~^ ERROR constant expression depends | ||
Default::default() | ||
} | ||
|
||
fn main() { | ||
let x = test::<33>(); | ||
assert_eq!(x, [0; 32]); | ||
} |
10 changes: 10 additions & 0 deletions
10
...ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.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,10 @@ | ||
error: constant expression depends on a generic parameter | ||
--> $DIR/feature-gate-const_evaluatable_checked.rs:6:30 | ||
| | ||
LL | fn test<const N: usize>() -> Arr<N> where Arr<N>: Default { | ||
| ^^^^^^ | ||
| | ||
= note: this may fail depending on what value the parameter takes | ||
|
||
error: aborting due to previous error | ||
|