Skip to content

Commit 33178d2

Browse files
authoredOct 4, 2021
Rollup merge of #89505 - Aaron1011:nll-const-test, r=Mark-Simulacrum
Add regression test for spurious const error with NLL Fixes #55825
2 parents 43c4355 + 5b66048 commit 33178d2

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
 
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Regression test for issue #55825
2+
// Tests that we don't emit a spurious warning in NLL mode
3+
4+
#![feature(nll)]
5+
6+
const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } //~ ERROR const
7+
8+
fn main() { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0658]: trait objects in const fn are unstable
2+
--> $DIR/issue-55825-const-fn.rs:6:32
3+
|
4+
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
8+
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)