File tree 5 files changed +15
-14
lines changed
compiler/rustc_middle/src/ty/print
tests/ui/impl-trait/in-trait
5 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -715,13 +715,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
715
715
p ! ( print_def_path( def_id, & [ ] ) ) ;
716
716
}
717
717
ty:: Alias ( ty:: Projection | ty:: Inherent | ty:: Weak , ref data) => {
718
- if !( self . should_print_verbose ( ) || with_no_queries ( ) )
719
- && self . tcx ( ) . is_impl_trait_in_trait ( data. def_id )
720
- {
721
- return self . pretty_print_opaque_impl_type ( data. def_id , data. args ) ;
722
- } else {
723
- p ! ( print( data) )
724
- }
718
+ p ! ( print( data) )
725
719
}
726
720
ty:: Placeholder ( placeholder) => match placeholder. bound . kind {
727
721
ty:: BoundTyKind :: Anon => p ! ( write( "{placeholder:?}" ) ) ,
@@ -3053,7 +3047,14 @@ define_print_and_forward_display! {
3053
3047
if let DefKind :: Impl { of_trait: false } = cx. tcx( ) . def_kind( cx. tcx( ) . parent( self . def_id) ) {
3054
3048
p!( pretty_print_inherent_projection( self ) )
3055
3049
} else {
3056
- p!( print_def_path( self . def_id, self . args) ) ;
3050
+ if !( cx. should_print_verbose( ) || with_no_queries( ) )
3051
+ && cx. tcx( ) . is_impl_trait_in_trait( self . def_id)
3052
+ {
3053
+ return cx. pretty_print_opaque_impl_type( self . def_id, self . args) ;
3054
+ } else {
3055
+ p!( print_def_path( self . def_id, self . args) ) ;
3056
+ }
3057
+
3057
3058
}
3058
3059
}
3059
3060
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ trait T {}
5
5
6
6
trait MyTrait {
7
7
async fn foo ( ) -> & ' static impl T ;
8
- //~^ ERROR the associated type `<Self as MyTrait>::{opaque#0} ` may not live long enough
8
+ //~^ ERROR the associated type `impl T ` may not live long enough
9
9
}
10
10
11
11
fn main ( ) { }
Original file line number Diff line number Diff line change 1
- error[E0310]: the associated type `<Self as MyTrait>::{synthetic#0} ` may not live long enough
1
+ error[E0310]: the associated type `impl T ` may not live long enough
2
2
--> $DIR/async-and-ret-ref.rs:7:5
3
3
|
4
4
LL | async fn foo() -> &'static impl T;
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
| |
7
- | the associated type `<Self as MyTrait>::{synthetic#0} ` must be valid for the static lifetime...
7
+ | the associated type `impl T ` must be valid for the static lifetime...
8
8
| ...so that the reference type `&'static impl T` does not outlive the data it points at
9
9
10
10
error: aborting due to 1 previous error
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ trait Erased {
9
9
impl < T : Original > Erased for T {
10
10
fn f ( & self ) -> Box < dyn Fn ( ) > {
11
11
Box :: new ( <T as Original >:: f ( ) )
12
- //~^ ERROR the associated type `<T as Original>::{opaque#0} ` may not live long enough
12
+ //~^ ERROR the associated type `impl Fn() ` may not live long enough
13
13
}
14
14
}
15
15
Original file line number Diff line number Diff line change 1
- error[E0310]: the associated type `<T as Original>::{synthetic#0} ` may not live long enough
1
+ error[E0310]: the associated type `impl Fn() ` may not live long enough
2
2
--> $DIR/missing-static-bound-from-impl.rs:11:9
3
3
|
4
4
LL | Box::new(<T as Original>::f())
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
| |
7
- | the associated type `<T as Original>::{synthetic#0} ` must be valid for the static lifetime...
7
+ | the associated type `impl Fn() ` must be valid for the static lifetime...
8
8
| ...so that the type `impl Fn()` will meet its required lifetime bounds
9
9
10
10
error: aborting due to 1 previous error
You can’t perform that action at this time.
0 commit comments