Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/format_foreign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ pub(crate) mod printf {
// Yes, this *is* the parameter.
Some(('$', end2)) => {
state = Flags;
parameter = Some(at.slice_between(end).unwrap().parse().unwrap());
parameter = at.slice_between(end).unwrap().parse().ok();
move_to!(end2);
}
// Wait, no, actually, it's the width.
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/macros/format-foreign-dollar-without-spec.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment here saying that this was issue #137580, then remove the old crashtest, and then r=me.

println!("%65536$", 1);
//~^ ERROR never used
}
16 changes: 16 additions & 0 deletions tests/ui/macros/format-foreign-dollar-without-spec.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error: argument never used
--> $DIR/format-foreign-dollar-without-spec.rs:2:25
|
LL | println!("%65536$", 1);
| ^ argument never used
|
note: format specifiers use curly braces, and the conversion specifier `
` is unknown or unsupported
--> $DIR/format-foreign-dollar-without-spec.rs:2:15
|
LL | println!("%65536$", 1);
| ^^^^^^^^
= note: printf formatting is not supported; see the documentation for `std::fmt`

error: aborting due to 1 previous error

Loading