rust/src
bors 2b5ddf36fd Auto merge of #86809 - DevinR528:reachable-pat, r=Nadrieril
Add non_exhaustive_omitted_patterns lint related to rfc-2008-non_exhaustive

Fixes: #84332

This PR adds `non_exhaustive_omitted_patterns`, an allow by default lint that is triggered when a `non_exhaustive` type is missing explicit patterns. The warning or deny attribute can be put above the wildcard `_` pattern on enums or on the expression for enums or structs. The lint is capable of warning about multiple types within the same pattern. This lint will not be triggered for `if let ..` patterns.

```rust
// crate A
#[non_exhaustive]
pub struct Foo {
    a: u8,
    b: usize,
}
#[non_exhaustive]
pub enum Bar {
    A(Foo),
    B,
}

// crate B
#[deny(non_exhaustive_omitted_patterns)] // here
match Bar::B {
    Bar::B => {}
    #[deny(non_exhaustive_omitted_patterns)] // or here
    _ => {}
}

#[warn(non_exhaustive_omitted_patterns)] // only here
let Foo { a, .. } = Foo::default();

#[deny(non_exhaustive_omitted_patterns)]
match Bar::B {
    // triggers for Bar::B, and Foo.b
    Bar::A(Foo { a, .. }) => {}
    // if the attribute was here only Bar::B would cause a warning
    _ => {}
}
```
2021-09-16 05:29:22 +00:00
..
bootstrap Rollup merge of #88885 - GuillaumeGomez:fix-jump-def-background, r=camelid 2021-09-13 21:20:41 +02:00
build_helper rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
ci Disable both reproducible-build tests for crate-type=bin 2021-09-15 13:37:22 -04:00
doc Rollup merge of #88951 - ehuss:update-books, r=ehuss 2021-09-15 14:57:04 -07:00
etc set the executable bit on pre-commit.sh 2021-08-11 15:06:33 -04:00
librustdoc Auto merge of #73314 - GuillaumeGomez:display-warnings, r=jyn514 2021-09-14 16:05:44 +00:00
llvm-project@86c7daa627 Update LLVM submodule 2021-09-11 00:15:38 +02:00
rustdoc-json-types rustdoc: Clean up handling of lifetime bounds 2021-09-02 14:27:59 -07:00
test Auto merge of #86809 - DevinR528:reachable-pat, r=Nadrieril 2021-09-16 05:29:22 +00:00
tools Auto merge of #88992 - Manishearth:rollup-k9hijii, r=Manishearth 2021-09-16 02:00:08 +00:00
README.md
stage0.json Bump stage0 compiler to 1.56 2021-09-08 20:51:05 -04:00
version Bump version to 1.57 2021-09-03 21:54:48 -04:00

This directory contains the source code of the rust project, including:

  • The test suite
  • The bootstrapping build system
  • Various submodules for tools, like rustdoc, rls, etc.

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