Commit bbd3a10
authored
Rollup merge of rust-lang#103774 - compiler-errors:dyn-trait-in-type-name, r=eholk
Format `dyn Trait` better in `type_name` intrinsic
Noticed this in rust-lang#103764 (though not related to that PR at all!)
```rust
trait Foo {
type Bar;
}
fn main() {
println!(
"`dyn Fn(i32, i32) -> i32` => `{}`",
std::any::type_name::<dyn Fn(i32, i32) -> i32>()
);
println!(
"`dyn Foo<Bar = i32> + Send + Sync` => `{}`",
std::any::type_name::<dyn Foo<Bar = i32> + Send + Sync>()
);
}
```
```
`dyn Fn(i32, i32) -> i32` => `dyn core::ops::function::Fn<(i32, i32)>+Output = i32`
`dyn Foo<Bar = i32> + Send + Sync` => `dyn playground::Foo+Bar = i32+core::marker::Sync+core::marker::Send`
```
Just reuse `pretty_print_dyn_existential` which already makes an attempt to make its output stable.File tree
4 files changed
+22
-15
lines changed- compiler
- rustc_const_eval/src/util
- rustc_middle/src/ty/print
- library/core/tests
- src/test/ui/type
4 files changed
+22
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 79 | + | |
88 | 80 | | |
89 | 81 | | |
90 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1137 | 1137 | | |
1138 | 1138 | | |
1139 | 1139 | | |
1140 | | - | |
| 1140 | + | |
1141 | 1141 | | |
1142 | 1142 | | |
1143 | 1143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
134 | 152 | | |
135 | 153 | | |
136 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 15 | + | |
19 | 16 | | |
0 commit comments