Skip to content

Commit 492891e

Browse files
committed
make all typing-mode conditional code an exhaustive match
1 parent 340bc2a commit 492891e

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

compiler/rustc_next_trait_solver/src/canonical/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use rustc_index::IndexVec;
1616
use rustc_type_ir::inherent::*;
1717
use rustc_type_ir::relate::solver_relating::RelateExt;
1818
use rustc_type_ir::{
19-
self as ty, Canonical, CanonicalVarKind, CanonicalVarValues, TypingModeEqWrapper, InferCtxtLike,
20-
Interner, TypeFoldable,
19+
self as ty, Canonical, CanonicalVarKind, CanonicalVarValues, InferCtxtLike, Interner,
20+
TypeFoldable, TypingModeEqWrapper,
2121
};
2222
use tracing::instrument;
2323

@@ -66,8 +66,10 @@ where
6666
predefined_opaques_in_body: delegate.cx().mk_predefined_opaques_in_body(opaque_types),
6767
},
6868
);
69-
let query_input =
70-
ty::CanonicalQueryInput { canonical, typing_mode: TypingModeEqWrapper(delegate.typing_mode()) };
69+
let query_input = ty::CanonicalQueryInput {
70+
canonical,
71+
typing_mode: TypingModeEqWrapper(delegate.typing_mode()),
72+
};
7173
(orig_values, query_input)
7274
}
7375

compiler/rustc_type_ir/src/canonical.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_type_ir_macros::{
1111

1212
use crate::data_structures::HashMap;
1313
use crate::inherent::*;
14-
use crate::{self as ty, TypingModeEqWrapper, Interner, UniverseIndex};
14+
use crate::{self as ty, Interner, TypingModeEqWrapper, UniverseIndex};
1515

1616
#[derive_where(Clone, Hash, PartialEq, Debug; I: Interner, V)]
1717
#[derive_where(Copy; I: Interner, V: Copy)]

tests/ui-fulldeps/internal-lints/must_match_exhaustively.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,43 @@
55
#![feature(rustc_attrs)]
66
#![deny(rustc::rustc_must_match_exhaustively)]
77

8-
98
#[rustc_must_match_exhaustively]
109
#[derive(Copy, Clone)]
1110
enum Foo {
12-
A {field: u32},
11+
A { field: u32 },
1312
B,
1413
}
1514

1615
fn foo(f: Foo) {
1716
match f {
18-
Foo::A {..}=> {}
17+
Foo::A { .. } => {}
1918
Foo::B => {}
2019
}
2120

2221
match f {
2322
//~^ ERROR match is not exhaustive
24-
Foo::A {..} => {}
23+
Foo::A { .. } => {}
2524
_ => {}
2625
}
2726

2827
match f {
2928
//~^ ERROR match is not exhaustive
30-
Foo::A {..} => {}
29+
Foo::A { .. } => {}
3130
a => {}
3231
}
3332

3433
match &f {
3534
//~^ ERROR match is not exhaustive
36-
Foo::A {..} => {}
35+
Foo::A { .. } => {}
3736
a => {}
3837
}
3938

4039
match f {
41-
Foo::A {..} => {}
42-
a@Foo::B => {}
40+
Foo::A { .. } => {}
41+
a @ Foo::B => {}
4342
}
4443

45-
if let Foo::A {..} = f {}
44+
if let Foo::A { .. } = f {}
4645
//~^ ERROR match is not exhaustive
4746
}
4847

0 commit comments

Comments
 (0)