Skip to content

Commit 775f1e5

Browse files
committed
fix pretty print for qpath
1 parent 55794e4 commit 775f1e5

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

compiler/rustc_ast_pretty/src/pprust/state.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -2328,11 +2328,12 @@ impl<'a> State<'a> {
23282328
self.print_path(path, false, depth);
23292329
}
23302330
self.s.word(">");
2331-
self.s.word("::");
2332-
let item_segment = path.segments.last().unwrap();
2333-
self.print_ident(item_segment.ident);
2334-
if let Some(ref args) = item_segment.args {
2335-
self.print_generic_args(args, colons_before_params)
2331+
for item_segment in &path.segments[qself.position..] {
2332+
self.s.word("::");
2333+
self.print_ident(item_segment.ident);
2334+
if let Some(ref args) = item_segment.args {
2335+
self.print_generic_args(args, colons_before_params)
2336+
}
23362337
}
23372338
}
23382339

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// pp-exact
2+
3+
4+
mod m {
5+
pub trait Tr {
6+
type Ts: super::Tu;
7+
}
8+
}
9+
10+
trait Tu {
11+
fn dummy() { }
12+
}
13+
14+
fn foo<T: m::Tr>() { <T as m::Tr>::Ts::dummy(); }
15+
16+
fn main() { }

0 commit comments

Comments
 (0)