mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
Resolve visibility paths as modules not as types.
This commit is contained in:
parent
7a5d2d0138
commit
2faa2626cc
@ -278,7 +278,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
|
||||
};
|
||||
match self.r.resolve_path(
|
||||
&segments,
|
||||
Some(TypeNS),
|
||||
None,
|
||||
parent_scope,
|
||||
finalize.then(|| Finalize::new(id, path.span)),
|
||||
None,
|
||||
|
11
tests/ui/resolve/unresolved-segments-visibility.rs
Normal file
11
tests/ui/resolve/unresolved-segments-visibility.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// Check that we do not ICE due to unresolved segments in visibility path.
|
||||
#![crate_type = "lib"]
|
||||
|
||||
extern crate alloc as b;
|
||||
|
||||
mod foo {
|
||||
mod bar {
|
||||
pub(in b::string::String::newy) extern crate alloc as e;
|
||||
//~^ ERROR failed to resolve: `String` is a struct, not a module [E0433]
|
||||
}
|
||||
}
|
9
tests/ui/resolve/unresolved-segments-visibility.stderr
Normal file
9
tests/ui/resolve/unresolved-segments-visibility.stderr
Normal file
@ -0,0 +1,9 @@
|
||||
error[E0433]: failed to resolve: `String` is a struct, not a module
|
||||
--> $DIR/unresolved-segments-visibility.rs:8:27
|
||||
|
|
||||
LL | pub(in b::string::String::newy) extern crate alloc as e;
|
||||
| ^^^^^^ `String` is a struct, not a module
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0433`.
|
@ -4,7 +4,7 @@ macro_rules! m {
|
||||
|
||||
struct S<T>(T);
|
||||
m!{ S<u8> } //~ ERROR unexpected generic arguments in path
|
||||
//~| ERROR expected module, found struct `S`
|
||||
//~| ERROR failed to resolve: `S` is a struct, not a module [E0433]
|
||||
|
||||
mod m {
|
||||
m!{ m<> } //~ ERROR unexpected generic arguments in path
|
||||
|
@ -4,11 +4,11 @@ error: unexpected generic arguments in path
|
||||
LL | m!{ S<u8> }
|
||||
| ^^^^
|
||||
|
||||
error[E0577]: expected module, found struct `S`
|
||||
error[E0433]: failed to resolve: `S` is a struct, not a module
|
||||
--> $DIR/visibility-ty-params.rs:6:5
|
||||
|
|
||||
LL | m!{ S<u8> }
|
||||
| ^^^^^ not a module
|
||||
| ^ `S` is a struct, not a module
|
||||
|
||||
error: unexpected generic arguments in path
|
||||
--> $DIR/visibility-ty-params.rs:10:10
|
||||
@ -18,4 +18,4 @@ LL | m!{ m<> }
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0577`.
|
||||
For more information about this error, try `rustc --explain E0433`.
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
|
||||
error[E0433]: failed to resolve: `Self` cannot be used in imports
|
||||
--> $DIR/use-self-type.rs:7:16
|
||||
|
|
||||
LL | pub(in Self::f) struct Z;
|
||||
| ^^^^ `Self` is only available in impls, traits, and type definitions
|
||||
| ^^^^ `Self` cannot be used in imports
|
||||
|
||||
error[E0432]: unresolved import `Self`
|
||||
--> $DIR/use-self-type.rs:6:13
|
||||
|
Loading…
Reference in New Issue
Block a user