about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-08-09 18:24:58 +0200
committerGitHub <noreply@github.com>2024-08-09 18:24:58 +0200
commit2066002b86062d57771f1c0f63871d825f4f201c (patch)
treec729d1e5fea56580457e8b9ce80c195f6aa26fa8 /compiler/rustc_codegen_llvm/src
parent9f11eb13b80336002834b6c342ffc574d5bb3248 (diff)
parent38874a692738f23b17d20a81bb906701303c0474 (diff)
downloadrust-2066002b86062d57771f1c0f63871d825f4f201c.tar.gz
rust-2066002b86062d57771f1c0f63871d825f4f201c.zip
Rollup merge of #128852 - folkertdev:multipart-suggestion-stable-sort, r=compiler-errors
use stable sort to sort multipart diagnostics

I think a stable sort should be used to sort the different parts of a multipart selection. The current unstable sort uses the text of the suggestion as a tie-breaker. That just doesn't seem right, and the order of the input is a better choice I think, because it gives the diagnostic author more control.

This came up when I was building a suggestion where

```rust
fn foo() {}
```

must be turned into an unsafe function, and an attribute must be added

```rust
#[target_feature(enable = "...")]
unsafe fn foo() {}
```

In this example, the two suggestions occur at the same position, but the order is extremely important: unsafe must come after the attribute. But the situation changes if there is a pub/pub(crate), and if the unsafe is already present. It just out that because of the suggestion text, there is no way for me to order the suggestions correctly.

This change probably should be tested, but are there tests of the diagnostics code itself in the tests?

r? ```@estebank```
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions