Skip to content

Commit e77612d

Browse files
committed
Fixes in various places
1 parent 8615a6b commit e77612d

File tree

11 files changed

+12
-4
lines changed

11 files changed

+12
-4
lines changed

Diff for: compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs

+1
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ pub enum E2<X> {
585585
V4,
586586
}
587587

588+
#[allow(unreachable_patterns)]
588589
fn check_niche_behavior() {
589590
if let E1::V2 { .. } = (E1::V1 { f: true }) {
590591
intrinsics::abort();

Diff for: compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs

+1
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ pub enum E2<X> {
430430
V4,
431431
}
432432

433+
#[allow(unreachable_patterns)]
433434
fn check_niche_behavior () {
434435
if let E1::V2 { .. } = (E1::V1 { f: true }) {
435436
intrinsics::abort();

Diff for: src/tools/clippy/clippy_utils/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2931,6 +2931,7 @@ pub fn expr_use_ctxt<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) -> ExprU
29312931
moved_before_use,
29322932
same_ctxt,
29332933
},
2934+
#[allow(unreachable_patterns)]
29342935
Some(ControlFlow::Break(_)) => unreachable!("type of node is ControlFlow<!>"),
29352936
None => ExprUseCtxt {
29362937
node: Node::Crate(cx.tcx.hir().root_module()),

Diff for: src/tools/clippy/tests/ui/single_match_else.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn main() {
8989

9090
// lint here
9191
use std::convert::Infallible;
92-
if let Ok(a) = Result::<i32, Infallible>::Ok(1) { println!("${:?}", a) } else {
92+
if let Ok(a) = Result::<i32, &Infallible>::Ok(1) { println!("${:?}", a) } else {
9393
println!("else block");
9494
return;
9595
}

Diff for: src/tools/clippy/tests/ui/single_match_else.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn main() {
9898

9999
// lint here
100100
use std::convert::Infallible;
101-
match Result::<i32, Infallible>::Ok(1) {
101+
match Result::<i32, &Infallible>::Ok(1) {
102102
Ok(a) => println!("${:?}", a),
103103
Err(_) => {
104104
println!("else block");

Diff for: src/tools/clippy/tests/ui/single_match_else.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ LL + }
6464
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
6565
--> tests/ui/single_match_else.rs:101:5
6666
|
67-
LL | / match Result::<i32, Infallible>::Ok(1) {
67+
LL | / match Result::<i32, &Infallible>::Ok(1) {
6868
LL | | Ok(a) => println!("${:?}", a),
6969
LL | | Err(_) => {
7070
LL | | println!("else block");
@@ -75,7 +75,7 @@ LL | | }
7575
|
7676
help: try
7777
|
78-
LL ~ if let Ok(a) = Result::<i32, Infallible>::Ok(1) { println!("${:?}", a) } else {
78+
LL ~ if let Ok(a) = Result::<i32, &Infallible>::Ok(1) { println!("${:?}", a) } else {
7979
LL + println!("else block");
8080
LL + return;
8181
LL + }

Diff for: src/tools/miri/src/eval.rs

+1
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ pub fn eval_entry<'tcx>(
463463
let res = match res {
464464
Err(res) => res,
465465
// `Ok` can never happen
466+
#[cfg(bootstrap)]
466467
Ok(never) => match never {},
467468
};
468469

Diff for: src/tools/miri/tests/pass/async-fn.rs

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ async fn hello_world() {
5959
}
6060

6161
// This example comes from https://github.com/rust-lang/rust/issues/115145
62+
#[allow(unreachable_patterns)]
6263
async fn uninhabited_variant() {
6364
async fn unreachable(_: Never) {}
6465

Diff for: src/tools/miri/tests/pass/enums.rs

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ fn discriminant_overflow() {
4343
}
4444
}
4545

46+
#[allow(unreachable_patterns)]
4647
fn more_discriminant_overflow() {
4748
pub enum Infallible {}
4849

Diff for: src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ macro_rules! from_bytes {
2727
($ty:tt, $value:expr) => {
2828
($ty::from_le_bytes(match ($value).try_into() {
2929
Ok(it) => it,
30+
#[allow(unreachable_patterns)]
3031
Err(_) => return Err(MirEvalError::InternalError("mismatched size".into())),
3132
}))
3233
};

Diff for: src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
11611161
ProjectionElem::OpaqueCast(it) => {
11621162
ProjectionElem::OpaqueCast(it)
11631163
}
1164+
#[allow(unreachable_patterns)]
11641165
ProjectionElem::Index(it) => match it {},
11651166
})
11661167
.collect(),

0 commit comments

Comments
 (0)