Skip to content

Commit 1b0ce5a

Browse files
committed
New fmt::Arguments implementation.
1 parent 5326fff commit 1b0ce5a

File tree

11 files changed

+478
-382
lines changed

11 files changed

+478
-382
lines changed

compiler/rustc_ast_lowering/messages.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ ast_lowering_template_modifier = template modifier
169169
170170
ast_lowering_this_not_async = this is not `async`
171171
172+
ast_lowering_too_many_format_arguments =
173+
too many arguments used in format string
174+
172175
ast_lowering_underscore_expr_lhs_assign =
173176
in expressions, `_` can only be used on the left-hand side of an assignment
174177
.label = `_` not allowed here

compiler/rustc_ast_lowering/src/errors.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,3 +475,10 @@ pub(crate) struct UnionWithDefault {
475475
#[primary_span]
476476
pub span: Span,
477477
}
478+
479+
#[derive(Diagnostic)]
480+
#[diag(ast_lowering_too_many_format_arguments)]
481+
pub(crate) struct TooManyFormatArguments {
482+
#[primary_span]
483+
pub span: Span,
484+
}

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,18 +2105,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
21052105
self.expr(sp, hir::ExprKind::Lit(lit))
21062106
}
21072107

2108-
pub(super) fn expr_usize(&mut self, sp: Span, value: usize) -> hir::Expr<'hir> {
2108+
pub(super) fn expr_usize(&mut self, sp: Span, value: u64) -> hir::Expr<'hir> {
21092109
self.expr_uint(sp, ast::UintTy::Usize, value as u128)
21102110
}
21112111

2112-
pub(super) fn expr_u32(&mut self, sp: Span, value: u32) -> hir::Expr<'hir> {
2113-
self.expr_uint(sp, ast::UintTy::U32, value as u128)
2114-
}
2115-
2116-
pub(super) fn expr_u16(&mut self, sp: Span, value: u16) -> hir::Expr<'hir> {
2117-
self.expr_uint(sp, ast::UintTy::U16, value as u128)
2118-
}
2119-
21202112
pub(super) fn expr_str(&mut self, sp: Span, value: Symbol) -> hir::Expr<'hir> {
21212113
let lit = hir::Lit {
21222114
span: self.lower_span(sp),

0 commit comments

Comments
 (0)