Skip to content

Commit 48c7ebe

Browse files
committed
Fixes in various places
1 parent a1d0cdb commit 48c7ebe

File tree

9 files changed

+10
-4
lines changed

9 files changed

+10
-4
lines changed

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();

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();

src/tools/clippy/clippy_utils/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2927,6 +2927,7 @@ pub fn expr_use_ctxt<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) -> ExprU
29272927
moved_before_use,
29282928
same_ctxt,
29292929
},
2930+
#[allow(unreachable_patterns)]
29302931
Some(ControlFlow::Break(_)) => unreachable!("type of node is ControlFlow<!>"),
29312932
None => ExprUseCtxt {
29322933
node: Node::Crate(cx.tcx.hir().root_module()),

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
}

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");

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 + }

src/tools/miri/src/eval.rs

+1
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ pub fn eval_entry<'tcx>(
460460
let res = match res {
461461
Err(res) => res,
462462
// `Ok` can never happen
463+
#[cfg(bootstrap)]
463464
Ok(never) => match never {},
464465
};
465466

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

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

0 commit comments

Comments
 (0)