Rollup merge of #103383 - compiler-errors:tait-scope, r=oli-obk
Note scope of TAIT more accurately This maybe explains why the person was confused in #101897, since we say "same module" but really should've said "same impl". r? ``@oli-obk``
This commit is contained in:
commit
790a716420
@ -93,7 +93,7 @@ hir_analysis_expected_default_return_type = expected `()` because of default ret
|
||||
hir_analysis_expected_return_type = expected `{$expected}` because of return type
|
||||
|
||||
hir_analysis_unconstrained_opaque_type = unconstrained opaque type
|
||||
.note = `{$name}` must be used in combination with a concrete type within the same module
|
||||
.note = `{$name}` must be used in combination with a concrete type within the same {$what}
|
||||
|
||||
hir_analysis_missing_type_params =
|
||||
the type {$parameterCount ->
|
||||
|
@ -701,6 +701,12 @@ fn visit_trait_item(&mut self, it: &'tcx TraitItem<'tcx>) {
|
||||
tcx.sess.emit_err(UnconstrainedOpaqueType {
|
||||
span: tcx.def_span(def_id),
|
||||
name: tcx.item_name(tcx.local_parent(def_id).to_def_id()),
|
||||
what: match tcx.hir().get(scope) {
|
||||
_ if scope == hir::CRATE_HIR_ID => "module",
|
||||
Node::Item(hir::Item { kind: hir::ItemKind::Mod(_), .. }) => "module",
|
||||
Node::Item(hir::Item { kind: hir::ItemKind::Impl(_), .. }) => "impl",
|
||||
_ => "item",
|
||||
},
|
||||
});
|
||||
return tcx.ty_error();
|
||||
};
|
||||
|
@ -143,6 +143,7 @@ pub struct UnconstrainedOpaqueType {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub name: Symbol,
|
||||
pub what: &'static str,
|
||||
}
|
||||
|
||||
pub struct MissingTypeParams {
|
||||
|
@ -4,7 +4,7 @@ error: unconstrained opaque type
|
||||
LL | type FooFuture<'a> = impl Trait1;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `FooFuture` must be used in combination with a concrete type within the same module
|
||||
= note: `FooFuture` must be used in combination with a concrete type within the same impl
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -67,7 +67,7 @@ error: unconstrained opaque type
|
||||
LL | type U = impl Trait;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `U` must be used in combination with a concrete type within the same module
|
||||
= note: `U` must be used in combination with a concrete type within the same impl
|
||||
|
||||
error: aborting due to 6 previous errors; 2 warnings emitted
|
||||
|
||||
|
@ -94,7 +94,7 @@ error: unconstrained opaque type
|
||||
LL | type U = impl Trait;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `U` must be used in combination with a concrete type within the same module
|
||||
= note: `U` must be used in combination with a concrete type within the same impl
|
||||
|
||||
error: aborting due to 7 previous errors; 6 warnings emitted
|
||||
|
||||
|
@ -4,7 +4,7 @@ error: unconstrained opaque type
|
||||
LL | type Future = impl Trait;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `Future` must be used in combination with a concrete type within the same module
|
||||
= note: `Future` must be used in combination with a concrete type within the same impl
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user