@@ -85,20 +85,19 @@ Server][rls] and [`rustfix`][rustfix].
85
85
[ rustfix ] : https://github.com/rust-lang-nursery/rustfix
86
86
87
87
Not all suggestions should be applied mechanically. Use the
88
- [ ` span_suggestion_with_applicability ` ] [ sswa ] method of ` DiagnosticBuilder ` to
89
- make a suggestion while providing a hint to tools whether the suggestion is
90
- mechanically applicable or not.
88
+ [ ` span_suggestion ` ] [ span_suggestion ] method of ` DiagnosticBuilder ` to
89
+ make a suggestion. The last argument provides a hint to tools whether
90
+ the suggestion is mechanically applicable or not.
91
91
92
- [ sswa ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.DiagnosticBuilder.html#method.span_suggestion_with_applicability
92
+ [ span_suggestion ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.DiagnosticBuilder.html#method.span_suggestion
93
93
94
94
For example, to make our ` qux ` suggestion machine-applicable, we would do:
95
95
96
96
``` rust,ignore
97
97
let mut err = sess.struct_span_err(sp, "oh no! this is an error!");
98
98
99
99
if let Ok(snippet) = sess.source_map().span_to_snippet(sp) {
100
- // Add applicability info!
101
- err.span_suggestion_with_applicability(
100
+ err.span_suggestion(
102
101
suggestion_sp,
103
102
"try using a qux here",
104
103
format!("qux {}", snip),
@@ -145,7 +144,7 @@ error: aborting due to previous error
145
144
For more information about this error, try `rustc --explain E0999`.
146
145
```
147
146
148
- There are a few other [ ` Applicability ` ] [ appl ] possibilities :
147
+ The possible values of [ ` Applicability ` ] [ appl ] are :
149
148
150
149
- ` MachineApplicable ` : Can be applied mechanically.
151
150
- ` HasPlaceholders ` : Cannot be applied mechanically because it has placeholder
0 commit comments