about summary refs log tree commit diff
path: root/compiler/rustc_session/src/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-03 10:01:16 +0000
committerbors <bors@rust-lang.org>2023-08-03 10:01:16 +0000
commitc115ec11d2087050dc12c5c83959979aa98bb3e5 (patch)
tree5b96ab0c4fab46b9217cd88f8bdecae48838a9cb /compiler/rustc_session/src/lib.rs
parenta922d1c0da0c904ffe9de256d926180613f1ed81 (diff)
parent25d065b2d476053102b05bbd5c4650a86ddc2c94 (diff)
downloadrust-c115ec11d2087050dc12c5c83959979aa98bb3e5.tar.gz
rust-c115ec11d2087050dc12c5c83959979aa98bb3e5.zip
Auto merge of #112043 - jieyouxu:suggestion_macro_expansion_source_callsites, r=cjgillot
Fix suggestion spans for expr from macro expansions

### Issue #112007: rustc shows expanded `writeln!` macro in code suggestion

#### Before This PR

```
help: consider using a semicolon here
  |
6 |     };
  |      +
help: you might have meant to return this value
 --> C:\Users\hayle\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\macros\mod.rs:557:9
  |
55|         return $dst.write_fmt($crate::format_args_nl!($($arg)*));
  |         ++++++                                                  +
```

#### After This PR

```
help: consider using a semicolon here
   |
LL |     };
   |      +
help: you might have meant to return this value
   |
LL |         return writeln!(w, "but not here");
   |         ++++++                            +
```

### Issue #110017: `format!` `.into()` suggestion deletes the `format` macro

#### Before This PR

```
help: call `Into::into` on this expression to convert `String` into `Box<dyn std::error::Error>`
 --> /Users/eric/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/macros.rs:121:12
  |
12|         res.into()
  |            +++++++
```

#### After This PR

```
help: call `Into::into` on this expression to convert `String` into `Box<dyn std::error::Error>`
   |
LL |     Err(format!("error: {x}").into())
   |                              +++++++
```

---

Fixes #112007.
Fixes #110017.
Diffstat (limited to 'compiler/rustc_session/src/lib.rs')
0 files changed, 0 insertions, 0 deletions