Skip to content

Commit f433c13

Browse files
Rollup merge of #153138 - mu001999-contrib:print-path-root, r=petrochenkov
Print path root when printing path Extracted from #152996. r? petrochenkov
2 parents 5bb3260 + dfd18b7 commit f433c13

9 files changed

Lines changed: 17 additions & 17 deletions

File tree

compiler/rustc_resolve/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2504,7 +2504,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
25042504

25052505
fn names_to_string(names: impl Iterator<Item = Symbol>) -> String {
25062506
let mut result = String::new();
2507-
for (i, name) in names.filter(|name| *name != kw::PathRoot).enumerate() {
2507+
for (i, name) in names.enumerate().filter(|(_, name)| *name != kw::PathRoot) {
25082508
if i > 0 {
25092509
result.push_str("::");
25102510
}

tests/ui/resolve/dot-notation-type-namespace-suggest-path-sep.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ fn main() {
3535
macro_rules! Type {
3636
() => {
3737
::std::cell::Cell
38-
//~^ ERROR expected value, found struct `std::cell::Cell`
39-
//~| ERROR expected value, found struct `std::cell::Cell`
40-
//~| ERROR expected value, found struct `std::cell::Cell`
38+
//~^ ERROR expected value, found struct `::std::cell::Cell`
39+
//~| ERROR expected value, found struct `::std::cell::Cell`
40+
//~| ERROR expected value, found struct `::std::cell::Cell`
4141
};
4242
(alias) => {
4343
Alias

tests/ui/resolve/dot-notation-type-namespace-suggest-path-sep.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ LL - let _ = foo.bar;
7070
LL + let _ = foo::bar;
7171
|
7272

73-
error[E0423]: expected value, found struct `std::cell::Cell`
73+
error[E0423]: expected value, found struct `::std::cell::Cell`
7474
--> $DIR/dot-notation-type-namespace-suggest-path-sep.rs:37:9
7575
|
7676
LL | ::std::cell::Cell
@@ -86,7 +86,7 @@ LL - Type!().get();
8686
LL + <Type!()>::get();
8787
|
8888

89-
error[E0423]: expected value, found struct `std::cell::Cell`
89+
error[E0423]: expected value, found struct `::std::cell::Cell`
9090
--> $DIR/dot-notation-type-namespace-suggest-path-sep.rs:37:9
9191
|
9292
LL | ::std::cell::Cell
@@ -166,7 +166,7 @@ LL - Vec.new
166166
LL + Vec::new
167167
|
168168

169-
error[E0423]: expected value, found struct `std::cell::Cell`
169+
error[E0423]: expected value, found struct `::std::cell::Cell`
170170
--> $DIR/dot-notation-type-namespace-suggest-path-sep.rs:37:9
171171
|
172172
LL | ::std::cell::Cell

tests/ui/resolve/issue-100365.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ fn main() {
1515
macro_rules! Trait {
1616
() => {
1717
::std::iter::Iterator
18-
//~^ ERROR expected value, found trait `std::iter::Iterator`
19-
//~| ERROR expected value, found trait `std::iter::Iterator`
18+
//~^ ERROR expected value, found trait `::std::iter::Iterator`
19+
//~| ERROR expected value, found trait `::std::iter::Iterator`
2020
};
2121
}
2222

tests/ui/resolve/issue-100365.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ LL - let _ = Into::<()>.into;
3434
LL + let _ = Into::<()>::into;
3535
|
3636

37-
error[E0423]: expected value, found trait `std::iter::Iterator`
37+
error[E0423]: expected value, found trait `::std::iter::Iterator`
3838
--> $DIR/issue-100365.rs:17:9
3939
|
4040
LL | ::std::iter::Iterator
@@ -45,7 +45,7 @@ LL | Trait!().map(std::convert::identity); // no `help` here!
4545
|
4646
= note: this error originates in the macro `Trait` (in Nightly builds, run with -Z macro-backtrace for more info)
4747

48-
error[E0423]: expected value, found trait `std::iter::Iterator`
48+
error[E0423]: expected value, found trait `::std::iter::Iterator`
4949
--> $DIR/issue-100365.rs:17:9
5050
|
5151
LL | ::std::iter::Iterator

tests/ui/resolve/resolve-bad-visibility.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
enum E {}
33
trait Tr {}
44

5-
pub(in E) struct S; //~ ERROR expected module, found enum `E`
6-
pub(in Tr) struct Z; //~ ERROR expected module, found trait `Tr`
5+
pub(in E) struct S; //~ ERROR expected module, found enum `::E`
6+
pub(in Tr) struct Z; //~ ERROR expected module, found trait `::Tr`
77
pub(in std::vec) struct F; //~ ERROR visibilities can only be restricted to ancestor modules
88
pub(in nonexistent) struct G; //~ ERROR cannot find
99
pub(in too_soon) struct H; //~ ERROR cannot find

tests/ui/resolve/resolve-bad-visibility.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0577]: expected module, found enum `E`
1+
error[E0577]: expected module, found enum `::E`
22
--> $DIR/resolve-bad-visibility.rs:5:8
33
|
44
LL | pub(in E) struct S;
55
| ^ not a module
66

7-
error[E0577]: expected module, found trait `Tr`
7+
error[E0577]: expected module, found trait `::Tr`
88
--> $DIR/resolve-bad-visibility.rs:6:8
99
|
1010
LL | pub(in Tr) struct Z;

tests/ui/rfcs/rfc-2126-extern-absolute-paths/single-segment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ use crate; //~ ERROR imports need to be explicitly named
66
use *; //~ ERROR cannot glob-import all possible crates
77

88
fn main() {
9-
let s = ::xcrate; //~ ERROR expected value, found crate `xcrate`
9+
let s = ::xcrate; //~ ERROR expected value, found crate `::xcrate`
1010
//~^ NOTE not a value
1111
}

tests/ui/rfcs/rfc-2126-extern-absolute-paths/single-segment.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ error: cannot glob-import all possible crates
1515
LL | use *;
1616
| ^
1717

18-
error[E0423]: expected value, found crate `xcrate`
18+
error[E0423]: expected value, found crate `::xcrate`
1919
--> $DIR/single-segment.rs:9:13
2020
|
2121
LL | let s = ::xcrate;

0 commit comments

Comments
 (0)