Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #130163

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1d42d6a
Revert warning empty patterns as unreachable
Nadrieril Aug 28, 2024
46115fd
fix ICE in CMSE type validation
folkertdev Sep 6, 2024
a6c6eda
Remove now redundant check in symlink_hard_link test
madsmtm Sep 7, 2024
6af470e
Reduce visibilities, and add `warn(unreachable_pub)`.
nnethercote Aug 27, 2024
cd9fd27
Factor out some more repetitive code.
nnethercote Aug 28, 2024
a6735e4
Add an explicit ignore message for "up-to-date" tests
Zalathar Sep 9, 2024
ec6fe4e
Streamline `AbortUnwindingCalls`.
nnethercote Aug 28, 2024
cc09ab3
Simplify `verify_candidate_branch`.
nnethercote Aug 29, 2024
181fbd5
Use `let`/`else` to de-indent `ElaborateBoxDerefs::run_pass`.
nnethercote Sep 8, 2024
4f2588f
Remove an unnecessary `continue`.
nnethercote Aug 30, 2024
9cf90b9
Remove some unnecessary dereferences.
nnethercote Aug 30, 2024
7adde3f
Make `CallSite` non-`Copy`.
nnethercote Aug 30, 2024
751c8b4
Use `LocalDecls` in a couple of places.
nnethercote Aug 30, 2024
5445953
Improve consistency in `LowerIntrinsics`.
nnethercote Sep 3, 2024
acccb39
Print a helpful message if any tests were skipped for being up-to-date
Zalathar Sep 9, 2024
3fe7dd6
Remove unnecessary lifetimes in dataflow structs.
nnethercote Sep 5, 2024
bed91f5
Remove unnecessary lifetime in `PlaceCollector`.
nnethercote Sep 6, 2024
1aafeb2
Remove unnecessary lifetime from `OperandCollector`.
nnethercote Sep 6, 2024
28a6dc4
Rename some lifetimes.
nnethercote Sep 6, 2024
dc62f07
Remove `Gatherer`.
nnethercote Sep 6, 2024
0b032f8
Remove `Elaborator`.
nnethercote Sep 6, 2024
5c35027
Remove unnecessary lifetime from `StorageConflictVisitor`.
nnethercote Sep 6, 2024
0f8efb3
Fix ICE caused by missing span in a region error
gurry Sep 9, 2024
e186cc6
do `PolyFnSig` -> `FnSig` conversion later
folkertdev Sep 9, 2024
19b8f9e
use verbose flag as a default value for `rust.verbose-tests`
onur-ozkan Sep 9, 2024
bc70fa2
Stabilize `char::MIN`
okaneco Sep 9, 2024
13ea104
update `rust.verbose-tests` doc in `config.example.toml`
onur-ozkan Sep 9, 2024
59fe4e9
Rollup merge of #129103 - Nadrieril:dont-warn-empty-unreachable, r=co…
matthiaskrgr Sep 9, 2024
1c4c089
Rollup merge of #129929 - nnethercote:rustc_mir_transform-cleanups-2,…
matthiaskrgr Sep 9, 2024
4b41fa6
Rollup merge of #130022 - nnethercote:dataflow-borrowck-lifetimes, r=…
matthiaskrgr Sep 9, 2024
58c8e12
Rollup merge of #130064 - folkertdev:fix-issue-129983, r=compiler-errors
matthiaskrgr Sep 9, 2024
d2f98de
Rollup merge of #130067 - madsmtm:clean-up-fs-test, r=ChrisDenton
matthiaskrgr Sep 9, 2024
c50de21
Rollup merge of #130131 - Zalathar:up-to-date, r=Kobzol
matthiaskrgr Sep 9, 2024
45e315d
Rollup merge of #130137 - gurry:master, r=cjgillot
matthiaskrgr Sep 9, 2024
76247b0
Rollup merge of #130153 - onur-ozkan:verbose-to-verbose-tests, r=Kobzol
matthiaskrgr Sep 9, 2024
f5cc9c8
Rollup merge of #130154 - okaneco:stabilize_char_min, r=cuviper
matthiaskrgr Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Revert warning empty patterns as unreachable
  • Loading branch information
Nadrieril committed Aug 28, 2024
commit 1d42d6a0a83cffcfab22158409d70be19b3afc3e
6 changes: 5 additions & 1 deletion compiler/rustc_pattern_analysis/src/usefulness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,11 @@ impl<Cx: PatCx> PlaceInfo<Cx> {
self.is_scrutinee && matches!(ctors_for_ty, ConstructorSet::NoConstructors);
// Whether empty patterns are counted as useful or not. We only warn an empty arm unreachable if
// it is guaranteed unreachable by the opsem (i.e. if the place is `known_valid`).
let empty_arms_are_unreachable = self.validity.is_known_valid();
// We don't want to warn empty patterns as unreachable by default just yet. We will in a
// later version of rust or under a different lint name, see
// https://github.com/rust-lang/rust/pull/129103.
let empty_arms_are_unreachable = self.validity.is_known_valid()
&& (is_toplevel_exception || cx.is_exhaustive_patterns_feature_on());
// Whether empty patterns can be omitted for exhaustiveness. We ignore place validity in the
// toplevel exception and `exhaustive_patterns` cases for backwards compatibility.
let can_omit_empty_arms = self.validity.is_known_valid()
Expand Down
188 changes: 1 addition & 187 deletions tests/ui/pattern/usefulness/empty-types.never_pats.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,6 @@ LL + _ => todo!(),
LL + }
|

