forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for rust-lang#69615
- Loading branch information
1 parent
d8047f8
commit e8b270a
Showing
2 changed files
with
28 additions
and
0 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
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
12
src/test/ui/rfc-2632-const-trait-impl/hir-const-check.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,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`. |