about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukas.wirth@ferrous-systems.com>2025-06-05 08:41:49 +0200
committerLukas Wirth <lukas.wirth@ferrous-systems.com>2025-06-05 09:19:31 +0200
commit46326e159f5008c1dca78911442167d5dee07b64 (patch)
treebdf0c29ea8750cbd76079080184aaf33cbf8adb6
parent81a964c23ea4fe9ab52b4449bb166bf280035797 (diff)
downloadrust-46326e159f5008c1dca78911442167d5dee07b64.tar.gz
rust-46326e159f5008c1dca78911442167d5dee07b64.zip
Use non-2015 edition paths in tests that do not test for their resolution
-rw-r--r--tests/ui/resolve/auxiliary/issue-80079.rs2
-rw-r--r--tests/ui/resolve/auxiliary/privacy-struct-ctor.rs2
-rw-r--r--tests/ui/resolve/issue-42944.rs2
-rw-r--r--tests/ui/resolve/issue-5035.rs2
-rw-r--r--tests/ui/resolve/issue-5035.stderr6
-rw-r--r--tests/ui/resolve/privacy-enum-ctor.rs4
-rw-r--r--tests/ui/resolve/privacy-enum-ctor.stderr38
-rw-r--r--tests/ui/resolve/privacy-struct-ctor.rs4
-rw-r--r--tests/ui/resolve/privacy-struct-ctor.stderr34
-rw-r--r--tests/ui/self/self-shadowing-import.rs2
-rw-r--r--tests/ui/sepcomp/auxiliary/sepcomp_lib.rs4
-rw-r--r--tests/ui/sepcomp/sepcomp-extern.rs4
-rw-r--r--tests/ui/sepcomp/sepcomp-fns-backwards.rs4
-rw-r--r--tests/ui/sepcomp/sepcomp-fns.rs4
-rw-r--r--tests/ui/sepcomp/sepcomp-statics.rs4
-rw-r--r--tests/ui/sepcomp/sepcomp-unwind.rs4
-rw-r--r--tests/ui/shadowed-use-visibility.rs2
-rw-r--r--tests/ui/shadowed/shadowed-trait-methods.rs2
-rw-r--r--tests/ui/shadowed/shadowed-use-visibility.rs8
-rw-r--r--tests/ui/shadowed/shadowed-use-visibility.stderr14
-rw-r--r--tests/ui/span/dropck_arr_cycle_checked.rs2
-rw-r--r--tests/ui/span/dropck_vec_cycle_checked.rs2
-rw-r--r--tests/ui/span/vec-must-not-hide-type-from-dropck.rs2
-rw-r--r--tests/ui/span/visibility-ty-params.rs6
-rw-r--r--tests/ui/span/visibility-ty-params.stderr18
-rw-r--r--tests/ui/static/auxiliary/static_priv_by_default.rs10
-rw-r--r--tests/ui/static/static-extern-type.rs4
-rw-r--r--tests/ui/statics/auxiliary/static_fn_inline_xc_aux.rs2
-rw-r--r--tests/ui/statics/auxiliary/static_fn_trait_xc_aux.rs2
-rw-r--r--tests/ui/statics/static-impl.rs4
-rw-r--r--tests/ui/structs-enums/issue-2718-a.rs2
-rw-r--r--tests/ui/structs-enums/namespaced-enum-glob-import.rs2
-rw-r--r--tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr28
-rw-r--r--tests/ui/symbol-names/impl1.rs2
-rw-r--r--tests/ui/symbol-names/issue-53912.rs10
-rw-r--r--tests/ui/symbol-names/issue-60925.rs10
-rw-r--r--tests/ui/threads-sendsync/thread-local-syntax.rs2
-rw-r--r--tests/ui/traits/impl-2.rs2
-rw-r--r--tests/ui/traits/item-privacy.rs18
-rw-r--r--tests/ui/traits/static-method-overwriting.rs4
-rw-r--r--tests/ui/tuple/tuple-struct-fields/test.rs2
-rw-r--r--tests/ui/tuple/tuple-struct-fields/test2.rs2
-rw-r--r--tests/ui/tuple/tuple-struct-fields/test3.rs2
-rw-r--r--tests/ui/type/issue-7607-2.rs2
-rw-r--r--tests/ui/underscore-imports/basic.rs24
-rw-r--r--tests/ui/underscore-imports/basic.stderr12
-rw-r--r--tests/ui/unresolved/unresolved-import-recovery.rs2
-rw-r--r--tests/ui/unresolved/unresolved-import-recovery.stderr6
-rw-r--r--tests/ui/use/use-mod/use-mod-4.rs2
-rw-r--r--tests/ui/use/use-mod/use-mod-4.stderr20
-rw-r--r--tests/ui/warnings/no-explicit-path-issue-122509.rs4
-rw-r--r--tests/ui/weird-exprs.rs2
52 files changed, 179 insertions, 179 deletions
diff --git a/tests/ui/resolve/auxiliary/issue-80079.rs b/tests/ui/resolve/auxiliary/issue-80079.rs
index 190ca75aba8..bfae5c5a24e 100644
--- a/tests/ui/resolve/auxiliary/issue-80079.rs
+++ b/tests/ui/resolve/auxiliary/issue-80079.rs
@@ -1,7 +1,7 @@
 #![crate_type = "lib"]
 
 pub mod public {
-    use private_import;
+    use crate::private_import;
 
     // should not be suggested since it is private
     struct Foo;
diff --git a/tests/ui/resolve/auxiliary/privacy-struct-ctor.rs b/tests/ui/resolve/auxiliary/privacy-struct-ctor.rs
index 6d0bc728524..ac157a82e17 100644
--- a/tests/ui/resolve/auxiliary/privacy-struct-ctor.rs
+++ b/tests/ui/resolve/auxiliary/privacy-struct-ctor.rs
@@ -2,7 +2,7 @@ pub mod m {
     pub struct S(u8);
 
     pub mod n {
-        pub(in m) struct Z(pub(in m::n) u8);
+        pub(in crate::m) struct Z(pub(in crate::m::n) u8);
     }
 }
 
diff --git a/tests/ui/resolve/issue-42944.rs b/tests/ui/resolve/issue-42944.rs
index 7e439c10b7b..24aa110329b 100644
--- a/tests/ui/resolve/issue-42944.rs
+++ b/tests/ui/resolve/issue-42944.rs
@@ -3,7 +3,7 @@ mod foo {
 }
 
 mod bar {
-    use foo::Bx;
+    use crate::foo::Bx;
 
     fn foo() {
         Bx(());
diff --git a/tests/ui/resolve/issue-5035.rs b/tests/ui/resolve/issue-5035.rs
index 82c4bc0d5ef..a9e2509dde9 100644
--- a/tests/ui/resolve/issue-5035.rs
+++ b/tests/ui/resolve/issue-5035.rs
@@ -4,7 +4,7 @@ trait I {}
 type K = dyn I;
 impl K for isize {} //~ ERROR expected trait, found type alias `K`
 
-use ImportError; //~ ERROR unresolved import `ImportError` [E0432]
+use crate::ImportError; //~ ERROR unresolved import `crate::ImportError` [E0432]
                  //~^ NOTE no `ImportError` in the root
 impl ImportError for () {} // check that this is not an additional error (cf. issue #35142)
 
diff --git a/tests/ui/resolve/issue-5035.stderr b/tests/ui/resolve/issue-5035.stderr
index f5717438fc8..b26c962c9bb 100644
--- a/tests/ui/resolve/issue-5035.stderr
+++ b/tests/ui/resolve/issue-5035.stderr
@@ -1,8 +1,8 @@
-error[E0432]: unresolved import `ImportError`
+error[E0432]: unresolved import `crate::ImportError`
   --> $DIR/issue-5035.rs:7:5
    |
-LL | use ImportError;
-   |     ^^^^^^^^^^^ no `ImportError` in the root
+LL | use crate::ImportError;
+   |     ^^^^^^^^^^^^^^^^^^ no `ImportError` in the root
 
 error[E0404]: expected trait, found type alias `K`
   --> $DIR/issue-5035.rs:5:6
diff --git a/tests/ui/resolve/privacy-enum-ctor.rs b/tests/ui/resolve/privacy-enum-ctor.rs
index f0d2cf8c04e..3f79b12a267 100644
--- a/tests/ui/resolve/privacy-enum-ctor.rs
+++ b/tests/ui/resolve/privacy-enum-ctor.rs
@@ -8,7 +8,7 @@ mod m {
     }
 
     pub mod n {
-        pub(in m) enum Z {
+        pub(in crate::m) enum Z {
             Fn(u8),
             Struct {
                 s: u8,
@@ -17,7 +17,7 @@ mod m {
         }
     }
 
-    use m::n::Z; // OK, only the type is imported
+    use crate::m::n::Z; // OK, only the type is imported
 
     fn f() {
         n::Z;
diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr
index f349b9391d1..4ec1b6b97bd 100644
--- a/tests/ui/resolve/privacy-enum-ctor.stderr
+++ b/tests/ui/resolve/privacy-enum-ctor.stderr
@@ -7,7 +7,7 @@ LL |         n::Z;
 note: the enum is defined here
   --> $DIR/privacy-enum-ctor.rs:11:9
    |
-LL | /         pub(in m) enum Z {
+LL | /         pub(in crate::m) enum Z {
 LL | |             Fn(u8),
 LL | |             Struct {
 LL | |                 s: u8,
@@ -35,7 +35,7 @@ LL |         Z;
 note: the enum is defined here
   --> $DIR/privacy-enum-ctor.rs:11:9
    |
-LL | /         pub(in m) enum Z {
+LL | /         pub(in crate::m) enum Z {
 LL | |             Fn(u8),
 LL | |             Struct {
 LL | |                 s: u8,
@@ -154,8 +154,8 @@ LL |     let _: Z = m::n::Z;
 note: enum `m::Z` exists but is inaccessible
   --> $DIR/privacy-enum-ctor.rs:11:9
    |
-LL |         pub(in m) enum Z {
-   |         ^^^^^^^^^^^^^^^^ not accessible
+LL |         pub(in crate::m) enum Z {
+   |         ^^^^^^^^^^^^^^^^^^^^^^^ not accessible
 
 error[E0423]: expected value, found enum `m::n::Z`
   --> $DIR/privacy-enum-ctor.rs:57:16
@@ -166,7 +166,7 @@ LL |     let _: Z = m::n::Z;
 note: the enum is defined here
   --> $DIR/privacy-enum-ctor.rs:11:9
    |
-LL | /         pub(in m) enum Z {
+LL | /         pub(in crate::m) enum Z {
 LL | |             Fn(u8),
 LL | |             Struct {
 LL | |                 s: u8,
@@ -197,8 +197,8 @@ LL |     let _: Z = m::n::Z::Fn;
 note: enum `m::Z` exists but is inaccessible
   --> $DIR/privacy-enum-ctor.rs:11:9
    |
-LL |         pub(in m) enum Z {
-   |         ^^^^^^^^^^^^^^^^ not accessible
+LL |         pub(in crate::m) enum Z {
+   |         ^^^^^^^^^^^^^^^^^^^^^^^ not accessible
 
 error[E0412]: cannot find type `Z` in this scope
   --> $DIR/privacy-enum-ctor.rs:64:12
@@ -212,8 +212,8 @@ LL |     let _: Z = m::n::Z::Struct;
 note: enum `m::Z` exists but is inaccessible
   --> $DIR/privacy-enum-ctor.rs:11:9
    |
-LL |         pub(in m) enum Z {
-   |         ^^^^^^^^^^^^^^^^ not accessible
+LL |         pub(in crate::m) enum Z {
+   |         ^^^^^^^^^^^^^^^^^^^^^^^ not accessible
 
 error[E0412]: cannot find type `Z` in this scope
   --> $DIR/privacy-enum-ctor.rs:68:12
@@ -227,8 +227,8 @@ LL |     let _: Z = m::n::Z::Unit {};
 note: enum `m::Z` exists but is inaccessible
   --> $DIR/privacy-enum-ctor.rs:11:9
    |
-LL |         pub(in m) enum Z {
-   |         ^^^^^^^^^^^^^^^^ not accessible
+LL |         pub(in crate::m) enum Z {
+   |         ^^^^^^^^^^^^^^^^^^^^^^^ not accessible
 
 error[E0603]: enum `Z` is private
   --> $DIR/privacy-enum-ctor.rs:57:22
@@ -239,8 +239,8 @@ LL |     let _: Z = m::n::Z;
 note: the enum `Z` is defined here
   --> $DIR/privacy-enum-ctor.rs:11:9
    |
-LL |         pub(in m) enum Z {
-   |         ^^^^^^^^^^^^^^^^
+LL |         pub(in crate::m) enum Z {
+   |         ^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0603]: enum `Z` is private
   --> $DIR/privacy-enum-ctor.rs:61:22
@@ -253,8 +253,8 @@ LL |     let _: Z = m::n::Z::Fn;
 note: the enum `Z` is defined here
   --> $DIR/privacy-enum-ctor.rs:11:9
    |
-LL |         pub(in m) enum Z {
-   |         ^^^^^^^^^^^^^^^^
+LL |         pub(in crate::m) enum Z {
+   |         ^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0603]: enum `Z` is private
   --> $DIR/privacy-enum-ctor.rs:64:22
@@ -265,8 +265,8 @@ LL |     let _: Z = m::n::Z::Struct;
 note: the enum `Z` is defined here
   --> $DIR/privacy-enum-ctor.rs:11:9
    |
-LL |         pub(in m) enum Z {
-   |         ^^^^^^^^^^^^^^^^
+LL |         pub(in crate::m) enum Z {
+   |         ^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0603]: enum `Z` is private
   --> $DIR/privacy-enum-ctor.rs:68:22
@@ -279,8 +279,8 @@ LL |     let _: Z = m::n::Z::Unit {};
 note: the enum `Z` is defined here
   --> $DIR/privacy-enum-ctor.rs:11:9
    |
-LL |         pub(in m) enum Z {
-   |         ^^^^^^^^^^^^^^^^
+LL |         pub(in crate::m) enum Z {
+   |         ^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0308]: mismatched types
   --> $DIR/privacy-enum-ctor.rs:27:20
diff --git a/tests/ui/resolve/privacy-struct-ctor.rs b/tests/ui/resolve/privacy-struct-ctor.rs
index da0e9f2fc04..70c751999b7 100644
--- a/tests/ui/resolve/privacy-struct-ctor.rs
+++ b/tests/ui/resolve/privacy-struct-ctor.rs
@@ -9,10 +9,10 @@ mod m {
     }
 
     pub mod n {
-        pub(in m) struct Z(pub(in m::n) u8);
+        pub(in crate::m) struct Z(pub(in crate::m::n) u8);
     }
 
-    use m::n::Z; // OK, only the type is imported
+    use crate::m::n::Z; // OK, only the type is imported
 
     fn f() {
         n::Z;
diff --git a/tests/ui/resolve/privacy-struct-ctor.stderr b/tests/ui/resolve/privacy-struct-ctor.stderr
index 1d8c741c964..0a6b1b46afa 100644
--- a/tests/ui/resolve/privacy-struct-ctor.stderr
+++ b/tests/ui/resolve/privacy-struct-ctor.stderr
@@ -42,8 +42,8 @@ LL |     pub struct S(u8);
 error[E0603]: tuple struct constructor `Z` is private
   --> $DIR/privacy-struct-ctor.rs:18:12
    |
-LL |         pub(in m) struct Z(pub(in m::n) u8);
-   |                            --------------- a constructor is private if any of the fields is private
+LL |         pub(in crate::m) struct Z(pub(in crate::m::n) u8);
+   |                                   ---------------------- a constructor is private if any of the fields is private
 ...
 LL |         n::Z;
    |            ^ private tuple struct constructor
@@ -51,12 +51,12 @@ LL |         n::Z;
 note: the tuple struct constructor `Z` is defined here
   --> $DIR/privacy-struct-ctor.rs:12:9
    |
-LL |         pub(in m) struct Z(pub(in m::n) u8);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |         pub(in crate::m) struct Z(pub(in crate::m::n) u8);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: consider making the field publicly accessible
    |
-LL -         pub(in m) struct Z(pub(in m::n) u8);
-LL +         pub(in m) struct Z(pub u8);
+LL -         pub(in crate::m) struct Z(pub(in crate::m::n) u8);
+LL +         pub(in crate::m) struct Z(pub u8);
    |
 
 error[E0603]: tuple struct constructor `S` is private
@@ -100,8 +100,8 @@ LL |     pub struct S(pub u8);
 error[E0603]: tuple struct constructor `Z` is private
   --> $DIR/privacy-struct-ctor.rs:35:11
    |
-LL |         pub(in m) struct Z(pub(in m::n) u8);
-   |                            --------------- a constructor is private if any of the fields is private
+LL |         pub(in crate::m) struct Z(pub(in crate::m::n) u8);
+   |                                   ---------------------- a constructor is private if any of the fields is private
 ...
 LL |     m::n::Z;
    |           ^ private tuple struct constructor
@@ -109,12 +109,12 @@ LL |     m::n::Z;
 note: the tuple struct constructor `Z` is defined here
   --> $DIR/privacy-struct-ctor.rs:12:9
    |
-LL |         pub(in m) struct Z(pub(in m::n) u8);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |         pub(in crate::m) struct Z(pub(in crate::m::n) u8);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: consider making the field publicly accessible
    |
-LL -         pub(in m) struct Z(pub(in m::n) u8);
-LL +         pub(in m) struct Z(pub u8);
+LL -         pub(in crate::m) struct Z(pub(in crate::m::n) u8);
+LL +         pub(in crate::m) struct Z(pub u8);
    |
 
 error[E0603]: tuple struct constructor `S` is private
@@ -140,16 +140,16 @@ error[E0603]: tuple struct constructor `Z` is private
 LL |     xcrate::m::n::Z;
    |                   ^ private tuple struct constructor
    |
-  ::: $DIR/auxiliary/privacy-struct-ctor.rs:5:28
+  ::: $DIR/auxiliary/privacy-struct-ctor.rs:5:35
    |
-LL |         pub(in m) struct Z(pub(in m::n) u8);
-   |                            --------------- a constructor is private if any of the fields is private
+LL |         pub(in crate::m) struct Z(pub(in crate::m::n) u8);
+   |                                   ---------------------- a constructor is private if any of the fields is private
    |
 note: the tuple struct constructor `Z` is defined here
   --> $DIR/auxiliary/privacy-struct-ctor.rs:5:9
    |
-LL |         pub(in m) struct Z(pub(in m::n) u8);
-   |         ^^^^^^^^^^^^^^^^^^
+LL |         pub(in crate::m) struct Z(pub(in crate::m::n) u8);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 10 previous errors
 
diff --git a/tests/ui/self/self-shadowing-import.rs b/tests/ui/self/self-shadowing-import.rs
index 85574daad5f..78d04e0713a 100644
--- a/tests/ui/self/self-shadowing-import.rs
+++ b/tests/ui/self/self-shadowing-import.rs
@@ -9,7 +9,7 @@ mod a {
 }
 
 mod c {
-    use a::b::a;
+    use crate::a::b::a;
     pub fn bar() { assert_eq!(a::foo(), 1); }
 }
 
diff --git a/tests/ui/sepcomp/auxiliary/sepcomp_lib.rs b/tests/ui/sepcomp/auxiliary/sepcomp_lib.rs
index 59efb3f790b..a0d91c5dc87 100644
--- a/tests/ui/sepcomp/auxiliary/sepcomp_lib.rs
+++ b/tests/ui/sepcomp/auxiliary/sepcomp_lib.rs
@@ -13,8 +13,8 @@ pub mod b {
 }
 
 pub mod c {
-    use a::one;
-    use b::two;
+    use crate::a::one;
+    use crate::b::two;
     pub fn three() -> usize {
         one() + two()
     }
diff --git a/tests/ui/sepcomp/sepcomp-extern.rs b/tests/ui/sepcomp/sepcomp-extern.rs
index 6acd3a1eede..d0756c5f19a 100644
--- a/tests/ui/sepcomp/sepcomp-extern.rs
+++ b/tests/ui/sepcomp/sepcomp-extern.rs
@@ -16,13 +16,13 @@ fn call1() -> usize {
 
 mod a {
     pub fn call2() -> usize {
-        unsafe { ::foo() }
+        unsafe { crate::foo() }
     }
 }
 
 mod b {
     pub fn call3() -> usize {
-        unsafe { ::foo() }
+        unsafe { crate::foo() }
     }
 }
 
diff --git a/tests/ui/sepcomp/sepcomp-fns-backwards.rs b/tests/ui/sepcomp/sepcomp-fns-backwards.rs
index 35326d19d6e..c671771babb 100644
--- a/tests/ui/sepcomp/sepcomp-fns-backwards.rs
+++ b/tests/ui/sepcomp/sepcomp-fns-backwards.rs
@@ -12,13 +12,13 @@ fn pad() -> usize { 0 }
 
 mod b {
     pub fn three() -> usize {
-        ::one() + ::a::two()
+        crate::one() + crate::a::two()
     }
 }
 
 mod a {
     pub fn two() -> usize {
-        ::one() + ::one()
+        crate::one() + crate::one()
     }
 }
 
diff --git a/tests/ui/sepcomp/sepcomp-fns.rs b/tests/ui/sepcomp/sepcomp-fns.rs
index 399193e69b6..1486a2471b8 100644
--- a/tests/ui/sepcomp/sepcomp-fns.rs
+++ b/tests/ui/sepcomp/sepcomp-fns.rs
@@ -13,13 +13,13 @@ fn one() -> usize { 1 }
 
 mod a {
     pub fn two() -> usize {
-        ::one() + ::one()
+        crate::one() + crate::one()
     }
 }
 
 mod b {
     pub fn three() -> usize {
-        ::one() + ::a::two()
+        crate::one() + crate::a::two()
     }
 }
 
diff --git a/tests/ui/sepcomp/sepcomp-statics.rs b/tests/ui/sepcomp/sepcomp-statics.rs
index 580bb628da6..3fe897f3c30 100644
--- a/tests/ui/sepcomp/sepcomp-statics.rs
+++ b/tests/ui/sepcomp/sepcomp-statics.rs
@@ -15,13 +15,13 @@ mod b {
     // that `a` and `b` don't go into the same compilation unit.
     fn pad() -> usize { 0 }
 
-    pub static THREE: usize = ::ONE + ::a::TWO;
+    pub static THREE: usize = crate::ONE + crate::a::TWO;
 }
 
 mod a {
     fn pad() -> usize { 0 }
 
-    pub const TWO: usize = ::ONE + ::ONE;
+    pub const TWO: usize = crate::ONE + crate::ONE;
 }
 
 fn main() {
diff --git a/tests/ui/sepcomp/sepcomp-unwind.rs b/tests/ui/sepcomp/sepcomp-unwind.rs
index 8c25278bb7e..95591676b5e 100644
--- a/tests/ui/sepcomp/sepcomp-unwind.rs
+++ b/tests/ui/sepcomp/sepcomp-unwind.rs
@@ -26,10 +26,10 @@ mod a {
 
 mod b {
     pub fn g() {
-        ::a::f();
+        crate::a::f();
     }
 }
 
 fn main() {
-    thread::spawn(move|| { ::b::g() }).join().unwrap_err();
+    thread::spawn(move|| { b::g() }).join().unwrap_err();
 }
diff --git a/tests/ui/shadowed-use-visibility.rs b/tests/ui/shadowed-use-visibility.rs
index 66181267f98..5ce4103b559 100644
--- a/tests/ui/shadowed-use-visibility.rs
+++ b/tests/ui/shadowed-use-visibility.rs
@@ -5,7 +5,7 @@ mod foo {
     pub fn f() {}
 
     pub use self::f as bar;
-    use foo as bar;
+    use crate::foo as bar;
 }
 
 fn main() {
diff --git a/tests/ui/shadowed/shadowed-trait-methods.rs b/tests/ui/shadowed/shadowed-trait-methods.rs
index f9c25d97913..6cc5159fd08 100644
--- a/tests/ui/shadowed/shadowed-trait-methods.rs
+++ b/tests/ui/shadowed/shadowed-trait-methods.rs
@@ -5,7 +5,7 @@ mod foo {
     impl T for () {}
 }
 
-mod bar { pub use foo::T; }
+mod bar { pub use crate::foo::T; }
 
 fn main() {
     pub use bar::*;
diff --git a/tests/ui/shadowed/shadowed-use-visibility.rs b/tests/ui/shadowed/shadowed-use-visibility.rs
index 6b801972f41..070aeaf1467 100644
--- a/tests/ui/shadowed/shadowed-use-visibility.rs
+++ b/tests/ui/shadowed/shadowed-use-visibility.rs
@@ -1,15 +1,15 @@
 mod foo {
     pub fn f() {}
 
-    use foo as bar;
+    use crate::foo as bar;
     pub use self::f as bar;
 }
 
 mod bar {
-    use foo::bar::f as g; //~ ERROR module import `bar` is private
+    use crate::foo::bar::f as g; //~ ERROR module import `bar` is private
 
-    use foo as f;
-    pub use foo::*;
+    use crate::foo as f;
+    pub use crate::foo::*;
 }
 
 use bar::f::f; //~ ERROR module import `f` is private
diff --git a/tests/ui/shadowed/shadowed-use-visibility.stderr b/tests/ui/shadowed/shadowed-use-visibility.stderr
index 1a642ae6e8e..b062341dc8b 100644
--- a/tests/ui/shadowed/shadowed-use-visibility.stderr
+++ b/tests/ui/shadowed/shadowed-use-visibility.stderr
@@ -1,14 +1,14 @@
 error[E0603]: module import `bar` is private
-  --> $DIR/shadowed-use-visibility.rs:9:14
+  --> $DIR/shadowed-use-visibility.rs:9:21
    |
-LL |     use foo::bar::f as g;
-   |              ^^^ private module import
+LL |     use crate::foo::bar::f as g;
+   |                     ^^^ private module import
    |
 note: the module import `bar` is defined here...
   --> $DIR/shadowed-use-visibility.rs:4:9
    |
-LL |     use foo as bar;
-   |         ^^^^^^^^^^
+LL |     use crate::foo as bar;
+   |         ^^^^^^^^^^^^^^^^^
 note: ...and refers to the module `foo` which is defined here
   --> $DIR/shadowed-use-visibility.rs:1:1
    |
@@ -24,8 +24,8 @@ LL | use bar::f::f;
 note: the module import `f` is defined here...
   --> $DIR/shadowed-use-visibility.rs:11:9
    |
-LL |     use foo as f;
-   |         ^^^^^^^^
+LL |     use crate::foo as f;
+   |         ^^^^^^^^^^^^^^^
 note: ...and refers to the module `foo` which is defined here
   --> $DIR/shadowed-use-visibility.rs:1:1
    |
diff --git a/tests/ui/span/dropck_arr_cycle_checked.rs b/tests/ui/span/dropck_arr_cycle_checked.rs
index a14db5ff089..adecb3f5942 100644
--- a/tests/ui/span/dropck_arr_cycle_checked.rs
+++ b/tests/ui/span/dropck_arr_cycle_checked.rs
@@ -19,7 +19,7 @@ mod s {
 }
 
 mod id {
-    use s;
+    use crate::s;
     #[derive(Debug)]
     pub struct Id {
         orig_count: usize,
diff --git a/tests/ui/span/dropck_vec_cycle_checked.rs b/tests/ui/span/dropck_vec_cycle_checked.rs
index c5d21507d76..b015131caf1 100644
--- a/tests/ui/span/dropck_vec_cycle_checked.rs
+++ b/tests/ui/span/dropck_vec_cycle_checked.rs
@@ -16,7 +16,7 @@ mod s {
 }
 
 mod id {
-    use s;
+    use crate::s;
     #[derive(Debug)]
     pub struct Id {
         orig_count: usize,
diff --git a/tests/ui/span/vec-must-not-hide-type-from-dropck.rs b/tests/ui/span/vec-must-not-hide-type-from-dropck.rs
index 9bfbfab06a0..972ffef2e3c 100644
--- a/tests/ui/span/vec-must-not-hide-type-from-dropck.rs
+++ b/tests/ui/span/vec-must-not-hide-type-from-dropck.rs
@@ -31,7 +31,7 @@ mod s {
 }
 
 mod id {
-    use s;
+    use crate::s;
 
     /// Id represents a globally unique identifier (global across the
     /// current process, that is). When dropped, it automatically
diff --git a/tests/ui/span/visibility-ty-params.rs b/tests/ui/span/visibility-ty-params.rs
index 11c2cf44cb4..05d93e54636 100644
--- a/tests/ui/span/visibility-ty-params.rs
+++ b/tests/ui/span/visibility-ty-params.rs
@@ -3,11 +3,11 @@ macro_rules! m {
 }
 
 struct S<T>(T);
-m!{ S<u8> } //~ ERROR unexpected generic arguments in path
-            //~| ERROR failed to resolve: `S` is a struct, not a module [E0433]
+m!{ crate::S<u8> } //~ ERROR unexpected generic arguments in path
+                   //~| ERROR failed to resolve: `S` is a struct, not a module [E0433]
 
 mod m {
-    m!{ m<> } //~ ERROR unexpected generic arguments in path
+    m!{ crate::m<> } //~ ERROR unexpected generic arguments in path
 }
 
 fn main() {}
diff --git a/tests/ui/span/visibility-ty-params.stderr b/tests/ui/span/visibility-ty-params.stderr
index 97d05c4644e..7b02d79a1bc 100644
--- a/tests/ui/span/visibility-ty-params.stderr
+++ b/tests/ui/span/visibility-ty-params.stderr
@@ -1,20 +1,20 @@
 error: unexpected generic arguments in path
-  --> $DIR/visibility-ty-params.rs:6:6
+  --> $DIR/visibility-ty-params.rs:6:13
    |
-LL | m!{ S<u8> }
-   |      ^^^^
+LL | m!{ crate::S<u8> }
+   |             ^^^^
 
 error[E0433]: failed to resolve: `S` is a struct, not a module
-  --> $DIR/visibility-ty-params.rs:6:5
+  --> $DIR/visibility-ty-params.rs:6:12
    |
-LL | m!{ S<u8> }
-   |     ^ `S` is a struct, not a module
+LL | m!{ crate::S<u8> }
+   |            ^ `S` is a struct, not a module
 
 error: unexpected generic arguments in path
-  --> $DIR/visibility-ty-params.rs:10:10
+  --> $DIR/visibility-ty-params.rs:10:17
    |
-LL |     m!{ m<> }
-   |          ^^
+LL |     m!{ crate::m<> }
+   |                 ^^
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/static/auxiliary/static_priv_by_default.rs b/tests/ui/static/auxiliary/static_priv_by_default.rs
index 39f912066ec..fe9aef42feb 100644
--- a/tests/ui/static/auxiliary/static_priv_by_default.rs
+++ b/tests/ui/static/auxiliary/static_priv_by_default.rs
@@ -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;
diff --git a/tests/ui/static/static-extern-type.rs b/tests/ui/static/static-extern-type.rs
index 8b022a5c31c..2597c22ed7e 100644
--- a/tests/ui/static/static-extern-type.rs
+++ b/tests/ui/static/static-extern-type.rs
@@ -10,7 +10,7 @@ pub mod a {
 
 pub mod b {
     #[repr(transparent)]
-    pub struct TransparentType(::a::StartFn);
+    pub struct TransparentType(crate::a::StartFn);
     extern "C" {
         pub static start: TransparentType;
     }
@@ -18,7 +18,7 @@ pub mod b {
 
 pub mod c {
     #[repr(C)]
-    pub struct CType(u32, ::b::TransparentType);
+    pub struct CType(u32, crate::b::TransparentType);
     extern "C" {
         pub static start: CType;
     }
diff --git a/tests/ui/statics/auxiliary/static_fn_inline_xc_aux.rs b/tests/ui/statics/auxiliary/static_fn_inline_xc_aux.rs
index 8d0f7f61ced..a739e8f2dbe 100644
--- a/tests/ui/statics/auxiliary/static_fn_inline_xc_aux.rs
+++ b/tests/ui/statics/auxiliary/static_fn_inline_xc_aux.rs
@@ -5,7 +5,7 @@ pub mod num {
 }
 
 pub mod f64 {
-    impl ::num::Num2 for f64 {
+    impl crate::num::Num2 for f64 {
         #[inline]
         fn from_int2(n: isize) -> f64 { return n as f64;  }
     }
diff --git a/tests/ui/statics/auxiliary/static_fn_trait_xc_aux.rs b/tests/ui/statics/auxiliary/static_fn_trait_xc_aux.rs
index b8aed2c5f54..ab73bac3bf8 100644
--- a/tests/ui/statics/auxiliary/static_fn_trait_xc_aux.rs
+++ b/tests/ui/statics/auxiliary/static_fn_trait_xc_aux.rs
@@ -5,7 +5,7 @@ pub mod num {
 }
 
 pub mod f64 {
-    impl ::num::Num2 for f64 {
+    impl crate::num::Num2 for f64 {
         fn from_int2(n: isize) -> f64 { return n as f64;  }
     }
 }
diff --git a/tests/ui/statics/static-impl.rs b/tests/ui/statics/static-impl.rs
index 37f3cd13133..5c8d20da0c6 100644
--- a/tests/ui/statics/static-impl.rs
+++ b/tests/ui/statics/static-impl.rs
@@ -9,12 +9,12 @@ pub trait plus {
 }
 
 mod a {
-    use plus;
+    use crate::plus;
     impl plus for usize { fn plus(&self) -> isize { *self as isize + 20 } }
 }
 
 mod b {
-    use plus;
+    use crate::plus;
     impl plus for String { fn plus(&self) -> isize { 200 } }
 }
 
diff --git a/tests/ui/structs-enums/issue-2718-a.rs b/tests/ui/structs-enums/issue-2718-a.rs
index 6c491584540..f799a82447f 100644
--- a/tests/ui/structs-enums/issue-2718-a.rs
+++ b/tests/ui/structs-enums/issue-2718-a.rs
@@ -3,7 +3,7 @@ pub struct SendPacket<T> {
 }
 
 mod pingpong {
-    use SendPacket;
+    use crate::SendPacket;
     pub type Ping = SendPacket<Pong>;
     pub struct Pong(SendPacket<Ping>);
     //~^ ERROR recursive type `Pong` has infinite size
diff --git a/tests/ui/structs-enums/namespaced-enum-glob-import.rs b/tests/ui/structs-enums/namespaced-enum-glob-import.rs
index e8a709d5bd0..82742a934c4 100644
--- a/tests/ui/structs-enums/namespaced-enum-glob-import.rs
+++ b/tests/ui/structs-enums/namespaced-enum-glob-import.rs
@@ -14,7 +14,7 @@ mod m2 {
 }
 
 mod m {
-    pub use m2::Foo::*;
+    pub use crate::m2::Foo::*;
 }
 
 fn _f(f: m2::Foo) {
diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr
index f4b669d7fcd..d344f246941 100644
--- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr
+++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr
@@ -3,20 +3,20 @@ error: associated item referring to unboxed trait object for its own trait
    |
 LL | trait A: Sized {
    |       - in this trait
-LL |     fn f(a: A) -> A;
-   |             ^     ^
+LL |     fn f(a: dyn A) -> dyn A;
+   |             ^^^^^     ^^^^^
    |
 help: you might have meant to use `Self` to refer to the implementing type
    |
-LL -     fn f(a: A) -> A;
+LL -     fn f(a: dyn A) -> dyn A;
 LL +     fn f(a: Self) -> Self;
    |
 
 error[E0038]: the trait `A` is not dyn compatible
   --> $DIR/dyn-incompatible-trait-should-use-self.rs:3:13
    |
-LL |     fn f(a: A) -> A;
-   |             ^ `A` is not dyn compatible
+LL |     fn f(a: dyn A) -> dyn A;
+   |             ^^^^^ `A` is not dyn compatible
    |
 note: for a trait to be dyn compatible it needs to allow building a vtable
       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
@@ -32,20 +32,20 @@ error: associated item referring to unboxed trait object for its own trait
    |
 LL | trait B {
    |       - in this trait
-LL |     fn f(a: B) -> B;
-   |             ^     ^
+LL |     fn f(a: dyn B) -> dyn B;
+   |             ^^^^^     ^^^^^
    |
 help: you might have meant to use `Self` to refer to the implementing type
    |
-LL -     fn f(a: B) -> B;
+LL -     fn f(a: dyn B) -> dyn B;
 LL +     fn f(a: Self) -> Self;
    |
 
 error[E0038]: the trait `B` is not dyn compatible
   --> $DIR/dyn-incompatible-trait-should-use-self.rs:8:13
    |
-LL |     fn f(a: B) -> B;
-   |             ^ `B` is not dyn compatible
+LL |     fn f(a: dyn B) -> dyn B;
+   |             ^^^^^ `B` is not dyn compatible
    |
 note: for a trait to be dyn compatible it needs to allow building a vtable
       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
@@ -53,16 +53,16 @@ note: for a trait to be dyn compatible it needs to allow building a vtable
    |
 LL | trait B {
    |       - this trait is not dyn compatible...
-LL |     fn f(a: B) -> B;
+LL |     fn f(a: dyn B) -> dyn B;
    |        ^ ...because associated function `f` has no `self` parameter
 help: consider turning `f` into a method by giving it a `&self` argument
    |
-LL |     fn f(&self, a: B) -> B;
+LL |     fn f(&self, a: dyn B) -> dyn B;
    |          ++++++
 help: alternatively, consider constraining `f` so it does not apply to trait objects
    |
-LL |     fn f(a: B) -> B where Self: Sized;
-   |                     +++++++++++++++++
+LL |     fn f(a: dyn B) -> dyn B where Self: Sized;
+   |                             +++++++++++++++++
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/symbol-names/impl1.rs b/tests/ui/symbol-names/impl1.rs
index 694cd89bd80..0fdf5645479 100644
--- a/tests/ui/symbol-names/impl1.rs
+++ b/tests/ui/symbol-names/impl1.rs
@@ -26,7 +26,7 @@ mod foo {
 }
 
 mod bar {
-    use foo::Foo;
+    use crate::foo::Foo;
 
     impl Foo {
         #[rustc_symbol_name]
diff --git a/tests/ui/symbol-names/issue-53912.rs b/tests/ui/symbol-names/issue-53912.rs
index 194416cdb70..ba28316b0bf 100644
--- a/tests/ui/symbol-names/issue-53912.rs
+++ b/tests/ui/symbol-names/issue-53912.rs
@@ -12,13 +12,13 @@ mod llvm {
 mod foo {
     pub(crate) struct Foo<T>(T);
 
-    impl Foo<::llvm::Foo> {
+    impl Foo<crate::llvm::Foo> {
         pub(crate) fn foo() {
             for _ in 0..0 {
-                for _ in &[::dummy()] {
-                    ::dummy();
-                    ::dummy();
-                    ::dummy();
+                for _ in &[crate::dummy()] {
+                    crate::dummy();
+                    crate::dummy();
+                    crate::dummy();
                 }
             }
         }
diff --git a/tests/ui/symbol-names/issue-60925.rs b/tests/ui/symbol-names/issue-60925.rs
index ca0f21b7a78..24969fc6641 100644
--- a/tests/ui/symbol-names/issue-60925.rs
+++ b/tests/ui/symbol-names/issue-60925.rs
@@ -17,7 +17,7 @@ mod llvm {
 mod foo {
     pub(crate) struct Foo<T>(T);
 
-    impl Foo<::llvm::Foo> {
+    impl Foo<crate::llvm::Foo> {
         #[rustc_symbol_name]
         //[legacy]~^ ERROR symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo
         //[legacy]~| ERROR demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo
@@ -27,10 +27,10 @@ mod foo {
             //[v0]~| ERROR demangling-alt(<issue_60925::foo::Foo<issue_60925::llvm::Foo>>::foo)
         pub(crate) fn foo() {
             for _ in 0..0 {
-                for _ in &[::dummy()] {
-                    ::dummy();
-                    ::dummy();
-                    ::dummy();
+                for _ in &[crate::dummy()] {
+                    crate::dummy();
+                    crate::dummy();
+                    crate::dummy();
                 }
             }
         }
diff --git a/tests/ui/threads-sendsync/thread-local-syntax.rs b/tests/ui/threads-sendsync/thread-local-syntax.rs
index 2cf91f0c1f7..9492e1c93e2 100644
--- a/tests/ui/threads-sendsync/thread-local-syntax.rs
+++ b/tests/ui/threads-sendsync/thread-local-syntax.rs
@@ -13,7 +13,7 @@ mod foo {
 
             // look at these restrictions!!
             pub(crate) static BAZ: usize = 0;
-            pub(in foo) static QUUX: usize = 0;
+            pub(in crate::foo) static QUUX: usize = 0;
         }
         thread_local!(static SPLOK: u32 = 0);
     }
diff --git a/tests/ui/traits/impl-2.rs b/tests/ui/traits/impl-2.rs
index c6f60a9081c..41fa1cd334f 100644
--- a/tests/ui/traits/impl-2.rs
+++ b/tests/ui/traits/impl-2.rs
@@ -10,7 +10,7 @@ pub mod Foo {
 }
 
 mod Bar {
-    impl<'a> dyn (::Foo::Trait) + 'a {
+    impl<'a> dyn (crate::Foo::Trait) + 'a {
         fn bar(&self) { self.foo() }
     }
 }
diff --git a/tests/ui/traits/item-privacy.rs b/tests/ui/traits/item-privacy.rs
index 9f75e6e4c12..b8724399e32 100644
--- a/tests/ui/traits/item-privacy.rs
+++ b/tests/ui/traits/item-privacy.rs
@@ -15,9 +15,9 @@ mod method {
         fn c(&self) { }
     }
 
-    impl A for ::S {}
-    impl B for ::S {}
-    impl C for ::S {}
+    impl A for crate::S {}
+    impl B for crate::S {}
+    impl C for crate::S {}
 }
 
 mod assoc_const {
@@ -33,9 +33,9 @@ mod assoc_const {
         const C: u8 = 0;
     }
 
-    impl A for ::S {}
-    impl B for ::S {}
-    impl C for ::S {}
+    impl A for crate::S {}
+    impl B for crate::S {}
+    impl C for crate::S {}
 }
 
 mod assoc_ty {
@@ -51,9 +51,9 @@ mod assoc_ty {
         type C = u8;
     }
 
-    impl A for ::S {}
-    impl B for ::S {}
-    impl C for ::S {}
+    impl A for crate::S {}
+    impl B for crate::S {}
+    impl C for crate::S {}
 }
 
 fn check_method() {
diff --git a/tests/ui/traits/static-method-overwriting.rs b/tests/ui/traits/static-method-overwriting.rs
index 7a2a51a4b99..28edcde4c49 100644
--- a/tests/ui/traits/static-method-overwriting.rs
+++ b/tests/ui/traits/static-method-overwriting.rs
@@ -9,7 +9,7 @@ mod base {
         dummy: (),
     }
 
-    impl ::base::HasNew for Foo {
+    impl crate::base::HasNew for Foo {
         fn new() -> Foo {
             println!("Foo");
             Foo { dummy: () }
@@ -20,7 +20,7 @@ mod base {
         dummy: (),
     }
 
-    impl ::base::HasNew for Bar {
+    impl crate::base::HasNew for Bar {
         fn new() -> Bar {
             println!("Bar");
             Bar { dummy: () }
diff --git a/tests/ui/tuple/tuple-struct-fields/test.rs b/tests/ui/tuple/tuple-struct-fields/test.rs
index 00677090d78..29aabf4579b 100644
--- a/tests/ui/tuple/tuple-struct-fields/test.rs
+++ b/tests/ui/tuple/tuple-struct-fields/test.rs
@@ -1,6 +1,6 @@
 mod foo {
     type T = ();
-    struct S1(pub(in foo) (), pub(T), pub(crate) (), pub(((), T)));
+    struct S1(pub(in crate::foo) (), pub(T), pub(crate) (), pub(((), T)));
     struct S2(pub((foo)) ());
     //~^ ERROR expected one of `)` or `,`, found `(`
     //~| ERROR cannot find type `foo` in this scope
diff --git a/tests/ui/tuple/tuple-struct-fields/test2.rs b/tests/ui/tuple/tuple-struct-fields/test2.rs
index 2b2a2c127e9..544d486752c 100644
--- a/tests/ui/tuple/tuple-struct-fields/test2.rs
+++ b/tests/ui/tuple/tuple-struct-fields/test2.rs
@@ -1,7 +1,7 @@
 macro_rules! define_struct {
     ($t:ty) => {
         struct S1(pub $t);
-        struct S2(pub (in foo) ());
+        struct S2(pub (in crate::foo) ());
         struct S3(pub $t ());
         //~^ ERROR expected one of `)` or `,`, found `(`
     }
diff --git a/tests/ui/tuple/tuple-struct-fields/test3.rs b/tests/ui/tuple/tuple-struct-fields/test3.rs
index 98d19426e77..b5f98a65fa6 100644
--- a/tests/ui/tuple/tuple-struct-fields/test3.rs
+++ b/tests/ui/tuple/tuple-struct-fields/test3.rs
@@ -1,7 +1,7 @@
 macro_rules! define_struct {
     ($t:ty) => {
         struct S1(pub($t));
-        struct S2(pub (in foo) ());
+        struct S2(pub (in crate::foo) ());
         struct S3(pub($t) ());
         //~^ ERROR expected one of `)` or `,`, found `(`
     }
diff --git a/tests/ui/type/issue-7607-2.rs b/tests/ui/type/issue-7607-2.rs
index ebc4fe1c2d3..53fafdf9489 100644
--- a/tests/ui/type/issue-7607-2.rs
+++ b/tests/ui/type/issue-7607-2.rs
@@ -6,7 +6,7 @@ pub mod a {
 }
 
 pub mod b {
-    use a::Foo;
+    use crate::a::Foo;
     impl Foo {
         fn bar(&self) { }
     }
diff --git a/tests/ui/underscore-imports/basic.rs b/tests/ui/underscore-imports/basic.rs
index 624ecb47ca6..8d8ff5c47bc 100644
--- a/tests/ui/underscore-imports/basic.rs
+++ b/tests/ui/underscore-imports/basic.rs
@@ -18,25 +18,25 @@ mod m {
         fn tr2_is_in_scope(&self) {}
     }
 
-    impl Tr1 for ::S {}
-    impl Tr2 for ::S {}
+    impl Tr1 for crate::S {}
+    impl Tr2 for crate::S {}
 }
 
 mod unused {
-    use m::Tr1 as _; //~ WARN unused import
-    use S as _; //~ WARN unused import
+    use crate::m::Tr1 as _; //~ WARN unused import
+    use crate::S as _; //~ WARN unused import
     extern crate core as _; // OK
 }
 
 mod outer {
     mod middle {
-        pub use m::Tr1 as _;
-        pub use m::Tr2 as _; // OK, no name conflict
+        pub use crate::m::Tr1 as _;
+        pub use crate::m::Tr2 as _; // OK, no name conflict
         struct Tr1; // OK, no name conflict
         fn check() {
             // Both traits are in scope
-            ::S.tr1_is_in_scope();
-            ::S.tr2_is_in_scope();
+            crate::S.tr1_is_in_scope();
+            crate::S.tr2_is_in_scope();
         }
 
         mod inner {
@@ -44,8 +44,8 @@ mod outer {
             use super::*;
             fn check() {
                 // Both traits are in scope
-                ::S.tr1_is_in_scope();
-                ::S.tr2_is_in_scope();
+                crate::S.tr1_is_in_scope();
+                crate::S.tr2_is_in_scope();
             }
         }
     }
@@ -54,8 +54,8 @@ mod outer {
     use self::middle::*;
     fn check() {
         // Both traits are in scope
-        ::S.tr1_is_in_scope();
-        ::S.tr2_is_in_scope();
+        crate::S.tr1_is_in_scope();
+        crate::S.tr2_is_in_scope();
     }
 }
 
diff --git a/tests/ui/underscore-imports/basic.stderr b/tests/ui/underscore-imports/basic.stderr
index c51493562eb..666d07349df 100644
--- a/tests/ui/underscore-imports/basic.stderr
+++ b/tests/ui/underscore-imports/basic.stderr
@@ -1,8 +1,8 @@
-warning: unused import: `m::Tr1 as _`
+warning: unused import: `crate::m::Tr1 as _`
   --> $DIR/basic.rs:26:9
    |
-LL |     use m::Tr1 as _;
-   |         ^^^^^^^^^^^
+LL |     use crate::m::Tr1 as _;
+   |         ^^^^^^^^^^^^^^^^^^
    |
 note: the lint level is defined here
   --> $DIR/basic.rs:4:9
@@ -10,11 +10,11 @@ note: the lint level is defined here
 LL | #![warn(unused_imports, unused_extern_crates)]
    |         ^^^^^^^^^^^^^^
 
-warning: unused import: `S as _`
+warning: unused import: `crate::S as _`
   --> $DIR/basic.rs:27:9
    |
-LL |     use S as _;
-   |         ^^^^^^
+LL |     use crate::S as _;
+   |         ^^^^^^^^^^^^^
 
 warning: 2 warnings emitted
 
diff --git a/tests/ui/unresolved/unresolved-import-recovery.rs b/tests/ui/unresolved/unresolved-import-recovery.rs
index 0b0653378cb..8657bb661a8 100644
--- a/tests/ui/unresolved/unresolved-import-recovery.rs
+++ b/tests/ui/unresolved/unresolved-import-recovery.rs
@@ -1,7 +1,7 @@
 // Check that unresolved imports do not create additional errors and ICEs
 
 mod m {
-    pub use unresolved; //~ ERROR unresolved import `unresolved`
+    pub use crate::unresolved; //~ ERROR unresolved import `crate::unresolved`
 
     fn f() {
         let unresolved = 0; // OK
diff --git a/tests/ui/unresolved/unresolved-import-recovery.stderr b/tests/ui/unresolved/unresolved-import-recovery.stderr
index 1c006049756..ec41c9e79d7 100644
--- a/tests/ui/unresolved/unresolved-import-recovery.stderr
+++ b/tests/ui/unresolved/unresolved-import-recovery.stderr
@@ -1,8 +1,8 @@
-error[E0432]: unresolved import `unresolved`
+error[E0432]: unresolved import `crate::unresolved`
   --> $DIR/unresolved-import-recovery.rs:4:13
    |
-LL |     pub use unresolved;
-   |             ^^^^^^^^^^ no `unresolved` in the root
+LL |     pub use crate::unresolved;
+   |             ^^^^^^^^^^^^^^^^^ no `unresolved` in the root
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/use/use-mod/use-mod-4.rs b/tests/ui/use/use-mod/use-mod-4.rs
index 46ae8ddadc0..34ce7c71957 100644
--- a/tests/ui/use/use-mod/use-mod-4.rs
+++ b/tests/ui/use/use-mod/use-mod-4.rs
@@ -1,4 +1,4 @@
-use foo::self; //~ ERROR unresolved import `foo`
+use crate::foo::self; //~ ERROR unresolved import `crate::foo`
 //~^ ERROR `self` imports are only allowed within a { } list
 
 use std::mem::self;
diff --git a/tests/ui/use/use-mod/use-mod-4.stderr b/tests/ui/use/use-mod/use-mod-4.stderr
index 0b4fbadb458..d4621296c0d 100644
--- a/tests/ui/use/use-mod/use-mod-4.stderr
+++ b/tests/ui/use/use-mod/use-mod-4.stderr
@@ -1,18 +1,18 @@
 error[E0429]: `self` imports are only allowed within a { } list
-  --> $DIR/use-mod-4.rs:1:8
+  --> $DIR/use-mod-4.rs:1:15
    |
-LL | use foo::self;
-   |        ^^^^^^
+LL | use crate::foo::self;
+   |               ^^^^^^
    |
 help: consider importing the module directly
    |
-LL - use foo::self;
-LL + use foo;
+LL - use crate::foo::self;
+LL + use crate::foo;
    |
 help: alternatively, use the multi-path `use` syntax to import `self`
    |
-LL | use foo::{self};
-   |          +    +
+LL | use crate::foo::{self};
+   |                 +    +
 
 error[E0429]: `self` imports are only allowed within a { } list
   --> $DIR/use-mod-4.rs:4:13
@@ -30,11 +30,11 @@ help: alternatively, use the multi-path `use` syntax to import `self`
 LL | use std::mem::{self};
    |               +    +
 
-error[E0432]: unresolved import `foo`
+error[E0432]: unresolved import `crate::foo`
   --> $DIR/use-mod-4.rs:1:5
    |
-LL | use foo::self;
-   |     ^^^^^^^^^ no `foo` in the root
+LL | use crate::foo::self;
+   |     ^^^^^^^^^^^^^^^^ no `foo` in the root
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/warnings/no-explicit-path-issue-122509.rs b/tests/ui/warnings/no-explicit-path-issue-122509.rs
index 4e8eefde5da..5be4b174076 100644
--- a/tests/ui/warnings/no-explicit-path-issue-122509.rs
+++ b/tests/ui/warnings/no-explicit-path-issue-122509.rs
@@ -7,13 +7,13 @@ fn one() -> usize {
 
 pub mod a {
     pub fn two() -> usize {
-        ::one() + ::one()
+        crate::one() + crate::one()
     }
 }
 
 pub mod b {
     pub fn three() -> usize {
-        ::one() + ::a::two()
+        crate::one() + crate::a::two()
     }
 }
 
diff --git a/tests/ui/weird-exprs.rs b/tests/ui/weird-exprs.rs
index b24e754a4ec..7db92d46067 100644
--- a/tests/ui/weird-exprs.rs
+++ b/tests/ui/weird-exprs.rs
@@ -105,7 +105,7 @@ fn u8(u8: u8) {
 
             u8!(u8);
             let &u8: &u8 = u8::u8(&8u8);
-            ::u8(0u8);
+            crate::u8(0u8);
             u8
         });
     }