Skip to content

Commit d6e6685

Browse files
authored
Unrolled build for #143168
Rollup merge of #143168 - Kivooeo:tf16, r=tgross35 `tests/ui`: A New Order [16/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of #133895. r? `@tgross35` (just small one to test new method, also I should squash all this commits except move commit, so we after review will end up having like one move commit and one commit with changes, right?)
2 parents ad3b725 + c240566 commit d6e6685

13 files changed

+76
-48
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//! Test that -Z maximal-hir-to-mir-coverage flag is accepted.
2+
//!
3+
//! Original PR: https://github.com/rust-lang/rust/pull/105286
4+
5+
//@ compile-flags: -Zmaximal-hir-to-mir-coverage
6+
//@ run-pass
7+
8+
fn main() {
9+
let x = 1;
10+
let y = x + 1;
11+
println!("{y}");
12+
}

tests/ui/missing_debug_impls.rs renamed to tests/ui/lint/missing-debug-implementations-lint.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//! Test the `missing_debug_implementations` lint that warns about public types without Debug.
2+
//!
3+
//! See https://github.com/rust-lang/rust/issues/20855
4+
15
//@ compile-flags: --crate-type lib
26
#![deny(missing_debug_implementations)]
37
#![allow(unused)]
@@ -10,7 +14,6 @@ pub enum A {} //~ ERROR type does not implement `Debug`
1014
pub enum B {}
1115

1216
pub enum C {}
13-
1417
impl fmt::Debug for C {
1518
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
1619
Ok(())
@@ -23,15 +26,14 @@ pub struct Foo; //~ ERROR type does not implement `Debug`
2326
pub struct Bar;
2427

2528
pub struct Baz;
26-
2729
impl fmt::Debug for Baz {
2830
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
2931
Ok(())
3032
}
3133
}
3234

35+
// Private types should not trigger the lint
3336
struct PrivateStruct;
34-
3537
enum PrivateEnum {}
3638

3739
#[derive(Debug)]

tests/ui/missing_debug_impls.stderr renamed to tests/ui/lint/missing-debug-implementations-lint.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: type does not implement `Debug`; consider adding `#[derive(Debug)]` or a manual implementation
2-
--> $DIR/missing_debug_impls.rs:7:1
2+
--> $DIR/missing-debug-implementations-lint.rs:11:1
33
|
44
LL | pub enum A {}
55
| ^^^^^^^^^^^^^
66
|
77
note: the lint level is defined here
8-
--> $DIR/missing_debug_impls.rs:2:9
8+
--> $DIR/missing-debug-implementations-lint.rs:6:9
99
|
1010
LL | #![deny(missing_debug_implementations)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: type does not implement `Debug`; consider adding `#[derive(Debug)]` or a manual implementation
14-
--> $DIR/missing_debug_impls.rs:20:1
14+
--> $DIR/missing-debug-implementations-lint.rs:23:1
1515
|
1616
LL | pub struct Foo;
1717
| ^^^^^^^^^^^^^^^

tests/ui/maximal_mir_to_hir_coverage.rs

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

tests/ui/maybe-bounds.rs

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

tests/ui/method-output-diff-issue-127263.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//! This test checks that when there's a type mismatch between a function item and
2+
//! a function pointer, the error message focuses on the actual type difference
3+
//! (return types, argument types) rather than the confusing "pointer vs item" distinction.
4+
//!
5+
//! See https://github.com/rust-lang/rust/issues/127263
6+
7+
fn bar() {}
8+
9+
fn foo(x: i32) -> u32 {
10+
0
11+
}
12+
13+
fn main() {
14+
let b: fn() -> u32 = bar; //~ ERROR mismatched types [E0308]
15+
let f: fn(i32) = foo; //~ ERROR mismatched types [E0308]
16+
}

