Skip to content

Commit 76bbef0

Browse files
committed
cleaned up some tests
1 parent e9191ec commit 76bbef0

24 files changed

+126
-85
lines changed

tests/ui/auto-traits/auto-traits-type-parameter renamed to tests/ui/auto-traits/auto-traits-type-parameter.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1+
//! Checks how type parameters interact with auto-traits like `Send` and `Sync` with implicit,
2+
//! bounds
3+
14
//@ run-pass
25

36
#![allow(non_camel_case_types)]
47
#![allow(dead_code)]
58

6-
fn p_foo<T>(_pinned: T) { }
7-
fn s_foo<T>(_shared: T) { }
8-
fn u_foo<T:Send>(_unique: T) { }
9+
fn p_foo<T>(_pinned: T) {}
10+
fn s_foo<T>(_shared: T) {}
11+
fn u_foo<T: Send>(_unique: T) {}
912

1013
struct r {
11-
i: isize,
14+
i: isize,
1215
}
1316

1417
impl Drop for r {
1518
fn drop(&mut self) {}
1619
}
1720

18-
fn r(i:isize) -> r {
19-
r {
20-
i: i
21-
}
21+
fn r(i: isize) -> r {
22+
r { i }
2223
}
2324

2425
pub fn main() {

tests/ui/consts/const-eval-array-len-in-impl.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// https://github.com/rust-lang/rust/issues/49208
1+
//! This checks that compiler correctly evaluate constant array lengths within trait `impl` headers.
2+
//!
3+
//! Regression test for <https://github.com/rust-lang/rust/issues/49208>.
24
35
trait Foo {
46
fn foo();

tests/ui/consts/const-eval-array-len-in-impl.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: the trait bound `[(); 0]: Foo` is not satisfied
2-
--> $DIR/unevaluated_fixed_size_array_len.rs:12:6
2+
--> $DIR/const-eval-array-len-in-impl.rs:14:6
33
|
44
LL | <[(); 0] as Foo>::foo()
55
| ^^^^^^^ the trait `Foo` is not implemented for `[(); 0]`

tests/ui/destructuring-assignment/let-binding-tuple-destructuring.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Checks basic multiple variable declaration using tuple destructuring in a `let` binding.
2+
13
//@ run-pass
24

35
pub fn main() {

tests/ui/lifetimes/any-lifetime-escape-higher-rank.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
//! Checks that `std::any::Any` cannot be used to circumvent lifetime rules
2+
//! with higher-rank types.
3+
14
//@ run-pass
2-
// Test that we can't ignore lifetimes by going through Any.
35

46
use std::any::Any;
57

68
struct Foo<'a>(&'a str);
79

8-
fn good(s: &String) -> Foo<'_> { Foo(s) }
10+
fn good(s: &String) -> Foo<'_> {
11+
Foo(s)
12+
}
913

1014
fn bad1(s: String) -> Option<&'static str> {
1115
let a: Box<dyn Any> = Box::new(good as fn(&String) -> Foo);
@@ -17,7 +21,9 @@ trait AsStr<'a, 'b> {
1721
}
1822

1923
impl<'a> AsStr<'a, 'a> for String {
20-
fn get(&'a self) -> &'a str { self }
24+
fn get(&'a self) -> &'a str {
25+
self
26+
}
2127
}
2228

2329
fn bad2(s: String) -> Option<&'static str> {

tests/ui/limits/type-length-limit-enforcement.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
//@ build-fail
1+
//~ ERROR reached the type-length limit
2+
3+
//! Checks the enforcement of the type-length limit
4+
//! and its configurability via `#![type_length_limit]`.
5+
26
//@ compile-flags: -Copt-level=0 -Zenforce-type-length-limit
3-
//~^^ ERROR reached the type-length limit
47

5-
// Test that the type length limit can be changed.
6-
// The exact type depends on optimizations, so disable them.
8+
//@ build-fail
79

810
#![allow(dead_code)]
9-
#![type_length_limit="8"]
11+
#![type_length_limit = "8"]
1012

1113
macro_rules! link {
1214
($id:ident, $t:ty) => {
1315
pub type $id = ($t, $t, $t);
14-
}
16+
};
1517
}
1618

1719
link! { A1, B1 }
@@ -26,7 +28,7 @@ link! { D, E }
2628
link! { E, F }
2729
link! { F, G<Option<i32>, Option<i32>> }
2830

29-
pub struct G<T, K>(std::marker::PhantomData::<(T, K)>);
31+
pub struct G<T, K>(std::marker::PhantomData<(T, K)>);
3032

3133
fn main() {
3234
drop::<Option<A>>(None);

tests/ui/limits/type-length-limit-enforcement.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: reached the type-length limit while instantiating `std::mem::drop::<Option<((((..., ..., ...), ..., ...), ..., ...), ..., ...)>>`
2-
--> $DIR/type_length_limit.rs:32:5
2+
--> $DIR/type-length-limit-enforcement.rs:34:5
33
|
44
LL | drop::<Option<A>>(None);
55
| ^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= help: consider adding a `#![type_length_limit="4010"]` attribute to your crate
8-
= note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit.long-type.txt'
8+
= note: the full type name has been written to '$TEST_BUILD_DIR/type-length-limit-enforcement.long-type.txt'
99

1010
error: reached the type-length limit while instantiating `<{closure@rt::lang_start<()>::{closure#0}} as FnMut<()>>::call_mut`
1111
|

tests/ui/macros/macro-fragment-ident-underscore-error.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
//! Verifies that the reserved underscore `_` cannot be used as an `ident` fragment specifier
2+
//! within a macro pattern, as it leads to a compilation error.
3+
14
macro_rules! identity {
2-
($i: ident) => (
5+
($i: ident) => {
36
$i
4-
)
7+
};
58
}
69

710
fn main() {

tests/ui/macros/macro-fragment-ident-underscore-error.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: no rules expected reserved identifier `_`
2-
--> $DIR/underscore-ident-matcher.rs:8:19
2+
--> $DIR/macro-fragment-ident-underscore-error.rs:11:19
33
|
44
LL | macro_rules! identity {
55
| --------------------- when calling this macro
@@ -8,9 +8,9 @@ LL | let identity!(_) = 10;
88
| ^ no rules expected this token in macro call
99
|
1010
note: while trying to match meta-variable `$i:ident`
11-
--> $DIR/underscore-ident-matcher.rs:2:6
11+
--> $DIR/macro-fragment-ident-underscore-error.rs:5:6
1212
|
13-
LL | ($i: ident) => (
13+
LL | ($i: ident) => {
1414
| ^^^^^^^^^
1515

1616
error: aborting due to 1 previous error
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
//@ run-pass
22

3-
struct A { a: isize }
3+
struct A {
4+
a: isize,
5+
}
46

5-
fn a(a: A) -> isize { return a.a; }
7+
fn a(a: A) -> isize {
8+
return a.a;
9+
}
610

7-
pub fn main() { let x: A = A {a: 1}; assert_eq!(a(x), 1); }
11+
pub fn main() {
12+
let x: A = A { a: 1 };
13+
assert_eq!(a(x), 1);
14+
}

0 commit comments

Comments
 (0)