-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #117190 - matthiaskrgr:test_effects_113381, r=fee1-dead
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs
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,15 @@ | ||
#![feature(const_closures, const_trait_impl, effects)] | ||
#![allow(incomplete_features)] | ||
|
||
trait Foo { | ||
fn foo(&self); | ||
} | ||
|
||
impl Foo for () { | ||
fn foo(&self) {} | ||
} | ||
|
||
fn main() { | ||
(const || { (()).foo() })(); | ||
//~^ ERROR: cannot call non-const fn | ||
} |
11 changes: 11 additions & 0 deletions
11
...i/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.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,11 @@ | ||
error[E0015]: cannot call non-const fn `<() as Foo>::foo` in constant functions | ||
--> $DIR/const_closure-const_trait_impl-ice-113381.rs:13:22 | ||
| | ||
LL | (const || { (()).foo() })(); | ||
| ^^^^^ | ||
| | ||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0015`. |