Skip to content

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

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 4, 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
16 changes: 8 additions & 8 deletions tests/ui/autoref-autoderef/autoderef-privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ impl Bar2 {

mod foo {
#[derive(Default)]
pub struct Bar { i: ::Bar2 }
pub struct Bar { i: crate::Bar2 }
#[derive(Default)]
pub struct Baz(::Baz2);
pub struct Baz(crate::Baz2);

impl Bar {
fn f(&self) -> bool { false }
}

impl ::std::ops::Deref for Bar {
type Target = ::Bar2;
fn deref(&self) -> &::Bar2 { &self.i }
type Target = crate::Bar2;
fn deref(&self) -> &crate::Bar2 { &self.i }
}

impl ::std::ops::Deref for Baz {
type Target = ::Baz2;
fn deref(&self) -> &::Baz2 { &self.0 }
type Target = crate::Baz2;
fn deref(&self) -> &crate::Baz2 { &self.0 }
}

pub fn f(bar: &Bar, baz: &Baz) {
// Since the private fields and methods are visible here, there should be no autoderefs.
let _: &::Bar2 = &bar.i;
let _: &::Baz2 = &baz.0;
let _: &crate::Bar2 = &bar.i;
let _: &crate::Baz2 = &baz.0;
assert!(!bar.f());
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub mod name_pool {
}

pub mod rust {
pub use name_pool::add;
pub use crate::name_pool::add;

pub type rt = Box<()>;

Expand Down
8 changes: 4 additions & 4 deletions tests/ui/auxiliary/pub-and-stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ mod m {
#[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY
pub(crate) b_crate: i32,
#[unstable(feature = "unstable_declared", issue = "38412")] // SILLY
pub(in m) c_mod: i32,
pub(in crate::m) c_mod: i32,
#[stable(feature = "unit_test", since = "1.0.0")] // SILLY
d_priv: i32
}
Expand All @@ -60,7 +60,7 @@ mod m {
pub i32,

pub(crate) i32,
pub(in m) i32,
pub(in crate::m) i32,
i32);

impl Record {
Expand Down Expand Up @@ -113,7 +113,7 @@ mod m {
#[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY
pub(crate) fn pub_crate(&self) -> i32 { self.d_priv }
#[unstable(feature = "unstable_declared", issue = "38412")] // SILLY
pub(in m) fn pub_mod(&self) -> i32 { self.d_priv }
pub(in crate::m) fn pub_mod(&self) -> i32 { self.d_priv }
#[stable(feature = "unit_test", since = "1.0.0")] // SILLY
fn private(&self) -> i32 { self.d_priv }
}
Expand All @@ -127,7 +127,7 @@ mod m {
pub fn stable(&self) -> i32 { self.0 }

pub(crate) fn pub_crate(&self) -> i32 { self.0 }
pub(in m) fn pub_mod(&self) -> i32 { self.0 }
pub(in crate::m) fn pub_mod(&self) -> i32 { self.0 }
fn private(&self) -> i32 { self.0 }
}
}
6 changes: 3 additions & 3 deletions tests/ui/coherence/coherence_inherent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ mod Lib {

mod Import {
// Trait is in scope here:
use Lib::TheStruct;
use Lib::TheTrait;
use crate::Lib::TheStruct;
use crate::Lib::TheTrait;

fn call_the_fn(s: &TheStruct) {
s.the_fn();
Expand All @@ -25,7 +25,7 @@ mod Import {

mod NoImport {
// Trait is not in scope here:
use Lib::TheStruct;
use crate::Lib::TheStruct;

fn call_the_fn(s: &TheStruct) {
s.the_fn();
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const-blocks/migrate-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
struct Bar;

mod non_constants {
use Bar;
use crate::Bar;

fn no_impl_copy_empty_value_multiple_elements() {
let x = None;
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/consts/const-blocks/migrate-pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
struct Bar;

mod constants {
use Bar;
use crate::Bar;

fn no_impl_copy_empty_value_no_elements() {
const FOO: Option<Bar> = None;
Expand Down Expand Up @@ -69,7 +69,7 @@ mod constants {
}

mod non_constants {
use Bar;
use crate::Bar;

fn no_impl_copy_empty_value_no_elements() {
let x = None;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const-blocks/nll-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
struct Bar;

mod non_constants {
use Bar;
use crate::Bar;

fn no_impl_copy_empty_value_multiple_elements() {
let x = None;
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/consts/const-blocks/nll-pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
struct Bar;

mod constants {
use Bar;
use crate::Bar;

fn no_impl_copy_empty_value_no_elements() {
const FOO: Option<Bar> = None;
Expand Down Expand Up @@ -69,7 +69,7 @@ mod constants {
}

mod non_constants {
use Bar;
use crate::Bar;

fn no_impl_copy_empty_value_no_elements() {
let x = None;
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/cross-crate/auxiliary/static_priv_by_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ mod foo {
}

pub mod bar {
pub use foo::reexported_a as e;
pub use foo::reexported_b as f;
pub use foo::reexported_c as g;
pub use foo::reexported_d as h;
pub use foo::reexported_e as i;
pub use crate::foo::reexported_a as e;
pub use crate::foo::reexported_b as f;
pub use crate::foo::reexported_c as g;
pub use crate::foo::reexported_d as h;
pub use crate::foo::reexported_e as i;
}

pub static a: isize = 0;
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub trait Foo: Sized {
}

mod x {
use Foo;
use crate::Foo;

#[rustc_if_this_changed]
impl Foo for char { type T = char; }
Expand All @@ -24,7 +24,7 @@ mod x {
}

mod y {
use Foo;
use crate::Foo;

#[rustc_then_this_would_need(typeck)] //~ ERROR OK
pub fn use_char_assoc() {
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/dep-graph/dep-graph-caller-callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mod x {
}

mod y {
use x;
use crate::x;

// These dependencies SHOULD exist:
#[rustc_then_this_would_need(typeck)] //~ ERROR OK
Expand All @@ -25,7 +25,7 @@ mod y {
}

mod z {
use y;
use crate::y;

// These are expected to yield errors, because changes to `x`
// affect the BODY of `y`, but not its signature.
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/dep-graph/dep-graph-struct-signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct WontChange {

// these are valid dependencies
mod signatures {
use WillChange;
use crate::WillChange;

#[rustc_then_this_would_need(type_of)] //~ ERROR no path
#[rustc_then_this_would_need(associated_item)] //~ ERROR no path
Expand Down Expand Up @@ -70,7 +70,7 @@ mod signatures {
}

mod invalid_signatures {
use WontChange;
use crate::WontChange;

#[rustc_then_this_would_need(type_of)] //~ ERROR no path
trait A {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub trait Bar: Sized {
}

mod x {
use {Foo, Bar};
use crate::{Foo, Bar};

#[rustc_if_this_changed]
impl Foo for u32 { }
Expand All @@ -28,7 +28,7 @@ mod x {
}

mod y {
use {Foo, Bar};
use crate::{Foo, Bar};

#[rustc_then_this_would_need(typeck)] //~ ERROR OK
pub fn with_char() {
Expand All @@ -37,7 +37,7 @@ mod y {
}

mod z {
use y;
use crate::y;

#[rustc_then_this_would_need(typeck)] //~ ERROR no path
pub fn z() {
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub trait Bar: Sized {
}

mod x {
use {Foo, Bar};
use crate::{Foo, Bar};

#[rustc_if_this_changed]
impl Foo for char { }
Expand All @@ -27,7 +27,7 @@ mod x {
}

mod y {
use {Foo, Bar};
use crate::{Foo, Bar};

#[rustc_then_this_would_need(typeck)] //~ ERROR no path
pub fn call_bar() {
Expand All @@ -36,7 +36,7 @@ mod y {
}

mod z {
use y;
use crate::y;

#[rustc_then_this_would_need(typeck)] //~ ERROR no path
pub fn z() {
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/dep-graph/dep-graph-trait-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub trait Foo: Sized {
}

mod x {
use Foo;
use crate::Foo;

#[rustc_if_this_changed]
impl Foo for char { }
Expand All @@ -23,7 +23,7 @@ mod x {
}

mod y {
use Foo;
use crate::Foo;

#[rustc_then_this_would_need(typeck)] //~ ERROR OK
pub fn with_char() {
Expand All @@ -49,7 +49,7 @@ mod y {
}

mod z {
use y;
use crate::y;

// These are expected to yield errors, because changes to `x`
// affect the BODY of `y`, but not its signature.
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/derived-errors/issue-31997.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn closure<F, T>(x: F) -> Result<T, ()>
}

fn foo() -> Result<(), ()> {
try!(closure(|| bar(core::ptr::null_mut()))); //~ ERROR cannot find function `bar` in this scope
closure(|| bar(core::ptr::null_mut()))?; //~ ERROR cannot find function `bar` in this scope
Ok(())
}

Expand Down
6 changes: 3 additions & 3 deletions tests/ui/derived-errors/issue-31997.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0425]: cannot find function `bar` in this scope
--> $DIR/issue-31997.rs:14:21
--> $DIR/issue-31997.rs:14:16
|
LL | try!(closure(|| bar(core::ptr::null_mut())));
| ^^^ not found in this scope
LL | closure(|| bar(core::ptr::null_mut()))?;
| ^^^ not found in this scope

error: aborting due to 1 previous error

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/drop/issue-23338-ensure-param-drop-order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub mod d {
};
self.log.borrow_mut().push(self.uid);
indent_println(self.trail, &format!("+-- Drop {}", self));
indent_println(::PREF_INDENT, "");
indent_println(super::PREF_INDENT, "");
}
}
}
2 changes: 1 addition & 1 deletion tests/ui/drop/issue-23611-enum-swap-in-drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ pub mod d {
};
self.log.borrow_mut().push(self.uid);
indent_println(self.trail, &format!("+-- Drop {}", self));
indent_println(::PREF_INDENT, "");
indent_println(super::PREF_INDENT, "");
}
}
}
2 changes: 1 addition & 1 deletion tests/ui/dropck/dropck_trait_cycle_checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod s {
}

mod id {
use s;
use crate::s;
#[derive(Debug)]
pub struct Id {
orig_count: usize,
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/error-codes/E0659.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ mod earth {
}

mod collider {
pub use moon::*;
pub use earth::*;
pub use crate::moon::*;
pub use crate::earth::*;
}

fn main() {
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/error-codes/E0659.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ LL | collider::foo();
note: `foo` could refer to the function imported here
--> $DIR/E0659.rs:10:13
|
LL | pub use moon::*;
| ^^^^^^^
LL | pub use crate::moon::*;
| ^^^^^^^^^^^^^^
= help: consider adding an explicit import of `foo` to disambiguate
note: `foo` could also refer to the function imported here
--> $DIR/E0659.rs:11:13
|
LL | pub use earth::*;
| ^^^^^^^^
LL | pub use crate::earth::*;
| ^^^^^^^^^^^^^^^
= help: consider adding an explicit import of `foo` to disambiguate

error: aborting due to 1 previous error
Expand Down
Loading
Loading