Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0994063

Browse files
committedJun 11, 2025·
cleaned up some tests
1 parent 8072811 commit 0994063

19 files changed

+102
-144
lines changed
 
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//! Smoke test: dereferencing boxed zero-sized types (ZSTs) should not crash.
2+
//!
3+
//! Originally a regression test of github.com/rust-lang/rust/issues/13360
4+
//! but repurposed for a smoke test.
5+
6+
//@ run-pass
7+
8+
pub fn main() {
9+
let _: () = *Box::new(());
10+
}

‎tests/ui/exclusive-drop-and-copy.rs renamed to ‎tests/ui/derives/copy-drop-mutually-exclusive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// issue #20126
1+
//! Regression test for issue #20126: Copy and Drop traits are mutually exclusive
22
33
#[derive(Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented
44
struct Foo;

‎tests/ui/exclusive-drop-and-copy.stderr renamed to ‎tests/ui/derives/copy-drop-mutually-exclusive.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor
2-
--> $DIR/exclusive-drop-and-copy.rs:3:10
2+
--> $DIR/copy-drop-mutually-exclusive.rs:3:10
33
|
44
LL | #[derive(Copy, Clone)]
55
| ^^^^ `Copy` not allowed on types with destructors
66

77
error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor
8-
--> $DIR/exclusive-drop-and-copy.rs:10:10
8+
--> $DIR/copy-drop-mutually-exclusive.rs:10:10
99
|
1010
LL | #[derive(Copy, Clone)]
1111
| ^^^^ `Copy` not allowed on types with destructors

‎tests/ui/empty-allocation-rvalue-non-null.rs

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

‎tests/ui/empty-type-parameter-list.rs

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

‎tests/ui/error-should-say-copy-not-pod.rs

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

‎tests/ui/error-should-say-copy-not-pod.stderr

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

‎tests/ui/explicit-i-suffix.rs

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

‎tests/ui/ext-nonexistent.rs

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

‎tests/ui/ext-nonexistent.stderr

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

‎tests/ui/fact.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//! Test that empty type parameter list <> is equivalent to no type parameters
2+
//!
3+
//! Checks` that empty angle brackets <> are syntactically valid and equivalent
4+
//! to omitting type parameters entirely across various language constructs.
5+
6+
//@ run-pass
7+
8+
struct S<>;
9+
trait T<> {} //~ WARN trait `T` is never used
10+
enum E<> {
11+
V
12+
}
13+
impl<> T<> for S<> {}
14+
impl T for E {}
15+
fn foo<>() {}
16+
fn bar() {}
17+
fn main() {
18+
let _ = S;
19+
let _ = S::<>;
20+
let _ = E::V;
21+
let _ = E::<>::V;
22+
foo();
23+
foo::<>();
24+
// Test that we can supply <> to non-generic things
25+
bar::<>();
26+
let _: i32<>;
27+
}

‎tests/ui/empty-type-parameter-list.stderr renamed to ‎tests/ui/generics/empty-generic-brackets-equiv.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: trait `T` is never used
2-
--> $DIR/empty-type-parameter-list.rs:6:7
2+
--> $DIR/empty-generic-brackets-equiv.rs:9:7
33
|
44
LL | trait T<> {}
55
| ^

‎tests/ui/ext-expand-inner-exprs.rs renamed to ‎tests/ui/macros/nested-macro-expansion.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Test nested macro expansion with concat! macros
2+
13
//@ run-pass
24

35
static FOO : &'static str = concat!(concat!("hel", "lo"), "world");

