Add approximate suggestions for rustfix
This adds `span_approximate_suggestion()` that lets you emit a suggestion marked as "approximate" in the JSON output. UI users see no difference. This is for when rustc and clippy wish to emit suggestions which will make sense to the reader (e.g. they may have placeholders like `<type>`) but are not source-applicable, so that rustfix/etc can ignore these. fixes #39254
This commit is contained in:
parent
385ef1514c
commit
937bc2e04a
4 changed files with 64 additions and 7 deletions
|
|
@ -83,6 +83,12 @@ pub struct CodeSuggestion {
|
|||
pub substitutions: Vec<Substitution>,
|
||||
pub msg: String,
|
||||
pub show_code_when_inline: bool,
|
||||
/// Whether or not the suggestion is approximate
|
||||
///
|
||||
/// Sometimes we may show suggestions with placeholders,
|
||||
/// which are useful for users but not useful for
|
||||
/// tools like rustfix
|
||||
pub approximate: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue