rust/src
bors 1b427b3bf7 Auto merge of #118879 - Nadrieril:lint-range-gap, r=estebank
Lint singleton gaps after exclusive ranges

In the discussion to stabilize exclusive range patterns (https://github.com/rust-lang/rust/issues/37854), it has often come up that they're likely to cause off-by-one mistakes. We already have the `overlapping_range_endpoints` lint, so I [proposed](https://github.com/rust-lang/rust/issues/37854#issuecomment-1845580712) a lint to catch the complementary mistake.

This PR adds a new `non_contiguous_range_endpoints` lint that catches likely off-by-one errors with exclusive range patterns. Here's the idea (see the test file for more examples):
```rust
match x {
    0..10 => ..., // WARN: this range doesn't match `10_u8` because `..` is an exclusive range
    11..20 => ..., // this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them
    _ => ...,
}
// help: use an inclusive range instead: `0_u8..=10_u8`
```

More precisely: for any exclusive range `lo..hi`, if `hi+1` is matched by another range but `hi` isn't, we suggest writing an inclusive range `lo..=hi` instead. We also catch `lo..T::MAX`.
2024-03-09 03:49:01 +00:00
..
bootstrap Auto merge of #122151 - GuillaumeGomez:rollup-hfxr9kv, r=GuillaumeGomez 2024-03-07 22:43:18 +00:00
ci Auto merge of #120468 - alexcrichton:start-wasm32-wasi-rename, r=wesleywiser 2024-03-04 18:55:14 +00:00
doc Rollup merge of #121832 - heiher:loongarch64-musl, r=wesleywiser 2024-03-08 08:19:18 +01:00
etc Update tests. 2024-01-27 16:38:57 +01:00
librustdoc Auto merge of #122190 - matthiaskrgr:rollup-9ol4y30, r=matthiaskrgr 2024-03-08 17:31:00 +00:00
llvm-project@7973f35602 Update to LLVM 18.1.0 rc 4 2024-03-01 16:18:57 +01:00
rustdoc-json-types Add is_object_safe information for traits in JSON output 2023-12-23 11:43:31 +01:00
tools Auto merge of #118879 - Nadrieril:lint-range-gap, r=estebank 2024-03-09 03:49:01 +00:00
README.md Remove stale reference to the test suite location 2023-01-13 11:49:06 +00:00
stage0.json Bump to newly branched stage0 compiler 2024-02-08 07:43:38 -05:00
version Bump to 1.78 2024-02-03 13:14:34 -05:00

This directory contains some source code for the Rust project, including:

  • The bootstrapping build system
  • Various submodules for tools, like cargo, tidy, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.