diff options
| author | bors <bors@rust-lang.org> | 2022-02-05 17:44:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-02-05 17:44:37 +0000 |
| commit | 68b44986de6a8c9e844afa55693a24f0d4a0978e (patch) | |
| tree | fa2e21087e2a10dfada3a1879a5132ed789cf5be /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | 29cc0d8e595f93cd0bd8341dd034c847f3a7746f (diff) | |
| parent | 144b4a59c7a3d18a0dd2c4316061672d00516ea3 (diff) | |
| download | rust-68b44986de6a8c9e844afa55693a24f0d4a0978e.tar.gz rust-68b44986de6a8c9e844afa55693a24f0d4a0978e.zip | |
Auto merge of #8365 - Alexendoo:explicit-write-suggestion, r=camsteffen
Add `explicit_write` suggestions for `write!`s with format args
changelog: Add [`explicit_write`] suggestions for `write!`s with format args
Fixes #4542
```rust
writeln!(std::io::stderr(), "macro arg {}", one!()).unwrap();
```
Now suggests:
```
error: use of `writeln!(stderr(), ...).unwrap()`
--> $DIR/explicit_write.rs:36:9
|
LL | writeln!(std::io::stderr(), "macro arg {}", one!()).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("macro arg {}", one!())`
```
---------
r? `@camsteffen` (again, sorry 😛) for the `FormatArgsExpn` change
Before this change `inputs_span` returned a span pointing to just `1` in
```rust
macro_rules! one {
() => { 1 };
}
`writeln!(std::io::stderr(), "macro arg {}", one!()).unwrap();`
```
And the `source_callsite` of that span didn't include the format string, it was just `one!()`
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
