diff options
| author | Nikita Tomashevich <quant3234@gmail.com> | 2023-01-21 18:16:53 +0300 |
|---|---|---|
| committer | IQuant <quant3234@gmail.com> | 2023-02-14 18:31:45 +0300 |
| commit | cb8ea01096fb14ea25bbe69fd0b92f7e7752cb78 (patch) | |
| tree | 78b684ad6694dc739921631086363e54c946d309 /compiler/rustc_infer/src/errors | |
| parent | 58e901b6fd1163172149fd422565523b17eed5f0 (diff) | |
| download | rust-cb8ea01096fb14ea25bbe69fd0b92f7e7752cb78.tar.gz rust-cb8ea01096fb14ea25bbe69fd0b92f7e7752cb78.zip | |
Port RefLongerThanData
Diffstat (limited to 'compiler/rustc_infer/src/errors')
| -rw-r--r-- | compiler/rustc_infer/src/errors/mod.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/errors/note_and_explain.rs | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_infer/src/errors/mod.rs b/compiler/rustc_infer/src/errors/mod.rs index 6efe72bfc36..7088be05ef7 100644 --- a/compiler/rustc_infer/src/errors/mod.rs +++ b/compiler/rustc_infer/src/errors/mod.rs @@ -980,3 +980,13 @@ pub struct BorrowedTooLong<'a> { #[subdiagnostic] pub notes: Vec<note_and_explain::RegionExplanation<'a>>, } + +#[derive(Diagnostic)] +#[diag(infer_ref_longer_than_data, code = "E0491")] +pub struct RefLongerThanData<'a> { + #[primary_span] + pub span: Span, + pub ty: Ty<'a>, + #[subdiagnostic] + pub notes: Vec<note_and_explain::RegionExplanation<'a>>, +} diff --git a/compiler/rustc_infer/src/errors/note_and_explain.rs b/compiler/rustc_infer/src/errors/note_and_explain.rs index e779fdd6e55..3516517dcc3 100644 --- a/compiler/rustc_infer/src/errors/note_and_explain.rs +++ b/compiler/rustc_infer/src/errors/note_and_explain.rs @@ -131,6 +131,8 @@ pub enum PrefixKind { LfMustOutlive, TypeValidFor, BorrowLastsFor, + PointerValidFor, + DataValidFor, } pub enum SuffixKind { @@ -153,6 +155,8 @@ impl IntoDiagnosticArg for PrefixKind { Self::LfMustOutlive => "lf_must_outlive", Self::TypeValidFor => "type_valid_for", Self::BorrowLastsFor => "borrow_lasts_for", + Self::PointerValidFor => "pointer_valid_for", + Self::DataValidFor => "data_valid_for", } .into(); rustc_errors::DiagnosticArgValue::Str(kind) |
