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.
Rollup merge of rust-lang#72714 - JohnTitor:debug-assert, r=nikomatsakis
Fix debug assertion in typeck Fixes rust-lang#72410
- Loading branch information
Showing
3 changed files
with
37 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,18 @@ | ||
// Regression test for #72410, this should be used with debug assertion enabled. | ||
|
||
// should be fine | ||
pub trait Foo { | ||
fn map() | ||
where | ||
Self: Sized, | ||
for<'a> &'a mut [u8]: ; | ||
} | ||
|
||
// should fail | ||
pub trait Bar { | ||
fn map() | ||
where for<'a> &'a mut [dyn Bar]: ; | ||
//~^ ERROR: the trait `Bar` cannot be made into an object | ||
} | ||
|
||
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,18 @@ | ||
error[E0038]: the trait `Bar` cannot be made into an object | ||
--> $DIR/issue-72410.rs:14:19 | ||
| | ||
LL | pub trait Bar { | ||
| --- this trait cannot be made into an object... | ||
LL | fn map() | ||
| --- ...because associated function `map` has no `self` parameter | ||
LL | where for<'a> &'a mut [dyn Bar]: ; | ||
| ^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | ||
| | ||
help: consider turning `map` into a method by giving it a `&self` argument or constraining it so it does not apply to trait objects | ||
| | ||
LL | where for<'a> &'a mut [dyn Bar]:, Self: Sized ; | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0038`. |