Skip to content

tests/ui: A New Order [15/N] #143118

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 2 commits into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//! Regression test checks UI tests without error annotations are detected as failing.
//!
//! This tests that when we forget to use any `//~ ERROR` comments whatsoever,
//! the test doesn't succeed
//! Originally created in https://github.com/rust-lang/rust/pull/56244
//@ should-fail

fn main() {}
30 changes: 30 additions & 0 deletions tests/ui/derives/derive-Debug-enum-variants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//! Test that `#[derive(Debug)]` for enums correctly formats variant names.
//@ run-pass

#[derive(Debug)]
enum Foo {
A(usize),
C,
}

#[derive(Debug)]
enum Bar {
D,
}

pub fn main() {
// Test variant with data
let foo_a = Foo::A(22);
assert_eq!("A(22)".to_string(), format!("{:?}", foo_a));

if let Foo::A(value) = foo_a {
println!("Value: {}", value); // This needs to remove #[allow(dead_code)]
}

// Test unit variant
assert_eq!("C".to_string(), format!("{:?}", Foo::C));

// Test unit variant from different enum
assert_eq!("D".to_string(), format!("{:?}", Bar::D));
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//! Test that Debug::fmt is called exactly once during formatting.
//!
//! This is a regression test for PR https://github.com/rust-lang/rust/pull/10715
//@ run-pass
//@ needs-threads

use std::cell::Cell;
use std::fmt;
use std::thread;
use std::{fmt, thread};

struct Foo(Cell<isize>);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//! Test placement of functions and statics in custom link sections
//@ run-pass

// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
#![allow(static_mut_refs)]

#![allow(non_upper_case_globals)]
#[cfg(not(target_vendor = "apple"))]
#[link_section = ".moretext"]
Expand Down
7 changes: 0 additions & 7 deletions tests/ui/log-err-phi.rs

This file was deleted.

21 changes: 0 additions & 21 deletions tests/ui/log-knows-the-names-of-variants.rs

This file was deleted.

6 changes: 0 additions & 6 deletions tests/ui/loud_ui.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Test that a struct and function can have the same name
//!
//@ run-pass

#![allow(non_snake_case)]
Expand All @@ -23,7 +25,7 @@ impl Product for Foo {
}

fn Foo(x: isize, y: isize) -> Foo {
Foo { x: x, y: y }
Foo { x, y }
}

pub fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
//! Test that items in subscopes correctly shadow type parameters and local variables
//!
//! Regression test for https://github.com/rust-lang/rust/issues/23880
//@ run-pass
// Tests that items in subscopes can shadow type parameters and local variables (see issue #23880).

#![allow(unused)]
struct Foo<X> { x: Box<X> }
struct Foo<X> {
x: Box<X>,
}
impl<Bar> Foo<Bar> {
fn foo(&self) {
type Bar = i32;
Expand Down
Loading