tests/ui/method-output-diff-issue-127263.stderr renamed to tests/ui/mismatched_types/fn-pointer-mismatch-diagnostics.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/method-output-diff-issue-127263.rs:6:26
2+
--> $DIR/fn-pointer-mismatch-diagnostics.rs:14:26
33
|
44
LL | let b: fn() -> u32 = bar;
55
| ----------- ^^^ expected fn pointer, found fn item
@@ -10,7 +10,7 @@ LL | let b: fn() -> u32 = bar;
1010
found fn item `fn() -> () {bar}`
1111

1212
error[E0308]: mismatched types
13-
--> $DIR/method-output-diff-issue-127263.rs:7:22
13+
--> $DIR/fn-pointer-mismatch-diagnostics.rs:15:22
1414
|
1515
LL | let f: fn(i32) = foo;
1616
| ------- ^^^ expected fn pointer, found fn item

tests/ui/mod-subitem-as-enum-variant.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//! Test that ?Trait bounds are forbidden in supertraits and trait object types.
2+
//!
3+
//! While `?Sized` and other maybe bounds are allowed in type parameter bounds and where clauses,
4+
//! they are explicitly forbidden in certain syntactic positions:
5+
//! - As supertraits in trait definitions
6+
//! - In trait object type expressions
7+
//!
8+
//! See https://github.com/rust-lang/rust/issues/20503
9+
10+
trait Tr: ?Sized {}
11+
//~^ ERROR `?Trait` is not permitted in supertraits
12+
13+
type A1 = dyn Tr + (?Sized);
14+
//~^ ERROR `?Trait` is not permitted in trait object types
15+
type A2 = dyn for<'a> Tr + (?Sized);
16+
//~^ ERROR `?Trait` is not permitted in trait object types
17+
18+
fn main() {}

tests/ui/maybe-bounds.stderr renamed to tests/ui/traits/maybe-trait-bounds-forbidden-locations.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: `?Trait` is not permitted in supertraits
2-
--> $DIR/maybe-bounds.rs:1:11
2+
--> $DIR/maybe-trait-bounds-forbidden-locations.rs:10:11
33
|
44
LL | trait Tr: ?Sized {}
55
| ^^^^^^
@@ -9,7 +9,7 @@ LL | trait Tr: ?Sized {}
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

1111
error[E0658]: `?Trait` is not permitted in trait object types
12-
--> $DIR/maybe-bounds.rs:4:20
12+
--> $DIR/maybe-trait-bounds-forbidden-locations.rs:13:20
1313
|
1414
LL | type A1 = dyn Tr + (?Sized);
1515
| ^^^^^^^^
@@ -18,7 +18,7 @@ LL | type A1 = dyn Tr + (?Sized);
1818
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1919

2020
error[E0658]: `?Trait` is not permitted in trait object types
21-
--> $DIR/maybe-bounds.rs:6:28
21+
--> $DIR/maybe-trait-bounds-forbidden-locations.rs:15:28
2222
|
2323
LL | type A2 = dyn for<'a> Tr + (?Sized);
2424
| ^^^^^^^^
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//! Test that type arguments are properly rejected on modules.
2+
//!
3+
//! Related PR: https://github.com/rust-lang/rust/pull/56225 (RFC 2338 implementation)
4+
5+
mod Mod {
6+
pub struct FakeVariant<T>(pub T);
7+
}
8+
9+
fn main() {
10+
// This should work fine - normal generic struct constructor
11+
Mod::FakeVariant::<i32>(0);
12+
13+
// This should error - type arguments not allowed on modules
14+
Mod::<i32>::FakeVariant(0);
15+
//~^ ERROR type arguments are not allowed on module `Mod` [E0109]
16+
}

tests/ui/mod-subitem-as-enum-variant.stderr renamed to tests/ui/type-alias-enum-variants/module-type-args-error.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0109]: type arguments are not allowed on module `Mod`
2-
--> $DIR/mod-subitem-as-enum-variant.rs:7:11
2+
--> $DIR/module-type-args-error.rs:14:11
33
|
44
LL | Mod::<i32>::FakeVariant(0);
55
| --- ^^^ type argument not allowed

0 commit comments

Comments
 (0)