error: unreachable pattern
--> $DIR/empty-types.rs:70:9
|
LL | (_, _) => {}
| ^^^^^^ matches no values because `(u32, !)` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:76:9
|
LL | _ => {}
| ^ matches no values because `(!, !)` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:79:9
|
LL | (_, _) => {}
| ^^^^^^ matches no values because `(!, !)` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:83:9
|
Expand Down Expand Up @@ -94,22 +70,6 @@ LL + Ok(_) => todo!(),
LL + }
|

error: unreachable pattern
--> $DIR/empty-types.rs:94:9
|
LL | Err(_) => {}
| ^^^^^^ matches no values because `!` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:99:9
|
LL | Err(_) => {}
| ^^^^^^ matches no values because `!` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
--> $DIR/empty-types.rs:96:11
|
Expand Down Expand Up @@ -156,54 +116,6 @@ help: you might want to use `let else` to handle the variant that isn't matched
LL | let Ok(_x) = &res_u32_never else { todo!() };
| ++++++++++++++++

error: unreachable pattern
--> $DIR/empty-types.rs:112:9
|
LL | _ => {}
| ^ matches no values because `Result<!, !>` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:115:9
|
LL | Ok(_) => {}
| ^^^^^ matches no values because `Result<!, !>` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:118:9
|
LL | Ok(_) => {}
| ^^^^^ matches no values because `Result<!, !>` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:119:9
|
LL | _ => {}
| ^ matches no values because `Result<!, !>` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:122:9
|
LL | Ok(_) => {}
| ^^^^^ matches no values because `Result<!, !>` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:123:9
|
LL | Err(_) => {}
| ^^^^^^ matches no values because `Result<!, !>` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:132:13
|
Expand All @@ -220,22 +132,6 @@ LL | _ if false => {}
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:143:13
|
LL | Some(_) => {}
| ^^^^^^^ matches no values because `Void` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:147:13
|
LL | None => {}
| ---- matches all the relevant values
LL | _ => {}
| ^ no value can reach this

error[E0004]: non-exhaustive patterns: `Some(!)` not covered
--> $DIR/empty-types.rs:156:15
|
Expand Down Expand Up @@ -303,30 +199,6 @@ LL | _ => {}
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:284:9
|
LL | (_, _) => {}
| ^^^^^^ matches no values because `(!, !)` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:287:9
|
LL | Ok(_) => {}
| ^^^^^ matches no values because `Result<!, !>` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:288:9
|
LL | Err(_) => {}
| ^^^^^^ matches no values because `Result<!, !>` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error[E0005]: refutable pattern in local binding
--> $DIR/empty-types.rs:297:13
|
Expand Down Expand Up @@ -474,30 +346,6 @@ LL + _ => todo!(),
LL + }
|

error: unreachable pattern
--> $DIR/empty-types.rs:368:9
|
LL | _ => {}
| ^ matches no values because `[!; 3]` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:371:9
|
LL | [_, _, _] => {}
| ^^^^^^^^^ matches no values because `[!; 3]` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:374:9
|
LL | [_, ..] => {}
| ^^^^^^^ matches no values because `[!; 3]` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
--> $DIR/empty-types.rs:388:11
|
Expand Down Expand Up @@ -534,40 +382,6 @@ LL ~ [..] if false => {},
LL + [] => todo!()
|

error: unreachable pattern
--> $DIR/empty-types.rs:416:9
|
LL | Some(_) => {}
| ^^^^^^^ matches no values because `!` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:421:9
|
LL | Some(_a) => {}
| ^^^^^^^^ matches no values because `!` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
--> $DIR/empty-types.rs:426:9
|
LL | None => {}
| ---- matches all the relevant values
LL | // !useful, !reachable
LL | _ => {}
| ^ no value can reach this

error: unreachable pattern
--> $DIR/empty-types.rs:431:9
|
LL | None => {}
| ---- matches all the relevant values
LL | // !useful, !reachable
LL | _a => {}
| ^^ no value can reach this

error[E0004]: non-exhaustive patterns: `&Some(!)` not covered
--> $DIR/empty-types.rs:451:11
|
Expand Down Expand Up @@ -744,7 +558,7 @@ LL ~ None => {},
LL + Some(!)
|

error: aborting due to 65 previous errors; 1 warning emitted
error: aborting due to 42 previous errors; 1 warning emitted

Some errors have detailed explanations: E0004, E0005.
For more information about an error, try `rustc --explain E0004`.
Loading
Loading