Skip to content

Commit 5b40ce3

Browse files
committed
Auto merge of #6374 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: [`panic`],[`unimplemented`],[`unreachable`],[`todo`] now also handle the `core::` version of those macros correctly.
2 parents 295fe28 + c6a577e commit 5b40ce3

8 files changed

+20
-10
lines changed

clippy_lints/src/utils/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,9 @@ pub fn implements_trait<'tcx>(
365365
return false;
366366
}
367367
let ty = cx.tcx.erase_regions(ty);
368+
if ty.has_escaping_bound_vars() {
369+
return false;
370+
}
368371
let ty_params = cx.tcx.mk_substs(ty_params.iter());
369372
cx.tcx.type_implements_trait((trait_id, ty, ty_params, cx.param_env))
370373
}

tests/ui/crashes/implements-trait.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#[allow(clippy::needless_borrowed_reference)]
2+
fn main() {
3+
let mut v = Vec::<String>::new();
4+
let _ = v.iter_mut().filter(|&ref a| a.is_empty());
5+
}

tests/ui/logic_bug.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(unused, clippy::many_single_char_names)]
1+
#![allow(unused, clippy::many_single_char_names, clippy::diverging_sub_expression)]
22
#![warn(clippy::logic_bug)]
33

44
fn main() {

tests/ui/nonminimal_bool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(unused, clippy::many_single_char_names)]
1+
#![allow(unused, clippy::many_single_char_names, clippy::diverging_sub_expression)]
22
#![warn(clippy::nonminimal_bool)]
33

44
fn main() {

tests/ui/nonminimal_bool_methods.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(unused, clippy::many_single_char_names)]
1+
#![allow(unused, clippy::many_single_char_names, clippy::diverging_sub_expression)]
22
#![warn(clippy::nonminimal_bool)]
33

44
fn methods_with_negation() {

tests/ui/wildcard_enum_match_arm.fixed

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
dead_code,
88
clippy::single_match,
99
clippy::wildcard_in_or_patterns,
10-
clippy::unnested_or_patterns
10+
clippy::unnested_or_patterns,
11+
clippy::diverging_sub_expression
1112
)]
1213

1314
use std::io::ErrorKind;

tests/ui/wildcard_enum_match_arm.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
dead_code,
88
clippy::single_match,
99
clippy::wildcard_in_or_patterns,
10-
clippy::unnested_or_patterns
10+
clippy::unnested_or_patterns,
11+
clippy::diverging_sub_expression
1112
)]
1213

1314
use std::io::ErrorKind;

tests/ui/wildcard_enum_match_arm.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: wildcard match will miss any future added variants
2-
--> $DIR/wildcard_enum_match_arm.rs:38:9
2+
--> $DIR/wildcard_enum_match_arm.rs:39:9
33
|
44
LL | _ => eprintln!("Not red"),
55
| ^ help: try this: `Color::Green | Color::Blue | Color::Rgb(..) | Color::Cyan`
@@ -11,25 +11,25 @@ LL | #![deny(clippy::wildcard_enum_match_arm)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: wildcard match will miss any future added variants
14-
--> $DIR/wildcard_enum_match_arm.rs:42:9
14+
--> $DIR/wildcard_enum_match_arm.rs:43:9
1515
|
1616
LL | _not_red => eprintln!("Not red"),
1717
| ^^^^^^^^ help: try this: `_not_red @ Color::Green | _not_red @ Color::Blue | _not_red @ Color::Rgb(..) | _not_red @ Color::Cyan`
1818

1919
error: wildcard match will miss any future added variants
20-
--> $DIR/wildcard_enum_match_arm.rs:46:9
20+
--> $DIR/wildcard_enum_match_arm.rs:47:9
2121
|
2222
LL | not_red => format!("{:?}", not_red),
2323
| ^^^^^^^ help: try this: `not_red @ Color::Green | not_red @ Color::Blue | not_red @ Color::Rgb(..) | not_red @ Color::Cyan`
2424

2525
error: wildcard match will miss any future added variants
26-
--> $DIR/wildcard_enum_match_arm.rs:62:9
26+
--> $DIR/wildcard_enum_match_arm.rs:63:9
2727
|
2828
LL | _ => "No red",
2929
| ^ help: try this: `Color::Red | Color::Green | Color::Blue | Color::Rgb(..) | Color::Cyan`
3030

3131
error: match on non-exhaustive enum doesn't explicitly match all known variants
32-
--> $DIR/wildcard_enum_match_arm.rs:79:9
32+
--> $DIR/wildcard_enum_match_arm.rs:80:9
3333
|
3434
LL | _ => {},
3535
| ^ help: try this: `std::io::ErrorKind::PermissionDenied | std::io::ErrorKind::ConnectionRefused | std::io::ErrorKind::ConnectionReset | std::io::ErrorKind::ConnectionAborted | std::io::ErrorKind::NotConnected | std::io::ErrorKind::AddrInUse | std::io::ErrorKind::AddrNotAvailable | std::io::ErrorKind::BrokenPipe | std::io::ErrorKind::AlreadyExists | std::io::ErrorKind::WouldBlock | std::io::ErrorKind::InvalidInput | std::io::ErrorKind::InvalidData | std::io::ErrorKind::TimedOut | std::io::ErrorKind::WriteZero | std::io::ErrorKind::Interrupted | std::io::ErrorKind::Other | std::io::ErrorKind::UnexpectedEof | _`

0 commit comments

Comments
 (0)