Skip to content

introduce -Znll-facts to dump base-facts for the NLL analysis #50370

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
merged 7 commits into from
May 5, 2018

Conversation

nikomatsakis
Copy link
Contributor

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 1, 2018
@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

[00:04:50] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:50] tidy error: /checkout/src/bootstrap/compile.rs:1182: TODO is deprecated; use FIXME
[00:04:50] tidy error: /checkout/src/librustc_mir/borrow_check/location.rs:62: TODO is deprecated; use FIXME
[00:04:52] some tidy checks failed
[00:04:52] 
[00:04:52] 
[00:04:52] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:52] 
[00:04:52] 
[00:04:52] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:52] Build completed unsuccessfully in 0:01:58
[00:04:52] Build completed unsuccessfully in 0:01:58
[00:04:52] Makefile:79: recipe for target 'tidy' failed
[00:04:52] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0b11d50e
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@nikomatsakis nikomatsakis force-pushed the nll-alias-analysis-flat branch from dc7b664 to 5ef8c30 Compare May 1, 2018 19:00
// `killed(B,P)` when some prefix of the path borrowed at B is assigned at point P
crate killed: Vec<(BorrowIndex, LocationIndex)>,

// `outlives(R1, R2, P)` when we require `R1@P: R2@P`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why didn't you write R1: R2 @ P here? I thought the idea was that the :-relation was indexed on P (and other occurrences of the :-relation is consistent with that interpretation ... ?)

@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:start:test_mir-opt
Check compiletest suite=mir-opt mode=mir-opt (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:59:50] 
[00:59:50] running 50 tests
[01:00:11] ..................................FFF.............
[01:00:11] 
[01:00:11] ---- [mir-opt] mir-opt/nll/region-liveness-basic.rs stdout ----
[01:00:11] ---- [mir-opt] mir-opt/nll/region-liveness-basic.rs stdout ----
[01:00:11]  thread '[mir-opt] mir-opt/nll/region-liveness-basic.rs' panicked at 'Did not find expected line, error: ran out of mir dump to match against
[01:00:11] Expected Line: "| \'_#2r    | {bb2[0..=1], bb3[0..=1]}"
[01:00:11] Expected:
[01:00:11] ... (elided)
[01:00:11] | '_#2r    | {bb2[0..=1], bb3[0..=1]}
[01:00:11] | '_#3r    | {bb2[1], bb3[0..=1]}
[01:00:11] ... (elided)
[01:00:11]             let _2: &'_#3r usize;
[01:00:11] Actual:
[01:00:11] | Free Region Mapping
[01:00:11] | '_#0r    | Global   | ['_#0r, '_#1r]
[01:00:11] | '_#1r    | Local    | ['_#1r]
[01:00:11] | Inferred Region Values
[01:00:11] | Inferred Region Values
[01:00:11] | '_#0r    | {'_#0r, bb0[0..=7], bb1[0], bb2[0..=1], bb3[0..=2], bb4[0], bb5[0..=2], bb6[0..=1], bb7[0..=3]}
[01:00:11] | '_#1r    | {'_#1r, bb0[0..=7], bb1[0], bb2[0..=1], bb3[0..=2], bb4[0], bb5[0..=2], bb6[0..=1], bb7[0..=3]}
[01:00:11] | '_#2r    | {bb2[1], bb3[0..=1]}
[01:0               | Live variables on entry to bb3[1]: [_2]
[01:00:11]         _7 = (*_2);
[01:00:11]                                          | Live variables on entry to bb3[2]: [_7]
[01:00:11]         _6 = const use_x(move _7) -> [return: bb5, unwind: bb1];
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb4: []
[01:00:11]     bb4: {                              
[01:00:11]                                          | Live variables on entry to bb4[0]: []
[01:00:11]         _8 = const use_x(const 22usize) -> [return: bb6, unwind: bb1];
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb5: []
[01:00:11]     bb5: {                              
[01:00:11]                                          | Live variables on entry to bb5[0]: []
[01:00:11]         StorageDead(_7);
[01:00:11]                                          | Live variables on entry to bb5[1]: []
[01:00:11]         _0 = ();
[01:00:11]                                          | Live variables on entry to bb5[2]: []
[01:00:11]         goto -> bb7;
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb6: []
[01:00:11]     bb6: {                              
[01:00:11]                                          | Live variables on entry to bb6[0]: []
[01:00:11]         _0 = ();
[01:00:11]                                          | Live variables on entry to bb6[1]: []
[01:00:11]         goto -> bb7;
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb7: []
[01:00:11]     bb7: {                              
[01:00:11]                                          | Live variables on entry to bb7[0]: []
[01:00:11]         nop;
[01:00:11]                                          | Live variables on entry to bb7[1]: []
[01:00:11]         StorageDead(_2);
[01:00:11]                                          | Live variables on entry to bb7[2]: []
[01:00:11]         StorageDead(_1);
[01:00:11]                                          | Live variables on entry to bb7[3]: []
[01:00:11]         return;
[01:00:11]     }
[01:00:11] }', tools/compiletest/src/runtest.rs:2735:13
[01:00:11] 
[01:00:11] ---- [mir-opt] mir-opt/nll/region-liveness-two-disjoint-uses.rs stdout ----
[01:00:11] ---- [mir-opt] mir-opt/nll/region-liveness-two-disjoint-uses.rs stdout ----
[01:00:11]  thread '[mir-opt] mir-opt/nll/region-liveness-two-disjoint-uses.rs' panicked at 'Did not find expected line, error: ran out of mir dump to match against
[01:00:11] Expected Line: "| \'_#2r    | {bb2[0..=1], bb3[0..=1]}"
[01:00:11] Expected:
[01:00:11] ... (elided)
[01:00:11] | '_#2r    | {bb2[0..=1], bb3[0..=1]}
[01:00:11] ... (elided)
[01:00:11] | '_#4r    | {bb8[1..=4]}
[01:00:11] | '_#5r    | {bb2[1], bb3[0..=1], bb8[2..=4]}
[01:00:11] ... (elided)
[01:00:11] let mut _2: &'_#5r usize;
[01:00:11] ... (elided)
[01:00:11] _2 = &'_#2r _1[_3];
[01:00:11] ... (elided)
[01:00:11] _2 = &'_#4r (*_10);
[01:00:11] Actual:
[01:00:11] | Free Region Mapping
[01:00:11] | '_#0r    | Global   | ['_#0r, '_#1r]
[01:00:11] | '_#1r    | Local    | ['_#1r]
[01:00:11] | Inferred Region Values
[01:00:11] | Inferred Region Values
[01:00:11] | '_#0r    | {'_#0r, bb0[0..=7], bb1[0], bb2[0..=1], bb3[0..=2], bb4[0], bb5[0..=2], bb6[0..=1], bb7[0..=5], bb8[0..=5], bb9[0..=5]}
[01:00:11] | '_#1r    | {'_#1r, bb0[0..=7], bb1[0], bb2[0..=1], bb3[0..=2], bb4[0], bb5[0..=2], bb6[0..=1], bb7[0..=5], bb8[0..=5], bb9[0..=5]}
[01:00:11] | '_#2r    | {bb2[1], bb3[0..=1]}
[01:00:11] | '_#3r    | {bb8[1..=4]}
[01:00:11] | '_#4r    | {bb8[2..=4]}
[01:00:11] | '_#5r    | {bb2[1], bb3[0..=1], bb8[2..=4]}
[01:00:11] | '_#6r    | {bb8[1..=4]}
[01:00:11] | Inference Constraints
[01:00:11] | Inference Constraints
[01:00:11] | '_#0r live at {'_#0r, bb0[0..=7], bb1[0], bb2[0..=1], bb3[0..=2], bb4[0], bb5[0..=2], bb6[0..=1], bb7[0..=5], bb8[0..=5], bb9[0..=5]}
[01:00:11] | '_#1r live at {'_#1r, bb0[0..=7], bb1[0], bb2[0..=1], bb3[0..=2], bb4[0], bb5[0..=2], bb6[0..=1], bb7[0..=5], bb8[0..=5], bb9[0..=5]}
[01:00:11] | '_#5r live at {bb2[1], bb3[0..=1], bb8[2..=4]}
[01:00:11] | '_#6r live at {bb8[1]}
[01:00:11] | '_#2r: '_#5r @ bb2[1] due to /checkout/src/test/mir-opt/nll/region-liveness-two-disjoint-uses.rs:26:17: 26:22
[01:00:11] | '_#3r: '_#6r @ bb8[1] due to /checkout/src/test/mir-opt/nll/region-liveness-two-disjoint-uses.rs:33:9: 33:14
[01:00:11] | '_#4r: '_#5r @ bb8[2] due to /checkout/src/test/mir-opt/nll/region-liveness-two-disjoint-uses.rs:33:5: 33:14
[01:00:11] | '_#6r: '_#4r @ bb8[2] due to /checkout/src/test/mir-opt/nll/region-liveness-two-disjoint-uses.rs:33:5: 33:14
[01:00:11] fn main() -> (){
[01:00:11]     let mut _0: ();
[01:00:11]     scope 1 {
[01:00:11]         let mut _1: [usize; 3];
[01:00:11]         scope 3 {
[01:00:11]             let mut _2: &'_#5r usize;
[01:00:11]         scope 4 {
[01:00:11]         }
[01:00:11]     }
[01:00:11]     scope 2 {
[01:00:11]     scope 2 {
[01:00:11]     }
[01:00:11]     let mut _3: usize;
[01:0the len is move _4 but the index is _3") -> [success: bb2, unwind: bb1];
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb1: []
[01:00:11]     bb1: {
[01:00:11]                                          | Live variables on entry to bb1[0]: []
[01:00:11]         resume;
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb2: [_1, _3]
[01:00:11]     bb2: {                              
[01:00:11]                                          | Live variables on entry to bb2[0]: [_1, _3]
[01:00:11]         _2 = &'_#2r _1[_3];
[01:00:11]                                          | Live variables on entry to bb2[1]: [_1, _2]
[01:00:11]         switchInt(const true) -> [false: bb4, otherwise: bb3];
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb3: [_1, _2]
[01:00:11]     bb3: {                              
[01:00:11]                                          | Live variables on entry to bb3[0]: [_1, _2]
[01:00:11]         StorageLive(_8);
[01:00:11]                                          | Live variables on entry to bb3[1]: [_1, _2]
[01:00:11]         _8 = (*_2);
[01:00:11]                                          | Live variables on entry to bb3[2]: [_1, _8]
[01:00:11]         _7 = const use_x(move _8) -> [return: bb5, unwind: bb1];
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb4: [_1]
[01:00:11]     bb4: {                              
[01:00:11]                                          | Live variables on entry to bb4[0]: [_1]
[01:00:11]         _9 = const use_x(const 22usize) -> [return: bb6, unwind: bb1];
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb5: [_1]
[01:00:11]     bb5: {                              
[01:00:11]                                          | Live variables on entry to bb5[0]: [_1]
[01:00:11]         StorageDead(_8);
[01:00:11]                                          | Live variables on entry to bb5[1]: [_1]
[01:00:11]         _6 = ();
[01:00:11]                                          | Live variables on entry to bb5[2]: [_1]
[01:00:11]         goto -> bb7;
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb6: [_1]
[01:00:11]     bb6: {                              
[01:00:11]                                          | Live variables on entry to bb6[0]: [_1]
[01:00:11]         _6 = ();
[01:00:11]                                          | Live variables on entry to bb6[1]: [_1]
[01:00:11]         goto -> bb7;
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb7: [_1]
[01:00:11]     bb7: {                              
[01:00:11]                                          | Live variables on entry to bb7[0]: [_1]
[01:00:11]         StorageLive(_10);
[01:00:11]                                          | Live variables on entry to bb7[1]: [_1]
[01:00:11]         StorageLive(_11);
[01:00:11]                                          | Live variables on entry to bb7[2]: [_1]
[01:00:11]         _11 = const 1usize;
[01:00:11]                                          | Live variables on entry to bb7[3]: [_1, _11]
[01:00:11]         _12 = Len(_1);
[01:00:11]                                          | Live variables on entry to bb7[4]: [_1, _11, _12]
[01:00:11]         _13 = Lt(_11, _12);
[01:00:11]                                          | Live variables on entry to bb7[5]: [_1, _11, _12, _13]
[01:00:11]         assert(move _13, "index out of bounds: the len is move _12 but the index is _11") -> [success: bb8, unwind: bb1];
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb8: [_1, _11]
[01:00:11]     bb8: {                              
[01:00:11]                                          | Live variables on entry to bb8[0]: [_1, _11]
[01:00:11]         _10 = &'_#3r _1[_11];
[01:00:11]                                          | Live variables on entry to bb8[1]: [_10]
[01:00:11]         _2 = &'_#4r (*_10);
[01:00:11]                                          | Live variables on entry to bb8[2]: [_2]
[01:00:11]         StorageDead(_10);
[01:00:11]                                          | Live variables on entry to bb8[3]: [_2]
[01:00:11]         StorageLive(_15);
[01:00:11]                                          | Live variables on entry to bb8[4]: [_2]
[01:00:11]         _15 = (*_2);
[01:00:11]                                          | Live variables on entry to bb8[5]: [_15]
[01:00:11]         _14 = const use_x(move _15) -> [return: bb9, unwind: bb1];
[01:00:11]     }
[01:00:11]     | Live variables on entry to bb9: []
[01:00:11]     bb9: {                              
[01:00:11]                                          | Live variables on entry to bb9[0]: []
[01:00:11]         StorageDead(_15);
[01:00:11]                                          | Live variables on entry to bb9[1]: []
[01:00:11]         _0 = ();
[01:00:11]                                          | Live variables on entry to bb9[2]: []
[01:00:11]         nop;
[01:00:11]                                          | Live variables on entry to bb9[3]: []
[01:00:11]         StorageDead(_2);
[01:00:11]                                          | Live variables on entry to bb9[4]: []
[01:00:11]         StorageDead(_1);
[01:00:11]                                          | Live variables on entry to bb9[5]: []
[01:00:11]         return;
[01:00:11]     }
[01:00:11] }', tools/compiletest/src/runtest.rs:2735:13
[01:00:11] ---- [mir-opt] mir-opt/nll/region-subtyping-basic.rs stdout ----
[01:00:11] ---- [mir-opt] mir-opt/nll/region-subtyping-basic.rs stdout ----
[01:00:11]  thread '[mir-opt] mir-opt/nll/region-subtyping-basic.rs' panicked at 'Did not find expected line, error: ran out of mir dump to match against
[01:00:11] Expected Line: "| \'_#2r    | {bb2[0..=6], bb3[0..=1]}"
[01:00:11] Expected:
[01:00:11] ... (elided)
[01:00:11] | '_#2r    | {bb2[0..=6], bb3[0..=1]}
[01:00:11] | '_#3r    | {bb2[1..=6], bb3[0..=1]}
[01:00:11] | '_#4r    | {bb2[5..=6], bb3[0..=1]}
[01:00:11] Actual:
[01:00:11] | Free Region Mapping
[01:00:11] | '_#0r    | Global   | ['_#0r, '_#1r]
[01:00:11] | '_#1r    | Local    | ['_#1r]
[01:00:11] | Inferred Region Values
[01:00:11] | Inferred Region Values
[01:00:11] | '_#0r    | {'_#0r, bb0[0..=7], bb1[0], bb2[0..=6], bb3[0..=2], bb4[0], bb5[0..=2], bb6[0..=1], bb7[0..=5]}
[01:00:11] | '_#1r    | {'_#1r, bb0[0..=7], bb1[0], bb2[0..=6], bb3[0..=2], bb4[0], bb5[0..=2], bb6[0..=1], bb7[0..=5]}
[01:00:11] | '_#2r    | {bb2[1..=6], bb3[0..=1]}
[01:00:11] | '_#3r    | {bb2[1..=6], bb3[0..=1]}
[01:00:11] | '_#4r    | {bb2[5..=6], bb3[0..=1]}
[01:00:11] | '_#5r    | {bb2[4..=6], bb3[0..=1]}
[01:00:11] | '_#6r    | {bb2[3..=6], bb3[0..=1]}
[01:00:11] | Inference Constraints
[01:00:11] | Inference Constraints
[01:00:11] | '_#0r live at {'_#0r, bb0[0..=7], bb1[0], bb2[0..=6], bb3[0..=2], bb4[0], bb5[0..=2], bb6[0..=1], bb7[0..=5]}
[01:00:11] | '_#1r live at {'_#1r, bb0[0..=7], bb1[0], bb2[0..=6], bb3[0..=2], bb4[0], bb5[0..=2], bb6[0..=1], bb7[0..=5]}
[01:00:11] | '_#3r live at {bb2[1..=3]}
[01:00:11] | '_#4r live at {bb2[5..=6], bb3[0..=1]}
[01:00:11] | '_#5r live at {bb2[4]}
[01:00:11] | '_#2r: '_#3r @ bb2[1] due to /checkout/src/test/mir-opt/nll/region-subtyping-basic.rs:24:13: 24:18
[01:00:11] | '_#3r: '_#5r @ bb2[4] due to /checkout/src/test/mir-opt/nll/region-subtyping-basic.rs:25:13: 25:14
[01:00:11] | '_#3r: '_#6r @ bb2[3] due to /checkout/src/test/mir-opt/nll/region-subtyping-basic.rs:25:13: 25:14
[01:00:11] | '_#5r: '_#4r @ bb2[5] due to /checkout/src/test/mir-opt/nll/region-subtyping-basic.rs:25:13: 25:14
[01:00:11] | '_#6r: '_#3r @ bb2[3] due to /checkout/src/test/mir-opt/nll/region-subtyping-basic.rs:25:13: 25:14
[01:00:11] fn main() -> (){
[01:00:11]     let mut _0: ();
[01:00:11]     scope 1 {
[01:00:11]         let mut _1: [usize; 3];
[01:00:11]         scope 3 {
[01:00:11]             let _2: &'_#3r usize;
[01:00:11]             scope 5 {
[01:00:11]                 let _6: &'_#4r usize;
[01:00:11]             scope 6 {
[01:00:11]             }
[01:00:11]         }
[01:00:11]         scope 4 {
[01:00:11]         scope 4 {
[01:00:11]         }
[01:00:11]     }
[01:00:11]     scope 2 {
[01:00:11]     }
[01:00:11]     let mut _3: usize;
[01:00:11]     let mut _4: usize;
[01:00:11try to bb7[2]: []
[01:00:11]         nop;
[01:00:11]                                          | Live variables on entry to bb7[3]: []
[01:00:11]         StorageDead(_2);
[01:00:11]                                          | Live variables on entry to bb7[4]: []
[01:00:11]         StorageDead(_1);
[01:00:11]                                          | Live variables on entry to bb7[5]: []
[01:00:11]         return;
[01:00:11]     }
[01:00:11] }', tools/compiletest/src/runtest.rs:2735:13
[01:00:11] 
[01:00:11] failures:
[01:00:11]     [mir-opt] mir-opt/nll/region-liveness-basic.rs
[01:00:11]     [mir-opt] mir-opt/nll/region-liveness-two-disjoint-uses.rs
[01:00:11]     [mir-opt] mir-opt/nll/region-liveness-two-disjoint-uses.rs
[01:00:11]     [mir-opt] mir-opt/nll/region-subtyping-basic.rs
[01:00:11] 
[01:00:11] test result: FAILED. 47 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out
[01:00:11] 
[01:00:11] 
[01:00:11] 
[01:00:11] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/mir-opt" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "mir-opt" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:00:11] 
[01:00:11] 
[01:00:11] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:488:22
[01:00:11] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:00:11] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:00:11] Build completed unsuccessfully in 0:17:46
[01:00:11] make: *** [check] Error 1
[01:00:11] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0224b284
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

/// is the `P` value.
pub at_location: Location,
pub enum Locations {
All,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, I'm torn. I was struck by your occasional use of .unwrap_or(Location::START), because I wasn't clear on how that was justified. But then I looked at the code prior to this PR, and do see places where you have (quite naturally) replaced previous uses of START with All...

Anyway, reading over those cases led me back to this enum declaration. I thought at first that All is pretty self-documenting here in the enum declaration itself (i.e., it represents all locations, and it is used in cases where you are describing some constraint that is true everywhere in the control-flow graph, like type equivalences)... But then after reading the comments that go with Locations::Pair, I sort of lost that perspective. I guess the main point is that some constraints are flow-independent throughout the function, and others are control-flow dependent, and that is the distinction encoded in this enum? Does that sound right?

But then ... how should one decide when it is appropriate to map from_location() (or at_location()) of None to Location::START? Is it just that since we're talking about an flow-independent constraint, then any location will do, so we might as well pick START?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, the code that "falls back" to START is a bit confusing. I'm not 100% convinced that is a correct thing to do, but I was just trying to keep existing behavior. In any case, START is a better choice for the old NLL because all other points are reachable from there. I can try to elaborate the comment a bit.

The problem I was specifically encountering here in the new analysis was that we would do this:

_0 = p

where _0 is the return pointer. We treat _0 like any other place, and hence we considered _0 to not be live until that point! This meant that when we related _0 to the return type at the entry, all of those subtype relations were lost. This is why I re-add it at each point. TBH it's .. maybe a hack? I wasn't fully satisfied.

@pnkfelix
Copy link
Member

pnkfelix commented May 1, 2018

I had some small nits mostly related to comments. But it looks fine as far as I understand it.

r=me once it passes travis.

@nikomatsakis nikomatsakis force-pushed the nll-alias-analysis-flat branch from a8160b0 to 2a240b1 Compare May 4, 2018 18:20
@nikomatsakis
Copy link
Contributor Author

Rebased and added a comment concerning Locations::All

x.py test passes locally.

@bors r=pnkfelix

@bors
Copy link
Collaborator

bors commented May 4, 2018

📌 Commit ecb2af4 has been approved by pnkfelix

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 4, 2018
@nikomatsakis nikomatsakis force-pushed the nll-alias-analysis-flat branch from ecb2af4 to 047ad85 Compare May 4, 2018 18:28
@nikomatsakis
Copy link
Contributor Author

@bors r=pnkfelix

@bors
Copy link
Collaborator

bors commented May 4, 2018

📌 Commit 047ad85 has been approved by pnkfelix

@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:07:35]    Compiling proc_macro v0.0.0 (file:///checkout/src/libproc_macro)
[00:07:53]    Compiling syntax_ext v0.0.0 (file:///checkout/src/libsyntax_ext)
[00:14:08]    Compiling rustc_mir v0.0.0 (file:///checkout/src/librustc_mir)
[00:14:08]    Compiling rustc_typeck v0.0.0 (file:///checkout/src/librustc_typeck)
[00:14:13] error[E0599]: no method named `iter` found for type `std::iter::Chain<std::option::IntoIter<&rustc::mir::BasicBlock>, std::slice::Iter<'_, rustc::mir::BasicBlock>>` in the current scope
[00:14:13]    --> librustc_mir/borrow_check/nll/constraint_generation.rs:164:60
[00:14:13]     |
[00:14:13] 164 |             for successor_block in terminator.successors().iter() {
[00:14:13] 
[00:14:22] error: aborting due to previous error
[00:14:22] 
[00:14:22] For more information about this error, try `rustc --explain E0599`.
[00:14:22] For more information about this error, try `rustc --explain E0599`.
[00:14:22] error: Could not compile `rustc_mir`.
[00:14:22] 
[00:14:22] Caused by:
[00:14:22]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_mir librustc_mir/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=3 -C metadata=be556f8244fb0842 -C extra-filename=-be556f8244fb0842 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-946eff7380f27f57.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-946eff7380f27f57.rlib --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-b789a86e1ab64d11.so --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-f456f53371aa074c.so --extern graphviz=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libgraphviz-21ce4bd19908f0cc.so --extern byteorder=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbyteorder-c0908caf79d2e3f2.rlib --extern rustc_apfloat=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-b7c66a9cab3ff5a6.rlib --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-16776be762f4e8c2.so --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-4f0866e958f59455.rlib --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-6af31fe8ff356c2e.so --extern log_settings=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog_settings-a9c63eb5aa166466.rlib --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-401bddd0d1809e53.rlib --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-b9901acb1e9e6766.so --extern rustc_target=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-aed9d8ab86b35123.so --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-566a8d95e6a18781.so -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-31a3817325787acc/out/.libs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-90c24e5cae9d047e/out` (exit code: 101)
nu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps
65424 ./src/llvm-emscripten/test/CodeGen
63880 ./obj/build/x86_64-unknown-linux-gnu/stage0-sysroot
63876 ./obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@kennytm
Copy link
Member

kennytm commented May 4, 2018

@bors r- ↑

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 4, 2018
In particular, type annotations given by the user must hold at all
points in the program. This doesn't affect current analysis but
will affect fact generation later.
This will be used in fact generation.
@nikomatsakis nikomatsakis force-pushed the nll-alias-analysis-flat branch from 047ad85 to b36cbcb Compare May 5, 2018 10:03
@nikomatsakis
Copy link
Contributor Author

Rebased, fixed resulting breakage.

@bors r=pnkfelix

@bors
Copy link
Collaborator

bors commented May 5, 2018

📌 Commit b36cbcb has been approved by pnkfelix

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 5, 2018
@bors
Copy link
Collaborator

bors commented May 5, 2018

⌛ Testing commit b36cbcb with merge 2d847dc...

bors added a commit that referenced this pull request May 5, 2018
introduce `-Znll-facts` to dump base-facts for the NLL analysis

r? @pnkfelix
@bors
Copy link
Collaborator

bors commented May 5, 2018

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

@bors bors merged commit b36cbcb into rust-lang:master May 5, 2018
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.

5 participants