Skip to content

Commit

Permalink
Rollup merge of rust-lang#64078 - Mark-Simulacrum:compiletest-lint-un…
Browse files Browse the repository at this point in the history
…used, r=petrochenkov

compiletest: disable -Aunused for run-pass tests

Disabled the flag, but that led to quite a bit of fall out -- I think most of it is benign but I've not investigated thoroughly.

r? @petrochenkov
  • Loading branch information
Centril authored Sep 8, 2019
2 parents 2b8116d + 6fdbece commit 510976b
Show file tree
Hide file tree
Showing 59 changed files with 131 additions and 69 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

#![feature(associated_type_bounds)]

Expand Down
1 change: 1 addition & 0 deletions src/test/ui/associated-type-bounds/fn-apit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// run-pass
// aux-build:fn-aux.rs

#![allow(unused)]
#![feature(associated_type_bounds)]

extern crate fn_aux;
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/associated-type-bounds/fn-dyn-apit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// run-pass
// aux-build:fn-dyn-aux.rs

#![allow(unused)]
#![feature(associated_type_bounds)]

extern crate fn_dyn_aux;
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/associated-type-bounds/fn-inline.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// run-pass
// aux-build:fn-aux.rs

#![allow(unused)]
#![feature(associated_type_bounds)]

extern crate fn_aux;
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/associated-type-bounds/fn-where.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// run-pass
// aux-build:fn-aux.rs

#![allow(unused)]
#![feature(associated_type_bounds)]

extern crate fn_aux;
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/associated-type-bounds/fn-wrap-apit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// aux-build:fn-aux.rs

#![feature(associated_type_bounds)]
#![allow(dead_code)]

extern crate fn_aux;

Expand Down
1 change: 1 addition & 0 deletions src/test/ui/associated-type-bounds/struct-bounds.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// run-pass

#![allow(unused)]
#![feature(associated_type_bounds)]

trait Tr1 { type As1; }
Expand Down
3 changes: 1 addition & 2 deletions src/test/ui/async-await/argument-patterns.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// edition:2018
// run-pass
// check-pass

#![allow(unused_variables)]
#![deny(unused_mut)]

type A = Vec<u32>;
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/async-await/async-await.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// run-pass

#![allow(unused)]

// edition:2018
// aux-build:arc_wake.rs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
// run-pass

#![deny(dead_code)]
#![allow(unused_variables)]
#![allow(unused_must_use)]
#![allow(path_statements)]

// Test that the drop order for locals in a fn and async fn matches up.
extern crate arc_wake;

use arc_wake::ArcWake;
use std::cell::RefCell;
use std::future::Future;
use std::marker::PhantomData;
use std::pin::Pin;
use std::rc::Rc;
use std::sync::Arc;
Expand Down Expand Up @@ -42,7 +44,7 @@ struct NeverReady;

