diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2024-01-13 19:24:52 +0000 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2024-01-14 12:31:34 +0000 |
| commit | 2cfc81766c37eb0f6696d50f9207876293fa7732 (patch) | |
| tree | 4412abe0a39c36c1012c9d7b59623cd36edc9e79 /compiler/rustc_resolve/src | |
| parent | 511bf6e1c7a3c2bf00d9c6d62f397b90aab55581 (diff) | |
| download | rust-2cfc81766c37eb0f6696d50f9207876293fa7732.tar.gz rust-2cfc81766c37eb0f6696d50f9207876293fa7732.zip | |
Special case 'generic param from outer item' message for `Self`
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/errors.rs | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 46da5b9d2e4..da31382112a 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -568,12 +568,14 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { DefKind::Const => Some(errs::GenericParamsFromOuterItemStaticOrConst::Const), _ => None, }; + let is_self = matches!(outer_res, Res::SelfTyParam { .. } | Res::SelfTyAlias { .. }); let mut err = errs::GenericParamsFromOuterItem { span, label: None, refer_to_type_directly: None, sugg: None, static_or_const, + is_self, }; let sm = self.tcx.sess.source_map(); diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index bd00cab66b0..da89df84c8a 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -46,6 +46,7 @@ pub(crate) struct GenericParamsFromOuterItem { pub(crate) sugg: Option<GenericParamsFromOuterItemSugg>, #[subdiagnostic] pub(crate) static_or_const: Option<GenericParamsFromOuterItemStaticOrConst>, + pub(crate) is_self: bool, } #[derive(Subdiagnostic)] |
