Print the path of an RPITIT in RTN
This commit is contained in:
parent
b0d45536ac
commit
748476d94d
@ -1123,6 +1123,17 @@ pub trait PrettyPrinter<'tcx>:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.tcx().features().return_type_notation
|
||||||
|
&& let Some(ty::ImplTraitInTraitData::Trait { fn_def_id, .. }) = self.tcx().opt_rpitit_info(def_id)
|
||||||
|
&& let ty::Alias(_, alias_ty) = self.tcx().fn_sig(fn_def_id).skip_binder().output().skip_binder().kind()
|
||||||
|
&& alias_ty.def_id == def_id
|
||||||
|
{
|
||||||
|
let num_args = self.tcx().generics_of(fn_def_id).count();
|
||||||
|
write!(self, " {{ ")?;
|
||||||
|
self = self.print_def_path(fn_def_id, &args[..num_args])?;
|
||||||
|
write!(self, "() }}")?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,12 +13,12 @@ error: future cannot be sent between threads safely
|
|||||||
LL | is_send(foo::<T>());
|
LL | is_send(foo::<T>());
|
||||||
| ^^^^^^^^^^ future returned by `foo` is not `Send`
|
| ^^^^^^^^^^ future returned by `foo` is not `Send`
|
||||||
|
|
|
|
||||||
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>`
|
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>> { <T as Foo>::method() }`
|
||||||
note: future is not `Send` as it awaits another future which is not `Send`
|
note: future is not `Send` as it awaits another future which is not `Send`
|
||||||
--> $DIR/basic.rs:13:5
|
--> $DIR/basic.rs:13:5
|
||||||
|
|
|
|
||||||
LL | T::method().await?;
|
LL | T::method().await?;
|
||||||
| ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send`
|
| ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>> { <T as Foo>::method() }`, which is not `Send`
|
||||||
note: required by a bound in `is_send`
|
note: required by a bound in `is_send`
|
||||||
--> $DIR/basic.rs:17:20
|
--> $DIR/basic.rs:17:20
|
||||||
|
|
|
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||||
|
--> $DIR/normalizing-self-auto-trait-issue-109924.rs:8:12
|
||||||
|
|
|
||||||
|
LL | #![feature(return_type_notation)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||||
|
= note: `#[warn(incomplete_features)]` on by default
|
||||||
|
|
||||||
|
error[E0277]: `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely
|
||||||
|
--> $DIR/normalizing-self-auto-trait-issue-109924.rs:23:11
|
||||||
|
|
|
||||||
|
LL | build(Bar);
|
||||||
|
| ----- ^^^ `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
= help: the trait `for<'a> Send` is not implemented for `impl Future<Output = ()> { <_ as Foo>::bar() }`
|
||||||
|
note: required by a bound in `build`
|
||||||
|
--> $DIR/normalizing-self-auto-trait-issue-109924.rs:20:39
|
||||||
|
|
|
||||||
|
LL | fn build<T>(_: T) where T: Foo<bar(): Send> {}
|
||||||
|
| ^^^^ required by this bound in `build`
|
||||||
|
|
||||||
|
error: aborting due to previous error; 1 warning emitted
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
@ -0,0 +1,11 @@
|
|||||||
|
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||||
|
--> $DIR/normalizing-self-auto-trait-issue-109924.rs:8:12
|
||||||
|
|
|
||||||
|
LL | #![feature(return_type_notation)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||||
|
= note: `#[warn(incomplete_features)]` on by default
|
||||||
|
|
||||||
|
warning: 1 warning emitted
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
// revisions: current next
|
||||||
|
//[current] known-bug: #109924
|
||||||
|
//[next] check-pass
|
||||||
|
//[next] compile-flags: -Ztrait-solver=next
|
||||||
|
// edition:2021
|
||||||
|
|
||||||
|
#![feature(async_fn_in_trait)]
|
||||||
|
#![feature(return_type_notation)]
|
||||||
|
//[next]~^ WARN the feature `return_type_notation` is incomplete
|
||||||
|
|
||||||
|
trait Foo {
|
||||||
|
async fn bar(&self);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Bar;
|
||||||
|
impl Foo for Bar {
|
||||||
|
async fn bar(&self) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn build<T>(_: T) where T: Foo<bar(): Send> {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
build(Bar);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user