Go to file
Matthias Krüger 2066002b86
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```
2024-08-09 18:24:58 +02:00
.github
compiler Rollup merge of #128852 - folkertdev:multipart-suggestion-stable-sort, r=compiler-errors 2024-08-09 18:24:58 +02:00
library Rollup merge of #128817 - biabbas:vxworks_update, r=tgross35 2024-08-09 18:24:56 +02:00
LICENSES
src Rollup merge of #128838 - notriddle:notriddle/invalid-tag-is-not-rust, r=GuillaumeGomez 2024-08-09 18:24:58 +02:00
tests Rollup merge of #128838 - notriddle:notriddle/invalid-tag-is-not-rust, r=GuillaumeGomez 2024-08-09 18:24:58 +02:00
.clang-format
.editorconfig
.git-blame-ignore-revs
.gitattributes
.gitignore Add -Zerror-metrics=PATH to save diagnostic metadata to disk 2024-08-07 11:16:55 -07:00
.gitmodules
.ignore
.mailmap
Cargo.lock Update Cargo.lock 2024-08-08 19:14:09 +02:00
Cargo.toml
CODE_OF_CONDUCT.md
config.example.toml
configure
CONTRIBUTING.md
COPYRIGHT
INSTALL.md
LICENSE-APACHE
LICENSE-MIT
README.md
RELEASES.md
REUSE.toml
rust-bors.toml
rustfmt.toml
triagebot.toml
x
x.ps1
x.py

This is the main source code repository for Rust. It contains the compiler, standard library, and documentation.

Why Rust?

  • Performance: Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrate with other languages.

  • Reliability: Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time.

  • Productivity: Comprehensive documentation, a compiler committed to providing great diagnostics, and advanced tooling including package manager and build tool (Cargo), auto-formatter (rustfmt), linter (Clippy) and editor support (rust-analyzer).

Quick Start

Read "Installation" from The Book.

Installing from Source

If you really want to install from source (though this is not recommended), see INSTALL.md.

Getting Help

See https://www.rust-lang.org/community for a list of chat platforms and forums.

Contributing

See CONTRIBUTING.md.

License

Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.

See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.

Trademark

The Rust Foundation owns and protects the Rust and Cargo trademarks and logos (the "Rust Trademarks").

If you want to use these names or brands, please read the media guide.

Third-party logos may be subject to third-party copyrights and trademarks. See Licenses for details.