Skip to content

Commit 50c84d1

Browse files
zackmdavismark-i-m
authored andcommitted
_with_applicability methods are gone
The simpler `span_suggestion` method name now takes the applicability argument, thanks to Andy Russell (rust-lang/rust@0897ffc28f6).
1 parent 0ffc56b commit 50c84d1

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/diag.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,19 @@ Server][rls] and [`rustfix`][rustfix].
8585
[rustfix]: https://github.com/rust-lang-nursery/rustfix
8686

8787
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.
9191

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
9393

9494
For example, to make our `qux` suggestion machine-applicable, we would do:
9595

9696
```rust,ignore
9797
let mut err = sess.struct_span_err(sp, "oh no! this is an error!");
9898
9999
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(
102101
suggestion_sp,
103102
"try using a qux here",
104103
format!("qux {}", snip),
@@ -145,7 +144,7 @@ error: aborting due to previous error
145144
For more information about this error, try `rustc --explain E0999`.
146145
```
147146

148-
There are a few other [`Applicability`][appl] possibilities:
147+
The possible values of [`Applicability`][appl] are:
149148

150149
- `MachineApplicable`: Can be applied mechanically.
151150
- `HasPlaceholders`: Cannot be applied mechanically because it has placeholder

0 commit comments

Comments
 (0)