-
Notifications
You must be signed in to change notification settings - Fork 13.5k
chore: Improve how the other suggestions message gets rendered #143661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+301
−14
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,130 @@ | ||
error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap` | ||
--> $DIR/multi-suggestion.rs:17:13 | ||
| | ||
LL | let _ = std::collections::HashMap(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL | ||
| | ||
= note: `std::collections::HashMap` defined here | ||
| | ||
help: you might have meant to use an associated function to build this type | ||
| | ||
LL | let _ = std::collections::HashMap::new(); | ||
| +++++ | ||
LL - let _ = std::collections::HashMap(); | ||
LL + let _ = std::collections::HashMap::with_capacity(_); | ||
| | ||
LL - let _ = std::collections::HashMap(); | ||
LL + let _ = std::collections::HashMap::with_hasher(_); | ||
| | ||
LL - let _ = std::collections::HashMap(); | ||
LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); | ||
| | ||
help: consider using the `Default` trait | ||
| | ||
LL | let _ = <std::collections::HashMap as std::default::Default>::default(); | ||
| + ++++++++++++++++++++++++++++++++++ | ||
|
||
error[E0423]: cannot initialize a tuple struct which contains private fields | ||
--> $DIR/multi-suggestion.rs:11:19 | ||
| | ||
LL | wtf: Some(Box(U { | ||
| ^^^ | ||
| | ||
note: constructor is not visible here due to private fields | ||
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL | ||
| | ||
= note: private field | ||
| | ||
= note: private field | ||
help: you might have meant to use an associated function to build this type | ||
| | ||
LL - wtf: Some(Box(U { | ||
LL - wtf: None, | ||
LL - x: (), | ||
LL - })), | ||
LL + wtf: Some(Box::new(_)), | ||
| | ||
LL - wtf: Some(Box(U { | ||
LL - wtf: None, | ||
LL - x: (), | ||
LL - })), | ||
LL + wtf: Some(Box::new_uninit()), | ||
| | ||
LL - wtf: Some(Box(U { | ||
LL - wtf: None, | ||
LL - x: (), | ||
LL - })), | ||
LL + wtf: Some(Box::new_zeroed()), | ||
| | ||
LL - wtf: Some(Box(U { | ||
LL - wtf: None, | ||
LL - x: (), | ||
LL - })), | ||
LL + wtf: Some(Box::new_in(_, _)), | ||
| | ||
= and 12 other candidates | ||
help: consider using the `Default` trait | ||
| | ||
LL - wtf: Some(Box(U { | ||
LL + wtf: Some(<Box as std::default::Default>::default()), | ||
| | ||
|
||
error: cannot construct `HashMap<_, _, _>` with struct literal syntax due to private fields | ||
--> $DIR/multi-suggestion.rs:19:13 | ||
| | ||
LL | let _ = std::collections::HashMap {}; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: private field `base` that was not provided | ||
help: you might have meant to use an associated function to build this type | ||
| | ||
LL - let _ = std::collections::HashMap {}; | ||
LL + let _ = std::collections::HashMap::new(); | ||
| | ||
LL - let _ = std::collections::HashMap {}; | ||
LL + let _ = std::collections::HashMap::with_capacity(_); | ||
| | ||
LL - let _ = std::collections::HashMap {}; | ||
LL + let _ = std::collections::HashMap::with_hasher(_); | ||
| | ||
LL - let _ = std::collections::HashMap {}; | ||
LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); | ||
| | ||
help: consider using the `Default` trait | ||
| | ||
LL - let _ = std::collections::HashMap {}; | ||
LL + let _ = <std::collections::HashMap as std::default::Default>::default(); | ||
| | ||
|
||
error: cannot construct `Box<_, _>` with struct literal syntax due to private fields | ||
--> $DIR/multi-suggestion.rs:21:13 | ||
| | ||
LL | let _ = Box {}; | ||
| ^^^ | ||
| | ||
= note: private fields `0` and `1` that were not provided | ||
help: you might have meant to use an associated function to build this type | ||
| | ||
LL - let _ = Box {}; | ||
LL + let _ = Box::new(_); | ||
| | ||
LL - let _ = Box {}; | ||
LL + let _ = Box::new_uninit(); | ||
| | ||
LL - let _ = Box {}; | ||
LL + let _ = Box::new_zeroed(); | ||
| | ||
LL - let _ = Box {}; | ||
LL + let _ = Box::new_in(_, _); | ||
| | ||
= and 12 other candidates | ||
help: consider using the `Default` trait | ||
| | ||
LL - let _ = Box {}; | ||
LL + let _ = <Box as std::default::Default>::default(); | ||
| | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0423`. |
This file contains hidden or 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,22 @@ | ||
//@ revisions: ascii unicode | ||
//@[unicode] compile-flags: -Zunstable-options --error-format=human-unicode | ||
|
||
#![allow(dead_code)] | ||
struct U <T> { | ||
wtf: Option<Box<U<T>>>, | ||
x: T, | ||
} | ||
fn main() { | ||
U { | ||
wtf: Some(Box(U { //[ascii]~ ERROR cannot initialize a tuple struct which contains private fields | ||
wtf: None, | ||
x: (), | ||
})), | ||
x: () | ||
}; | ||
let _ = std::collections::HashMap(); | ||
//[ascii]~^ ERROR expected function, tuple struct or tuple variant, found struct `std::collections::HashMap` | ||
let _ = std::collections::HashMap {}; | ||
//[ascii]~^ ERROR cannot construct `HashMap<_, _, _>` with struct literal syntax due to private fields | ||
let _ = Box {}; //[ascii]~ ERROR cannot construct `Box<_, _>` with struct literal syntax due to private fields | ||
} |
This file contains hidden or 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,130 @@ | ||
error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap` | ||
╭▸ $DIR/multi-suggestion.rs:17:13 | ||
│ | ||
LL │ let _ = std::collections::HashMap(); | ||
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL | ||
│ | ||
╰ note: `std::collections::HashMap` defined here | ||
╰╴ | ||
help: you might have meant to use an associated function to build this type | ||
╭╴ | ||
LL │ let _ = std::collections::HashMap::new(); | ||
├╴ +++++ | ||
LL - let _ = std::collections::HashMap(); | ||
LL + let _ = std::collections::HashMap::with_capacity(_); | ||
├╴ | ||
LL - let _ = std::collections::HashMap(); | ||
LL + let _ = std::collections::HashMap::with_hasher(_); | ||
├╴ | ||
LL - let _ = std::collections::HashMap(); | ||
LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); | ||
╰╴ | ||
help: consider using the `Default` trait | ||
╭╴ | ||
LL │ let _ = <std::collections::HashMap as std::default::Default>::default(); | ||
╰╴ + ++++++++++++++++++++++++++++++++++ | ||
|
||
error[E0423]: cannot initialize a tuple struct which contains private fields | ||
╭▸ $DIR/multi-suggestion.rs:11:19 | ||
│ | ||
LL │ wtf: Some(Box(U { | ||
│ ━━━ | ||
╰╴ | ||
note: constructor is not visible here due to private fields | ||
╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL | ||
│ | ||
╰ note: private field | ||
│ | ||
╰ note: private field | ||
help: you might have meant to use an associated function to build this type | ||
╭╴ | ||
LL - wtf: Some(Box(U { | ||
LL - wtf: None, | ||
LL - x: (), | ||
LL - })), | ||
LL + wtf: Some(Box::new(_)), | ||
├╴ | ||
LL - wtf: Some(Box(U { | ||
LL - wtf: None, | ||
LL - x: (), | ||
LL - })), | ||
LL + wtf: Some(Box::new_uninit()), | ||
├╴ | ||
LL - wtf: Some(Box(U { | ||
LL - wtf: None, | ||
LL - x: (), | ||
LL - })), | ||
LL + wtf: Some(Box::new_zeroed()), | ||
├╴ | ||
LL - wtf: Some(Box(U { | ||
LL - wtf: None, | ||
LL - x: (), | ||
LL - })), | ||
LL + wtf: Some(Box::new_in(_, _)), | ||
│ | ||
╰ and 12 other candidates | ||
help: consider using the `Default` trait | ||
╭╴ | ||
LL - wtf: Some(Box(U { | ||
LL + wtf: Some(<Box as std::default::Default>::default()), | ||
╰╴ | ||
|
||
error: cannot construct `HashMap<_, _, _>` with struct literal syntax due to private fields | ||
╭▸ $DIR/multi-suggestion.rs:19:13 | ||
│ | ||
LL │ let _ = std::collections::HashMap {}; | ||
│ ━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
│ | ||
╰ note: private field `base` that was not provided | ||
help: you might have meant to use an associated function to build this type | ||
╭╴ | ||
LL - let _ = std::collections::HashMap {}; | ||
LL + let _ = std::collections::HashMap::new(); | ||
├╴ | ||
LL - let _ = std::collections::HashMap {}; | ||
LL + let _ = std::collections::HashMap::with_capacity(_); | ||
├╴ | ||
LL - let _ = std::collections::HashMap {}; | ||
LL + let _ = std::collections::HashMap::with_hasher(_); | ||
├╴ | ||
LL - let _ = std::collections::HashMap {}; | ||
LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); | ||
╰╴ | ||
help: consider using the `Default` trait | ||
╭╴ | ||
LL - let _ = std::collections::HashMap {}; | ||
LL + let _ = <std::collections::HashMap as std::default::Default>::default(); | ||
╰╴ | ||
|
||
error: cannot construct `Box<_, _>` with struct literal syntax due to private fields | ||
╭▸ $DIR/multi-suggestion.rs:21:13 | ||
│ | ||
LL │ let _ = Box {}; | ||
│ ━━━ | ||
│ | ||
╰ note: private fields `0` and `1` that were not provided | ||
help: you might have meant to use an associated function to build this type | ||
╭╴ | ||
LL - let _ = Box {}; | ||
LL + let _ = Box::new(_); | ||
├╴ | ||
LL - let _ = Box {}; | ||
LL + let _ = Box::new_uninit(); | ||
├╴ | ||
LL - let _ = Box {}; | ||
LL + let _ = Box::new_zeroed(); | ||
├╴ | ||
LL - let _ = Box {}; | ||
LL + let _ = Box::new_in(_, _); | ||
│ | ||
╰ and 12 other candidates | ||
help: consider using the `Default` trait | ||
╭╴ | ||
LL - let _ = Box {}; | ||
LL + let _ = <Box as std::default::Default>::default(); | ||
╰╴ | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0423`. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. This seems to be a mild render bug for the unicode output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, this should have been
Pre-existing. The logic for "couldn't find span" predates the unicode output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct that the logic for "couldn't find span" is the cause of the odd output here. I have a commit locally that changes how it is rendered to resemble what you expected it to be.