-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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 #114322 - Urgau:fix-issue-110063, r=compiler-errors
Fix invalid slice coercion suggestion reported in turbofish This PR fixes the invalid slice coercion suggestion reported in turbofish and inferred generics by not emitting them. Fixes #110063
- Loading branch information
Showing
4 changed files
with
54 additions
and
3 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
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
13 changes: 13 additions & 0 deletions
13
tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.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,13 @@ | ||
trait Test {} | ||
impl Test for &[u8] {} | ||
|
||
fn needs_test<T: Test>() -> T { | ||
panic!() | ||
} | ||
|
||
fn main() { | ||
needs_test::<[u8; 1]>(); | ||
//~^ ERROR the trait bound | ||
let x: [u8; 1] = needs_test(); | ||
//~^ ERROR the trait bound | ||
} |
29 changes: 29 additions & 0 deletions
29
tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.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,29 @@ | ||
error[E0277]: the trait bound `[u8; 1]: Test` is not satisfied | ||
--> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:9:18 | ||
| | ||
LL | needs_test::<[u8; 1]>(); | ||
| ^^^^^^^ the trait `Test` is not implemented for `[u8; 1]` | ||
| | ||
= help: the trait `Test` is implemented for `&[u8]` | ||
note: required by a bound in `needs_test` | ||
--> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:4:18 | ||
| | ||
LL | fn needs_test<T: Test>() -> T { | ||
| ^^^^ required by this bound in `needs_test` | ||
|
||
error[E0277]: the trait bound `[u8; 1]: Test` is not satisfied | ||
--> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:11:22 | ||
| | ||
LL | let x: [u8; 1] = needs_test(); | ||
| ^^^^^^^^^^ the trait `Test` is not implemented for `[u8; 1]` | ||
| | ||
= help: the trait `Test` is implemented for `&[u8]` | ||
note: required by a bound in `needs_test` | ||
--> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:4:18 | ||
| | ||
LL | fn needs_test<T: Test>() -> T { | ||
| ^^^^ required by this bound in `needs_test` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |