Skip to content

Conversation

alexcrichton
Copy link
Member

This commit alters the rustc::ty::maps implementation to ensure that all
output diagnostics from the compiler are tracked for the duration of each query.
These are then intended to be replayed back the first time a cached value is
loaded, and otherwise the cache should operate the same as it does today.

Closes #42513

@rust-highfive
Copy link
Contributor

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member Author

r? @michaelwoerister

This doesn't currently include any tests as I wasn't quite sure how to test it, but if you know how/where to add tests I'd be more than happy to do so! Otherwise I just noticed #41184 so I'm not sure if this is quite amenable to such construction, but figure it was at least likely a step in the right direction.

@michaelwoerister
Copy link
Member

Thanks, @alexcrichton! Looks good to me at a first glance.

Have you done any measurements on how this affects memory consumption? We are potentially storing a lot of these query results, also in non-incremental mode, so it might make sense to optimize for the "no-diagnostics" case. But I'd measure first.

@alexcrichton
Copy link
Member Author

Oh good point! I tried to measure a bit but the one test case I used said this decreased memory usage wrt the most recent nightly, so I figured it wasn't really much effort to go ahead and optimize the representation so I've now done so.

@michaelwoerister
Copy link
Member

@bors r+

Looks good to me now! Thanks!

@bors
Copy link
Collaborator

bors commented Aug 23, 2017

📌 Commit 79ebc10 has been approved by michaelwoerister

@aidanhs aidanhs added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 23, 2017
@bors
Copy link
Collaborator

bors commented Aug 24, 2017

☔ The latest upstream changes (presumably #43345) made this pull request unmergeable. Please resolve the merge conflicts.

This commit alters the `rustc::ty::maps` implementation to ensure that all
output diagnostics from the compiler are tracked for the duration of each query.
These are then intended to be replayed back the first time a cached value is
loaded, and otherwise the cache should operate the same as it does today.

Closes rust-lang#42513
@alexcrichton
Copy link
Member Author

@bors: r=michaelwoerister

@bors
Copy link
Collaborator

bors commented Aug 24, 2017

📌 Commit 8e95b3a has been approved by michaelwoerister

@bors
Copy link
Collaborator

bors commented Aug 25, 2017

⌛ Testing commit 8e95b3a with merge ccb1cb25a8c8134685167205b866f830d484e633...

@bors
Copy link
Collaborator

bors commented Aug 25, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Aug 25, 2017

@bors retry

check x86_64-apple-darwin LLDB segfault, assuming spurious.

[01:45:13] ---- [debuginfo-lldb] debuginfo-lldb/generic-method-on-generic-struct.rs stdout ----
[01:45:13] 	NOTE: compiletest thinks it is using LLDB version 360
[01:45:13] 
[01:45:13] error: Error while running LLDB
[01:45:13] status: signal: 11
[01:45:13] command: "/usr/bin/python" "/Users/travis/build/rust-lang/rust/src/etc/lldb_batchmode.py" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/generic-method-on-generic-struct.stage2-x86_64-apple-darwin" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/generic-method-on-generic-struct.debugger.script"
[01:45:13] stdout:
[01:45:13] ------------------------------------------
[01:45:13] LLDB batch-mode script
[01:45:13] ----------------------
[01:45:13] Debugger commands script is '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/generic-method-on-generic-struct.debugger.script'.
[01:45:13] Target executable is '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/generic-method-on-generic-struct.stage2-x86_64-apple-darwin'.
[01:45:13] Current working directory is '/Users/travis/build/rust-lang/rust'
[01:45:13] Creating a target for '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/generic-method-on-generic-struct.stage2-x86_64-apple-darwin'
[01:45:13] settings set auto-confirm true
[01:45:13] 
[01:45:13] version
[01:45:13] lldb-360.1.70 
[01:45:13] command script import /Users/travis/build/rust-lang/rust/./src/etc/lldb_rust_formatters.py
[01:45:13] type summary add --no-value --python-function lldb_rust_formatters.print_val -x ".*" --category Rust
[01:45:13] type category enable Rust
[01:45:13] 
[01:45:13] breakpoint set --file 'generic-method-on-generic-struct.rs' --line 131
[01:45:13] Breakpoint 1: 2 locations. 
[01:45:13] breakpoint set --file 'generic-method-on-generic-struct.rs' --line 136
[01:45:13] Breakpoint 2: 2 locations. 
[01:45:13] breakpoint set --file 'generic-method-on-generic-struct.rs' --line 141
[01:45:13] Breakpoint 3: where = generic-method-on-generic-struct.stage2-x86_64-apple-darwin`generic_method_on_generic_struct::{{impl}}::self_owned<f64,f32> + 47 at generic-method-on-generic-struct.rs:141, address = 0x00000001000016ff 
[01:45:13] quit
[01:45:13] 
[01:45:13] 
[01:45:13] ------------------------------------------
[01:45:13] stderr:
[01:45:13] ------------------------------------------
[01:45:13] 
[01:45:13] ------------------------------------------
[01:45:13] 
[01:45:13] thread '[debuginfo-lldb] debuginfo-lldb/generic-method-on-generic-struct.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:2435:8
[01:45:13] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:45:13] 
[01:45:13] 
[01:45:13] failures:
[01:45:13]     [debuginfo-lldb] debuginfo-lldb/generic-method-on-generic-struct.rs
[01:45:13] 
[01:45:13] test result: �[31mFAILED�(B�[m. 97 passed; 1 failed; 10 ignored; 0 measured; 0 filtered out
[01:45:13] 
[01:45:13] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:322:21

@shepmaster
Copy link
Member

shepmaster commented Aug 25, 2017

Perhaps a real failure:

[01:45:13] failures:
[01:45:13] 
[01:45:13] ---- [debuginfo-lldb] debuginfo-lldb/generic-method-on-generic-struct.rs stdout ----
[01:45:13] 	NOTE: compiletest thinks it is using LLDB version 360
[01:45:13] 
[01:45:13] error: Error while running LLDB
[01:45:13] thread '[debuginfo-lldb] debuginfo-lldb/generic-method-on-generic-struct.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:2435:8
[01:45:13] note: Run with `RUST_BACKTRACE=1` for a backtrace.

@bors
Copy link
Collaborator

bors commented Aug 25, 2017

⌛ Testing commit 8e95b3a with merge 2aeb593...

bors added a commit that referenced this pull request Aug 25, 2017
…rister

rustc: Capture diagnostics from all queries

This commit alters the `rustc::ty::maps` implementation to ensure that all
output diagnostics from the compiler are tracked for the duration of each query.
These are then intended to be replayed back the first time a cached value is
loaded, and otherwise the cache should operate the same as it does today.

Closes #42513
@bors
Copy link
Collaborator

bors commented Aug 25, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: michaelwoerister
Pushing 2aeb593 to master...

@bors bors merged commit 8e95b3a into rust-lang:master Aug 25, 2017
@alexcrichton alexcrichton deleted the capture-diagnostics branch September 1, 2017 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants