Fixes in various places
This commit is contained in:
parent
8615a6b006
commit
e77612d3e4
@ -585,6 +585,7 @@ pub enum E2<X> {
|
||||
V4,
|
||||
}
|
||||
|
||||
#[allow(unreachable_patterns)]
|
||||
fn check_niche_behavior() {
|
||||
if let E1::V2 { .. } = (E1::V1 { f: true }) {
|
||||
intrinsics::abort();
|
||||
|
@ -430,6 +430,7 @@ pub enum E2<X> {
|
||||
V4,
|
||||
}
|
||||
|
||||
#[allow(unreachable_patterns)]
|
||||
fn check_niche_behavior () {
|
||||
if let E1::V2 { .. } = (E1::V1 { f: true }) {
|
||||
intrinsics::abort();
|
||||
|
@ -2931,6 +2931,7 @@ pub fn expr_use_ctxt<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) -> ExprU
|
||||
moved_before_use,
|
||||
same_ctxt,
|
||||
},
|
||||
#[allow(unreachable_patterns)]
|
||||
Some(ControlFlow::Break(_)) => unreachable!("type of node is ControlFlow<!>"),
|
||||
None => ExprUseCtxt {
|
||||
node: Node::Crate(cx.tcx.hir().root_module()),
|
||||
|
@ -89,7 +89,7 @@ fn main() {
|
||||
|
||||
// lint here
|
||||
use std::convert::Infallible;
|
||||
if let Ok(a) = Result::<i32, Infallible>::Ok(1) { println!("${:?}", a) } else {
|
||||
if let Ok(a) = Result::<i32, &Infallible>::Ok(1) { println!("${:?}", a) } else {
|
||||
println!("else block");
|
||||
return;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ fn main() {
|
||||
|
||||
// lint here
|
||||
use std::convert::Infallible;
|
||||
match Result::<i32, Infallible>::Ok(1) {
|
||||
match Result::<i32, &Infallible>::Ok(1) {
|
||||
Ok(a) => println!("${:?}", a),
|
||||
Err(_) => {
|
||||
println!("else block");
|
||||
|
@ -64,7 +64,7 @@ LL + }
|
||||
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
||||
--> tests/ui/single_match_else.rs:101:5
|
||||
|
|
||||
LL | / match Result::<i32, Infallible>::Ok(1) {
|
||||
LL | / match Result::<i32, &Infallible>::Ok(1) {
|
||||
LL | | Ok(a) => println!("${:?}", a),
|
||||
LL | | Err(_) => {
|
||||
LL | | println!("else block");
|
||||
@ -75,7 +75,7 @@ LL | | }
|
||||
|
|
||||
help: try
|
||||
|
|
||||
LL ~ if let Ok(a) = Result::<i32, Infallible>::Ok(1) { println!("${:?}", a) } else {
|
||||
LL ~ if let Ok(a) = Result::<i32, &Infallible>::Ok(1) { println!("${:?}", a) } else {
|
||||
LL + println!("else block");
|
||||
LL + return;
|
||||
LL + }
|
||||
|
@ -463,6 +463,7 @@ pub fn eval_entry<'tcx>(
|
||||
let res = match res {
|
||||
Err(res) => res,
|
||||
// `Ok` can never happen
|
||||
#[cfg(bootstrap)]
|
||||
Ok(never) => match never {},
|
||||
};
|
||||
|
||||
|
@ -59,6 +59,7 @@ async fn hello_world() {
|
||||
}
|
||||
|
||||
// This example comes from https://github.com/rust-lang/rust/issues/115145
|
||||
#[allow(unreachable_patterns)]
|
||||
async fn uninhabited_variant() {
|
||||
async fn unreachable(_: Never) {}
|
||||
|
||||
|
@ -43,6 +43,7 @@ enum Foo {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unreachable_patterns)]
|
||||
fn more_discriminant_overflow() {
|
||||
pub enum Infallible {}
|
||||
|
||||
|
@ -27,6 +27,7 @@ macro_rules! from_bytes {
|
||||
($ty:tt, $value:expr) => {
|
||||
($ty::from_le_bytes(match ($value).try_into() {
|
||||
Ok(it) => it,
|
||||
#[allow(unreachable_patterns)]
|
||||
Err(_) => return Err(MirEvalError::InternalError("mismatched size".into())),
|
||||
}))
|
||||
};
|
||||
|
@ -1161,6 +1161,7 @@ fn lower_expr_to_place_without_adjust(
|
||||
ProjectionElem::OpaqueCast(it) => {
|
||||
ProjectionElem::OpaqueCast(it)
|
||||
}
|
||||
#[allow(unreachable_patterns)]
|
||||
ProjectionElem::Index(it) => match it {},
|
||||
})
|
||||
.collect(),
|
||||
|
Loading…
Reference in New Issue
Block a user