diff options
| author | bors <bors@rust-lang.org> | 2023-09-11 16:50:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-09-11 16:50:22 +0000 |
| commit | 0a199e4e93d2c7cfa7e0bee831e5aed03250fab4 (patch) | |
| tree | ca3aa84c2f830f3fca904de76fa2dc436ec15e41 /compiler/rustc_resolve/src/errors.rs | |
| parent | 3ebb5629d1a39345d37c4838d31dc7280384ea94 (diff) | |
| parent | 9ed6eea86ba3b6c66e448d8be971b302a5788742 (diff) | |
| download | rust-0a199e4e93d2c7cfa7e0bee831e5aed03250fab4.tar.gz rust-0a199e4e93d2c7cfa7e0bee831e5aed03250fab4.zip | |
Auto merge of #115758 - matthiaskrgr:rollup-khwbjj7, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #115335 (fix overflow in array length computation) - #115440 (bootstrap/format: remove unnecessary paths.push) - #115702 (Update mailmap) - #115727 (Implement fallback for effect param) - #115739 (Call `LateLintPass::check_attribute` from `with_lint_attrs`) - #115743 (Point out if a local trait has no implementations) - #115744 (Improve diagnostic for generic params from outer items (E0401)) - #115752 (rustdoc: Add missing "Aliased type" title in the sidebar) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_resolve/src/errors.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/errors.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index 85c9171e78a..72ff959bbd6 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -33,6 +33,40 @@ pub(crate) struct CrateRootNamesMustBeNamedExplicitly(#[primary_span] pub(crate) pub(crate) struct ResolutionError(#[primary_span] pub(crate) Span); #[derive(Diagnostic)] +#[diag(resolve_generic_params_from_outer_item, code = "E0401")] +pub(crate) struct GenericParamsFromOuterItem { + #[primary_span] + #[label] + pub(crate) span: Span, + #[subdiagnostic] + pub(crate) label: Option<GenericParamsFromOuterItemLabel>, + #[label(resolve_refer_to_type_directly)] + pub(crate) refer_to_type_directly: Option<Span>, + #[subdiagnostic] + pub(crate) sugg: Option<GenericParamsFromOuterItemSugg>, +} + +#[derive(Subdiagnostic)] +pub(crate) enum GenericParamsFromOuterItemLabel { + #[label(resolve_generic_params_from_outer_item_self_ty_param)] + SelfTyParam(#[primary_span] Span), + #[label(resolve_generic_params_from_outer_item_self_ty_alias)] + SelfTyAlias(#[primary_span] Span), + #[label(resolve_generic_params_from_outer_item_ty_param)] + TyParam(#[primary_span] Span), + #[label(resolve_generic_params_from_outer_item_const_param)] + ConstParam(#[primary_span] Span), +} + +#[derive(Subdiagnostic)] +#[suggestion(resolve_suggestion, code = "{snippet}", applicability = "maybe-incorrect")] +pub(crate) struct GenericParamsFromOuterItemSugg { + #[primary_span] + pub(crate) span: Span, + pub(crate) snippet: String, +} + +#[derive(Diagnostic)] #[diag(resolve_name_is_already_used_as_generic_parameter, code = "E0403")] pub(crate) struct NameAlreadyUsedInParameterList { #[primary_span] |
