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#85979 - tlyu:where-no-unsized-indirection, …
…r=estebank don't suggest unsized indirection in where-clauses Skip where-clauses when suggesting using indirection in combination with `?Sized` bounds on type parameters. Fixes rust-lang#85943. `@estebank` I think this doesn't conflict with your work in rust-lang#85947; please let me know if you'd like me to cherry pick it to a new branch based on yours instead.
- Loading branch information
Showing
3 changed files
with
33 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
9 changes: 9 additions & 0 deletions
9
src/test/ui/suggestions/issue-85943-no-suggest-unsized-indirection-in-where-clause.rs
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,9 @@ | ||
// Regression test for #85943: should not emit suggestions for adding | ||
// indirection to type parameters in where-clauses when suggesting | ||
// adding `?Sized`. | ||
struct A<T>(T) where T: Send; | ||
struct B(A<[u8]>); | ||
//~^ ERROR the size for values of type | ||
|
||
pub fn main() { | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/ui/suggestions/issue-85943-no-suggest-unsized-indirection-in-where-clause.stderr
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,20 @@ | ||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time | ||
--> $DIR/issue-85943-no-suggest-unsized-indirection-in-where-clause.rs:5:10 | ||
| | ||
LL | struct A<T>(T) where T: Send; | ||
| - required by this bound in `A` | ||
LL | struct B(A<[u8]>); | ||
| ^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `[u8]` | ||
help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` | ||
--> $DIR/issue-85943-no-suggest-unsized-indirection-in-where-clause.rs:4:10 | ||
| | ||
LL | struct A<T>(T) where T: Send; | ||
| ^ - ...if indirection were used here: `Box<T>` | ||
| | | ||
| this could be changed to `T: ?Sized`... | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |