Skip to content

Commit 252c43b

Browse files
committed
Do not mention lifetime names in force trimmed paths
1 parent 81973a3 commit 252c43b

23 files changed

+44
-40
lines changed

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,6 +2070,10 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
20702070
return true;
20712071
}
20722072

2073+
if FORCE_TRIMMED_PATH.with(|flag| flag.get()) {
2074+
return false;
2075+
}
2076+
20732077
let identify_regions = self.tcx.sess.opts.unstable_opts.identify_regions;
20742078

20752079
match *region {

tests/ui/associated-type-bounds/inside-adt.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ LL | union U1 { f: ManuallyDrop<dyn Iterator<Item: Copy>> }
9595
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
9696
|
9797
= help: within `ManuallyDrop<(dyn Iterator<Item = impl Copy> + 'static)>`, the trait `Sized` is not implemented for `(dyn Iterator<Item = impl Copy> + 'static)`
98-
= note: required because it appears within the type `ManuallyDrop<(dyn Iterator<Item = impl Copy> + 'static)>`
98+
= note: required because it appears within the type `ManuallyDrop<dyn Iterator<Item = impl Copy>>`
9999
= note: no field of a union may have a dynamically sized type
100100
= help: change the field's type to have a statically known size
101101
help: borrowed types always have a statically known size
@@ -114,7 +114,7 @@ LL | union U3 { f: ManuallyDrop<dyn Iterator<Item: 'static>> }
114114
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
115115
|
116116
= help: within `ManuallyDrop<(dyn Iterator<Item = impl Sized + 'static> + 'static)>`, the trait `Sized` is not implemented for `(dyn Iterator<Item = impl Sized + 'static> + 'static)`
117-
= note: required because it appears within the type `ManuallyDrop<(dyn Iterator<Item = impl Sized + 'static> + 'static)>`
117+
= note: required because it appears within the type `ManuallyDrop<dyn Iterator<Item = impl Sized + 'static>>`
118118
= note: no field of a union may have a dynamically sized type
119119
= help: change the field's type to have a statically known size
120120
help: borrowed types always have a statically known size

tests/ui/associated-types/issue-43924.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ note: required by a bound in `Foo::Out`
1010
LL | type Out: Default + ToString + ?Sized = dyn ToString;
1111
| ^^^^^^^ required by this bound in `Foo::Out`
1212

13-
error[E0599]: no function or associated item named `default` found for trait object `(dyn ToString + 'static)` in the current scope
13+
error[E0599]: no function or associated item named `default` found for trait object `dyn ToString` in the current scope
1414
--> $DIR/issue-43924.rs:14:39
1515
|
1616
LL | assert_eq!(<() as Foo<u32>>::Out::default().to_string(), "false");
17-
| ^^^^^^^ function or associated item not found in `(dyn ToString + 'static)`
17+
| ^^^^^^^ function or associated item not found in `dyn ToString`
1818

1919
error: aborting due to 2 previous errors
2020

tests/ui/async-await/issue-98634.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ impl Runtime {
4343
fn main() {
4444
Runtime.block_on(async {
4545
StructAsync { callback }.await;
46-
//~^ ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
47-
//~| ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
48-
//~| ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
46+
//~^ ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
47+
//~| ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
48+
//~| ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
4949
});
5050
}

tests/ui/async-await/issue-98634.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
1+
error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
22
--> $DIR/issue-98634.rs:45:23
33
|
44
LL | StructAsync { callback }.await;
@@ -17,7 +17,7 @@ note: required by a bound in `StructAsync`
1717
LL | pub struct StructAsync<F: Fn() -> Pin<Box<dyn Future<Output = ()>>>> {
1818
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync`
1919

20-
error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
20+
error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
2121
--> $DIR/issue-98634.rs:45:9
2222
|
2323
LL | StructAsync { callback }.await;
@@ -36,7 +36,7 @@ note: required by a bound in `StructAsync`
3636
LL | pub struct StructAsync<F: Fn() -> Pin<Box<dyn Future<Output = ()>>>> {
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync`
3838

39-
error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
39+
error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
4040
--> $DIR/issue-98634.rs:45:33
4141
|
4242
LL | StructAsync { callback }.await;

tests/ui/feature-gates/feature-gate-trivial_bounds.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ LL | fn unsized_local() where Dst<dyn A>: Sized {
9595
| ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
9696
|
9797
= help: within `Dst<(dyn A + 'static)>`, the trait `Sized` is not implemented for `(dyn A + 'static)`
98-
note: required because it appears within the type `Dst<(dyn A + 'static)>`
98+
note: required because it appears within the type `Dst<dyn A>`
9999
--> $DIR/feature-gate-trivial_bounds.rs:48:8
100100
|
101101
LL | struct Dst<X: ?Sized> {

tests/ui/function-pointer/unsized-ret.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ LL | foo::<for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a), _>(None, (&()
2323
| required by a bound introduced by this call
2424
|
2525
= help: within `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`, the trait `for<'a> Sized` is not implemented for `(dyn std::fmt::Display + 'a)`
26-
= note: required because it appears within the type `fn(&'a ()) -> (dyn Display + 'a)`
26+
= note: required because it appears within the type `fn(&()) -> dyn Display`
2727
note: required by a bound in `foo`
2828
--> $DIR/unsized-ret.rs:5:11
2929
|

tests/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ LL | | ),
1111
LL | | ) {
1212
| |_- expected `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn Fn(u32) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a))` because of return type
1313
LL | f
14-
| ^ expected `&dyn Fn(&'a (dyn Fn(&'a ...) + 'a))`, found `&dyn Fn(u32)`
14+
| ^ expected `&dyn Fn(&dyn Fn(&dyn Fn(&...)))`, found `&dyn Fn(u32)`
1515
|
16-
= note: expected reference `&dyn Fn(&'a (dyn Fn(&'a (dyn Fn(&'a (dyn Fn(&'a (dyn Fn(&'a (dyn Fn(...) + 'a)) + 'a)) + 'a)) + 'a)) + 'a))`
16+
= note: expected reference `&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&...)))))))))))`
1717
the full type name has been written to '$TEST_BUILD_DIR/higher-rank-trait-bounds/hang-on-deeply-nested-dyn/hang-on-deeply-nested-dyn.long-type-hash.txt'
1818
found reference `&dyn Fn(u32)`
1919

tests/ui/higher-rank-trait-bounds/issue-30786.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ note: the following trait bounds were not satisfied:
1919
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
2020
| --------- - ^^^^^^ unsatisfied trait bound introduced here
2121

22-
error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@issue-30786.rs:129:30]>`, but its trait bounds were not satisfied
22+
error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, fn(&u64) -> &u64 {identity::<u64>}>, [closure@issue-30786.rs:129:30]>`, but its trait bounds were not satisfied
2323
--> $DIR/issue-30786.rs:130:24
2424
|
2525
LL | pub struct Filter<S, F> {

tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | fn fuz() -> (usize, Trait) { (42, Struct) }
1616
| doesn't have a size known at compile-time
1717
|
1818
= help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)`
19-
= note: required because it appears within the type `(usize, (dyn Trait + 'static))`
19+
= note: required because it appears within the type `(usize, dyn Trait)`
2020
= note: the return type of a function must have a statically known size
2121

2222
error[E0308]: mismatched types
@@ -37,7 +37,7 @@ LL | fn bar() -> (usize, dyn Trait) { (42, Struct) }
3737
| doesn't have a size known at compile-time
3838
|
3939
= help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)`
40-
= note: required because it appears within the type `(usize, (dyn Trait + 'static))`
40+
= note: required because it appears within the type `(usize, dyn Trait)`
4141
= note: the return type of a function must have a statically known size
4242

4343
error[E0746]: return type cannot have an unboxed trait object

0 commit comments

Comments
 (0)