Skip to content

Commit

Permalink
Add const generics failing test for pattern types
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Apr 9, 2024
1 parent ff24ef9 commit a2bdb99
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/ui/type/pattern_types/const_generics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#![feature(pattern_types)]
#![feature(core_pattern_types)]
#![feature(core_pattern_type)]

use std::pat::pattern_type;

trait Foo {}

impl<const START: u32, const END: u32> Foo for pattern_type!(u32 is START..=END) {}
//~^ ERROR: range patterns must have constant range start and end
//~| ERROR: range patterns must have constant range start and end

fn main() {}
14 changes: 14 additions & 0 deletions tests/ui/type/pattern_types/const_generics.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: "range patterns must have constant range start and end"
--> $DIR/const_generics.rs:9:69
|
LL | impl<const START: u32, const END: u32> Foo for pattern_type!(u32 is START..=END) {}
| ^^^^^

error: "range patterns must have constant range start and end"
--> $DIR/const_generics.rs:9:77
|
LL | impl<const START: u32, const END: u32> Foo for pattern_type!(u32 is START..=END) {}
| ^^^

error: aborting due to 2 previous errors

0 comments on commit a2bdb99

Please sign in to comment.