-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Name the captured upvars for closures/generators in debuginfo #85020
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
Merged
+277
−24
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
29856ac
Name the captured upvars for closures/generators in debuginfo
lrh2000 cda90f5
Store names of captured variables in `optimized_mir`
lrh2000 0cb6f07
Avoid unnecessary `String::clone`
lrh2000 cf5eda1
Add a query for `CapturedPlace::to_symbol`
lrh2000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 file contains hidden or 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 file contains hidden or 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 file contains hidden or 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 file contains hidden or 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 file contains hidden or 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 file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// compile-flags:-g | ||
|
||
// === GDB TESTS =================================================================================== | ||
|
||
// gdb-command:run | ||
// gdb-command:print test | ||
// gdbr-check:$1 = captured_fields_1::main::{closure#0} {_ref__my_ref__my_field1: 0x[...]} | ||
// gdb-command:continue | ||
// gdb-command:print test | ||
// gdbr-check:$2 = captured_fields_1::main::{closure#1} {_ref__my_ref__my_field2: 0x[...]} | ||
// gdb-command:continue | ||
// gdb-command:print test | ||
// gdbr-check:$3 = captured_fields_1::main::{closure#2} {_ref__my_ref: 0x[...]} | ||
// gdb-command:continue | ||
// gdb-command:print test | ||
// gdbr-check:$4 = captured_fields_1::main::{closure#3} {my_ref: 0x[...]} | ||
// gdb-command:continue | ||
// gdb-command:print test | ||
// gdbr-check:$5 = captured_fields_1::main::{closure#4} {my_var__my_field2: 22} | ||
// gdb-command:continue | ||
// gdb-command:print test | ||
// gdbr-check:$6 = captured_fields_1::main::{closure#5} {my_var: captured_fields_1::MyStruct {my_field1: 11, my_field2: 22}} | ||
// gdb-command:continue | ||
|
||
// === LLDB TESTS ================================================================================== | ||
|
||
// lldb-command:run | ||
// lldb-command:print test | ||
// lldbg-check:(captured_fields_1::main::{closure#0}) $0 = { _ref__my_ref__my_field1 = 0x[...] } | ||
// lldb-command:continue | ||
// lldb-command:print test | ||
// lldbg-check:(captured_fields_1::main::{closure#1}) $1 = { _ref__my_ref__my_field2 = 0x[...] } | ||
// lldb-command:continue | ||
// lldb-command:print test | ||
// lldbg-check:(captured_fields_1::main::{closure#2}) $2 = { _ref__my_ref = 0x[...] } | ||
// lldb-command:continue | ||
// lldb-command:print test | ||
// lldbg-check:(captured_fields_1::main::{closure#3}) $3 = { my_ref = 0x[...] } | ||
// lldb-command:continue | ||
// lldb-command:print test | ||
// lldbg-check:(captured_fields_1::main::{closure#4}) $4 = { my_var__my_field2 = 22 } | ||
// lldb-command:continue | ||
// lldb-command:print test | ||
// lldbg-check:(captured_fields_1::main::{closure#5}) $5 = { my_var = { my_field1 = 11 my_field2 = 22 } } | ||
// lldb-command:continue | ||
|
||
#![feature(capture_disjoint_fields)] | ||
#![allow(unused)] | ||
|
||
struct MyStruct { | ||
my_field1: u32, | ||
my_field2: u32, | ||
} | ||
|
||
fn main() { | ||
let mut my_var = MyStruct { | ||
my_field1: 11, | ||
my_field2: 22, | ||
}; | ||
let my_ref = &mut my_var; | ||
|
||
let test = || { | ||
let a = &mut my_ref.my_field1; | ||
}; | ||
|
||
_zzz(); // #break | ||
|
||
let test = || { | ||
let a = &my_ref.my_field2; | ||
}; | ||
|
||
_zzz(); // #break | ||
|
||
let test = || { | ||
let a = &my_ref; | ||
}; | ||
|
||
_zzz(); // #break | ||
|
||
let test = || { | ||
let a = my_ref; | ||
}; | ||
|
||
_zzz(); // #break | ||
|
||
let test = move || { | ||
let a = my_var.my_field2; | ||
}; | ||
|
||
_zzz(); // #break | ||
|
||
let test = || { | ||
let a = my_var; | ||
}; | ||
|
||
_zzz(); // #break | ||
} | ||
|
||
fn _zzz() {} |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// compile-flags:-g | ||
|
||
// === GDB TESTS =================================================================================== | ||
|
||
// gdb-command:run | ||
// gdb-command:print my_ref__my_field1 | ||
// gdbr-check:$1 = 11 | ||
// gdb-command:continue | ||
// gdb-command:print my_var__my_field2 | ||
// gdbr-check:$2 = 22 | ||
// gdb-command:continue | ||
|
||
// === LLDB TESTS ================================================================================== | ||
|
||
// lldb-command:run | ||
// lldb-command:print my_ref__my_field1 | ||
// lldbg-check:(unsigned int) $0 = 11 | ||
// lldb-command:continue | ||
// lldb-command:print my_var__my_field2 | ||
// lldbg-check:(unsigned int) $1 = 22 | ||
// lldb-command:continue | ||
|
||
#![feature(capture_disjoint_fields)] | ||
#![allow(unused)] | ||
|
||
struct MyStruct { | ||
my_field1: u32, | ||
my_field2: u32, | ||
} | ||
|
||
fn main() { | ||
let mut my_var = MyStruct { | ||
my_field1: 11, | ||
my_field2: 22, | ||
}; | ||
let my_ref = &mut my_var; | ||
|
||
let test = || { | ||
let a = my_ref.my_field1; | ||
|
||
_zzz(); // #break | ||
}; | ||
|
||
test(); | ||
|
||
let test = move || { | ||
let a = my_var.my_field2; | ||
|
||
_zzz(); // #break | ||
}; | ||
|
||
test(); | ||
} | ||
|
||
fn _zzz() {} |
This file contains hidden or 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 file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.