-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 #98509 - rust-lang:notriddle/precise-pin-diag, r=comp…
…iler-errors diagnostics: consider parameter count when suggesting smart pointers Fixes #96834
- Loading branch information
Showing
3 changed files
with
28 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,15 @@ | ||
// https://github.com/rust-lang/rust/issues/96834 | ||
// | ||
// This test case verifies that rustc does not make an unhelpful suggestion: | ||
// | ||
// help: consider wrapping the receiver expression with the appropriate type | ||
// | | ||
// 14 | Pin::new(&mut a).set(0, 3); | ||
// | +++++++++++++ + | ||
// | ||
// We can tell that it isn't helpful, because `Pin::set` takes two parameters (including | ||
// the receiver), but the function call on line 14 supplies three. | ||
fn main() { | ||
let mut a = [0u8; 1]; | ||
a.set(0, 3); //~ERROR | ||
} |
9 changes: 9 additions & 0 deletions
9
src/test/ui/suggestions/dont-suggest-pin-array-dot-set.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,9 @@ | ||
error[E0599]: no method named `set` found for array `[u8; 1]` in the current scope | ||
--> $DIR/dont-suggest-pin-array-dot-set.rs:14:7 | ||
| | ||
LL | a.set(0, 3); | ||
| ^^^ help: there is an associated function with a similar name: `get` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |