Skip to content

Commit 7e9da87

Browse files
authored
Unrolled build for #142429
Rollup merge of #142429 - Kivooeo:tf13, r=jieyouxu `tests/ui`: A New Order [13/N] Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of #133895. r? ```@jieyouxu```
2 parents ad3b725 + d0bd279 commit 7e9da87

15 files changed

+157
-98
lines changed

src/tools/tidy/src/issues.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,6 @@ ui/infinite/issue-41731-infinite-macro-println.rs
13681368
ui/intrinsics/issue-28575.rs
13691369
ui/intrinsics/issue-84297-reifying-copy.rs
13701370
ui/invalid/issue-114435-layout-type-err.rs
1371-
ui/issue-11881.rs
13721371
ui/issue-15924.rs
13731372
ui/issue-16822.rs
13741373
ui/issues-71798.rs
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//! Test inner attributes (#![...]) behavior in impl blocks with cfg conditions.
2+
//!
3+
//! This test verifies that:
4+
//! - Inner attributes can conditionally exclude entire impl blocks
5+
//! - Regular attributes within impl blocks work independently
6+
//! - Attribute parsing doesn't consume too eagerly
7+
8+
//@ run-pass
9+
10+
struct Foo;
11+
12+
impl Foo {
13+
#![cfg(false)]
14+
15+
fn method(&self) -> bool {
16+
false
17+
}
18+
}
19+
20+
impl Foo {
21+
#![cfg(not(FALSE))]
22+
23+
// Check that we don't eat attributes too eagerly.
24+
#[cfg(false)]
25+
fn method(&self) -> bool {
26+
false
27+
}
28+
29+
fn method(&self) -> bool {
30+
true
31+
}
32+
}
33+
34+
pub fn main() {
35+
assert!(Foo.method());
36+
}
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1+
//! Test that only usize can be used for indexing arrays and slices.
2+
13
pub fn main() {
24
let v: Vec<isize> = vec![0, 1, 2, 3, 4, 5];
35
let s: String = "abcdef".to_string();
6+
7+
// Valid indexing with usize
48
v[3_usize];
59
v[3];
6-
v[3u8]; //~ ERROR the type `[isize]` cannot be indexed by `u8`
7-
v[3i8]; //~ ERROR the type `[isize]` cannot be indexed by `i8`
10+
v[3u8]; //~ ERROR the type `[isize]` cannot be indexed by `u8`
11+
v[3i8]; //~ ERROR the type `[isize]` cannot be indexed by `i8`
812
v[3u32]; //~ ERROR the type `[isize]` cannot be indexed by `u32`
913
v[3i32]; //~ ERROR the type `[isize]` cannot be indexed by `i32`
1014
s.as_bytes()[3_usize];
1115
s.as_bytes()[3];
12-
s.as_bytes()[3u8]; //~ ERROR the type `[u8]` cannot be indexed by `u8`
13-
s.as_bytes()[3i8]; //~ ERROR the type `[u8]` cannot be indexed by `i8`
16+
s.as_bytes()[3u8]; //~ ERROR the type `[u8]` cannot be indexed by `u8`
17+
s.as_bytes()[3i8]; //~ ERROR the type `[u8]` cannot be indexed by `i8`
1418
s.as_bytes()[3u32]; //~ ERROR the type `[u8]` cannot be indexed by `u32`
1519
s.as_bytes()[3i32]; //~ ERROR the type `[u8]` cannot be indexed by `i32`
1620
}

tests/ui/integral-indexing.stderr renamed to tests/ui/indexing/indexing-integral-types.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: the type `[isize]` cannot be indexed by `u8`
2-
--> $DIR/integral-indexing.rs:6:7
2+
--> $DIR/indexing-integral-types.rs:10:7
33
|
44
LL | v[3u8];
55
| ^^^ slice indices are of type `usize` or ranges of `usize`
@@ -11,7 +11,7 @@ LL | v[3u8];
1111
= note: required for `Vec<isize>` to implement `Index<u8>`
1212

1313
error[E0277]: the type `[isize]` cannot be indexed by `i8`
14-
--> $DIR/integral-indexing.rs:7:7
14+
--> $DIR/indexing-integral-types.rs:11:7
1515
|
1616
LL | v[3i8];
1717
| ^^^ slice indices are of type `usize` or ranges of `usize`
@@ -23,7 +23,7 @@ LL | v[3i8];
2323
= note: required for `Vec<isize>` to implement `Index<i8>`
2424

2525
error[E0277]: the type `[isize]` cannot be indexed by `u32`
26-
--> $DIR/integral-indexing.rs:8:7
26+
--> $DIR/indexing-integral-types.rs:12:7
2727
|
2828
LL | v[3u32];
2929
| ^^^^ slice indices are of type `usize` or ranges of `usize`
@@ -35,7 +35,7 @@ LL | v[3u32];
3535
= note: required for `Vec<isize>` to implement `Index<u32>`
3636

3737
error[E0277]: the type `[isize]` cannot be indexed by `i32`
38-
--> $DIR/integral-indexing.rs:9:7
38+
--> $DIR/indexing-integral-types.rs:13:7
3939
|
4040
LL | v[3i32];
4141
| ^^^^ slice indices are of type `usize` or ranges of `usize`
@@ -47,7 +47,7 @@ LL | v[3i32];
4747
= note: required for `Vec<isize>` to implement `Index<i32>`
4848

4949
error[E0277]: the type `[u8]` cannot be indexed by `u8`
50-
--> $DIR/integral-indexing.rs:12:18
50+
--> $DIR/indexing-integral-types.rs:16:18
5151
|
5252
LL | s.as_bytes()[3u8];
5353
| ^^^ slice indices are of type `usize` or ranges of `usize`
@@ -59,7 +59,7 @@ LL | s.as_bytes()[3u8];
5959
= note: required for `[u8]` to implement `Index<u8>`
6060

6161
error[E0277]: the type `[u8]` cannot be indexed by `i8`
62-
--> $DIR/integral-indexing.rs:13:18
62+
--> $DIR/indexing-integral-types.rs:17:18
6363
|
6464
LL | s.as_bytes()[3i8];
6565
| ^^^ slice indices are of type `usize` or ranges of `usize`
@@ -71,7 +71,7 @@ LL | s.as_bytes()[3i8];
7171
= note: required for `[u8]` to implement `Index<i8>`
7272

7373
error[E0277]: the type `[u8]` cannot be indexed by `u32`
74-
--> $DIR/integral-indexing.rs:14:18
74+
--> $DIR/indexing-integral-types.rs:18:18
7575
|
7676
LL | s.as_bytes()[3u32];
7777
| ^^^^ slice indices are of type `usize` or ranges of `usize`
@@ -83,7 +83,7 @@ LL | s.as_bytes()[3u32];
8383
= note: required for `[u8]` to implement `Index<u32>`
8484

8585
error[E0277]: the type `[u8]` cannot be indexed by `i32`
86-
--> $DIR/integral-indexing.rs:15:18
86+
--> $DIR/indexing-integral-types.rs:19:18
8787
|
8888
LL | s.as_bytes()[3i32];
8989
| ^^^^ slice indices are of type `usize` or ranges of `usize`

tests/ui/inner-attrs-on-impl.rs

Lines changed: 0 additions & 24 deletions
This file was deleted.

tests/ui/inner-module.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/ui/inner-static-type-parameter.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/ui/integral-variable-unification-error.rs renamed to tests/ui/mismatched_types/int-float-type-mismatch.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! Check that a type mismatch error is reported when trying
2+
//! to unify a {float} value assignment to an {integer} variable.
3+
14
fn main() {
25
let mut x //~ NOTE expected due to the type of this binding
36
=

tests/ui/integral-variable-unification-error.stderr renamed to tests/ui/mismatched_types/int-float-type-mismatch.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/integral-variable-unification-error.rs:5:9
2+
--> $DIR/int-float-type-mismatch.rs:8:9
33
|
44
LL | let mut x
55
| ----- expected due to the type of this binding
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//! Basic test for nested module functionality and path resolution
2+
3+
//@ run-pass
4+
5+
mod inner {
6+
pub mod inner2 {
7+
pub fn hello() {
8+
println!("hello, modular world");
9+
}
10+
}
11+
pub fn hello() {
12+
inner2::hello();
13+
}
14+
}
15+
16+
pub fn main() {
17+
inner::hello();
18+
inner::inner2::hello();
19+
}

0 commit comments

Comments
 (0)