Skip to content

Use non-2015 edition paths in tests that do not test for their resolution #141960

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 5, 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
2 changes: 1 addition & 1 deletion tests/ui/issues/issue-20427.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mod reuse {

pub fn check<u16>() {
assert_eq!(size_of::<u8>(), 8);
assert_eq!(size_of::<::u64>(), 0);
assert_eq!(size_of::<crate::u64>(), 0);
assert_eq!(size_of::<i16>(), 3 * size_of::<*const ()>());
assert_eq!(size_of::<u16>(), 0);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/issues/issue-28983.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ impl Test for u32 {

pub mod export {
#[no_mangle]
pub extern "C" fn issue_28983(t: <u32 as ::Test>::T) -> i32 { t*3 }
pub extern "C" fn issue_28983(t: <u32 as crate::Test>::T) -> i32 { t*3 }
}

// to test both exporting and importing functions, import
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/issues/issue-31776.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct S;

mod m {
fn f() {
impl ::S {
impl crate::S {
pub fn s(&self) {}
}
}
Expand All @@ -24,7 +24,7 @@ pub struct S1;
fn f() {
pub struct Z;

impl ::Tr for ::S1 {
impl crate::Tr for crate::S1 {
type A = Z; // Private-in-public error unless `struct Z` is pub
}
}
Expand All @@ -43,7 +43,7 @@ mod m1 {
pub field: u8
}

impl ::Tr1 for ::S2 {
impl crate::Tr1 for crate::S2 {
type A = Z;
fn pull(&self) -> Self::A { Z{field: 10} }
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/issues/issue-32797.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod bar {

pub use baz::*;
mod baz {
pub use main as f;
pub use crate::main as f;
}

pub fn main() {}
2 changes: 1 addition & 1 deletion tests/ui/issues/issue-41053.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl Iterator for Foo {
type Item = Box<dyn Trait>;
fn next(&mut self) -> Option<Box<dyn Trait>> {
extern crate issue_41053;
impl ::Trait for issue_41053::Test {
impl crate::Trait for issue_41053::Test {
fn foo(&self) {}
}
Some(Box::new(issue_41053::Test))
Expand Down
24 changes: 12 additions & 12 deletions tests/ui/issues/issue-47364.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ pub enum IResult<I,O> {
Incomplete(u32, u64)
}

pub fn multispace<T: Copy>(input: T) -> ::IResult<i8, i8> {
::IResult::Done(0, 0)
pub fn multispace<T: Copy>(input: T) -> crate::IResult<i8, i8> {
crate::IResult::Done(0, 0)
}

mod nom_sql {
fn where_clause(i: &[u8]) -> ::IResult<&[u8], Option<String>> {
let X = match ::multispace(i) {
::IResult::Done(..) => ::IResult::Done(i, None::<String>),
_ => ::IResult::Error(::Err::NodePosition(0)),
fn where_clause(i: &[u8]) -> crate::IResult<&[u8], Option<String>> {
let X = match crate::multispace(i) {
crate::IResult::Done(..) => crate::IResult::Done(i, None::<String>),
_ => crate::IResult::Error(crate::Err::NodePosition(0)),
};
match X {
::IResult::Done(_, _) => ::IResult::Done(i, None),
crate::IResult::Done(_, _) => crate::IResult::Done(i, None),
_ => X
}
}
Expand All @@ -39,16 +39,16 @@ mod nom_sql {
match {
where_clause(i)
} {
::IResult::Done(_, o) => ::IResult::Done(i, Some(o)),
::IResult::Error(_) => ::IResult::Done(i, None),
_ => ::IResult::Incomplete(0, 0),
crate::IResult::Done(_, o) => crate::IResult::Done(i, Some(o)),
crate::IResult::Error(_) => crate::IResult::Done(i, None),
_ => crate::IResult::Incomplete(0, 0),
}
} {
::IResult::Done(z, _) => ::IResult::Done(z, None::<String>),
crate::IResult::Done(z, _) => crate::IResult::Done(z, None::<String>),
_ => return ()
};
match Y {
::IResult::Done(x, _) => {
crate::IResult::Done(x, _) => {
let bytes = b"; ";
let len = x.len();
bytes[len];
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/issues/issue-50187.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ mod macro_ns {
}

mod merge2 {
pub use type_ns::A;
pub use value_ns::A;
pub use crate::type_ns::A;
pub use crate::value_ns::A;
}
mod merge3 {
pub use type_ns::A;
pub use value_ns::A;
pub use macro_ns::A;
pub use crate::type_ns::A;
pub use crate::value_ns::A;
pub use crate::macro_ns::A;
}

mod use2 {
pub use merge2::A;
pub use crate::merge2::A;
}
mod use3 {
pub use merge3::A;
pub use crate::merge3::A;
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/issues/issue-50761.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mod b {
}

impl Builder {
pub fn with_a(&mut self, _a: fn() -> dyn (::a::A)) {}
pub fn with_a(&mut self, _a: fn() -> dyn (crate::a::A)) {}
}
}

Expand Down
10 changes: 5 additions & 5 deletions tests/ui/issues/issue-6936.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
struct T;

mod t1 {
type Foo = ::T;
type Foo = crate::T;
mod Foo {} //~ ERROR the name `Foo` is defined multiple times
}

mod t2 {
type Foo = ::T;
type Foo = crate::T;
struct Foo; //~ ERROR the name `Foo` is defined multiple times
}

mod t3 {
type Foo = ::T;
type Foo = crate::T;
enum Foo {} //~ ERROR the name `Foo` is defined multiple times
}

mod t4 {
type Foo = ::T;
type Foo = crate::T;
fn Foo() {} // ok
}

Expand All @@ -26,7 +26,7 @@ mod t5 {
}

mod t6 {
type Foo = ::T;
type Foo = crate::T;
impl Foo {} // ok
}

Expand Down
12 changes: 6 additions & 6 deletions tests/ui/issues/issue-6936.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0428]: the name `Foo` is defined multiple times
--> $DIR/issue-6936.rs:5:5
|
LL | type Foo = ::T;
| --------------- previous definition of the type `Foo` here
LL | type Foo = crate::T;
| -------------------- previous definition of the type `Foo` here
LL | mod Foo {}
| ^^^^^^^ `Foo` redefined here
|
Expand All @@ -11,8 +11,8 @@ LL | mod Foo {}
error[E0428]: the name `Foo` is defined multiple times
--> $DIR/issue-6936.rs:10:5
|
LL | type Foo = ::T;
| --------------- previous definition of the type `Foo` here
LL | type Foo = crate::T;
| -------------------- previous definition of the type `Foo` here
LL | struct Foo;
| ^^^^^^^^^^^ `Foo` redefined here
|
Expand All @@ -21,8 +21,8 @@ LL | struct Foo;
error[E0428]: the name `Foo` is defined multiple times
--> $DIR/issue-6936.rs:15:5
|
LL | type Foo = ::T;
| --------------- previous definition of the type `Foo` here
LL | type Foo = crate::T;
| -------------------- previous definition of the type `Foo` here
LL | enum Foo {}
| ^^^^^^^^ `Foo` redefined here
|
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/issues/issue-7663.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod test1 {
mod bar { pub fn p() -> isize { 2 } }

pub mod baz {
use test1::bar::p;
use crate::test1::bar::p;

pub fn my_main() { assert_eq!(p(), 2); }
}
Expand All @@ -20,7 +20,7 @@ mod test2 {
mod bar { pub fn p() -> isize { 2 } }

pub mod baz {
use test2::bar::p;
use crate::test2::bar::p;

pub fn my_main() { assert_eq!(p(), 2); }
}
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/lint/lint-directives-on-use-items-issue-10534.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
mod a { pub static x: isize = 3; pub static y: isize = 4; }

mod b {
use a::x; //~ ERROR: unused import
use crate::a::x; //~ ERROR: unused import
#[allow(unused_imports)]
use a::y; // no error here
use crate::a::y; // no error here
}

#[allow(unused_imports)]
mod c {
use a::x;
use crate::a::x;
#[deny(unused_imports)]
use a::y; //~ ERROR: unused import
use crate::a::y; //~ ERROR: unused import
}

fn main() {}
12 changes: 6 additions & 6 deletions tests/ui/lint/lint-directives-on-use-items-issue-10534.stderr
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
error: unused import: `a::x`
error: unused import: `crate::a::x`
--> $DIR/lint-directives-on-use-items-issue-10534.rs:12:9
|
LL | use a::x;
| ^^^^
LL | use crate::a::x;
| ^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/lint-directives-on-use-items-issue-10534.rs:1:9
|
LL | #![deny(unused_imports)]
| ^^^^^^^^^^^^^^

error: unused import: `a::y`
error: unused import: `crate::a::y`
--> $DIR/lint-directives-on-use-items-issue-10534.rs:21:9
|
LL | use a::y;
| ^^^^
LL | use crate::a::y;
| ^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/lint-directives-on-use-items-issue-10534.rs:20:12
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/lint/lint-missing-doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ mod internal_impl {
}
/// dox
pub mod public_interface {
pub use internal_impl::documented as foo;
pub use internal_impl::undocumented1 as bar;
pub use internal_impl::{documented, undocumented2};
pub use internal_impl::globbed::*;
pub use crate::internal_impl::documented as foo;
pub use crate::internal_impl::undocumented1 as bar;
pub use crate::internal_impl::{documented, undocumented2};
pub use crate::internal_impl::globbed::*;
}

extern "C" {
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/lint/lint-unnecessary-import-braces.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#![deny(unused_import_braces)]

use test::{A}; //~ ERROR braces around A is unnecessary
use crate::test::{A}; //~ ERROR braces around A is unnecessary

mod test {
use test::{self}; // OK
use test::{self as rename}; // OK
use crate::test::{self}; // OK
use crate::test::{self as rename}; // OK
pub struct A;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/lint/lint-unnecessary-import-braces.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: braces around A is unnecessary
--> $DIR/lint-unnecessary-import-braces.rs:3:1
|
LL | use test::{A};
| ^^^^^^^^^^^^^^
LL | use crate::test::{A};
| ^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/lint-unnecessary-import-braces.rs:1:9
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/lint/unused/lint-unused-imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ pub mod bar {
pub struct Square;

pub mod c {
use foo::Point;
use foo::Square; //~ ERROR unused import: `foo::Square`
use crate::foo::Point;
use crate::foo::Square; //~ ERROR unused import: `crate::foo::Square`
pub fn cc(_p: Point) -> super::Square {
fn f() -> super::Square {
super::Square
Expand All @@ -74,7 +74,7 @@ fn g() {
// cf. issue #35135.
#[allow(unused_variables)]
fn h() {
use test2::foo; //~ ERROR unused import: `test2::foo`
use crate::test2::foo; //~ ERROR unused import: `crate::test2::foo`
let foo = 0;
}

Expand All @@ -83,6 +83,6 @@ fn main() {
let mut a = 3;
let mut b = 4;
swap(&mut a, &mut b);
test::C.b();
crate::test::C.b();
foo();
}
12 changes: 6 additions & 6 deletions tests/ui/lint/unused/lint-unused-imports.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ error: unused import: `bar`
LL | use test2::{foo, bar};
| ^^^

error: unused import: `foo::Square`
error: unused import: `crate::foo::Square`
--> $DIR/lint-unused-imports.rs:52:13
|
LL | use foo::Square;
| ^^^^^^^^^^^
LL | use crate::foo::Square;
| ^^^^^^^^^^^^^^^^^^

error: unused import: `self::g`
--> $DIR/lint-unused-imports.rs:68:9
|
LL | use self::g;
| ^^^^^^^

error: unused import: `test2::foo`
error: unused import: `crate::test2::foo`
--> $DIR/lint-unused-imports.rs:77:9
|
LL | use test2::foo;
| ^^^^^^^^^^
LL | use crate::test2::foo;
| ^^^^^^^^^^^^^^^^^

error: unused import: `test::B2`
--> $DIR/lint-unused-imports.rs:20:5
Expand Down
Loading
Loading