Use non-2015 edition paths in tests that do not test for their resolution
This commit is contained in:
parent
81a964c23e
commit
46326e159f
52 changed files with 179 additions and 179 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ mod foo {
|
|||
}
|
||||
|
||||
mod bar {
|
||||
use foo::Bx;
|
||||
use crate::foo::Bx;
|
||||
|
||||
fn foo() {
|
||||
Bx(());
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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); }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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::*;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ mod s {
|
|||
}
|
||||
|
||||
mod id {
|
||||
use s;
|
||||
use crate::s;
|
||||
#[derive(Debug)]
|
||||
pub struct Id {
|
||||
orig_count: usize,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ mod s {
|
|||
}
|
||||
|
||||
mod id {
|
||||
use s;
|
||||
use crate::s;
|
||||
#[derive(Debug)]
|
||||
pub struct Id {
|
||||
orig_count: usize,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 } }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ mod m2 {
|
|||
}
|
||||
|
||||
mod m {
|
||||
pub use m2::Foo::*;
|
||||
pub use crate::m2::Foo::*;
|
||||
}
|
||||
|
||||
fn _f(f: m2::Foo) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ mod foo {
|
|||
}
|
||||
|
||||
mod bar {
|
||||
use foo::Foo;
|
||||
use crate::foo::Foo;
|
||||
|
||||
impl Foo {
|
||||
#[rustc_symbol_name]
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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: () }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 `(`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 `(`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pub mod a {
|
|||
}
|
||||
|
||||
pub mod b {
|
||||
use a::Foo;
|
||||
use crate::a::Foo;
|
||||
impl Foo {
|
||||
fn bar(&self) { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ fn u8(u8: u8) {
|
|||
|
||||
u8!(u8);
|
||||
let &u8: &u8 = u8::u8(&8u8);
|
||||
::u8(0u8);
|
||||
crate::u8(0u8);
|
||||
u8
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue