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.
Make "parent also has host effect param?" a
span_delayed_bug
.
Fixes rust-lang#121418.
- Loading branch information
1 parent
4a11628
commit 96f609a
Showing
3 changed files
with
36 additions
and
1 deletion.
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
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,13 @@ | ||
#![feature(const_trait_impl)] | ||
#![feature(effects)] | ||
|
||
struct S; | ||
trait T {} | ||
|
||
impl const dyn T { | ||
//~^ ERROR inherent impls cannot be `const` | ||
//~| ERROR the const parameter `host` is not constrained by the impl trait, self type, or | ||
pub const fn new() -> std::sync::Mutex<dyn T> {} | ||
} | ||
|
||
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,22 @@ | ||
error: inherent impls cannot be `const` | ||
--> $DIR/issue-121418.rs:7:12 | ||
| | ||
LL | impl const dyn T { | ||
| ----- ^^^^^ inherent impl for this type | ||
| | | ||
| `const` because of this | ||
| | ||
= note: only trait implementations may be annotated with `const` | ||
|
||
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates | ||
--> $DIR/issue-121418.rs:7:6 | ||
| | ||
LL | impl const dyn T { | ||
| ^^^^^ unconstrained const parameter | ||
| | ||
= note: expressions using a const parameter must map each value to a distinct output value | ||
= note: proving the result of expressions other than the parameter are unique is not supported | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0207`. |