Migrate diagnostic
This commit is contained in:
parent
4b23a224ab
commit
bdacc8bdd9
@ -345,3 +345,6 @@ infer_prlf_defined_without_sub = the lifetime defined here...
|
|||||||
infer_prlf_must_oultive_with_sup = ...must outlive the lifetime `{$sup_symbol}` defined here
|
infer_prlf_must_oultive_with_sup = ...must outlive the lifetime `{$sup_symbol}` defined here
|
||||||
infer_prlf_must_oultive_without_sup = ...must outlive the lifetime defined here
|
infer_prlf_must_oultive_without_sup = ...must outlive the lifetime defined here
|
||||||
infer_prlf_known_limitation = this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
|
infer_prlf_known_limitation = this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
|
||||||
|
|
||||||
|
infer_opaque_captures_lifetime = hidden type for `{$opaque_ty}` captures lifetime that does not appear in bounds
|
||||||
|
.label = opaque type defined here
|
||||||
|
@ -1147,3 +1147,13 @@ pub enum PlaceholderRelationLfNotSatisfied {
|
|||||||
note: (),
|
note: (),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
#[diag(infer_opaque_captures_lifetime, code = "E0700")]
|
||||||
|
pub struct OpaqueCapturesLifetime<'tcx> {
|
||||||
|
#[primary_span]
|
||||||
|
pub span: Span,
|
||||||
|
#[label]
|
||||||
|
pub opaque_ty_span: Span,
|
||||||
|
pub opaque_ty: Ty<'tcx>,
|
||||||
|
}
|
||||||
|
@ -49,6 +49,7 @@ use super::lexical_region_resolve::RegionResolutionError;
|
|||||||
use super::region_constraints::GenericKind;
|
use super::region_constraints::GenericKind;
|
||||||
use super::{InferCtxt, RegionVariableOrigin, SubregionOrigin, TypeTrace, ValuePairs};
|
use super::{InferCtxt, RegionVariableOrigin, SubregionOrigin, TypeTrace, ValuePairs};
|
||||||
|
|
||||||
|
use crate::errors;
|
||||||
use crate::infer;
|
use crate::infer;
|
||||||
use crate::infer::error_reporting::nice_region_error::find_anon_type::find_anon_type;
|
use crate::infer::error_reporting::nice_region_error::find_anon_type::find_anon_type;
|
||||||
use crate::infer::ExpectedFound;
|
use crate::infer::ExpectedFound;
|
||||||
@ -283,17 +284,11 @@ pub fn unexpected_hidden_region_diagnostic<'tcx>(
|
|||||||
hidden_region: ty::Region<'tcx>,
|
hidden_region: ty::Region<'tcx>,
|
||||||
opaque_ty_key: ty::OpaqueTypeKey<'tcx>,
|
opaque_ty_key: ty::OpaqueTypeKey<'tcx>,
|
||||||
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
||||||
let opaque_ty = tcx.mk_opaque(opaque_ty_key.def_id.to_def_id(), opaque_ty_key.substs);
|
let mut err = tcx.sess.create_err(errors::OpaqueCapturesLifetime {
|
||||||
|
|
||||||
let mut err = struct_span_err!(
|
|
||||||
tcx.sess,
|
|
||||||
span,
|
span,
|
||||||
E0700,
|
opaque_ty: tcx.mk_opaque(opaque_ty_key.def_id.to_def_id(), opaque_ty_key.substs),
|
||||||
"hidden type for `{opaque_ty}` captures lifetime that does not appear in bounds",
|
opaque_ty_span: tcx.def_span(opaque_ty_key.def_id),
|
||||||
);
|
});
|
||||||
|
|
||||||
let opaque_ty_span = tcx.def_span(opaque_ty_key.def_id);
|
|
||||||
err.span_label(opaque_ty_span, "opaque type defined here");
|
|
||||||
|
|
||||||
// Explain the region we are capturing.
|
// Explain the region we are capturing.
|
||||||
match *hidden_region {
|
match *hidden_region {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user