Rollup merge of #139995 - spencer3035:clean-ui-tests-4-of-n, r=jieyouxu
Clean UI tests 4 of n Cleaned up some tests that have `issue` in the title. I kept the commits to be one per "`issue`" cleanup/rename to make it easier to check. I can rebase to one commit once the changes are approved. Related Issues: #73494 #133895 r? jieyouxu
This commit is contained in:
commit
f0a0efdcdc
14 changed files with 202 additions and 182 deletions
|
@ -1397,7 +1397,6 @@ ui/issues/auxiliary/issue-13620-1.rs
|
|||
ui/issues/auxiliary/issue-13620-2.rs
|
||||
ui/issues/auxiliary/issue-14344-1.rs
|
||||
ui/issues/auxiliary/issue-14344-2.rs
|
||||
ui/issues/auxiliary/issue-14421.rs
|
||||
ui/issues/auxiliary/issue-14422.rs
|
||||
ui/issues/auxiliary/issue-15562.rs
|
||||
ui/issues/auxiliary/issue-16643.rs
|
||||
|
@ -1564,7 +1563,6 @@ ui/issues/issue-14366.rs
|
|||
ui/issues/issue-14382.rs
|
||||
ui/issues/issue-14393.rs
|
||||
ui/issues/issue-14399.rs
|
||||
ui/issues/issue-14421.rs
|
||||
ui/issues/issue-14422.rs
|
||||
ui/issues/issue-14541.rs
|
||||
ui/issues/issue-14721.rs
|
||||
|
@ -1629,7 +1627,6 @@ ui/issues/issue-16774.rs
|
|||
ui/issues/issue-16783.rs
|
||||
ui/issues/issue-16819.rs
|
||||
ui/issues/issue-16922-rpass.rs
|
||||
ui/issues/issue-16939.rs
|
||||
ui/issues/issue-16966.rs
|
||||
ui/issues/issue-16994.rs
|
||||
ui/issues/issue-17001.rs
|
||||
|
@ -1867,7 +1864,6 @@ ui/issues/issue-23550.rs
|
|||
ui/issues/issue-23589.rs
|
||||
ui/issues/issue-23699.rs
|
||||
ui/issues/issue-2380-b.rs
|
||||
ui/issues/issue-23808.rs
|
||||
ui/issues/issue-2383.rs
|
||||
ui/issues/issue-23891.rs
|
||||
ui/issues/issue-23898.rs
|
||||
|
@ -2607,7 +2603,6 @@ ui/issues/issue-9249.rs
|
|||
ui/issues/issue-9259.rs
|
||||
ui/issues/issue-92741.rs
|
||||
ui/issues/issue-9446.rs
|
||||
ui/issues/issue-9719.rs
|
||||
ui/issues/issue-9725.rs
|
||||
ui/issues/issue-9737.rs
|
||||
ui/issues/issue-9814.rs
|
||||
|
|
|
@ -17,7 +17,7 @@ use ignore::Walk;
|
|||
const ENTRY_LIMIT: u32 = 901;
|
||||
// FIXME: The following limits should be reduced eventually.
|
||||
|
||||
const ISSUES_ENTRY_LIMIT: u32 = 1631;
|
||||
const ISSUES_ENTRY_LIMIT: u32 = 1626;
|
||||
|
||||
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
|
||||
"rs", // test source files
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
//! Checks variations of E0057, which is the incorrect number of agruments passed into a closure
|
||||
|
||||
//@ check-fail
|
||||
|
||||
fn foo<T: Fn()>(t: T) {
|
||||
t(1i32);
|
||||
//~^ ERROR function takes 0 arguments but 1 argument was supplied
|
||||
}
|
||||
|
||||
/// Regression test for <https://github.com/rust-lang/rust/issues/16939>
|
||||
fn foo2<T: Fn()>(f: T) {
|
||||
|t| f(t);
|
||||
//~^ ERROR function takes 0 arguments but 1 argument was supplied
|
||||
}
|
||||
|
||||
fn bar(t: impl Fn()) {
|
||||
t(1i32);
|
||||
//~^ ERROR function takes 0 arguments but 1 argument was supplied
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
error[E0057]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> $DIR/exotic-calls.rs:2:5
|
||||
--> $DIR/exotic-calls.rs:6:5
|
||||
|
|
||||
LL | t(1i32);
|
||||
| ^ ---- unexpected argument of type `i32`
|
||||
|
|
||||
note: callable defined here
|
||||
--> $DIR/exotic-calls.rs:1:11
|
||||
--> $DIR/exotic-calls.rs:5:11
|
||||
|
|
||||
LL | fn foo<T: Fn()>(t: T) {
|
||||
| ^^^^
|
||||
|
@ -16,13 +16,30 @@ LL + t();
|
|||
|
|
||||
|
||||
error[E0057]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> $DIR/exotic-calls.rs:7:5
|
||||
--> $DIR/exotic-calls.rs:12:9
|
||||
|
|
||||
LL | |t| f(t);
|
||||
| ^ - unexpected argument
|
||||
|
|
||||
note: callable defined here
|
||||
--> $DIR/exotic-calls.rs:11:12
|
||||
|
|
||||
LL | fn foo2<T: Fn()>(f: T) {
|
||||
| ^^^^
|
||||
help: remove the extra argument
|
||||
|
|
||||
LL - |t| f(t);
|
||||
LL + |t| f();
|
||||
|
|
||||
|
||||
error[E0057]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> $DIR/exotic-calls.rs:17:5
|
||||
|
|
||||
LL | t(1i32);
|
||||
| ^ ---- unexpected argument of type `i32`
|
||||
|
|
||||
note: type parameter defined here
|
||||
--> $DIR/exotic-calls.rs:6:11
|
||||
--> $DIR/exotic-calls.rs:16:11
|
||||
|
|
||||
LL | fn bar(t: impl Fn()) {
|
||||
| ^^^^^^^^^
|
||||
|
@ -33,13 +50,13 @@ LL + t();
|
|||
|
|
||||
|
||||
error[E0057]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> $DIR/exotic-calls.rs:16:5
|
||||
--> $DIR/exotic-calls.rs:26:5
|
||||
|
|
||||
LL | baz()(1i32)
|
||||
| ^^^^^ ---- unexpected argument of type `i32`
|
||||
|
|
||||
note: opaque type defined here
|
||||
--> $DIR/exotic-calls.rs:11:13
|
||||
--> $DIR/exotic-calls.rs:21:13
|
||||
|
|
||||
LL | fn baz() -> impl Fn() {
|
||||
| ^^^^^^^^^
|
||||
|
@ -50,13 +67,13 @@ LL + baz()()
|
|||
|
|
||||
|
||||
error[E0057]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> $DIR/exotic-calls.rs:22:5
|
||||
--> $DIR/exotic-calls.rs:32:5
|
||||
|
|
||||
LL | x(1i32);
|
||||
| ^ ---- unexpected argument of type `i32`
|
||||
|
|
||||
note: closure defined here
|
||||
--> $DIR/exotic-calls.rs:21:13
|
||||
--> $DIR/exotic-calls.rs:31:13
|
||||
|
|
||||
LL | let x = || {};
|
||||
| ^^
|
||||
|
@ -66,6 +83,6 @@ LL - x(1i32);
|
|||
LL + x();
|
||||
|
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0057`.
|
||||
|
|
54
tests/ui/codegen/ref-dyn-trait-in-structs-and-enums.rs
Normal file
54
tests/ui/codegen/ref-dyn-trait-in-structs-and-enums.rs
Normal file
|
@ -0,0 +1,54 @@
|
|||
//! Regression test for an LLVM assertion that used to be hit when:
|
||||
//!
|
||||
//! - There's a generic enum contained within a tuple struct
|
||||
//! - When the tuple struct is parameterized by some lifetime `'a`
|
||||
//! - The enum is concretized with its type argument being a reference to a trait object (of
|
||||
//! lifetime `'a`)
|
||||
//!
|
||||
//! Issue: <https://github.com/rust-lang/rust/issues/9719>
|
||||
|
||||
//@ build-pass
|
||||
|
||||
// Dummy trait implemented for `isize` to use in the test cases
|
||||
pub trait MyTrait {
|
||||
fn dummy(&self) {}
|
||||
}
|
||||
impl MyTrait for isize {}
|
||||
|
||||
// `&dyn MyTrait` contained in enum variant
|
||||
pub struct EnumRefDynTrait<'a>(Enum<&'a (dyn MyTrait + 'a)>);
|
||||
pub enum Enum<T> {
|
||||
Variant(T),
|
||||
}
|
||||
|
||||
fn enum_dyn_trait() {
|
||||
let x: isize = 42;
|
||||
let y = EnumRefDynTrait(Enum::Variant(&x as &dyn MyTrait));
|
||||
let _ = y;
|
||||
}
|
||||
|
||||
// `&dyn MyTrait` contained behind `Option` in named field of struct
|
||||
struct RefDynTraitNamed<'a> {
|
||||
x: Option<&'a (dyn MyTrait + 'a)>,
|
||||
}
|
||||
|
||||
fn named_option_dyn_trait() {
|
||||
let x: isize = 42;
|
||||
let y = RefDynTraitNamed { x: Some(&x as &dyn MyTrait) };
|
||||
let _ = y;
|
||||
}
|
||||
|
||||
// `&dyn MyTrait` contained behind `Option` in unnamed field of struct
|
||||
pub struct RefDynTraitUnnamed<'a>(Option<&'a (dyn MyTrait + 'a)>);
|
||||
|
||||
fn unnamed_option_dyn_trait() {
|
||||
let x: isize = 42;
|
||||
let y = RefDynTraitUnnamed(Some(&x as &dyn MyTrait));
|
||||
let _ = y;
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
enum_dyn_trait();
|
||||
named_option_dyn_trait();
|
||||
unnamed_option_dyn_trait();
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
#![crate_type="lib"]
|
||||
#![deny(warnings)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
pub use src::aliases::B;
|
||||
pub use src::hidden_core::make;
|
||||
|
||||
mod src {
|
||||
pub mod aliases {
|
||||
use super::hidden_core::A;
|
||||
pub type B = A<f32>;
|
||||
}
|
||||
|
||||
pub mod hidden_core {
|
||||
use super::aliases::B;
|
||||
|
||||
pub struct A<T> { t: T }
|
||||
|
||||
pub fn make() -> B { A { t: 1.0 } }
|
||||
|
||||
impl<T> A<T> {
|
||||
pub fn foo(&mut self) { println!("called foo"); }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
//@ run-pass
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
//@ aux-build:issue-14421.rs
|
||||
|
||||
|
||||
extern crate issue_14421 as bug_lib;
|
||||
|
||||
use bug_lib::B;
|
||||
use bug_lib::make;
|
||||
|
||||
pub fn main() {
|
||||
let mut an_A: B = make();
|
||||
an_A.foo();
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
// Make sure we don't ICE when making an overloaded call with the
|
||||
// wrong arity.
|
||||
|
||||
fn _foo<F: Fn()> (f: F) {
|
||||
|t| f(t); //~ ERROR E0057
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -1,20 +0,0 @@
|
|||
error[E0057]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> $DIR/issue-16939.rs:5:9
|
||||
|
|
||||
LL | |t| f(t);
|
||||
| ^ - unexpected argument
|
||||
|
|
||||
note: callable defined here
|
||||
--> $DIR/issue-16939.rs:4:12
|
||||
|
|
||||
LL | fn _foo<F: Fn()> (f: F) {
|
||||
| ^^^^
|
||||
help: remove the extra argument
|
||||
|
|
||||
LL - |t| f(t);
|
||||
LL + |t| f();
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0057`.
|
|
@ -1,59 +0,0 @@
|
|||
//@ run-pass
|
||||
|
||||
#![deny(dead_code)]
|
||||
|
||||
// use different types / traits to test all combinations
|
||||
|
||||
trait Const {
|
||||
const C: ();
|
||||
}
|
||||
|
||||
trait StaticFn {
|
||||
fn sfn();
|
||||
}
|
||||
|
||||
struct ConstStruct;
|
||||
struct StaticFnStruct;
|
||||
|
||||
enum ConstEnum {}
|
||||
enum StaticFnEnum {}
|
||||
|
||||
struct AliasedConstStruct;
|
||||
struct AliasedStaticFnStruct;
|
||||
|
||||
enum AliasedConstEnum {}
|
||||
enum AliasedStaticFnEnum {}
|
||||
|
||||
type AliasConstStruct = AliasedConstStruct;
|
||||
type AliasStaticFnStruct = AliasedStaticFnStruct;
|
||||
type AliasConstEnum = AliasedConstEnum;
|
||||
type AliasStaticFnEnum = AliasedStaticFnEnum;
|
||||
|
||||
macro_rules! impl_Const {($($T:ident),*) => {$(
|
||||
impl Const for $T {
|
||||
const C: () = ();
|
||||
}
|
||||
)*}}
|
||||
|
||||
macro_rules! impl_StaticFn {($($T:ident),*) => {$(
|
||||
impl StaticFn for $T {
|
||||
fn sfn() {}
|
||||
}
|
||||
)*}}
|
||||
|
||||
impl_Const!(ConstStruct, ConstEnum, AliasedConstStruct, AliasedConstEnum);
|
||||
impl_StaticFn!(StaticFnStruct, StaticFnEnum, AliasedStaticFnStruct, AliasedStaticFnEnum);
|
||||
|
||||
fn main() {
|
||||
let () = ConstStruct::C;
|
||||
let () = ConstEnum::C;
|
||||
|
||||
StaticFnStruct::sfn();
|
||||
StaticFnEnum::sfn();
|
||||
|
||||
let () = AliasConstStruct::C;
|
||||
let () = AliasConstEnum::C;
|
||||
|
||||
AliasStaticFnStruct::sfn();
|
||||
AliasStaticFnEnum::sfn();
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
//@ build-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
mod a {
|
||||
pub enum Enum<T> {
|
||||
A(T),
|
||||
}
|
||||
|
||||
pub trait X {
|
||||
fn dummy(&self) { }
|
||||
}
|
||||
impl X for isize {}
|
||||
|
||||
pub struct Z<'a>(Enum<&'a (dyn X + 'a)>);
|
||||
fn foo() { let x: isize = 42; let z = Z(Enum::A(&x as &dyn X)); let _ = z; }
|
||||
}
|
||||
|
||||
mod b {
|
||||
trait X {
|
||||
fn dummy(&self) { }
|
||||
}
|
||||
impl X for isize {}
|
||||
struct Y<'a>{
|
||||
x:Option<&'a (dyn X + 'a)>,
|
||||
}
|
||||
|
||||
fn bar() {
|
||||
let x: isize = 42;
|
||||
let _y = Y { x: Some(&x as &dyn X) };
|
||||
}
|
||||
}
|
||||
|
||||
mod c {
|
||||
pub trait X { fn f(&self); }
|
||||
impl X for isize { fn f(&self) {} }
|
||||
pub struct Z<'a>(Option<&'a (dyn X + 'a)>);
|
||||
fn main() { let x: isize = 42; let z = Z(Some(&x as &dyn X)); let _ = z; }
|
||||
}
|
||||
|
||||
pub fn main() {}
|
|
@ -0,0 +1,33 @@
|
|||
//! Auxilary file for testing `dead_code` lint. This crate is compiled as a library and exposes
|
||||
//! aliased types. When used externally, there should not be warnings of `dead_code`
|
||||
//!
|
||||
//! Issue: <https://github.com/rust-lang/rust/issues/14421>
|
||||
|
||||
// Expose internal types to be used in external test
|
||||
pub use src::aliases::ExposedType;
|
||||
pub use src::hidden_core::new;
|
||||
|
||||
mod src {
|
||||
pub mod aliases {
|
||||
use super::hidden_core::InternalStruct;
|
||||
pub type ExposedType = InternalStruct<f32>;
|
||||
}
|
||||
|
||||
pub mod hidden_core {
|
||||
use super::aliases::ExposedType;
|
||||
|
||||
pub struct InternalStruct<T> {
|
||||
_x: T,
|
||||
}
|
||||
|
||||
pub fn new() -> ExposedType {
|
||||
InternalStruct { _x: 1.0 }
|
||||
}
|
||||
|
||||
impl<T> InternalStruct<T> {
|
||||
pub fn foo(&mut self) {
|
||||
println!("called foo");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
//! Regression test to ensure false positive `dead_code` diagnostic warnings are not triggered for
|
||||
//! structs and enums that implement static trait functions or use associated constants.
|
||||
//!
|
||||
//! Aliased versions of all cases are also tested
|
||||
//!
|
||||
//! Issue: <https://github.com/rust-lang/rust/issues/23808>
|
||||
|
||||
//@ check-pass
|
||||
#![deny(dead_code)]
|
||||
|
||||
trait Const {
|
||||
const C: ();
|
||||
}
|
||||
|
||||
trait StaticFn {
|
||||
fn sfn();
|
||||
}
|
||||
|
||||
macro_rules! impl_const {($($T:ident),*) => {$(
|
||||
impl Const for $T {
|
||||
const C: () = ();
|
||||
}
|
||||
)*}}
|
||||
|
||||
macro_rules! impl_static_fn {($($T:ident),*) => {$(
|
||||
impl StaticFn for $T {
|
||||
fn sfn() {}
|
||||
}
|
||||
)*}}
|
||||
|
||||
struct ConstStruct;
|
||||
enum ConstEnum {}
|
||||
struct AliasedConstStruct;
|
||||
type AliasConstStruct = AliasedConstStruct;
|
||||
enum AliasedConstEnum {}
|
||||
type AliasConstEnum = AliasedConstEnum;
|
||||
|
||||
impl_const!(ConstStruct, ConstEnum, AliasedConstStruct, AliasedConstEnum);
|
||||
|
||||
struct StaticFnStruct;
|
||||
enum StaticFnEnum {}
|
||||
struct AliasedStaticFnStruct;
|
||||
type AliasStaticFnStruct = AliasedStaticFnStruct;
|
||||
enum AliasedStaticFnEnum {}
|
||||
type AliasStaticFnEnum = AliasedStaticFnEnum;
|
||||
|
||||
impl_static_fn!(StaticFnStruct, StaticFnEnum, AliasedStaticFnStruct, AliasedStaticFnEnum);
|
||||
|
||||
fn main() {
|
||||
// Use the associated constant for all the types, they should be considered "used"
|
||||
let () = ConstStruct::C;
|
||||
let () = ConstEnum::C;
|
||||
let () = AliasConstStruct::C;
|
||||
let () = AliasConstEnum::C;
|
||||
|
||||
// Use the associated static function for all the types, they should be considered "used"
|
||||
StaticFnStruct::sfn();
|
||||
StaticFnEnum::sfn();
|
||||
AliasStaticFnStruct::sfn();
|
||||
AliasStaticFnEnum::sfn();
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
//! Regression test to ensure that `dead_code` warning does not get triggered when using re-exported
|
||||
//! types that are exposed from a different crate
|
||||
//!
|
||||
//! Issue: <https://github.com/rust-lang/rust/issues/14421>
|
||||
|
||||
//@ check-pass
|
||||
//@ aux-build:no-dead-code-reexported-types-across-crates.rs
|
||||
|
||||
extern crate no_dead_code_reexported_types_across_crates as bug_lib;
|
||||
|
||||
use bug_lib::ExposedType;
|
||||
use bug_lib::new;
|
||||
|
||||
pub fn main() {
|
||||
let mut x: ExposedType = new();
|
||||
x.foo();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue