Don't annotate type when type is opaque
This commit is contained in:
parent
db0a5a1056
commit
7127ff3d94
4 changed files with 10 additions and 5 deletions
|
@ -1353,7 +1353,12 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
format!("{} occurs here, with `{}` maybe used later", await_or_yield, snippet),
|
||||
);
|
||||
|
||||
span.push_span_label(target_span, format!("has type `{}`", target_ty));
|
||||
if target_ty.is_impl_trait() {
|
||||
// It's not very useful to tell the user the type if it's opaque.
|
||||
span.push_span_label(target_span, "created here".to_string());
|
||||
} else {
|
||||
span.push_span_label(target_span, format!("has type `{}`", target_ty));
|
||||
}
|
||||
|
||||
// If available, use the scope span to annotate the drop location.
|
||||
if let Some(scope_span) = scope_span {
|
||||
|
|
|
@ -12,7 +12,7 @@ note: future is not `Send` as this value is used across an await
|
|||
--> $DIR/async-fn-nonsend.rs:24:5
|
||||
|
|
||||
LL | let x = non_send();
|
||||
| - has type `impl std::fmt::Debug`
|
||||
| - created here
|
||||
LL | drop(x);
|
||||
LL | fut().await;
|
||||
| ^^^^^^^^^^^ await occurs here, with `x` maybe used later
|
||||
|
@ -33,7 +33,7 @@ note: future is not `Send` as this value is used across an await
|
|||
--> $DIR/async-fn-nonsend.rs:33:20
|
||||
|
|
||||
LL | match Some(non_send()) {
|
||||
| ---------- has type `impl std::fmt::Debug`
|
||||
| ---------- created here
|
||||
LL | Some(_) => fut().await,
|
||||
| ^^^^^^^^^^^ await occurs here, with `non_send()` maybe used later
|
||||
...
|
||||
|
|
|
@ -12,7 +12,7 @@ note: future is not `Send` as this value is used across an await
|
|||
--> $DIR/issue-68112.rs:32:9
|
||||
|
|
||||
LL | let non_send_fut = make_non_send_future1();
|
||||
| ------------ has type `impl std::future::Future`
|
||||
| ------------ created here
|
||||
LL | let _ = non_send_fut.await;
|
||||
LL | ready(0).await;
|
||||
| ^^^^^^^^ await occurs here, with `non_send_fut` maybe used later
|
||||
|
|
|
@ -12,7 +12,7 @@ note: future is not `Send` as this value is used across an yield
|
|||
--> $DIR/issue-68112.rs:31:9
|
||||
|
|
||||
LL | let _non_send_gen = make_non_send_generator();
|
||||
| ------------- has type `impl std::ops::Generator`
|
||||
| ------------- created here
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
|
||||
LL | };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue