-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 #89505 - Aaron1011:nll-const-test, r=Mark-Simulacrum
Add regression test for spurious const error with NLL Fixes #55825
- Loading branch information
Showing
2 changed files
with
20 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,8 @@ | ||
// Regression test for issue #55825 | ||
// Tests that we don't emit a spurious warning in NLL mode | ||
|
||
#![feature(nll)] | ||
|
||
const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } //~ ERROR const | ||
|
||
fn main() { } |
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]: trait objects in const fn are unstable | ||
--> $DIR/issue-55825-const-fn.rs:6:32 | ||
| | ||
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information | ||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |