rust/compiler/rustc_span/src
Matthias Krüger e525bc9592
Rollup merge of #120272 - long-long-float:suppress-suggestions-in-derive-macro, r=oli-obk
Suppress suggestions in derive macro

close #118809

I suppress warnings inside derive macros.

For example, the compiler emits following error by a program described in https://github.com/rust-lang/rust/issues/118809#issuecomment-1852256687 with a suggestion that indicates invalid syntax.

```
error[E0308]: `?` operator has incompatible types
 --> src/main.rs:3:17
  |
3 | #[derive(Debug, Deserialize)]
  |                 ^^^^^^^^^^^ expected `u32`, found `u64`
  |
  = note: `?` operator cannot convert from `u64` to `u32`
  = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
  |
3 | #[derive(Debug, Deserialize.try_into().unwrap())]
  |                            ++++++++++++++++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `serde_test` (bin "serde_test") due to 2 previous errors
```

In this PR, suggestions to cast are suppressed.

```
error[E0308]: `?` operator has incompatible types
 --> src/main.rs:3:17
  |
3 | #[derive(Debug, Deserialize)]
  |                 ^^^^^^^^^^^ expected `u32`, found `u64`
  |
  = note: `?` operator cannot convert from `u64` to `u32`
  = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0308`.
error: could not compile `serde_test` (bin "serde_test") due to 2 previous errors
```
2024-02-11 01:37:54 +01:00
..
analyze_source_file Use relative positions inside a SourceFile. 2023-09-03 12:56:10 +00:00
edit_distance Add test for precise algorithm used 2023-02-19 22:59:22 +00:00
source_map Update tests 2024-02-07 10:42:01 +08:00
symbol Use FxIndexSet in the symbol interner. 2023-11-03 07:19:41 +11:00
analyze_source_file.rs Initiate the inner usage of cfg_match 2023-10-19 20:18:51 -03:00
caching_source_map_view.rs Add better ICE messages for some undescriptive panics 2023-12-15 00:50:55 -05:00
def_id.rs Auto merge of #119478 - bjorn3:no_serialize_specialization, r=wesleywiser 2024-01-06 09:56:00 +00:00
edit_distance.rs check rust lints when an unknown lint is detected 2024-01-12 18:50:36 +08:00
edition.rs Remove edition umbrella features. 2023-12-10 13:03:28 -08:00
fatal_error.rs Auto merge of #117557 - Zoxc:panic-prio, r=petrochenkov 2023-11-09 00:39:02 +00:00
hygiene.rs Add async bound modifier to enable async Fn bounds 2024-01-31 16:59:19 +00:00
lib.rs Rollup merge of #120272 - long-long-float:suppress-suggestions-in-derive-macro, r=oli-obk 2024-02-11 01:37:54 +01:00
profiling.rs Remove an unnecessary use of with_session_globals. 2023-03-31 15:34:00 +11:00
source_map.rs Use UnhashMap for a few more maps 2024-01-17 17:09:55 -05:00
span_encoding.rs rustc_span: Optimize syntax context comparisons 2024-01-06 01:25:20 +03:00
symbol.rs unstably allow constants to refer to statics and read from immutable statics 2024-02-10 16:12:55 +01:00
tests.rs Use Freeze for SourceFile.lines 2023-09-07 13:05:05 +02:00