Skip to content

Commit da9585b

Browse files
authored
Rollup merge of #105237 - JohnTitor:issue-79450, r=oli-obk
Add regression test for #79450 Closes #79450 r? `@oli-obk` Signed-off-by: Yuki Okushi <[email protected]>
2 parents 3c4a430 + 047fda2 commit da9585b

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#![feature(const_fmt_arguments_new)]
2+
#![feature(const_trait_impl)]
3+
4+
#[const_trait]
5+
trait Tr {
6+
fn req(&self);
7+
8+
fn prov(&self) {
9+
println!("lul"); //~ ERROR: cannot call non-const fn `_print` in constant functions
10+
self.req();
11+
}
12+
}
13+
14+
struct S;
15+
16+
impl const Tr for S {
17+
fn req(&self) {}
18+
}
19+
20+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0015]: cannot call non-const fn `_print` in constant functions
2+
--> $DIR/issue-79450.rs:9:9
3+
|
4+
LL | println!("lul");
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
8+
= note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0015`.

0 commit comments

Comments
 (0)