-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #126115 - gurry:125876-ice-unwrap-probe-many-result, …
…r=compiler-errors Fix ICE due to `unwrap` in `probe_for_name_many` Fixes #125876 Now `probe_for_name_many` bubbles up the error returned by `probe_op` instead of calling `unwrap` on it.
- Loading branch information
Showing
5 changed files
with
72 additions
and
11 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
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
11 changes: 11 additions & 0 deletions
11
tests/ui/suggestions/ice-unwrap-probe-many-result-125876.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,11 @@ | ||
// Regression test for ICE #125876 | ||
|
||
fn main() { | ||
std::ptr::from_ref(num).cast_mut().as_deref(); | ||
//~^ ERROR cannot find value `num` in this scope | ||
//~| ERROR no method named `as_deref` found for raw pointer `*mut _` in the current scope | ||
//~| WARN type annotations needed | ||
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! | ||
//~| WARN type annotations needed | ||
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! | ||
} |
40 changes: 40 additions & 0 deletions
40
tests/ui/suggestions/ice-unwrap-probe-many-result-125876.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,40 @@ | ||
error[E0425]: cannot find value `num` in this scope | ||
--> $DIR/ice-unwrap-probe-many-result-125876.rs:4:24 | ||
| | ||
LL | std::ptr::from_ref(num).cast_mut().as_deref(); | ||
| ^^^ not found in this scope | ||
|
||
warning: type annotations needed | ||
--> $DIR/ice-unwrap-probe-many-result-125876.rs:4:29 | ||
| | ||
LL | std::ptr::from_ref(num).cast_mut().as_deref(); | ||
| ^^^^^^^^ | ||
| | ||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! | ||
= note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906> | ||
= note: `#[warn(tyvar_behind_raw_pointer)]` on by default | ||
|
||
warning: type annotations needed | ||
--> $DIR/ice-unwrap-probe-many-result-125876.rs:4:40 | ||
| | ||
LL | std::ptr::from_ref(num).cast_mut().as_deref(); | ||
| ^^^^^^^^ | ||
| | ||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! | ||
= note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906> | ||
|
||
error[E0599]: no method named `as_deref` found for raw pointer `*mut _` in the current scope | ||
--> $DIR/ice-unwrap-probe-many-result-125876.rs:4:40 | ||
| | ||
LL | std::ptr::from_ref(num).cast_mut().as_deref(); | ||
| ^^^^^^^^ | ||
| | ||
help: there is a method `as_ref` with a similar name | ||
| | ||
LL | std::ptr::from_ref(num).cast_mut().as_ref(); | ||
| ~~~~~~ | ||
|
||
error: aborting due to 2 previous errors; 2 warnings emitted | ||
|
||
Some errors have detailed explanations: E0425, E0599. | ||
For more information about an error, try `rustc --explain E0425`. |