diff options
| author | IQuant <quant3234@gmail.com> | 2023-03-03 16:17:53 +0300 |
|---|---|---|
| committer | IQuant <quant3234@gmail.com> | 2023-04-04 18:34:50 +0300 |
| commit | d56b304bc8bd603d5f4298793f33f1cbb6c9d0d1 (patch) | |
| tree | d9a9ca6f7d3ebb9f2da4629096d8c402d6df07ad /compiler/rustc_infer/src/errors/mod.rs | |
| parent | b36abea285e7615f12c079c40d3a68c9eee15c8d (diff) | |
| download | rust-d56b304bc8bd603d5f4298793f33f1cbb6c9d0d1.tar.gz rust-d56b304bc8bd603d5f4298793f33f1cbb6c9d0d1.zip | |
Migrate SuggestAccessingField
Diffstat (limited to 'compiler/rustc_infer/src/errors/mod.rs')
| -rw-r--r-- | compiler/rustc_infer/src/errors/mod.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler/rustc_infer/src/errors/mod.rs b/compiler/rustc_infer/src/errors/mod.rs index 481199d99ea..25c4e9a55f8 100644 --- a/compiler/rustc_infer/src/errors/mod.rs +++ b/compiler/rustc_infer/src/errors/mod.rs @@ -1289,3 +1289,31 @@ pub enum SuggestAsRefWhereAppropriate<'a> { snippet: &'a str, }, } + +#[derive(Subdiagnostic)] +pub enum SuggestAccessingField<'a> { + #[suggestion( + infer_suggest_accessing_field, + code = "{snippet}.{name}", + applicability = "maybe-incorrect" + )] + Safe { + #[primary_span] + span: Span, + snippet: String, + name: Symbol, + ty: Ty<'a>, + }, + #[suggestion( + infer_suggest_accessing_field, + code = "unsafe {{ {snippet}.{name} }}", + applicability = "maybe-incorrect" + )] + Unsafe { + #[primary_span] + span: Span, + snippet: String, + name: Symbol, + ty: Ty<'a>, + }, +} |
