This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +64
-0
lines changed
src/test/ui/const-generics Expand file tree Collapse file tree 4 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( const_generics) ]
2+ //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
3+
4+ pub struct MyArray < const COUNT : usize > ( [ u8 ; COUNT + 1 ] ) ;
5+ //~^ ERROR constant expression depends on a generic parameter
6+
7+ impl < const COUNT : usize > MyArray < COUNT > {
8+ fn inner ( & self ) -> & [ u8 ; COUNT + 1 ] {
9+ //~^ ERROR constant expression depends on a generic parameter
10+ & self . 0
11+ }
12+ }
13+
14+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+ --> $DIR/issue-61522-array-len-succ.rs:1:12
3+ |
4+ LL | #![feature(const_generics)]
5+ | ^^^^^^^^^^^^^^
6+ |
7+ = note: `#[warn(incomplete_features)]` on by default
8+
9+ error: constant expression depends on a generic parameter
10+ --> $DIR/issue-61522-array-len-succ.rs:4:40
11+ |
12+ LL | pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
13+ | ^^^^^^^^^^^^^^^
14+ |
15+ = note: this may fail depending on what value the parameter takes
16+
17+ error: constant expression depends on a generic parameter
18+ --> $DIR/issue-61522-array-len-succ.rs:8:24
19+ |
20+ LL | fn inner(&self) -> &[u8; COUNT + 1] {
21+ | ^^^^^^^^^^^^^^^^
22+ |
23+ = note: this may fail depending on what value the parameter takes
24+
25+ error: aborting due to 2 previous errors
26+
Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ #![ feature( const_generics) ]
4+ //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
5+
6+ trait Trait < const NAME : & ' static str > {
7+ type Assoc ;
8+ }
9+
10+ impl Trait < "0" > for ( ) {
11+ type Assoc = ( ) ;
12+ }
13+
14+ fn main ( ) {
15+ let _: <( ) as Trait < "0" > >:: Assoc = ( ) ;
16+ }
Original file line number Diff line number Diff line change 1+ warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+ --> $DIR/issue-66596-impl-trait-for-str-const-arg.rs:3:12
3+ |
4+ LL | #![feature(const_generics)]
5+ | ^^^^^^^^^^^^^^
6+ |
7+ = note: `#[warn(incomplete_features)]` on by default
8+
You can’t perform that action at this time.
0 commit comments