Skip to content

Fix {,e}println!() #3205

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 1 commit into from
Closed

Conversation

GrigorenkoPV
Copy link
Contributor

@GrigorenkoPV GrigorenkoPV commented May 28, 2024

Change the implementation of println! & eprintln! with no arguments to call print!("\n")
& eprint!("\n") respectively instead of producing no tokens. This is what std does. 12

Probably resolves #320. Haven't tested, sorry. It might also make sense to add a test for this.

Footnotes

  1. https://github.com/rust-lang/rust/blob/8c127df75fde3d5ad8ef9af664962a7676288b52/library/std/src/macros.rs#L140

  2. https://github.com/rust-lang/rust/blob/8c127df75fde3d5ad8ef9af664962a7676288b52/library/std/src/macros.rs#L218

@GrigorenkoPV GrigorenkoPV requested a review from a team as a code owner May 28, 2024 13:24
@github-actions github-actions bot added the Z-BenchCI Tag a PR to run benchmark CI label May 28, 2024
@zhassan-aws
Copy link
Contributor

Thanks for the contribution @GrigorenkoPV!

It might also make sense to add a test for this.

Can you please add one? It can be placed under tests/kani/Print.

Thank you!

@zhassan-aws
Copy link
Contributor

Probably resolves #320.

I think you meant #3204

@GrigorenkoPV GrigorenkoPV deleted the patch-1 branch May 29, 2024 10:23
@GrigorenkoPV GrigorenkoPV restored the patch-1 branch May 29, 2024 10:24
@GrigorenkoPV GrigorenkoPV deleted the patch-1 branch May 29, 2024 10:25
@GrigorenkoPV GrigorenkoPV mentioned this pull request May 29, 2024
zhassan-aws pushed a commit that referenced this pull request May 29, 2024
GitHub closed the previous PR (#3205) after I renamed a branch, hooray.

Change the implementation of `println!` & `eprintln!` with no arguments
to call `print!("\n")`
& `eprint!("\n")` respectively instead of producing no tokens. This is
what std does. [^println][^eprintln]

 
[^println]:
https://github.com/rust-lang/rust/blob/8c127df75fde3d5ad8ef9af664962a7676288b52/library/std/src/macros.rs#L140
[^eprintln]:
https://github.com/rust-lang/rust/blob/8c127df75fde3d5ad8ef9af664962a7676288b52/library/std/src/macros.rs#L218

Resolves #3204.

A test included, as per
#3205 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-BenchCI Tag a PR to run benchmark CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants