Skip to content

More simple 2015 edition test decoupling #142066

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions tests/ui/auxiliary/typeid-intrinsic-aux1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ pub struct E(Result<&'static str, isize>);
pub type F = Option<isize>;
pub type G = usize;
pub type H = &'static str;
pub type I = Box<Fn()>;
pub type I32Iterator = Iterator<Item=i32>;
pub type U32Iterator = Iterator<Item=u32>;
pub type I = Box<dyn Fn()>;
pub type I32Iterator = dyn Iterator<Item=i32>;
pub type U32Iterator = dyn Iterator<Item=u32>;

pub fn id_A() -> TypeId { TypeId::of::<A>() }
pub fn id_B() -> TypeId { TypeId::of::<B>() }
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/auxiliary/typeid-intrinsic-aux2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ pub struct E(Result<&'static str, isize>);
pub type F = Option<isize>;
pub type G = usize;
pub type H = &'static str;
pub type I = Box<Fn()>;
pub type I32Iterator = Iterator<Item=i32>;
pub type U32Iterator = Iterator<Item=u32>;
pub type I = Box<dyn Fn()>;
pub type I32Iterator = dyn Iterator<Item=i32>;
pub type U32Iterator = dyn Iterator<Item=u32>;

pub fn id_A() -> TypeId { TypeId::of::<A>() }
pub fn id_B() -> TypeId { TypeId::of::<B>() }
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/resolve/auxiliary/issue-80079.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/resolve/auxiliary/privacy-struct-ctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/resolve/extern-prelude-fail.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ compile-flags:--extern extern_prelude
//@ aux-build:extern-prelude.rs

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/resolve/extern-prelude-fail.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0432]: unresolved import `extern_prelude`
--> $DIR/extern-prelude-fail.rs:7:9
--> $DIR/extern-prelude-fail.rs:8:9
|
LL | use extern_prelude::S;
| ^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `extern_prelude`
Expand All @@ -10,7 +10,7 @@ LL + extern crate extern_prelude;
|

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `extern_prelude`
--> $DIR/extern-prelude-fail.rs:8:15
--> $DIR/extern-prelude-fail.rs:9:15
|
LL | let s = ::extern_prelude::S;
| ^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `extern_prelude`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/resolve/issue-42944.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod foo {
}

mod bar {
use foo::Bx;
use crate::foo::Bx;

fn foo() {
Bx(());
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/resolve/issue-5035.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions tests/ui/resolve/issue-5035.stderr
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/resolve/privacy-enum-ctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
38 changes: 19 additions & 19 deletions tests/ui/resolve/privacy-enum-ctor.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/resolve/privacy-struct-ctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
34 changes: 17 additions & 17 deletions tests/ui/resolve/privacy-struct-ctor.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ 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
|
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
Expand Down Expand Up @@ -100,21 +100,21 @@ 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
|
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
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions tests/ui/resolve/resolve-bad-visibility.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
enum E {}
trait Tr {}

Expand Down
10 changes: 5 additions & 5 deletions tests/ui/resolve/resolve-bad-visibility.stderr
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
error[E0577]: expected module, found enum `E`
--> $DIR/resolve-bad-visibility.rs:4:8
--> $DIR/resolve-bad-visibility.rs:5:8
|
LL | pub(in E) struct S;
| ^ not a module

error[E0577]: expected module, found trait `Tr`
--> $DIR/resolve-bad-visibility.rs:5:8
--> $DIR/resolve-bad-visibility.rs:6:8
|
LL | pub(in Tr) struct Z;
| ^^ not a module

error[E0742]: visibilities can only be restricted to ancestor modules
--> $DIR/resolve-bad-visibility.rs:6:8
--> $DIR/resolve-bad-visibility.rs:7:8
|
LL | pub(in std::vec) struct F;
| ^^^^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistent`
--> $DIR/resolve-bad-visibility.rs:7:8
--> $DIR/resolve-bad-visibility.rs:8:8
|
LL | pub(in nonexistent) struct G;
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `nonexistent`
Expand All @@ -28,7 +28,7 @@ LL + extern crate nonexistent;
|

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `too_soon`
--> $DIR/resolve-bad-visibility.rs:8:8
--> $DIR/resolve-bad-visibility.rs:9:8
|
LL | pub(in too_soon) struct H;
| ^^^^^^^^ use of unresolved module or unlinked crate `too_soon`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/resolve/suggest-builder-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Bar {
}

mod SomeMod {
use Bar;
use crate::Bar;

impl Bar {
// Public method. Should be suggested
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/resolve/unresolved-segments-visibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extern crate alloc as b;

mod foo {
mod bar {
pub(in b::string::String::newy) extern crate alloc as e;
pub(in crate::b::string::String::newy) extern crate alloc as e;
//~^ ERROR failed to resolve: `String` is a struct, not a module [E0433]
}
}
6 changes: 3 additions & 3 deletions tests/ui/resolve/unresolved-segments-visibility.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0433]: failed to resolve: `String` is a struct, not a module
--> $DIR/unresolved-segments-visibility.rs:8:27
--> $DIR/unresolved-segments-visibility.rs:8:34
|
LL | pub(in b::string::String::newy) extern crate alloc as e;
| ^^^^^^ `String` is a struct, not a module
LL | pub(in crate::b::string::String::newy) extern crate alloc as e;
| ^^^^^^ `String` is a struct, not a module

error: aborting due to 1 previous error

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ run-rustfix

#![deny(absolute_paths_not_starting_with_crate)]
Expand Down
Loading
Loading