[generic_assert] Constify methods used by the formatting system - #135139
Conversation
|
Looks like this is strictly internal so far, so this shouldn't need team input. @bors r+ |
This comment has been minimized.
This comment has been minimized.
|
@bors r- |
|
@rustbot review Should be good now |
|
Thanks! @bors r+ rollup |
|
@c410-f3r @jhpratt This PR caused #139136 and #139621 There was a good reason that rust/compiler/rustc_ast_lowering/src/format.rs Lines 467 to 469 in 6bc57c6
The effect was not internal. This allowed more format_args!() invocations in const which has now shipped on stable. We're trying to revert it, but unfortunately that is now technically a breaking change. |
|
Next time you change/review anything about Edit: Triagebot should do this automatically in the future: #140173 |
|
Sorry, of course! Certainly not intentional. My question is, how could/should I have recognized that this was not internal? The only
👍 |
The methods this PR changed are all methods on types that are That this PR had effects on stable code can be seen from the few errors that disappeared in one of the tests, in the diff of this PR. E.g. - --> $DIR/format.rs:2:5
- |
- LL | panic!("{:?}", 0);
- | ^^^^^^^^^^^^^^^^^
- |That test doesn't use any unstable features, so that's a clear sign that this affects stable code. In those cases, it might be a good idea to ping |
|
To be fair, it's not clear that I would have caught this, since all involved functions are unstable. If something relies on an unstable function not being const, that really warrants a comment at that function and a dedicated test (as is done in #139624), otherwise this is bound to go wrong. "Just be more careful" is generally not the attitude we are using in Rust, after all.
Every line that used to have an error still has an error. It's fairly normal for a PR to change what exact errors are emitted. So I would not call this a very clear sign. The main issue is that we didn't have a test ensuring that |
FWIW, there were two error annotations: The first one is basically for "no Debug formatting in const" and the second is basically "no format_args!() in const". This PR removes the second one. What makes it extra confusing is that the compiler is replacing the first error message with a generic "no formatting in const" message, but not the second one. That should have been the other way around.
I agree. |
Yeah, but it's quite common that a PR changes output from 2 annotations to 1, at least in the area of const stability checks -- and generally we consider that an improvement. So it does not stand out to me in the diff. |
That indicates that the logic around here uses the wrong key to trigger |
Yeah I already have that changed in my local copy. Will send it as a PR as soon as #139624 is merged. |
cc #44838
Starts the "constification" of all the elements required to allow the execution of the formatting system in constant environments.
Further stuff is blocked by #133999.