Skip to content

Commit a2e9e3b

Browse files
Rollup merge of #78960 - ethanboxx:const-gen-test-default-error, r=lcnr
Test default values for const parameters. The last topic on #78433 I originally intended to place these tests in a single file, however, due to them being parser errors that are fatal, they must be in separate files to be detected. Thanks, ``@lcnr`` for mentoring me on this PR. r? ``@lcnr``
2 parents d3244df + 1d3f9d0 commit a2e9e3b

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(min_const_generics)]
2+
3+
fn foo<const SIZE: usize = 5>() {}
4+
//~^ ERROR expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `=`
5+
6+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `=`
2+
--> $DIR/default_function_param.rs:3:26
3+
|
4+
LL | fn foo<const SIZE: usize = 5>() {}
5+
| ^ expected one of 7 possible tokens
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(min_const_generics)]
2+
3+
trait Foo<const KIND: bool = true> {}
4+
//~^ ERROR expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `=`
5+
6+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `=`
2+
--> $DIR/default_trait_param.rs:3:28
3+
|
4+
LL | trait Foo<const KIND: bool = true> {}
5+
| ^ expected one of 7 possible tokens
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)