-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ICE caused by suggestion with no code substitutions
Change suggestion logic to filter and checking _before_ creating specific resolution suggestion. Assert earlier that suggestions contain code substitions to make it easier in the future to debug invalid uses. If we find this becomes too noisy in the wild, we can always make the emitter resilient to these cases and remove the assertions. Fix #78651.
- Loading branch information
Showing
4 changed files
with
39 additions
and
20 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
5 changes: 5 additions & 0 deletions
5
src/test/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.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,5 @@ | ||
use std::result; | ||
impl result { //~ ERROR expected type, found module `result` | ||
fn into_future() -> Err {} //~ ERROR expected type, found variant `Err` | ||
} | ||
fn main() {} |
20 changes: 20 additions & 0 deletions
20
src/test/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.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[E0573]: expected type, found module `result` | ||
--> $DIR/do-not-attempt-to-add-suggestions-with-no-changes.rs:2:6 | ||
| | ||
LL | impl result { | ||
| ^^^^^^ help: an enum with a similar name exists: `Result` | ||
| | ||
::: $SRC_DIR/core/src/result.rs:LL:COL | ||
| | ||
LL | pub enum Result<T, E> { | ||
| --------------------- similarly named enum `Result` defined here | ||
|
||
error[E0573]: expected type, found variant `Err` | ||
--> $DIR/do-not-attempt-to-add-suggestions-with-no-changes.rs:3:25 | ||
| | ||
LL | fn into_future() -> Err {} | ||
| ^^^ not a type | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0573`. |