Skip to content

tests/ui: A New Order [10/N] #142217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/ui/box/empty-alloc-deref-rvalue.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//! Smoke test: dereferencing boxed zero-sized types (ZSTs) should not crash.
//!
//! Originally a regression test of github.com/rust-lang/rust/issues/13360
//! but repurposed for a smoke test.

//@ run-pass

pub fn main() {
let _: () = *Box::new(());
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// issue #20126
//! Regression test for issue #20126: Copy and Drop traits are mutually exclusive

#[derive(Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented
struct Foo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor
--> $DIR/exclusive-drop-and-copy.rs:3:10
--> $DIR/copy-drop-mutually-exclusive.rs:3:10
|
LL | #[derive(Copy, Clone)]
| ^^^^ `Copy` not allowed on types with destructors

error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor
--> $DIR/exclusive-drop-and-copy.rs:10:10
--> $DIR/copy-drop-mutually-exclusive.rs:10:10
|
LL | #[derive(Copy, Clone)]
| ^^^^ `Copy` not allowed on types with destructors
Expand Down
7 changes: 0 additions & 7 deletions tests/ui/empty-allocation-rvalue-non-null.rs

This file was deleted.

24 changes: 0 additions & 24 deletions tests/ui/empty-type-parameter-list.rs

This file was deleted.

7 changes: 0 additions & 7 deletions tests/ui/error-should-say-copy-not-pod.rs

This file was deleted.

22 changes: 0 additions & 22 deletions tests/ui/error-should-say-copy-not-pod.stderr

This file was deleted.

13 changes: 0 additions & 13 deletions tests/ui/explicit-i-suffix.rs

This file was deleted.

2 changes: 0 additions & 2 deletions tests/ui/ext-nonexistent.rs

This file was deleted.

8 changes: 0 additions & 8 deletions tests/ui/ext-nonexistent.stderr

This file was deleted.

26 changes: 0 additions & 26 deletions tests/ui/fact.rs

This file was deleted.

27 changes: 27 additions & 0 deletions tests/ui/generics/empty-generic-brackets-equiv.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//! Test that empty type parameter list <> is equivalent to no type parameters
//!
//! Checks` that empty angle brackets <> are syntactically valid and equivalent
//! to omitting type parameters entirely across various language constructs.

//@ run-pass

struct S<>;
trait T<> {} //~ WARN trait `T` is never used
enum E<> {
V
}
impl<> T<> for S<> {}
impl T for E {}
fn foo<>() {}
fn bar() {}
fn main() {
let _ = S;
let _ = S::<>;
let _ = E::V;
let _ = E::<>::V;
foo();
foo::<>();
// Test that we can supply <> to non-generic things
bar::<>();
let _: i32<>;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: trait `T` is never used
--> $DIR/empty-type-parameter-list.rs:6:7
--> $DIR/empty-generic-brackets-equiv.rs:9:7
|
LL | trait T<> {}
| ^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Test nested macro expansion with concat! macros

//@ run-pass

static FOO : &'static str = concat!(concat!("hel", "lo"), "world");
Expand Down
6 changes: 6 additions & 0 deletions tests/ui/resolve/nonexistent-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//! Test error handling for undefined macro calls

fn main() {
iamnotanextensionthatexists!("");
//~^ ERROR cannot find macro `iamnotanextensionthatexists` in this scope
}
8 changes: 8 additions & 0 deletions tests/ui/resolve/nonexistent-macro.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: cannot find macro `iamnotanextensionthatexists` in this scope
--> $DIR/nonexistent-macro.rs:4:5
|
LL | iamnotanextensionthatexists!("");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error

Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
//! Regression test for issue #38412: interaction between stability attributes and privacy
//!
//! Tests that the compiler correctly handles the interaction between feature gates
//! and privacy/visibility rules. Specifically verifies that enabled unstable features
//! are accessible while disabled ones are properly rejected.

//@ aux-build:pub-and-stability.rs

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

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

fn main() {
// Okay
// Test struct field access patterns
let Record { .. } = Record::new();

// Okay
let Record { a_stable_pub: _, a_unstable_declared_pub: _, .. } = Record::new();
let Record {
a_stable_pub: _,
a_unstable_declared_pub: _,
..
} = Record::new();

let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
Record::new();
//~^^ ERROR use of unstable library feature `unstable_undeclared`
let Record {
a_stable_pub: _,
a_unstable_declared_pub: _,
a_unstable_undeclared_pub: _, //~ ERROR use of unstable library feature `unstable_undeclared`
..
} = Record::new();

let r = Record::new();
let t = Tuple::new();

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

// Test trait method access
r.stable_trait_method();
r.unstable_declared_trait_method();
r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature

// Test inherent method access
r.stable();
r.unstable_declared();
r.unstable_undeclared(); //~ ERROR use of unstable library feature
Expand All @@ -49,6 +62,7 @@ fn main() {
r.pub_mod(); //~ ERROR `pub_mod` is private
r.private(); //~ ERROR `private` is private

// Repeat tests for tuple struct
let t = Tuple::new();
t.stable_trait_method();
t.unstable_declared_trait_method();
Expand Down
Loading
Loading