8000 [WIP] Migrate rustc_ast_passes diagnostics to SessionDiagnostic and translatable messages (second part) by finalchild · Pull Request #101657 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

[WIP] Migrate rustc_ast_passes diagnostics to SessionDiagnostic and translatable messages (second part) #101657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d9e8e42
Migrate check_type_no_bounds
finalchild Sep 9, 2022
ae28c07
Rename (assoc/foreign)_type to (assoc/foreign)_ty
finalchild Sep 9, 2022
8635da7
Rename AssocTyWithoutBody to ImplAssocTyWithoutBody
finalchild Sep 9, 2022
92b96e6
Migrate check_foreign_ty_genericless
finalchild Sep 9, 2022
69cb057
Migrate check_foreign_kind_bodyless and fix prev
finalchild Sep 10, 2022
8384368
Tidy
finalchild Sep 10, 2022
79ad624
Migrate ForeignFnWith(Body/Qualifier) and fix prev
finalchild Sep 10, 2022
2aea631
Migrate ForeignItemNonAscii, ForbiddenCVarArgs, UnnamedAssocConst, No…
finalchild Sep 10, 2022
00d739b
Migrate AutoTraitWith(GenericParam/SuperTraitOrWhereClause/AssocItem)
finalchild Sep 10, 2022
c8de335
Migrate GenericArgAfterConstraint and fix prev
finalchild Sep 10, 2022
18cd17d
Migrate FnPtrTyWithPat, MultipleExplicitLifetimeBound, ImplTraitTyInP…
finalchild Sep 10, 2022
baab6c1
Migrate GenericParamWrongOrder
finalchild Sep 10, 2022
560d445
Fix rebase
finalchild Sep 11, 2022
834db8b
Migrate the rest of ast_validation.rs
finalchild Sep 11, 2022
af29599
Fix raw identifiers not handled correctly in 8000 EqualityConstraintToAsso…
finalchild Sep 12, 2022
798064c
Fix rebase mistake
finalchild Sep 29, 2022
4f4248f
Fix rebase mistake
finalchild Sep 29, 2022
e3c6279
resolve rebase error
finalchild Oct 13, 2022
2a0f2cd
Remove redundant change
finalchild Oct 14, 2022
7ca0eb8
fix rebase mistakes
finalchild Oct 21, 2022
facf6ac
fix rebase mistake
finalchild Oct 21, 2022
8575873
fix rebase
finalchild Oct 26, 2022
56d7426
fix rebase
finalchild Jan 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename (assoc/foreign)_type to (assoc/foreign)_ty
  • Loading branch information
finalchild committed Jan 25, 2023
commit ae28c07ea7851d3cae5d45678e004cd0656b823a
6 changes: 3 additions & 3 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
}) => {
self.check_defaultness(fi.span, *defaultness);
self.check_foreign_kind_bodyless(fi.ident, "type", ty.as_ref().map(|b| b.span));
self.check_type_no_bounds(bounds, |span| ForeignTypeWithBound { span });
self.check_type_no_bounds(bounds, |span| ForeignTyWithBound { span });
self.check_foreign_ty_genericless(generics, where_clauses.0.1);
self.check_foreign_item_ascii_only(fi.ident);
}
Expand Down Expand Up @@ -1535,12 +1535,12 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
..
}) => {
if ty.is_none() {
self.session.emit_err(AssocTypeWithoutBody {
self.session.emit_err(AssocTyWithoutBody {
span: item.span,
replace_span: self.ending_semi_or_hi(item.span),
});
}
self.check_type_no_bounds(bounds, |span| ImplAssocTypeWithBound { span });
self.check_type_no_bounds(bounds, |span| ImplAssocTyWithBound { span });
if ty.is_some() {
self.check_gat_where(
item.id,
Expand Down
18 changes: 9 additions & 9 deletions compiler/rustc_ast_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub struct AssocFnWithoutBody {
}

#[derive(Diagnostic)]
#[diag(ast_passes_assoc_type_without_body)]
#[diag(ast_passes_assoc_ty_without_body)]
pub struct AssocTypeWithoutBody {
#[primary_span]
pub span: Span,
Expand Down Expand Up @@ -225,23 +225,23 @@ pub enum ExternBlockSuggestion {
},
}

#[derive(SessionDiagnostic)]
#[diag(ast_passes::ty_alias_with_bound)]
#[derive(Diagnostic)]
#[diag(ast_passes_ty_alias_with_bound)]
pub struct TyAliasWithBound {
#[primary_span]
pub span: Span,
}

#[derive(SessionDiagnostic)]
#[diag(ast_passes::foreign_type_with_bound)]
pub struct ForeignTypeWithBound {
#[derive(Diagnostic)]
#[diag(ast_passes_foreign_ty_with_bound)]
pub struct ForeignTyWithBound {
#[primary_span]
pub span: Span,
}

#[derive(SessionDiagnostic)]
#[diag(ast_passes::impl_assoc_type_with_bound)]
pub struct ImplAssocTypeWithBound {
#[derive(Diagnostic)]
#[diag(ast_passes_impl_assoc_ty_with_bound)]
pub struct ImplAssocTyWithBound {
#[primary_span]
pub span: Span,
}
6 changes: 3 additions & 3 deletions compiler/rustc_error_messages/locales/en-US/ast_passes.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ast_passes_assoc_fn_without_body =
associated function in `impl` without body
.suggestion = provide a definition for the function

ast_passes_assoc_type_without_body =
ast_passes_assoc_ty_without_body =
associated type in `impl` without body
.suggestion = provide a definition for the type

Expand All @@ -94,8 +94,8 @@ ast_passes_extern_block_suggestion = if you meant to declare an externally defin
ast_passes_ty_alias_with_bound =
bounds on `type`s in this context have no effect

ast_passes_foreign_type_with_bound =
ast_passes_foreign_ty_with_bound =
bounds on `type`s in `extern` blocks have no effect

ast_passes_impl_assoc_type_with_bound =
ast_passes_impl_assoc_ty_with_bound =
bounds on `type`s in `impl`s have no effect
0