Auto merge of #54810 - 1aim:unused-impl-trait, r=oli-obk
Fix dead code lint for functions using impl Trait Fixes https://github.com/rust-lang/rust/issues/54754 This is a minimal fix that doesn't add any new queries or touches unnecessary code. Please nominate for beta backport if wanted.
This commit is contained in:
commit
b2d6ea98b0
9 changed files with 24 additions and 7 deletions
|
|
@ -170,6 +170,7 @@ fn main() {
|
|||
async_closure,
|
||||
async_fn,
|
||||
async_fn_with_internal_borrow,
|
||||
Foo::async_method,
|
||||
|x| {
|
||||
async move {
|
||||
unsafe { await!(unsafe_async_fn(x)) }
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// run-pass
|
||||
// compile-pass
|
||||
|
||||
fn main() {}
|
||||
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// run-pass
|
||||
// compile-pass
|
||||
|
||||
use std::iter::once;
|
||||
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// run-pass
|
||||
// compile-pass
|
||||
|
||||
// Tests for nested self-reference which caused a stack overflow.
|
||||
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// run-pass
|
||||
// compile-pass
|
||||
fn iter<'a>(data: &'a [usize]) -> impl Iterator<Item = usize> + 'a {
|
||||
data.iter()
|
||||
.map(
|
||||
|
|
@ -109,6 +109,10 @@ fn bar() { //~ ERROR: function is never used
|
|||
foo();
|
||||
}
|
||||
|
||||
fn baz() -> impl Copy { //~ ERROR: function is never used
|
||||
"I'm unused, too"
|
||||
}
|
||||
|
||||
// Code with #[allow(dead_code)] should be marked live (and thus anything it
|
||||
// calls is marked live)
|
||||
#[allow(dead_code)]
|
||||
|
|
|
|||
|
|
@ -58,5 +58,11 @@ error: function is never used: `bar`
|
|||
LL | fn bar() { //~ ERROR: function is never used
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
error: function is never used: `baz`
|
||||
--> $DIR/lint-dead-code-1.rs:112:1
|
||||
|
|
||||
LL | fn baz() -> impl Copy { //~ ERROR: function is never used
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// run-pass
|
||||
// compile-pass
|
||||
// #39665
|
||||
|
||||
fn batches(n: &u32) -> impl Iterator<Item=&u32> {
|
||||
Loading…
Add table
Add a link
Reference in a new issue