‎tests/ui/resolve/nonexistent-macro.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//! Test error handling for undefined macro calls
2+
3+
fn main() {
4+
iamnotanextensionthatexists!("");
5+
//~^ ERROR cannot find macro `iamnotanextensionthatexists` in this scope
6+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: cannot find macro `iamnotanextensionthatexists` in this scope
2+
--> $DIR/nonexistent-macro.rs:4:5
3+
|
4+
LL | iamnotanextensionthatexists!("");
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to 1 previous error
8+

‎tests/ui/explore-issue-38412.rs renamed to ‎tests/ui/stability-attribute/stability-privacy-interaction.rs

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
1+
//! Regression test for issue #38412: interaction between stability attributes and privacy
2+
//!
3+
//! Tests that the compiler correctly handles the interaction between feature gates
4+
//! and privacy/visibility rules. Specifically verifies that enabled unstable features
5+
//! are accessible while disabled ones are properly rejected.
6+
17
//@ aux-build:pub-and-stability.rs
28

3-
// A big point of this test is that we *enable* `unstable_declared`,
4-
// but do *not* enable `unstable_undeclared`. This way we can check
5-
// that the compiler is letting in uses of enabled feature-gated
6-
// stuff but still rejecting uses of disabled feature-gated stuff.
9+
// Enable `unstable_declared` but not `unstable_undeclared` to test
10+
// that the compiler allows enabled features but rejects disabled ones
711
#![feature(unstable_declared)]
812

913
extern crate pub_and_stability;
1014
use pub_and_stability::{Record, Trait, Tuple};
1115

1216
fn main() {
13-
// Okay
17+
// Test struct field access patterns
1418
let Record { .. } = Record::new();
1519

16-
// Okay
17-
let Record { a_stable_pub: _, a_unstable_declared_pub: _, .. } = Record::new();
20+
let Record {
21+
a_stable_pub: _,
22+
a_unstable_declared_pub: _,
23+
..
24+
} = Record::new();
1825

19-
let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
20-
Record::new();
21-
//~^^ ERROR use of unstable library feature `unstable_undeclared`
26+
let Record {
27+
a_stable_pub: _,
28+
a_unstable_declared_pub: _,
29+
a_unstable_undeclared_pub: _, //~ ERROR use of unstable library feature `unstable_undeclared`
30+
..
31+
} = Record::new();
2232

2333
let r = Record::new();
2434
let t = Tuple::new();
2535

36+
// Test field access with different stability/privacy combinations
2637
r.a_stable_pub;
2738
r.a_unstable_declared_pub;
2839
r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature
@@ -37,10 +48,12 @@ fn main() {
3748
t.4; //~ ERROR is private
3849
t.5; //~ ERROR is private
3950

51+
// Test trait method access
4052
r.stable_trait_method();
4153
r.unstable_declared_trait_method();
4254
r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
4355

56+
// Test inherent method access
4457
r.stable();
4558
r.unstable_declared();
4659
r.unstable_undeclared(); //~ ERROR use of unstable library feature
@@ -49,6 +62,7 @@ fn main() {
4962
r.pub_mod(); //~ ERROR `pub_mod` is private
5063
r.private(); //~ ERROR `private` is private
5164

65+
// Repeat tests for tuple struct
5266
let t = Tuple::new();
5367
t.stable_trait_method();
5468
t.unstable_declared_trait_method();

‎tests/ui/explore-issue-38412.stderr renamed to ‎tests/ui/stability-attribute/stability-privacy-interaction.stderr

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
error[E0658]: use of unstable library feature `unstable_undeclared`
2-
--> $DIR/explore-issue-38412.rs:19:63
2+
--> $DIR/stability-privacy-interaction.rs:29:9
33
|
4-
LL | let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | a_unstable_undeclared_pub: _,
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: see issue #38412 <https://github.com/rust-lang/rust/issues/38412> for more information
88
= help: add `#![feature(unstable_undeclared)]` to the crate attributes to enable
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

1111
error[E0658]: use of unstable library feature `unstable_undeclared`
12-
--> $DIR/explore-issue-38412.rs:28:5
12+
--> $DIR/stability-privacy-interaction.rs:39:5
1313
|
1414
LL | r.a_unstable_undeclared_pub;
1515
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -19,25 +19,25 @@ LL | r.a_unstable_undeclared_pub;
1919
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2020

2121
error[E0616]: field `b_crate` of struct `Record` is private
22-
--> $DIR/explore-issue-38412.rs:29:7
22+
--> $DIR/stability-privacy-interaction.rs:40:7
2323
|
2424
LL | r.b_crate;
2525
| ^^^^^^^ private field
2626

2727
error[E0616]: field `c_mod` of struct `Record` is private
28-
--> $DIR/explore-issue-38412.rs:30:7
28+
--> $DIR/stability-privacy-interaction.rs:41:7
2929
|
3030
LL | r.c_mod;
3131
| ^^^^^ private field
3232

3333
error[E0616]: field `d_priv` of struct `Record` is private
34-
--> $DIR/explore-issue-38412.rs:31:7
34+
--> $DIR/stability-privacy-interaction.rs:42:7
3535
|
3636
LL | r.d_priv;
3737
| ^^^^^^ private field
3838

3939
error[E0658]: use of unstable library feature `unstable_undeclared`
40-
--> $DIR/explore-issue-38412.rs:35:5
40+
--> $DIR/stability-privacy-interaction.rs:46:5
4141
|
4242
LL | t.2;
4343
| ^^^
@@ -47,25 +47,25 @@ LL | t.2;
4747
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4848

4949
error[E0616]: field `3` of struct `pub_and_stability::Tuple` is private
50-
--> $DIR/explore-issue-38412.rs:36:7
50+
--> $DIR/stability-privacy-interaction.rs:47:7
5151
|
5252
LL | t.3;
5353
| ^ private field
5454

5555
error[E0616]: field `4` of struct `pub_and_stability::Tuple` is private
56-
--> $DIR/explore-issue-38412.rs:37:7
56+
--> $DIR/stability-privacy-interaction.rs:48:7
5757
|
5858
LL | t.4;
5959
| ^ private field
6060

6161
error[E0616]: field `5` of struct `pub_and_stability::Tuple` is private
62-
--> $DIR/explore-issue-38412.rs:38:7
62+
--> $DIR/stability-privacy-interaction.rs:49:7
6363
|
6464
LL | t.5;
6565
| ^ private field
6666

6767
error[E0658]: use of unstable library feature `unstable_undeclared`
68-
--> $DIR/explore-issue-38412.rs:42:7
68+
--> $DIR/stability-privacy-interaction.rs:54:7
6969
|
7070
LL | r.unstable_undeclared_trait_method();
7171
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -75,7 +75,7 @@ LL | r.unstable_undeclared_trait_method();
7575
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
7676

7777
error[E0658]: use of unstable library feature `unstable_undeclared`
78-
--> $DIR/explore-issue-38412.rs:46:7
78+
--> $DIR/stability-privacy-interaction.rs:59:7
7979
|
8080
LL | r.unstable_undeclared();
8181
| ^^^^^^^^^^^^^^^^^^^
@@ -85,7 +85,7 @@ LL | r.unstable_undeclared();
8585
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
8686

8787
error[E0624]: method `pub_crate` is private
88-
--> $DIR/explore-issue-38412.rs:48:7
88+
--> $DIR/stability-privacy-interaction.rs:61:7
8989
|
9090
LL | r.pub_crate();
9191
| ^^^^^^^^^ private method
@@ -96,7 +96,7 @@ LL | pub(crate) fn pub_crate(&self) -> i32 { self.d_priv }
9696
| ------------------------------------- private method defined here
9797

9898
error[E0624]: method `pub_mod` is private
99-
--> $DIR/explore-issue-38412.rs:49:7
99+
--> $DIR/stability-privacy-interaction.rs:62:7
100100
|
101101
LL | r.pub_mod();
102102
| ^^^^^^^ private method
@@ -107,7 +107,7 @@ LL | pub(in crate::m) fn pub_mod(&self) -> i32 { self.d_priv }
107107
| ----------------------------------------- private method defined here
108108

109109
error[E0624]: method `private` is private
110-
--> $DIR/explore-issue-38412.rs:50:7
110+
--> $DIR/stability-privacy-interaction.rs:63:7
111111
|
112112
LL | r.private();
113113
| ^^^^^^^ private method
@@ -118,7 +118,7 @@ LL | fn private(&self) -> i32 { self.d_priv }
118118
| ------------------------ private method defined here
119119

120120
error[E0658]: use of unstable library feature `unstable_undeclared`
121-
--> $DIR/explore-issue-38412.rs:55:7
121+
--> $DIR/stability-privacy-interaction.rs:69:7
122122
|
123123
LL | t.unstable_undeclared_trait_method();
124124
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -128,7 +128,7 @@ LL | t.unstable_undeclared_trait_method();
128128
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
129129

130130
error[E0658]: use of unstable library feature `unstable_undeclared`
131-
--> $DIR/explore-issue-38412.rs:59:7
131+
--> $DIR/stability-privacy-interaction.rs:73:7
132132
|
133133
LL | t.unstable_undeclared();
134134
| ^^^^^^^^^^^^^^^^^^^
@@ -138,7 +138,7 @@ LL | t.unstable_undeclared();
138138
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
139139

140140
error[E0624]: method `pub_crate` is private
141-
--> $DIR/explore-issue-38412.rs:61:7
141+
--> $DIR/stability-privacy-interaction.rs:75:7
142142
|
143143
LL | t.pub_crate();
144144
| ^^^^^^^^^ private method
@@ -149,7 +149,7 @@ LL | pub(crate) fn pub_crate(&self) -> i32 { self.0 }
149149
| ------------------------------------- private method defined here
150150

151151
error[E0624]: method `pub_mod` is private
152-
--> $DIR/explore-issue-38412.rs:62:7
152+
--> $DIR/stability-privacy-interaction.rs:76:7
153153
|
154154
LL | t.pub_mod();
155155
| ^^^^^^^ private method
@@ -160,7 +160,7 @@ LL | pub(in crate::m) fn pub_mod(&self) -> i32 { self.0 }
160160
| ----------------------------------------- private method defined here
161161

162162
error[E0624]: method `private` is private
163-
--> $DIR/explore-issue-38412.rs:63:7
163+
--> $DIR/stability-privacy-interaction.rs:77:7
164164
|
165165
LL | t.private();
166166
| ^^^^^^^ private method

0 commit comments

Comments
 (0)
Please sign in to comment.