-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Suppress "const" prefix of FnDef constants in MIR dump #75697
Conversation
cc @mark-i-m Do I need to update MIR dump in rustc-dev-guide somewhere? |
cc @rust-lang/wg-mir-opt |
@@ -1,4 +1,4 @@ | |||
error[E0723]: can only call other `const fn` within a `const fn`, but `const regular_in_block` is not stable as `const fn` | |||
error[E0723]: can only call other `const fn` within a `const fn`, but `regular_in_block` is not stable as `const fn` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this is interesting!
☔ The latest upstream changes (presumably #75715) made this pull request unmergeable. Please resolve the merge conflicts. |
1941082
to
4089aad
Compare
cc @bjorn3 for your work with MIR in |
@@ -38,7 +38,7 @@ fn borrow_and_cast(_1: i32) -> () { | |||
_6 = &raw mut (*_7); // scope 2 at $DIR/address-of.rs:44:13: 44:19 | |||
FakeRead(ForLet, _6); // scope 2 at $DIR/address-of.rs:44:9: 44:10 | |||
StorageDead(_7); // scope 2 at $DIR/address-of.rs:44:31: 44:32 | |||
_0 = const (); // scope 0 at $DIR/address-of.rs:41:32: 45:2 | |||
_0 = (); // scope 0 at $DIR/address-of.rs:41:32: 45:2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a difference between these two. const ()
is a Constant
, while ()
is an Aggregate
.
@@ -25,9 +25,9 @@ fn main() -> () { | |||
|
|||
bb0: { | |||
StorageLive(_1); // scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14 | |||
_1 = [const 42_u32, const 43_u32, const 44_u32]; // scope 0 at $DIR/array-index-is-temporary.rs:13:17: 13:29 | |||
_1 = [42_u32, 43_u32, 44_u32]; // scope 0 at $DIR/array-index-is-temporary.rs:13:17: 13:29 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarily here, though I am not sure if the Constant
could be printed as an array, or would be printed as a raw allocation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it can be printed as an array, so yea, there would be no visible difference in the mir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering whether the information const
vs Aggregate
is useful, but the original comment by me that motivated @lzutao to open this PR was solely for FnDef
, where the const
is actively confusing (at least in the position for function calls. Maybe we should just special case function calls to not print a const
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel super strongly but I would prefer if this was only done for FnDef
s right now.
4089aad
to
62cff09
Compare
Thanks for all comments. Now I only suppress "const" prefix for FnDef. |
☔ The latest upstream changes (presumably #75670) made this pull request unmergeable. Please resolve the merge conflicts. |
62cff09
to
4019330
Compare
@bors r+ rollup=iffy |
📌 Commit 4019330ee337e28ac2869ebbc47884f819c269b2 has been approved by |
4019330
to
3b853f3
Compare
Sorry, forgot to edit the commit message. It should be more correct now. |
@bors r+ |
📌 Commit 3b853f396dcbcbb5ddf94373526e7598184cee1f has been approved by |
☔ The latest upstream changes (presumably #75562) made this pull request unmergeable. Please resolve the merge conflicts. |
To be honest, I'm not sure. I don't remember how much we have about MIR dump. Perhaps someone else from @rust-lang/wg-rustc-dev-guide knows? |
@lzutao @mark-i-m We have https://rustc-dev-guide.rust-lang.org/mir/debugging.html but it doesn't seem to be affected. |
@bors r=oli-obk |
📌 Commit c4c017a has been approved by |
⌛ Testing commit c4c017a with merge fbc600c60e44097b00ddc90cee2548c4e59d7610... |
💔 Test failed - checks-azure |
Spurious error,
|
@bors retry |
⌛ Testing commit c4c017a with merge b374559b5a3ce28efb78626eab441eb0c1e176d6... |
💔 Test failed - checks-actions |
this appears to break rustfmt? |
Hm, I don't think it's caused by this PR, though I'm not sure if it's spurious or not.
|
Has to be spurious: |
☀️ Test successful - checks-actions, checks-azure |
I was asked to suppress the
const
infront ofFnDef
.I tried to suppress comments for other types, but turned out that
const ()
and()
is different: #75697 (comment)