Skip to content

tests/ui: A New Order [11/N] #142219

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
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Test that use items with cfg(false) are properly filtered out

//@ run-pass

pub fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Test error for explicit destructor method calls via UFCS
//@ run-rustfix

#![allow(dropping_references)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Test error for explicit destructor method calls via UFCS

//@ run-rustfix

#![allow(dropping_references)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0040]: explicit use of destructor method
--> $DIR/illegal-ufcs-drop.rs:12:5
--> $DIR/explicit-drop-call-error.rs:14:5
|
LL | Drop::drop(&mut Foo)
| ^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Test format! macro functionality in no_std environment
//@ run-pass
//@ ignore-emscripten no no_std executables
//@ ignore-wasm different `main` convention
Expand All @@ -9,7 +11,8 @@
// Import global allocator and panic handler.
extern crate std as other;

#[macro_use] extern crate alloc;
#[macro_use]
extern crate alloc;

use alloc::string::ToString;

Expand All @@ -21,7 +24,7 @@ extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ff
let s = format!("test");
assert_eq!(s, "test".to_string());

let s = format!("{test}", test=3_isize);
let s = format!("{test}", test = 3_isize);
assert_eq!(s, "3".to_string());

let s = format!("hello {}", "world");
Expand Down
9 changes: 0 additions & 9 deletions tests/ui/fun-indirect-call.rs

This file was deleted.

15 changes: 0 additions & 15 deletions tests/ui/future-incompatible-lint-group.rs

This file was deleted.

13 changes: 0 additions & 13 deletions tests/ui/global-scope.rs

This file was deleted.

10 changes: 0 additions & 10 deletions tests/ui/hello.rs

This file was deleted.

2 changes: 0 additions & 2 deletions tests/ui/include-macros/parent_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
fn main() {
let _ = include_str!("include-macros/file.txt"); //~ ERROR couldn't read
//~^HELP different directory
let _ = include_str!("hello.rs"); //~ ERROR couldn't read
//~^HELP different directory
let _ = include_bytes!("../../data.bin"); //~ ERROR couldn't read
//~^HELP different directory
let _ = include_str!("tests/ui/include-macros/file.txt"); //~ ERROR couldn't read
Expand Down
17 changes: 3 additions & 14 deletions tests/ui/include-macros/parent_dir.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,8 @@ LL - let _ = include_str!("include-macros/file.txt");
LL + let _ = include_str!("file.txt");
|

error: couldn't read `$DIR/hello.rs`: $FILE_NOT_FOUND_MSG
--> $DIR/parent_dir.rs:6:13
|
LL | let _ = include_str!("hello.rs");
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
help: there is a file with the same name in a different directory
|
LL | let _ = include_str!("../hello.rs");
| +++

error: couldn't read `$DIR/../../data.bin`: $FILE_NOT_FOUND_MSG
--> $DIR/parent_dir.rs:8:13
--> $DIR/parent_dir.rs:6:13
|
LL | let _ = include_bytes!("../../data.bin");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -34,7 +23,7 @@ LL + let _ = include_bytes!("data.bin");
|

error: couldn't read `$DIR/tests/ui/include-macros/file.txt`: $FILE_NOT_FOUND_MSG
--> $DIR/parent_dir.rs:10:13
--> $DIR/parent_dir.rs:8:13
|
LL | let _ = include_str!("tests/ui/include-macros/file.txt");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -45,5 +34,5 @@ LL - let _ = include_str!("tests/ui/include-macros/file.txt");
LL + let _ = include_str!("file.txt");
|

error: aborting due to 4 previous errors
error: aborting due to 3 previous errors

21 changes: 21 additions & 0 deletions tests/ui/lint/future-incompatible-lint-group.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! Test that future_incompatible lint group only includes edition-independent lints

// Ensure that the future_incompatible lint group only includes
// lints for changes that are not tied to an edition
#![deny(future_incompatible)]

// Error since this is a `future_incompatible` lint
macro_rules! m {
($i) => {};
//~^ ERROR missing fragment specifier
//~| WARN this was previously accepted
}

trait Tr {
// Warn only since this is not a `future_incompatible` lint
fn f(u8) {}
//~^ WARN anonymous parameters are deprecated
//~| WARN this is accepted in the current edition
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
error: missing fragment specifier
--> $DIR/future-incompatible-lint-group.rs:6:19
--> $DIR/future-incompatible-lint-group.rs:9:6
|
LL | macro_rules! m { ($i) => {} }
| ^^
LL | ($i) => {};
| ^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
note: the lint level is defined here
--> $DIR/future-incompatible-lint-group.rs:3:9
--> $DIR/future-incompatible-lint-group.rs:5:9
|
LL | #![deny(future_incompatible)]
| ^^^^^^^^^^^^^^^^^^^
= note: `#[deny(missing_fragment_specifier)]` implied by `#[deny(future_incompatible)]`

warning: anonymous parameters are deprecated and will be removed in the next edition
--> $DIR/future-incompatible-lint-group.rs:11:10
--> $DIR/future-incompatible-lint-group.rs:16:10
|
LL | fn f(u8) {}
| ^^ help: try naming the parameter or explicitly ignoring it: `_: u8`
Expand All @@ -27,15 +27,15 @@ error: aborting due to 1 previous error; 1 warning emitted

Future incompatibility report: Future breakage diagnostic:
error: missing fragment specifier
--> $DIR/future-incompatible-lint-group.rs:6:19
--> $DIR/future-incompatible-lint-group.rs:9:6
|
LL | macro_rules! m { ($i) => {} }
| ^^
LL | ($i) => {};
| ^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
note: the lint level is defined here
--> $DIR/future-incompatible-lint-group.rs:3:9
--> $DIR/future-incompatible-lint-group.rs:5:9
|
LL | #![deny(future_incompatible)]
| ^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
//! Test multiple inherent methods with same name on different type parameters

//@ run-pass
// Ensure that a user-defined type admits multiple inherent methods
// with the same name, which can be called on values that have a
// precise enough type to allow distinguishing between the methods.


struct Foo<T>(T);

impl Foo<usize> {
fn bar(&self) -> i32 { self.0 as i32 }
fn bar(&self) -> i32 {
self.0 as i32
}
}

impl Foo<isize> {
fn bar(&self) -> i32 { -(self.0 as i32) }
fn bar(&self) -> i32 {
-(self.0 as i32)
}
}

fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Test implementing methods for types defined in other modules

//@ run-pass

mod foo {
Expand Down
21 changes: 21 additions & 0 deletions tests/ui/resolve/global-scope-resolution.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! Test global scope resolution with :: operator

//@ run-pass

pub fn f() -> isize {
return 1;
}

pub mod foo {
pub fn f() -> isize {
return 2;
}
pub fn g() {
assert_eq!(f(), 2);
assert_eq!(::f(), 1);
}
}

pub fn main() {
return foo::g();
}
Loading