Rollup merge of #138471 - spencer3035:move-ui-test-1ofn, r=jieyouxu

Clean up some tests in tests/ui

I cleaned up 3 top level tests, keeping the changes minor because it is my first PR and wanted to get feedback before doing more changes/PRs.

Tracking issues:
https://github.com/rust-lang/rust/issues/73494
https://github.com/rust-lang/rust/issues/133895

r? jieyouxu
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2025-03-16 09:40:08 +08:00 committed by GitHub
commit 7c1555cb9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 43 additions and 47 deletions

View file

@ -0,0 +1,16 @@
//! Regression test to check that outer attributes applied to the first module item is applied to
//! its attached module item only, and not also to other subsequent module items
//!
//! Commit: <https://github.com/rust-lang/rust/commit/7aee9f7b56f8d96f9444ebb1d06e32e024b81974>
//@ check-pass
//@ compile-flags: --cfg=first
//@ no-auto-check-cfg
#[cfg(first)]
mod hello {}
#[cfg(not_set)]
mod hello {}
fn main() {}

View file

@ -1,25 +0,0 @@
//@ run-pass
// Regression test for a problem with the first mod attribute
// being applied to every mod
#[cfg(target_os = "linux")]
mod hello {}
#[cfg(target_os = "macos")]
mod hello {}
#[cfg(target_os = "windows")]
mod hello {}
#[cfg(target_os = "freebsd")]
mod hello {}
#[cfg(target_os = "dragonfly")]
mod hello {}
#[cfg(target_os = "android")]
mod hello {}
fn main() {}

View file

@ -1,18 +0,0 @@
//@ normalize-stderr: "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
// note-pattern: first defined in crate `std`.
// Test for issue #31788 and E0152
#![feature(lang_items)]
extern crate core;
use core::panic::PanicInfo;
#[lang = "panic_impl"]
fn panic_impl(info: &PanicInfo) -> ! {
//~^ ERROR: found duplicate lang item `panic_impl`
loop {}
}
fn main() {}

View file

@ -0,0 +1,20 @@
//! Validates the correct printing of E0152 in the case of duplicate "lang_item" function
//! definitions.
//!
//! Issue: <https://github.com/rust-lang/rust/issues/31788>
//@ error-pattern: first defined in crate `std`
//@ normalize-stderr: "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
#![feature(lang_items)]
extern crate core;
use core::panic::PanicInfo;
#[lang = "panic_impl"]
fn panic_impl(info: &PanicInfo) -> ! {
//~^ ERROR: found duplicate lang item `panic_impl`
loop {}
}
fn main() {}

View file

@ -1,5 +1,5 @@
error[E0152]: found duplicate lang item `panic_impl`
--> $DIR/duplicate_entry_error.rs:13:1
--> $DIR/E0152-duplicate-lang-items.rs:15:1
|
LL | / fn panic_impl(info: &PanicInfo) -> ! {
LL | |
@ -7,9 +7,9 @@ LL | | loop {}
LL | | }
| |_^
|
= note: the lang item is first defined in crate `std` (which `duplicate_entry_error` depends on)
= note: the lang item is first defined in crate `std` (which `E0152_duplicate_lang_items` depends on)
= note: first definition in `std` loaded from SYSROOT/libstd-*.rlib
= note: second definition in the local crate (`duplicate_entry_error`)
= note: second definition in the local crate (`E0152_duplicate_lang_items`)
error: aborting due to 1 previous error

View file

@ -1,3 +1,6 @@
//! Regression test for duplicated label in E0381 error message.
//!
//! Issue: <https://github.com/rust-lang/rust/issues/129274>
fn main() {
fn test() {
loop {

View file

@ -1,5 +1,5 @@
error[E0381]: used binding `blah` is possibly-uninitialized
--> $DIR/duplicate-label-E0381-issue-129274.rs:8:33
--> $DIR/E0381-duplicated-label.rs:11:33
|
LL | let blah: Option<String>;
| ---- binding declared here but left uninitialized