diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-11-15 03:02:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-15 03:02:53 +0100 |
| commit | 4fcb617cbe6a92dabac763bd38862d2c40b4d247 (patch) | |
| tree | 995cc7ddde058a542fe0f67c0a7216daae41c6b6 /src | |
| parent | 7e0441dc36d293ed93a41b93ddfa0ace05dec28b (diff) | |
| parent | 775f1e5acdeae38eae7de41b22bdf6ab71e34efd (diff) | |
Rollup merge of #78980 - thiolliere:gui-fix-qpath, r=estebank
Fix rustc_ast_pretty print_qpath resulting in invalid macro input
related https://github.com/rust-lang/rust/issues/76874 (third case)
### Issue:
The input for a procedural macro is incorrect, for the rust code:
```rust
mod m {
pub trait Tr {
type Ts: super::Tu;
}
}
trait Tu {
fn dummy() { }
}
#[may_proc_macro]
fn foo() {
<T as m::Tr>::Ts::dummy();
}
```
the macro will get the input:
```rust
fn foo() {
<T as m::Tr>::dummy();
}
```
Thus `Ts` has disappeared.
### Fix:
This is due to invalid pretty print of qpath. This PR fix it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/pretty/qpath-associated-type-bound.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/pretty/qpath-associated-type-bound.rs b/src/test/pretty/qpath-associated-type-bound.rs new file mode 100644 index 00000000000..e06885e0388 --- /dev/null +++ b/src/test/pretty/qpath-associated-type-bound.rs @@ -0,0 +1,16 @@ +// pp-exact + + +mod m { + pub trait Tr { + type Ts: super::Tu; + } +} + +trait Tu { + fn dummy() { } +} + +fn foo<T: m::Tr>() { <T as m::Tr>::Ts::dummy(); } + +fn main() { } |
