-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Allow storing format_args!() in variable or const #139135
Draft
m-ou-se
wants to merge
5
commits into
rust-lang:master
Choose a base branch
from
m-ou-se:super-format-args
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Mar 30, 2025
This comment was marked as outdated.
This comment was marked as outdated.
3b4d57d
to
627b48c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
627b48c
to
25d0db8
Compare
This comment has been minimized.
This comment has been minimized.
25d0db8
to
2a4d503
Compare
This comment has been minimized.
This comment has been minimized.
2a4d503
to
44b1861
Compare
One day, clippy will not break when I make any change to format_args!(). That day is not today. |
This comment has been minimized.
This comment has been minimized.
44b1861
to
847637d
Compare
This makes it posisble to do: let f = format_args!("Hello, {name}!");
We can now just make new_v1_formatted an unsafe fn.
847637d
to
096a1b8
Compare
This comment has been minimized.
This comment has been minimized.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Mar 31, 2025
Remove fragile equal-pointers-unequal/*/print3.rs tests. These tests were added in rust-lang#127003 The print3.rs tests stop working when I change implementation details of format_args!(). (For example, in rust-lang#139175 and rust-lang#139135). These tests shouldn't rely on such implementation details. It gets in the way for format_args!() improvements. If they test anything that aren't already covered by the other tests in this directory, they should be expressed in a less fragile way that doesn't rely on internal details of format_args!(). cc `@GrigorenkoPV,` author of these tests.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Mar 31, 2025
Remove fragile equal-pointers-unequal/*/print3.rs tests. These tests were added in rust-lang#127003 The print3.rs tests stop working when I change implementation details of format_args!(). (For example, in rust-lang#139175 and rust-lang#139135). These tests shouldn't rely on such implementation details. It gets in the way for format_args!() improvements. If they test anything that aren't already covered by the other tests in this directory, they should be expressed in a less fragile way that doesn't rely on internal details of format_args!(). cc ``@GrigorenkoPV,`` author of these tests.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 1, 2025
Rollup merge of rust-lang#139176 - m-ou-se:print3, r=compiler-errors Remove fragile equal-pointers-unequal/*/print3.rs tests. These tests were added in rust-lang#127003 The print3.rs tests stop working when I change implementation details of format_args!(). (For example, in rust-lang#139175 and rust-lang#139135). These tests shouldn't rely on such implementation details. It gets in the way for format_args!() improvements. If they test anything that aren't already covered by the other tests in this directory, they should be expressed in a less fragile way that doesn't rely on internal details of format_args!(). cc ``@GrigorenkoPV,`` author of these tests.
☔ The latest upstream changes (presumably #138740) made this pull request unmergeable. Please resolve the merge conflicts. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-tidy
Area: The tidy tool
needs-fcp
This change is insta-stable, so needs a completed FCP to proceed.
S-blocked
Status: Blocked on something else such as an RFC or other implementation work.
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #92698
Fixes #139136
This includes and is blocked on #139080, #139112, and #139131. Marking this as draft.
This change allows:
and
This will need an FCP.
This accidentally 'fixes' the tests/ui/codegen/equal-pointers-unequal/*/print3.rs tests. Those tests seem very fragile and should probably not depend on formatting implementation details at all.
This accidentally 'fixes' tests/ui/consts/const-eval/format.rs: it now allows any
panic!()
in a const fn. This might be expected. But we should then work on a better error when such a panic!() is const evaluated. (Now it reaches unreachable_unchecked().)