-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Doc comment custom MIR debuginfo. #117015
Conversation
52e7328
to
23052ad
Compare
9fa3469
to
f5ddec8
Compare
//! fn debuginfo(option: Option<&i32>) { | ||
//! mir!( | ||
//! debug option => option; | ||
//! debug projection => *Field::<&i32>(Variant(option, 1), 0); |
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.
So what does this mean? There's no local "projection" so I'm confused by both the left-hand side and the right-hand side.
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.
This mean debuginfo name projection
corresponds to the place (*((_1 as Some).0: &i32))
.
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.
And what does that mean?^^ What's a "debuginfo name"?
If the intention is that this is only understandable for people that know our debuginfo system internals, then I guess it's fine. But as someone who has no idea at all about debuginfo, your explanation tells me nothing.
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 know the better terminology.
I by "debuginfo name", I mean the string you give to gdb when you want to print the variable.
MIR roughly represents debuginfo as a list of structs { Symbol, SourceScope, Place or Const }
, stating "this name at at this point in code corresponds to this memory place".
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.
Ah so it's meant to be the name of the variable in the original source code?
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.
Yes.
Should we call it "Source code variable name"?
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.
Yes I like that.
//! #[custom_mir(dialect = "built")] | ||
//! fn debuginfo(option: Option<&i32>) { | ||
//! mir!( | ||
//! debug option => option; |
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.
//! debug option => option; | |
//! debug plain_local => option; |
?
//! - A debuginfo name can be given to a local using `debug my_name => contents;`. | ||
//! For `contents`, we use the same syntax as operands, to support both places and constants. |
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.
//! - A debuginfo name can be given to a local using `debug my_name => contents;`. | |
//! For `contents`, we use the same syntax as operands, to support both places and constants. | |
Debuginfo associates source code variable names (of variables that | |
may not exist any more) with MIR expressions that indicate where | |
the value of that variable is stored. The syntax to do so is: | |
``` | |
debug source_var_name => expression; | |
``` | |
For `expression`, we use the same syntax as operands, to support both places and constants. |
@rustbot author |
☔ The latest upstream changes (presumably #119578) made this pull request unmergeable. Please resolve the merge conflicts. |
@cjgillot what's the status of this PR? I think we have reached a consensus above for how to document this, it just needs to be implemented. :) |
Ping from triage: I'm closing this due to inactivity because no commits have occurred in a year. Please reopen when you are ready to continue with this. @rustbot label: +S-inactive |
I revived this PR at #133625 |
…compiler-errors custom MIR: add doc comment for debuginfo This is a revival of rust-lang#117015
…compiler-errors custom MIR: add doc comment for debuginfo This is a revival of rust-lang#117015
Rollup merge of rust-lang#133625 - RalfJung:custom-mir-debug-info, r=compiler-errors custom MIR: add doc comment for debuginfo This is a revival of rust-lang#117015
r? @RalfJung
Asked in https://github.com/rust-lang/rust/pull/115540/files#r1318762354