impl Future for NeverReady {
type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
Poll::Pending
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// parameters (used or unused) are not dropped until the async fn is cancelled.
// This file is mostly copy-pasted from drop-order-for-async-fn-parameters.rs

#![allow(unused_variables)]

extern crate arc_wake;

use arc_wake::ArcWake;
Expand Down Expand Up @@ -43,7 +45,7 @@ struct NeverReady;

impl Future for NeverReady {
type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
Poll::Pending
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui/async-await/issues/issue-54752-async-block.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: unnecessary parentheses around assigned value
--> $DIR/issue-54752-async-block.rs:6:22
|
LL | fn main() { let _a = (async { }); }
| ^^^^^^^^^^^^ help: remove these parentheses
|
= note: `#[warn(unused_parens)]` on by default

2 changes: 1 addition & 1 deletion src/test/ui/async-await/issues/issue-59972.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// run-pass

// compile-flags: --edition=2018
// compile-flags: --edition=2018 -Aunused

pub enum Uninhabited { }

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/multiple-lifetimes/hrtb.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// edition:2018
// run-pass
// check-pass

// Test that we can use async fns with multiple arbitrary lifetimes.

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/borrowck-migrate-to-nll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// revisions: zflag edition
//[zflag]compile-flags: -Z borrowck=migrate
//[edition]edition:2018
//[zflag] run-pass
//[zflag] check-pass

pub struct Block<'a> {
current: &'a u8,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/issue-10876.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

enum Nat {
S(Box<Nat>),
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/borrowck/two-phase-multiple-activations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ pub trait FakeRead {
}

impl FakeRead for Foo {
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
fn read_to_end(&mut self, _buf: &mut Vec<u8>) -> Result<usize> {
Ok(4)
}
}

fn main() {
let mut a = Foo {};
let mut v = Vec::new();
a.read_to_end(&mut v);
a.read_to_end(&mut v).unwrap();
}
2 changes: 1 addition & 1 deletion src/test/ui/const-generics/apit-with-const-param.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/const-generics/array-wrapper-struct-ctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash

#![allow(dead_code)]

struct ArrayStruct<T, const N: usize> {
data: [T; N],
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/const-generics/const-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash

#[allow(dead_code)]
#![allow(dead_code, unused_variables)]

struct ConstArray<T, const LEN: usize> {
array: [T; LEN],
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/const-generics/issue-61422.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
Expand All @@ -8,7 +8,7 @@ use std::mem;
fn foo<const SIZE: usize>() {
let arr: [u8; SIZE] = unsafe {
#[allow(deprecated)]
let mut array: [u8; SIZE] = mem::uninitialized();
let array: [u8; SIZE] = mem::uninitialized();
array
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/const-generics/unused-const-param.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/consts/const-eval/const_transmute.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// run-pass

#![feature(const_fn_union)]
#![allow(dead_code)]

#[repr(C)]
union Transmute<T: Copy, U: Copy> {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-labeled-break.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// build-pass

// Using labeled break in a while loop has caused an illegal instruction being
// generated, and an ICE later.
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui/consts/packed_pattern.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: unreachable pattern
--> $DIR/packed_pattern.rs:16:9
|
LL | FOO => unreachable!(),
| ^^^
|
= note: `#[warn(unreachable_patterns)]` on by default

8 changes: 8 additions & 0 deletions src/test/ui/consts/packed_pattern2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: unreachable pattern
--> $DIR/packed_pattern2.rs:24:9
|
LL | FOO => unreachable!(),
| ^^^
|
= note: `#[warn(unreachable_patterns)]` on by default

2 changes: 1 addition & 1 deletion src/test/ui/deprecation/deprecation-in-future.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

#![deny(deprecated_in_future)]

Expand Down
1 change: 1 addition & 0 deletions src/test/ui/drop/dynamic-drop-async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// ignore-wasm32-bare compiled with panic=abort by default

#![feature(slice_patterns)]
#![allow(unused)]

use std::{
cell::{Cell, RefCell},
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/hrtb/issue-57639.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
// See [this comment on GitHub][c] for more details.
//
// run-pass
// check-pass
//
// [c]: https:/rust-lang/rust/issues/57639#issuecomment-455685861

Expand Down
8 changes: 8 additions & 0 deletions src/test/ui/if-ret.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: unreachable block in `if` expression
--> $DIR/if-ret.rs:6:24
|
LL | fn foo() { if (return) { } }
| ^^^
|
= note: `#[warn(unreachable_code)]` on by default

2 changes: 1 addition & 1 deletion src/test/ui/impl-trait/closure-calling-parent-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// `foo` and hence is treated opaquely within the closure body. This
// resulted in a failed subtype relationship.
//
// run-pass
// check-pass

fn foo() -> impl Copy { || foo(); }
fn bar() -> impl Copy { || bar(); }
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/impl-trait/issues/issue-53457.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

#![feature(type_alias_impl_trait)]

Expand All @@ -9,7 +9,7 @@ fn bar<F: Fn(&i32) + Clone>(f: F) -> F {
}

fn foo() -> X {
bar(|x| ())
bar(|_| ())
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// edition:2018
// run-pass
// check-pass
// revisions: migrate mir
//[mir]compile-flags: -Z borrowck=mir

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/impl-trait/needs_least_region_or_bound.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// run-pass
// check-pass

#![feature(member_constraints)]

use std::fmt::Debug;

trait MultiRegionTrait<'a, 'b> {}
impl<'a, 'b> MultiRegionTrait<'a, 'b> for (&'a u32, &'b u32) {}

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-26448-2.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

pub struct Bar<T> {
items: Vec<&'static str>,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-26448-3.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

pub struct Item {
_inner: &'static str,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-27697.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

use std::ops::Deref;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-38591.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

struct S<T> {
t : T,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-43806.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

#![deny(unused_results)]

Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-48132.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

// run-pass

#![allow(dead_code)]

struct Inner<I, V> {
iterator: I,
item: V,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-48179.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Regression test for #48132. This was failing due to problems around
// the projection caching and dropck type enumeration.

// run-pass
// check-pass

pub struct Container<T: Iterator> {
value: Option<T::Item>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// aux-build:xcrate-issue-61711-b.rs
// compile-flags:--extern xcrate_issue_61711_b

// run-pass
// build-pass

fn f<F: Fn(xcrate_issue_61711_b::Struct)>(_: F) { }
fn main() { }
2 changes: 1 addition & 1 deletion src/test/ui/lint/empty-lint-attributes.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![feature(lint_reasons)]

// run-pass
// check-pass

// Empty (and reason-only) lint attributes are legal—although we may want to
// lint them in the future (Issue #55112).
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/nll/issue-55288.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

struct Slice(&'static [&'static [u8]]);

Expand Down
Loading

0 comments on commit 510976b

Please sign in to comment.