Skip to content

Commit

Permalink
Add regression test for rust-lang#69615
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Apr 9, 2020
1 parent d8047f8 commit e8b270a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/ui/rfc-2632-const-trait-impl/hir-const-check.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Regression test for #69615.

#![feature(const_trait_impl, const_fn)]
#![allow(incomplete_features)]

pub trait MyTrait {
fn method(&self);
}

impl const MyTrait for () {
fn method(&self) {
match *self {} //~ ERROR `match` is not allowed in a `const fn`
}
}

fn main() {}
12 changes: 12 additions & 0 deletions src/test/ui/rfc-2632-const-trait-impl/hir-const-check.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0658]: `match` is not allowed in a `const fn`
--> $DIR/hir-const-check.rs:12:9
|
LL | match *self {}
| ^^^^^^^^^^^^^^
|
= note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
= help: add `#![feature(const_if_match)]` to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.

0 comments on commit e8b270a

Please sign in to comment.