Note scope of TAIT more accurately
This commit is contained in:
parent
0940040c04
commit
4accf838f6
7 changed files with 12 additions and 5 deletions
|
@ -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_expected_return_type = expected `{$expected}` because of return type
|
||||||
|
|
||||||
hir_analysis_unconstrained_opaque_type = unconstrained opaque 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 =
|
hir_analysis_missing_type_params =
|
||||||
the type {$parameterCount ->
|
the type {$parameterCount ->
|
||||||
|
|
|
@ -693,6 +693,12 @@ fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: LocalDefId) -> T
|
||||||
tcx.sess.emit_err(UnconstrainedOpaqueType {
|
tcx.sess.emit_err(UnconstrainedOpaqueType {
|
||||||
span: tcx.def_span(def_id),
|
span: tcx.def_span(def_id),
|
||||||
name: tcx.item_name(tcx.local_parent(def_id).to_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();
|
return tcx.ty_error();
|
||||||
};
|
};
|
||||||
|
|
|
@ -143,6 +143,7 @@ pub struct UnconstrainedOpaqueType {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub name: Symbol,
|
pub name: Symbol,
|
||||||
|
pub what: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MissingTypeParams {
|
pub struct MissingTypeParams {
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: unconstrained opaque type
|
||||||
LL | type FooFuture<'a> = impl Trait1;
|
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
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ error: unconstrained opaque type
|
||||||
LL | type U = impl Trait;
|
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
|
error: aborting due to 6 previous errors; 2 warnings emitted
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ error: unconstrained opaque type
|
||||||
LL | type U = impl Trait;
|
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
|
error: aborting due to 7 previous errors; 6 warnings emitted
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: unconstrained opaque type
|
||||||
LL | type Future = impl Trait;
|
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
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue