Skip to content
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

html5ever in the rustc-perf repository is memory-intensive #52190

Merged
merged 1 commit into from
Jul 17, 2018

Conversation

davidtwco
Copy link
Member

Part of #52028. Rebased atop of #51987.

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 9, 2018
@davidtwco
Copy link
Member Author

This doesn't currently pass tests - the error is related to the SCC stuff and I've not had a great deal of time to look into it.

@rust-highfive
Copy link
Collaborator

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_ui
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:38:33] 
[00:38:33] running 1554 tests
[00:38:39] ....................................F.......F..F...........FF.F...................................i.
[00:38:49] ....................................................................................................
[00:38:52] ....................................................................................................
[00:38:56] ....................................................................................................
[00:38:59] ....................................................................................................
[00:38:59] ....................................................................................................
[00:39:04] .................................F..........F.....................................F.................
[00:39:09] ..................................................................................FFF.F......F......
[00:39:15] ...................................FFF...FFF....F......F.FF.F.......................................
[00:39:20] ....................................................................................................
[00:39:26] ...................................i.......FF.FFFFFFFFFFFFFFFFFFF..FF.F.FFFFFF.FFF.FFF.FF.F..F.FFFFF
[00:39:30] .FF.....FFFFFF.FFFFFF..iF...........................................................................
[00:39:41] ....................................................................................................
[00:39:48] ....................................................................i...............................
[00:39:51] ......................................................
[00:39:51] failures:
[00:39:51] failures:
[00:39:51] 
[00:39:51] ---- [ui] ui/borrowck/borrowck-closures-two-mut.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] 73 LL | }
[00:39:51] 74    | - first borrow ends here
[00:39:51] 75 
[00:39:51] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     let c1 = to_fn_mut(|| x = 4);
[00:39:51] -    |                        -- - previous borrow occurs due to use of `x` in closure
[00:39:51] -    |                        first mutable borrow occurs here
[00:39:51] -    |                        first mutable borrow occurs here
[00:39:51] - LL |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
[00:39:51] -    |                        ^^ - borrow occurs due to use of `x` in closure
[00:39:51] -    |                        second mutable borrow occurs here
[00:39:51] -    |                        second mutable borrow occurs here
[00/~ ERROR cannot borrow `x` as mutable more than once
[00:39:51] -    |                        ^^          - borrow occurs due to use of `x` in closure
[00:39:51] -    |                        second mutable borrow occurs here
[00:39:51] -    |                        second mutable borrow occurs here
[00:39:51] - LL |     //~| ERROR cannot borrow `x` as mutable more than once
[00:39:51] - LL |     drop((c1, c2));
[00:39:51] -    |           -- borrow later used here
[00:39:51] - 
[00:39:51] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     let c1 = to_fn_mut(|| x = 5);
[00:39:51] -    |                        -- - previous borrow occurs due to use of `x` in closure
[00:39:51] -    |                        first mutable borrow occurs here
[00:39:51] -    |                        first mutable borrow occurs here
[00:39:51] - LL |     let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
[00:39:51] -    |                        ^^                                  - borrow occurs due to use of `x` in closure
[00:39:51] -    |                        second mutable borrow occurs here
[00:39:51] - ...
[00:39:51] - ...
[00:39:51] - LL |     drop((c1, c2));
[00:39:51] -    |           -- borrow later used here
[00:39:51] - 
[00:39:51] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     let c1 = to_fn_mut(|| set(&mut *x.f));
[00:39:51] -    |                        --           - previous borrow occurs due to use of `x` in closure
[00:39:51] -    |                        first mutable borrow occurs here
[00:39:51] -    |                        first mutable borrow occurs here
[00:39:51] - LL |     let c2 = to_fn_mut(|| set(&mut *x.f));
[00:39:51] -    |                        ^^           - borrow occurs due to use of `x` in closure
[00:39:51] -    |                        second mutable borrow occurs here
[00:39:51] - ...
[00:39:51] - ...
[00:39:51] - LL |     drop((c1, c2));
[00:39:51] -    |           -- borrow later used here
[00:39:51] - error: aborting due to 10 previous errors
[00:39:51] + error: aborting due to 5 previous errors
[00:39:51] 152 
[00:39:51] 153 For more information about this error, try `rustc --explain E0499`.
[00:39:51] 153 For more information about this error, try `rustc --explain E0499`.
[00:39:51] 154 
[00:39:51] 
[00:39:51] 
[00:39:51] The actual stderr differed from the expected stderr.
[00:39:51] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-closures-two-mut/borrowck-closures-two-mut.stderr
[00:39:51] To update references, rerun the tests and pass the `--bless` flag
[00:39:51] To only update this specific test, also pass `--test-args borrowck/borrowck-closures-two-mut.rs`
[00:39:51] error: 1 errors occurred comparing output.
[00:39:51] status: exit code: 101
[00:39:51] status: exit code: 101
[00:39:51] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-closures-two-mut/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=compare" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-closures-two-mut/auxiliary" "-A" "unused"
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] stderr:
[00:39:51] stderr:
[00:39:51] ------------------------------------------
[00:39:51] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":816,"byte_end":818,"line_start":23,"line_end":23,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 4);","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":850,"byte_end":852,"line_start":24,"line_end":24,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":994,"byte_end":995,"line_start":27,"line_end":27,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":853,"byte_end":854,"line_start":24,"line_end":24,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":27,"highlight_end":28}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":819,"byte_end":820,"line_start":23,"line_end":23,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 4);","highlight_start":27,"highlight_end":28}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:24:24\n   |\nLL |     let c1 = to_fn_mut(|| x = 4);\n   |                        -- - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once\n   |                        ^^ - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:39:51] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":108t/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1099,"byte_end":1100,"line_start":35,"line_end":35,"column_start":36,"column_end":37,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| set(&mut x));","highlight_start":36,"highlight_end":37}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:36:24\n   |\nLL |     let c1 = to_fn_mut(|| set(&mut x));\n   |                        --          - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once\n   |                        ^^          - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:39:51] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1331,"byte_end":1333,"line_start":43,"line_end":43,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 5);","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1365,"byte_end":1367,"line_start":44,"line_end":44,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1515,"byte_end":1516,"line_start":47,"line_end":47,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1377,"byte_end":1378,"line_start":44,"line_end":44,"column_start":36,"column_end":37,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":36,"highlight_end":37}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1334,"byte_end":1335,"line_start":43,"line_end":43,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 5);","highlight_start":27,"highlight_end":28}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:44:24\n   |\nLL |     let c1 = to_fn_mut(|| x = 5);\n   |                        -- - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once\n   |                        ^^          - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:39:51] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1569,"byte_end":1571,"line_start":51,"line_end":51,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 5);","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1603,"byte_end":1605,"line_start":52,"line_end":52,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1806,"byte_end":1807,"line_start":56,"line_end":56,"column_start":1,"column_end":2,"is_primary":false,"text":[{"tn closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:39:51] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1933,"byte_end":1935,"line_start":64,"line_end":64,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| set(&mut *x.f));","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1976,"byte_end":1978,"line_start":65,"line_end":65,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut *x.f));","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":2134,"byte_end":2135,"line_start":69,"line_end":69,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1989,"byte_end":1990,"line_start":65,"line_end":65,"column_start":37,"column_end":38,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut *x.f));","highlight_start":37,"highlight_end":38}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1946,"byte_end":1947,"line_start":64,"line_end":64,"column_start":37,"column_end":38,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| set(&mut *x.f));","highlight_start":37,"highlight_end":38}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:65:24\n   |\nLL |     let c1 = to_fn_mut(|| set(&mut *x.f));\n   |                        --           - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| set(&mut *x.f));\n   |                        ^^           - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:39:51] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:39:51] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:39:51] {"message":"aborting due to 5 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 5 previous errors\n\n"}
[00:39:51] {"message":"For more information about this error, try `rustc --explain E0499`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0499`.\n"}
[00:39:51] error: internal compiler error: unexpected panic
[00:39:51] 
[00:39:51] 
[00:39:51] note: the compiler unexpectedly panicked. this is a bug.
[00:39:51] 
[00:39:51] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:39:51] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:39:51] 
[00:39:51] 
[00:39:51] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=compare -C prefer-dynamic -C rpath
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] thread '[ui] ui/borrowck/borrowck-closures-two-mut.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] thread '[ui] ui/borrowck/borrowck-closures-two-mut.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:39:51] 
[00:39:51] ---- [ui] ui/borrowck/borrowck-slice-pattern-element-loan.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     if let [ref first, ref second, ..] = *s {
[00:39:51] -    |                        ---------- immutable borrow occurs here
[00:39:51] - LL |         if let [_, ref mut  second2, ref mut third, ..] = *s { //~ERROR
[00:39:51] -    |                    ^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:39:51] - LL |             nop(&[first, second, second2, third]);
[00:39:51] -    |                          ------ borrow later used here
[00:39:51] - 
[00:39:51] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     if let [.., ref fourth, ref third, _, ref first] = *s {
[00:39:51] -    |                             --------- immutable borrow occurs here
[00:39:51] - LL |         if let [.., ref mut third2, _, _] = *s { //~ERROR
[00:39:51] -    |                     ^^^^^^^^^^^^^^ mutable borrow occurs here
[00:39:51] - LL |             nop(&[first, third, third2, fourth]);
[00:39:51] -    |                          ----- borrow later used here
[00:39:51] - 
[00:39:51] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
[00:39:51] -    |                    ------------- immutable borrow occurs here
[00:39:51] - ...
[00:39:51] - LL |         if let [_, ref mut from_begin1, ..] = *s { //~ERROR
[00:39:51] -    |                    ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:39:51] - LL |             nop(&[from_begin1, from_end1, from_end3, from_end4]);
[00:39:51] -    |                                                      --------- borrow later used here
[00:39:51] - 
[00:39:51] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
[00:39:51] -    |                                   ------------- immutable borrow occurs here
[00:39:51] - ...
[00:39:51] - LL |         if let [_, _, ref mut from_begin2, ..] = *s { //~ERROR
[00:39:51] -    |                       ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:39:51] - LL |             nop(&[from_begin2, from_end1, from_end3, from_end4]);
[00:39:51] -    |                                           --------- borrow later used here
[00:39:51] - 
[00:39:51] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
[00:39:51] -    |                                   ------------- immutable borrow occurs here
[00:39:51] - ...
[00:39:51] - LL |         if let [_, _, _, ref mut from_begin3, ..] = *s { //~ERROR
[00:39:51] -    |                          ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:39:51] - LL |             nop(&[from_begin3, from_end1, from_end3, from_end4]);
[00:39:51] -    |                                           --------- borrow later used here
[00:39:51] - 
[00:39:51] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
[00:39:51] -    |                                                  --------------- immutable borrow occurs here
[00:39:51] - ...
[00:39:51] - LL |         if let [.., ref mut from_end2, _] = *s { //~ERROR
[00:39:51] -    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:39:51] - LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end2]);
[00:39:51] -    |                                             ----------- borrow later used here
[00:39:51] - 
[00:39:51] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
[00:39:51] -    |                                                  --------------- immutable borrow occurs here
[00:39:51] - ...
[00:39:51] - LL |         if let [.., ref mut from_end3, _,  _] = *s { //~ERROR
[00:39:51] -    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:39:51] - LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end3]);
[00:39:51] -    |                                             ----------- borrow later used here
[00:39:51] - 
[00:39:51] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
[00:39:51] -    |                              --------------- immutable borrow occurs here
[00:39:51] - ...
[00:39:51] - LL |         if let [.., ref mut from_end4, _, _, _] = *s { //~ERROR
[00:39:51] -    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:39:51] - LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end4]);
[00:39:51] -    |                                ----------- borrow later used here
[00:39:51] - 
[00:39:51] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     if let [ref first, ref second, ..] = *s {
[00:39:51] -    |                        ---------- immutable borrow occurs here
[00:39:51] - LL |         if let [_, ref mut tail..] = *s [00:39:51] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-slice-pattern-element-loan/borrowck-slice-pattern-element-loan.stderr`: No such file or directory (os error 2)
[00:39:51] 
[00:39:51] ---- [ui] ui/borrowck/issue-41962.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] 
[00:39:51] 16    |
[00:39:51] 17    = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
[00:39:51] 18 
[00:39:51] - error[E0382]: use of moved value: `maybe` (Mir)
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |           if let Some(thing) = maybe {
[00:39:51] -    |           ^           ----- value moved here
[00:39:51] -    |  _________|
[00:39:51] -    | |
[00:39:51] - LL | |         }
[00:39:51] -    | |_________^ value used here after move
[00:39:51] -    |
[00:39:51] -    = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
[00:39:51] - 
[00:39:51] - error[E0382]: borrow of moved value: `maybe` (Mir)
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |           if let Some(thing) = maybe {
[00:39:51] -    |           ^           ----- value moved here
[00:39:51] -    |  _________|
[00:39:51] -    | |
[00:39:51] - LL | |         }
[00:39:51] -    | |_________^ value borrowed here after move
[00:39:51] -    |
[00:39:51] -    = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
[00:39:51] - 
[00:39:51] - error[E0382]: use of moved value: `maybe` (Mir)
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |         if let Some(thing) = maybe {
[00:39:51] -    |                ^^^^^-----^
[00:39:51] -    |                |    value moved here
[00:39:51] -    |                |    value moved here
[00:39:51] -    |                value used here after move
[00:39:51] -    |
[00:39:51] -    = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
[00:39:51] - 
[00:39:51] - error[E0382]: use of moved value (Mir)
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |         if let Some(thing) = maybe {
[00:39:51] -    |                     ^^^^^ value moved here in previous iteration of loop
[00:39:51] -    |
[00:39:51] -    = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
[00:39:51] - error: aborting due to 6 previous errors
[00:39:51] + error: aborting due to 2 previous errors
[00:39:51] 63 
[00:39:51] 64 For more information about this error, try `rustc --explain E0382`.
[00:39:51] 64 For more information about this error, try `rustc --explain E0382`.
[00:39:51] 65 
[00:39:51] 
[00:39:51] 
[00:39:51] The actual stderr differed from the expected stderr.
[00:39:51] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/issue-41962/issue-41962.stderr
[00:39:51] To update references, rerun the tests and pass the `--bless` flag
[00:39:51] To only update this specific test, also pass `--test-args borrowck/issue-41962.rs`
[00:39:51] error: 1 errors occurred comparing output.
[00:39:51] status: exit code: 101
[00:39:51] status: exit code: 101
[00:39:51] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/issue-41962.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/issue-41962/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=compare" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/issue-41962/auxiliary" "-A" "unused"
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] stderr:
[00:39:51] stderr:
[00:39:51] ------------------------------------------
[00:39:51] {"message":"use of partially moved value: `maybe` (Ast)","code":{"code":"E0382","explanation":"\nThis error occurs when an attempt is made to use a variable after its contents\nhave been moved elsewhere. For example:\n\n```compile_fail,E0382\nstruct MyStruct { s: u32 }\n\nfn main() {\n    let mut x = MyStruct{ s: 5u32 };\n    let y = x;\n    x.s = 6;\n    println!(\"{}\", x.s);\n}\n```\n\nSince `MyStruct` is a type that is not marked `Copy`, the data gets moved out\nof `x` when we set `y`. This is fundamental to Rust's ownership system: outside\nof workarounds like `Rc`, a value cannot be owned by more than one variable.\n\nSometimes we don't need to move the value. Using a reference, we can let another\nfunction borrow the value without changing its ownership. In the example below,\nwe don't actually have to move our string to `calculate_length`, we can give it\na reference to it with `&` instead.\n\n```\nfn main() {\n    let s1 = String::from(\"hello\");\n\n    let len = calculate_length(&s1);\n\n    println!(\"The length of '{}' is {}.\", s1, len);\n}\n\nfn calculate_length(s: &String) -> usize {\n    s.len()\n}\n```\n\nA mutable reference can be created with `&mut`.\n\nSometimes we don't want a reference, but a duplicate. All types marked `Clone`\ncan be duplicated by calling `.clone()`. Subsequent changes to a clone do not\naffect the original variable.\n\nMost types in the standard library are marked `Clone`. The example below\ndemonstrates using `clone()` on a string. `s1` is first set to \"many\", and then\ncopied to `s2`. Then the first character of `s1` is removed, without affecting\n`s2`. \"any many\" is printed to the console.\n\n```\nfn main() {\n    let mut s1 = String::from(\"many\");\n    let s2 = s1.clone();\n    s1.remove(0);\n    println!(\"{} {}\", s1, s2);\n}\n```\n\nIf we control the definition of a type, we can implement `Clone` on it ourselves\nwith `#[derive(Clone)]`.\n\nSome types have no ownership semantics at all and are trivial to duplicate. An\nexample is `i32` and the other number types. We don't have to call `.clone()` to\nclone them, because they are marked `Copy` in addition to `Clone`.  Implicit\ncloning is more convenient in this case. We can mark our own types `Copy` if\nall their members also are marked `Copy`.\n\nIn the example below, we implement a `Point` type. Because it only stores two\nintegers, we opt-out of ownership semantics with `Copy`. Then we can\n`let p2 = p1` without `p1` being moved.\n\n```\n#[derive(Copy, Clone)]\nstruct Point { x: i32, y: i32 }\n\nfn main() {\n    let mut p1 = Point{ x: -1, y: 2 };\n    let p2 = p1;\n    p1.x = 1;\n    println!(\"p1: {}, {}\", p1.x, p1.y);\n    println!(\"p2: {}, {}\", p2.x, p2.y);\n}\n```\n\nAlternatively, if we don't control the struct's definition, or mutable shared\nownership is truly required, we can use `Rc` and `RefCell`:\n\n```\nuse std::cell::RefCell;\nuse std::rc::Rc;\n\nstruct MyStruct { s: u32 }\n\nfn main() {\n    let mut x = Rc::new(RefCell::new(MyStruct{ s: 5u32 }));\n    let y = x.clone();\n    x.borrow_mut().s = 6;\n    println!(\"{}\", x.borrow().s);\n}\n```\n\nWith this approach, x and y share ownership of the data via the `Rc` (reference\ncount type). `RefCell` essentially performs runtime borrow checking: ensuring\nthat at most one writer or multiple readers can access the data at any one time.\n\nIf you wish to learn more about ownership in Rust, start with the chapter in the\nBook:\n\nhttps://doc.rust-lang.org/book/first-edition/ownership.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/issue-41962.rs","byte_start":602,"byte_end":607,"line_start":17,"line_end":17,"column_start":30,"column_end":35,"is_primary":true,"text":[{"text":"        if let Some(thing) = maybe {","highlight_start":30,"highlight_end":35}],"label":"value used here after move","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/issue-41962.rs","byte_start":593,"byte_end":598,"line_scan let another\nfunction borrow the value without changing its ownership. In the example below,\nwe don't actually have to move our string to `calculate_length`, we can give it\na reference to it with `&` instead.\n\n```\nfn main() {\n    let s1 = String::from(\"hello\");\n\n    let len = calculate_length(&s1);\n\n    println!(\"The length of '{}' is {}.\", s1, len);\n}\n\nfn calculate_length(s: &String) -> usize {\n    s.len()\n}\n```\n\nA mutable reference can be created with `&mut`.\n\nSometimes we don't want a reference, but a duplicate. All types marked `Clone`\ncan be duplicated by calling `.clone()`. Subsequent changes to a clone do not\naffect the original variable.\n\nMost types in the standard library are marked `Clone`. The example below\ndemonstrates using `clone()` on a string. `s1` is first set to \"many\", and then\ncopied to `s2`. Then the first character of `s1` is removed, without affecting\n`s2`. \"any many\" is printed to the console.\n\n```\nfn main() {\n    let mut s1 = String::from(\"many\");\n    let s2 = s1.clone();\n    s1.remove(0);\n    println!(\"{} {}\", s1, s2);\n}\n```\n\nIf we control the definition of a type, we can implement `Clone` on it ourselves\nwith `#[derive(Clone)]`.\n\nSome types have no ownership semantics at all and are trivial to duplicate. An\nexample is `i32` and the other number types. We don't have to call `.clone()` to\nclone them, because they are marked `Copy` in addition to `Clone`.  Implicit\ncloning is more convenient in this case. We can mark our own types `Copy` if\nall their members also are marked `Copy`.\n\nIn the example below, we implement a `Point` type. Because it only stores two\nintegers, we opt-out of ownership semantics with `Copy`. Then we can\n`let p2 = p1` without `p1` being moved.\n\n```\n#[derive(Copy, Clone)]\nstruct Point { x: i32, y: i32 }\n\nfn main() {\n    let mut p1 = Point{ x: -1, y: 2 };\n    let p2 = p1;\n    p1.x = 1;\n    println!(\"p1: {}, {}\", p1.x, p1.y);\n    println!(\"p2: {}, {}\", p2.x, p2.y);\n}\n```\n\nAlternatively, if we don't control the struct's definition, or mutable shared\nownership is truly required, we can use `Rc` and `RefCell`:\n\n```\nuse std::cell::RefCell;\nuse std::rc::Rc;\n\nstruct MyStruct { s: u32 }\n\nfn main() {\n    let mut x = Rc::new(RefCell::new(MyStruct{ s: 5u32 }));\n    let y = x.clone();\n    x.borrow_mut().s = 6;\n    println!(\"{}\", x.borrow().s);\n}\n```\n\nWith this approach, x and y share ownership of the data via the `Rc` (reference\ncount type). `RefCell` essentially performs runtime borrow checking: ensuring\nthat at most one writer or multiple readers can access the data at any one time.\n\nIf you wish to learn more about ownership in Rust, start with the chapter in the\nBook:\n\nhttps://doc.rust-lang.org/book/first-edition/ownership.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/issue-41962.rs","byte_start":593,"byte_end":598,"line_start":17,"line_end":17,"column_start":21,"column_end":26,"is_primary":true,"text":[{"text":"        if let Some(thing) = maybe {","highlight_start":21,"highlight_end":26}],"label":"value moved here in previous iteration of loop","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0382]: use of moved value: `(maybe as std::prelude::v1::Some).0` (Ast)\n  --> /checkout/src/test/ui/borrowck/issue-41962.rs:17:21\n   |\nLL |         if let Some(thing) = maybe {\n   |                     ^^^^^ value moved here in previous iteration of loop\n   |\n   = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait\n\n"}
[00:39:51] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:39:51] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:39:51] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:39:51] {"message":"For more information about this error, try `rustc --explain E0382`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0382`.\n"}
[00:39:51] error: internal compiler error: unexpected panic
[00:39:51] 
[00:39:51] 
[00:39:51] note: the compiler unexpectedly panicked. this is a bug.
[00:39:51] 
[00:39:51] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:39:51] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:39:51] 
[00:39:51] 
[00:39:51] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=compare -C prefer-dynamic -C rpath
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] thread '[ui] ui/borrowck/issue-41962.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] thread '[ui] ui/borrowck/issue-41962.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] 
[00:39:51] ---- [ui] ui/borrowck/two-phase-method-receivers.rs stdout ----
[00:39:51] 
[00:39:51] error: test compilation failed although it shouldn't!
[00:39:51] status: exit code: 101
[00:39:51] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/two-phase-method-receivers.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-method-receivers/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=mir" "-Z" "two-phase-borrows" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-method-receivers/auxiliary" "-A" "unused"
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] stderr:
[00:39:51] stderr:
[00:39:51] ------------------------------------------
[00:39:51] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:39:51] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:39:51] 
[00:39:51] error: internal compiler error: unexpected panic
[00:39:51] 
[00:39:51] note: the compiler unexpectedly panicked. this is a bug.
[00:39:51] 
[00:39:51] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:39:51] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:39:51] 
[00:39:51] 
[00:39:51] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=mir -Z two-phase-borrows -C prefer-dynamic -C rpath
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] thread '[ui] ui/borrowck/two-phase-method-receivers.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] thread '[ui] ui/borrowck/two-phase-method-receivers.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] 
[00:39:51] ---- [ui] ui/borrowck/two-phase-multi-mut.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] - error[E0499]: cannot borrow `foo` as mutable more than once at a time
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     foo.method(&mut foo);
[00:39:51] -    |     -----------^^^^^^^^-
[00:39:51] -    |     |          second mutable borrow occurs here
[00:39:51] -    |     first mutable borrow occurs here
[00:39:51] -    |     first mutable borrow occurs here
[00:39:51] -    |     borrow later used here
[00:39:51] - 
[00:39:51] - error[E0499]: cannot borrow `foo` as mutable more than once at a time
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     foo.method(&mut foo);
[00:39:51] -    |     ^^^^^^^^^^^--------^
[00:39:51] -    |     |          first mutable borrow occurs here
[00:39:51] -    |     second mutable borrow occurs here
[00:39:51] -    |     second mutable borrow occurs here
[00:39:51] -    |     borrow later used here
[00:39:51] - error: aborting due to 2 previous errors
[00:39:51] - 
[00:39:51] - For more information about this error, try `rustc --explain E0499`.
[00:39:51] - 
[00:39:51] - 
[00:39:51] 
[00:39:51] 
[00:39:51] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-multi-mut/two-phase-multi-mut.stderr`: No such file or directory (os error 2)
[00:39:51] 
[00:39:51] ---- [ui] ui/borrowck/two-phase-multiple-activations.rs stdout ----
[00:39:51] 
[00:39:51] 
[00:39:51] error: test compilation failed although it shouldn't!
[00:39:51] status: exit code: 101
[00:39:51] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/two-phase-multiple-activations.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-multiple-activations/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=mir" "-Z" "two-phase-borrows" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-multiple-activations/auxiliary" "-A" "unused"
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] stderr:
[00:39:51] stderr:
[00:39:51] ------------------------------------------
[00:39:51] thread 'main' panicked at 'assertion failed: mid <= len', libcore/slice/mod.rs:875:13
[00:39:51] 
[00:39:51] error: internal compiler error: unexpected panic
[00:39:51] 
[00:39:51] 
[00:39:51] note: the compiler unexpectedly panicked. this is a bug.
[00:39:51] 
[00:39:51] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:39:51] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:39:51] 
[00:39:51] 
[00:39:51] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=mir -Z two-phase-borrows -C prefer-dynamic -C rpath
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] thread '[ui] ui/borrowck/two-phase-multiple-activations.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] thread '[ui] ui/borrowck/two-phase-multiple-activations.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] 
[00:39:51] ---- [ui] ui/generator/generator-with-nll.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] 16 LL |         yield ();
[00:39:51] 17    |         -------- possible yield occurs here
[00:39:51] 18 
[00:39:51] - error[E0626]: borrow may still be in use when generator yields (Mir)
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |         let b = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)
[00:39:51] -    |                 ^^^^^^^^^
[00:39:51] - LL |         //~^ borrow may still be in use when generator yields (Mir)
[00:39:51] - LL |         yield ();
[00:39:51] -    |         -------- possible yield occurs here
[00:39:51] - error: aborting due to 3 previous errors
[00:39:51] + error: aborting due to 2 previous errors
[00:39:51] 29 
[00:39:51] 30 For more information about this error, try `rustc --explain E0626`.
[00:39:51] 30 For more information about this error, try `rustc --explain E0626`.
[00:39:51] 31 
[00:39:51] 
[00:39:51] 
[00:39:51] The actual stderr differed from the expected stderr.
[00:39:51] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/generator-with-nll/generator-with-nll.stderr
[00:39:51] To update references, rerun the tests and pass the `--bless` flag
[00:39:51] To only update this specific test, also pass `--test-args generator/generator-with-nll.rs`
[00:39:51] error: 1 errors occurred comparing output.
[00:39:51] status: exit code: 101
[00:39:51] status: exit code: 101
[00:39:51] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/generator/generator-with-nll.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/generator-with-nll/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=compare" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/generator-with-nll/auxiliary" "-A" "unused"
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] stderr:
[00:39:51] stderr:
[00:39:51] ------------------------------------------
[00:39:51] {"message":"borrow may still be in use when generator yields (Ast)","code":{"code":"E0626","explanation":"\nThis error occurs because a borrow;\n  for &x in &v { // <-- borrow of `v` is still in scope...\n    yield x; // ...when this yield occurs.\n  }\n};\nunsafe { b.resume() };\n```\n\nSuch cases can sometimes be resolved by iterating \"by value\" (or using\n`into_iter()`) to avoid borrowing:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  for x in v { // <-- Take ownership of the values instead!\n    yield x; // <-- Now yield is OK.\n  }\n};\nunsafe { b.resume() };\n```\n\nIf taking ownership is not an option, using indices can work too:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  let len = v.len(); // (*)\n  for i in 0..len {\n    let x = v[i]; // (*)\n    yield x; // <-- Now yield is OK.\n  }\n};\nunsafe { b.resume() };\n\n// (*) -- Unfortunately, these temporaries are currently required.\n// See <https://github.com/rust-lang/rust/issues/43122>.\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/generator/generator-with-nll.rs","byte_start":914,"byte_end":922,"line_start":22,"line_end":22,"column_start":9,"column_end":17,"is_primary":false,"text":[{"text":"        yield ();","highlight_start":9,"highlight_end":17}],"label":"possible yield occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/generator/generator-with-nll.rs","byte_start":767,"byte_end":771,"line_start":20,"line_end":20,"column_start":22,"column_end":26,"is_primary":true,"text":[{"text":"        let b = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)","highlight_start":22,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0626]: borrow may still be in use when generator yields (Ast)\n  --> /checkout/src/test/ui/generator/generator-with-nll.rs:20:22\n   |\nLL |         let b = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)\n   |                      ^^^^\nLL |         //~^ borrow may still be in use when generator yields (Mir)\nLL |         yield ();\n   |         -------- possible yield occurs here\n\n"}
[00:39:51] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:39:51] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:39:51] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:39:51] {"message":"For more information about this error, try `rustc --explain E0626`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0626`.\n"}
[00:39:51] error: internal compiler error: unexpected panic
[00:39:51] 
[00:39:51] 
[00:39:51] note: the compiler unexpectedly panicked. this is a bug.
[00:39:51] 
[00:39:51] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:39:51] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:39:51] 
[00:39:51] 
[00:39:51] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=compare -C prefer-dynamic -C rpath
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] thread '[ui] ui/generator/generator-with-nll.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] thread '[ui] ui/generator/generator-with-nll.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] 
[00:39:51] ---- [ui] ui/generator/yield-while-local-borrowed.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] 16 LL |             yield();
[00:39:51] 17    |             ------- possible yield occurs here
[00:39:51] 18 
[00:39:51] - error[E0626]: borrow may still be in use when generator yields (Mir)
[00:39:51] -   --> $DIR/yield-while-local-borrowed.rs:24:17
[00:39:51] -    |
[00:39:51] - LL |         let a = &mut 3;
[00:39:51] - ...
[00:39:51] - ...
[00:39:51] - LL |         yield();
[00:39:51] -    |         ------- possible yield occurs here
[00:39:51] - 
[00:39:51] - error[E0626]: borrow may still be in use when generator yields (Mir)
[00:39:51] -   --> $DIR/yield-while-local-borrowed.rs:52:21
[00:39:51] -    |
[00:39:51] - LL |             let b = &a;
[00:39:51] - ...
[00:39:51] - ...
[00:39:51] - LL |             yield();
[00:39:51] -    |             ------- possible yield occurs here
[00:39:51] - error: aborting due to 4 previous errors
[00:39:51] + error: aborting due to 2 previous errors
[00:39:51] 38 
[00:39:51] 39 For more information about this error, try `rustc --explain E0626`.
[00:39:51] 39 For more information about this error, try `rustc --explain E0626`.
[00:39:51] 40 
[00:39:51] 
[00:39:51] 
[00:39:51] The actual stderr differed from the expected stderr.
[00:39:51] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/yield-while-local-borrowed/yield-while-local-borrowed.stderr
[00:39:51] To update references, rerun the tests and pass the `--bless` flag
[00:39:51] To only update this specific test, also pass `--test-args generator/yield-while-local-borrowed.rs`
[00:39:51] error: 1 errors occurred comparing output.
[00:39:51] status: exit code: 101
[00:39:51] status: exit code: 101
[00:39:51] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/generator/yield-while-local-borrowed.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/yield-while-local-borrowed/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=compare" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/yield-while-local-borrowed/auxiliary" "-A" "unused"
[00:39:51] ------------------------------------------
[00:39:51] 
---
[00:39:51] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:39:51] 
[00:39:51] error: internal compiler error: unexpected panic
[00:39:51] 
[00:39:51] note: the compiler unexpectedly panicked. this is a bug.
[00:39:51] 
[00:39:51] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:39:51] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:39:51] 
[00:39:51] 
[00:39:51] note: compiler flags: -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] thread '[ui] ui/nll/generator-distinct-lifetime.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] thread '[ui] ui/nll/generator-distinct-lifetime.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/get_default.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] 34 LL | }
[00:39:51] 35    | - immutable borrow ends here
[00:39:51] 36 
[00:39:51] - error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |         match map.get() {
[00:39:51] -    |               --- immutable borrow occurs here
[00:39:51] - ...
[00:39:51] - LL |                 map.set(String::new()); // Ideally, this would not error.
[00:39:51] -    |                 ^^^ mutable borrow occurs here
[00:39:5" "unused"
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] stderr:
[00:39:51] stderr:
[00:39:51] ------------------------------------------
[00:39:51] {"message":"cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)","code":{"code":"E0502","explanation":"\nThis error indicates that you are trying to borrow a variable as mutable when it\nhas already been borrowed as immutable.\n\nExample of erroneous code:\n\n```compile_fail,E0502\nfn bar(x: &mut i32) {}\nfn foo(a: &mut i32) {\n    let ref y = a; // a is borrowed as immutable.\n    bar(a); // error: cannot borrow `*a` as mutable because `a` is also borrowed\n            //        as immutable\n}\n```\n\nTo fix this error, ensure that you don't have any other references to the\nvariable before trying to access it mutably:\n\n```\nfn bar(x: &mut i32) {}\nfn foo(a: &mut i32) {\n    bar(a);\n    let ref y = a; // ok!\n}\n```\n\nFor more information on the rust ownership system, take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nll/get_default.rs","byte_start":1053,"byte_end":1056,"line_start":33,"line_end":33,"column_start":17,"column_end":20,"is_primary":true,"text":[{"text":"                map.set(String::new()); // Ideally, this would not error.","highlight_start":17,"highlight_end":20}],"label":"mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nll/get_default.rs","byte_start":938,"byte_end":941,"line_start":28,"line_end":28,"column_start":15,"column_end":18,"is_primary":false,"text":[{"text":"        match map.get() {","highlight_start":15,"highlight_end":18}],"label":"immutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nll/get_default.rs","byte_start":1251,"byte_end":1252,"line_start":39,"line_end":39,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"immutable borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)\n  --> /checkout/src/test/ui/nll/get_default.rs:33:17\n   |\nLL |         match map.get() {\n   |               --- immutable borrow occurs here\n...\nLL |                 map.set(String::new()); // Ideally, this would not error.\n   |                 ^^^ mutable borrow occurs here\n...\nLL | }\n   | - immutable borrow ends here\n\n"}
[00:39:51] {"message":"cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)","code":{"code":"E0502","explanation":"\nThis error indicates that you are trying to borrow a variable as mutable when it\nhas already been borrowed as immutable.\n\nExample of erroneous code:\n\n```compile_fail,E0502\nfn bar(x: &mut i32) {}\nfn foo(a: &mut i32) {\n    let ref y = a; // a is borrowed as immutable.\n    bar(a); // error: cannot borrow `*a` as mutable because `a` is also borrowed\n            //        as immutable\n}\n```\n\nTo fix this error, ensure that you don't have any other references to the\nvariable before trying to access it mutably:\n\n```\nfn bar(x: &mut i32) {}\nfn foo(a: &mut i32) {\n    bar(a);\n    let ref y = a; // ok!\n}\n```\n\nFor more information on the rust ownership system, take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nll/get_default.rs","byte_start":1367,"byte_end":1370,"line_start":45,"line_end":45,"column_start":17,"column_end":20,"is_primary":true,"text":[{"text":"                map.set(String::new()); // Both AST and MIR error here","highlight_start":17,"highlight_end":20}],"label":"mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nll/get_default.rs","byte_start":1314,"byte_end":1317,"line_start":43,"line_end":43,"column_start":15,"column_end":18,"is_primary":false,"text":[{"text":"        match map.get() {","highlight_start":15,"highlight_end":18}],"label":"immutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nll/get_default.rs","byte_start":1812,"byte_end":1813,"line_start":57,"line_end":57,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"immutable borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)\n  --> /checkout/src/test/ui/nll/get_default.rs:45:17\n   |\nLL |         match map.get() {\n   |               --- immutable borrow occurs here\nLL |             Some(v) => {\nLL |                 map.set(String::new()); // Both AST and MIR error here\n   |                 ^^^ mutable borrow occurs here\n...\nLL | }\n   | - immutable borrow ends here\n\n"}
[00:39:51] {"message":"cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)","code":{"code":"E0502","explanation":"\nThis error indicates that you are trying to borrow a variable as mutable when it\nhas already been borrowed as immutable.\n\nExample of erroneous code:\n\n```compile_fail,E0502\nfn bar(x: &mut i32) {}\nfn foo(a: &mut i32) {\n    let ref y = a; // a is borrowed as immutable.\n    bar(a); // error: cannot borrow `*a` as mutable because `a` is also borrowed\n            //        as immutable\n}\n```\n\nTo fix this error, ensure that you don't have any other references to the\nvariable before trying to access it mutably:\n\n```\nfn bar(x: &mut i32) {}\nfn foo(a: &mut i32) {\n    bar(a);\n    let ref y = a; // ok!\n}\n```\n\nFor more information on the rust ownership system, take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nll/get_default.rs","byte_start":1610,"byte_end":1613,"line_start":51,"line_end":51,"column_start":17,"column_end":20,"is_primary":true,"text":[{"text":"                map.set(String::new()); // Ideally, just AST would error here","highlight_start":17,"highlight_end":20}],"label":"mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nll/get_default.rs","byte_start":1314,"byte_end":1317,"line_start":43,"line_end":43,"column_start":15,"column_end":18,"is_primary":false,"text":[{"text":"        match map.get() {","highlight_start":15,"highlight_end":18}],"label":"immutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nll/get_default.rs","byte_start":1812,"byte_end":1813,"line_start":57,"line_end":57,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"immutable borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)\n  --> /checkout/src/test/ui/nll/get_default.rs:51:17\n   |\nLL |         match map.get() {\n   |               --- immutable borrow occurs here\n...\nLL |                 map.set(String::new()); // Ideally, just AST would error here\n   |                 ^^^ mutable borrow occurs here\n...\nLL | }\n   | - immutable borrow ends here\n\n"}
[00:39:51] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:39:51] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:39:51] {"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 3 previous errors\n\n"}
[00:39:51] {"message":"For more information about this error, try `rustc --explain E0502`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0502`.\n"}
[00:39:51] error: internal compiler error: unexpected panic
[00:39:51] 
[00:39:51] 
[00:39:51] note: the compiler unexpectedly panicked. this is a bug.
[00:39:51] 
[00:39:51] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:39:51] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:39:51] 
[00:39:51] 
[00:39:51] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=compare -C prefer-dynamic -C rpath
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] thread '[ui] ui/nll/get_default.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] thread '[ui] ui/nll/get_default.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/guarantor-issue-46974.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] - error[E0506]: cannot assign to `*s` because it is borrowed
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     let t = &mut *s; // this borrow should last for the entire function
[00:39:51] -    |             ------- borrow of `*s` occurs here
[00:39:51] - LL |     let x = &t.0;
[00:39:51] - LL |     *s = (2,); //~ ERROR cannot assign to `*s`
[00:39:51] -    |     ^^^^^^^^^ assignment to borrowed `*s` occurs here
[00:39:51] - LL |     *x
[00:39:51] -    |     -- borrow later used here
[00:39:51] - 
[00:39:51] 12 ering due to previous error\n\n"}
[00:39:51] {"message":"For more information about this error, try `rustc --explain E0621`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0621`.\n"}
[00:39:51] error: internal compiler error: unexpected panic
[00:39:51] 
[00:39:51] 
[00:39:51] note: the compiler unexpectedly panicked. this is a bug.
[00:39:51] 
[00:39:51] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:39:51] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:39:51] 
[00:39:51] 
[00:39:51] note: compiler flags: -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] thread '[ui] ui/nll/guarantor-issue-46974.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] thread '[ui] ui/nll/guarantor-issue-46974.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/issue-16223.rs stdout ----
[00:39:51] 
[00:39:51] error: test compilation failed although it shouldn't!
[00:39:51] status: exit code: 101
[00:39:51] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/nll/issue-16223.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/issue-16223/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/issue-16223/auxiliary" "-A" "unused"
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] stderr:
[00:39:51] stderr:
[00:39:51] ------------------------------------------
[00:39:51] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:39:51] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:39:51] 
[00:39:51] error: internal compiler error: unexpected panic
[00:39:51] 
[00:39:51] note: the compiler unexpectedly panicked. this is a bug.
[00:39:51] 
[00:39:51] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:39:51] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:39:51] 
[00:39:51] 
[00:39:51] note: compiler flags: -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] thread '[ui] ui/nll/issue-16223.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] thread '[ui] ui/nll/issue-16223.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/issue-47388.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] - error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     let fancy_ref = &(&mut fancy);
[00:39:51] -    |                     ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)`
[00:39:51] - LL |     fancy_ref.num = 6; //~ ERROR E0594
[00:39:51] -    |     ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written
[00:39:51] - error: aborting due to previous error
[00:39:51] - 
[00:39:51] - For more information about this error, try `rustc --explain E0594`.
[00:39:51] - 
[00:39:51] - 
[00:39:51] 
[00:39:51] 
[00:39:51] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/issue-47388/issue-47388.stderr`: No such file or directory (os error 2)
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/issue-43058.rs stdout ----
[00:39:51] 
[00:39:51] 
[00:39:51] error: test compilation failed although it shouldn't!
[00:39:51] status: exit code: 101
[00:39:51] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/nll/issue-43058.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/issue-43058/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/issue-43058/auxiliary" "-A" "unused"
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] stderr:
[00:39:51] stderr:
[00:39:51] ------------------------------------------
[00:39:51] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:39:51] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:39:51] 
[00:39:51] error: internal compiler error: unexpected panic
[00:39:51] 
[00:39:51] note: the compiler unexpectedly panicked. this is a bug.
[00:39:51] 
[00:39:51] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:39:51] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:39:51] 
[00:39:51] 
[00:39:51] note: compiler flags: -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] thread '[ui] ui/nll/issue-43058.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] thread '[ui] ui/nll/issue-43058.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/issue-47470.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] - error[E0597]: `local` does not live long enough
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |         &local //~ ERROR `local` does not live long enough
[00:39:51] -    |         ^^^^^^ borrowed value does not live long enough
[00:39:51] - LL |     }
[00:39:51] -    |     - borrowed value only lives until here
[00:39:51] -    |
[00:39:51] - note: borrowed value must be valid for the lifetime 'a as defined on the impl at 23:6...
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL | impl<'a> Bar for Foo<'a> {
[00:39:51] - 
[00:39:51] - error: aborting due to previous error
[00:39:51] - 
[00:39:51] - For more information about this error, try `rustc --explain E0597`.
[00:39:51] - For more information about this error, try `rustc --explain E0597`.
[00:39:51] - 
[00:39:51] 
[00:39:51] 
[00:39:51] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/issue-47470/issue-47470.stderr`: No such file or directory (os error 2)
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/issue-48238.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] 
[00:39:51] - error: unsatisfied lifetime constraints
[00:39:51] -   --> $DIR/issue-48238.rs:21:13
[00:39:51] -    |
[00:39:51] - LL |     move || use_val(&orig); //~ ERROR
[00:39:51] -    |     --------^^^^^^^^^^^^^^
[00:39:51] -    |     |       |
[00:39:51] -    |     |       argument requires that `'1` must outlive `'2`
[00:39:51] -    |     lifetime `'1` represents the closure body
[00:39:51] -    |     lifetime `'2` appears in return type
[00:39:51] - error: aborting due to previous error
[00:39:51] - 
[00:39:51] - 
[00:39:51] 
[00:39:51] 
[00:39:51] 
[00:39:51] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/issue-48238/issue-48238.stderr`: No such file or directory (os error 2)
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/issue-48070.rs#nll stdout ----
[00:39:51] 
[00:39:51] 
[00:39:51] error in revision `nll`: test compilation failed although it shouldn't!
[00:39:51] status: exit code: 101
[00:39:51] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui] diff of stderr:
[00:39:51] - error: unsatisfied lifetime constraints
[00:39:51] -   --> $DIR/issue-50716.rs:25:14
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     let _x = *s; //~ ERROR
[00:39:51] -    |              ^^ assignment requires that `'a` must outlive `'static`
[00:39:51] - error: aborting due to previous error
[00:39:51] - 
[00:39:51] - 
[00:39:51] 
[00:39:51] 
[00:39:51] 
[00:39:51] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/issue-50716/issue-50716.stderr`: No such file or directory (os error 2)
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/issue-51268.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] 
[00:39:51] - error[E0502]: cannot borrow `self.thing` as mutable because it is also borrowed as immutable
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |            self.thing.bar(|| {
[00:39:51] -    |            ^              -- immutable borrow occurs here
[00:39:51] -    |   _________|
[00:39:51] -    |  |_________|
[00:39:51] -    | ||
[00:39:51] - LL | ||         //~^ ERROR cannot borrow `self.thing` as mutable because it is also borrowed as immutable [E0502]
[00:39:51] - LL | ||             &self.number;
[00:39:51] -    | ||              ---- previous borrow occurs due to use of `self` in closure
[00:39:51] - LL | ||         });
[00:39:51] -    | ||          ^
[00:39:51] -    | ||__________|
[00:39:51] -    | |___________mutable borrow occurs here
[00:39:51] -    |             borrow l: the compiler unexpectedly panicked. this is a bug.
[00:39:51] 
[00:39:51] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:39:51] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:39:51] 
[00:39:51] 
[00:39:51] note: compiler flags: -Z ui-testing -Z unstable-options -Z emit-end-regions -Z borrowck=mir -C prefer-dynamic -C rpath
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] thread '[ui] ui/nll/maybe-initialized-drop-uninitialized.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] thread '[ui] ui/nll/maybe-initialized-drop-uninitialized.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/maybe-initialized-drop-with-fragment.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] - error[E0506]: cannot assign to `x` because it is borrowed
[00:39:51] -   --> $DIR/maybe-initialized-drop-with-fragment.rs:31:5
[00:39:51] -    |
[00:39:51] - LL |     let wrap = Wrap { p: &mut x };
[00:39:51] -    |                          ------ borrow of `x` occurs here
[00:39:51] - ...
[00:39:51] - LL |     x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506]
[00:39:51] -    |     ^^^^^ assignment to borrowed `x` occurs here
[00:39:51] - LL | }
[00:39:51] -    | - borrow later used here, when `foo` is dropped
[00:39:51] - error: aborting due to previous error
[00:39:51] - 
[00:39:51] - For more information about this error, try `rustc --explain E0506`.
[00:39:51] - 
[00:39:51] - 
[00:39:51] 
[00:39:51] 
[00:39:51] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/maybe-initialized-drop-with-fragment/maybe-initialized-drop-with-fragment.stderr`: No such file or directory (os error 2)
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] 
[00:39:51] - error[E0506]: cannot assign to `x` because it is borrowed
[00:39:51] -   --> $DIR/maybe-initialized-drop-with-uninitialized-fragments.rs:32:5
[00:39:51] -    |
[00:39:51] - LL |     let wrap = Wrap { p: &mut x };
[00:39:51] -    |                          ------ borrow of `x` occurs here
[00:39:51] - ...
[00:39:51] - LL |     x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506]
[00:39:51] -    |     ^^^^^ assignment to borrowed `x` occurs here
[00:39:51] - LL |     // FIXME ^ This currently errors and it should not.
[00:39:51] - LL | }
[00:39:51] -    | - borrow later used here, when `foo` is dropped
[00:39:51] - error: aborting due to previous error
[00:39:51] - 
[00:39:51] - For more information about this error, try `rustc --explain E0506`.
[00:39:51] - 
[00:39:51] - 
[00:39:51] 
[00:39:51] 
[00:39:51] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments/maybe-initialized-drop-with-uninitialized-fragments.stderr`: No such file or directory (os error 2)
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/maybe-initialized-drop.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] 
[00:39:51] - error[E0506]: cannot assign to `x` because it is borrowed
[00:39:51] -   --> $DIR/maybe-initialized-drop.rs:26:5
[00:39:51] -    |
[00:39:51] - LL |     let wrap = Wrap { p: &mut x };
[00:39:51] -    |                          ------ borrow of `x` occurs here
[00:39:51] - LL |     x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506]
[00:39:51] -    |     ^^^^^ assignment to borrowed `x` occurs here
[00:39:51] - LL | }
[00:39:51] -    | - borrow later used here, when `wrap` is dropped
[00:39:51] - error: aborting due to previous error
[00:39:51] - 
[00:39:51] - For more information about this error, try `rustc --explain E0506`.
[00:39:51] - 
[00:39:51] - 
[00:39:51] 
[00:39:51] 
[00:39:51] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/maybe-initialized-drop/maybe-initialized-drop.stderr`: No such file or directory (os error 2)
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/move-errors.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] 
[00:39:51] 7    |             cannot move out of borrowed content
[00:39:51] 8    |             help: consider removing this dereference operator: `a`
[00:39:51] 9 
[00:39:51] - error[E0508]: cannot move out of type `[A; 1]`, a non-copy array
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     let b = a[0];
[00:39:51] -    |             |
[00:39:51] -    |             cannot move out of here
[00:39:51] -    |             help: consider using a reference instead: `&a[0]`
[00:39:51] + error: aborting due to previous error
[00:39:51] + error: aborting due to previous error
[00:39:51] 18 
[00:39:51] - error[E0507]: cannot move out of borrowed content
[00:39:51] -   --> $DIR/move-errors.rs:32:13
[00:39:51] -    |
[00:39:51] - LL |     let s = **r;
[00:39:51] -    |             |
[00:39:51] -    |             cannot move out of borrowed content
[00:39:51] -    |             help: consider using a reference instead: `&**r`
[00:39:51] - 
[00:39:51] - 
[00:39:51] - error[E0507]: cannot move out of borrowed content
[00:39:51] -   --> $DIR/move-errors.rs:40:13
[00:39:51] -    |
[00:39:51] - LL |     let s = *r;
[00:39:51] -    |             |
[00:39:51] -    |             cannot move out of borrowed content
[00:39:51] -    |             help: consider using a reference instead: `&*r`
[00:39:51] - 
[00:39:51] - 
[00:39:51] - error[E0508]: cannot move out of type `[A; 1]`, a non-copy array
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     let a = [A("".to_string())][0];
[00:39:51] -    |             |
[00:39:51] -    |             cannot move out of here
[00:39:51] -    |             cannot move out of here
[00:39:51] -    |             help: consider using a reference instead: `&[A("".to_string())][0]`
[00:39:51] - error[E0507]: cannot move out of borrowed content
[00:39:51] -   --> $DIR/move-errors.rs:51:16
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     let A(s) = *a;
[00:39:51] -    |           -    ^^
[00:39:51] -    |           |    cannot move out of borrowed content
[00:39:51] -    |           |    help: consider removing this dereference operator: `a`
[00:39:51] -    |           |    help: consider removing this dereference operator: `a`
[00:39:51] -    |           move occurs because s has type `std::string::String`, which does not implement the `Copy` trait
[00:39:51] - 
[00:39:51] - error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     let C(D(s)) = c;
[00:39:51] -    |             -     ^ cannot move out of here
[00:39:51] -    |             |
[00:39:51] -    |             help: to prevent move, use ref or ref mut: `ref s`
[00:39:51] - error[E0507]: cannot move out of borrowed content
[00:39:51] -   --> $DIR/move-errors.rs:64:9
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     b = *a;
[00:39:51] -    |         ^^ cannot move out of borrowed content
[00:39:51] - 
[00:39:51] - error[E0508]: cannot move out of type `[B; 1]`, a non-copy array
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     match x[0] {
[00:39:51] -    |           |
[00:39:51] -    |           cannot move out of here
[00:39:51] -    |           help: consider using a reference instead: `&x[0]`
[00:39:51] -    |           help: consider using a reference instead: `&x[0]`
[00:39:51] - LL |     //~^ ERROR
[00:39:51] - LL |         B::U(d) => (),
[00:39:51] -    |              - move occurs because d has type `D`, which does not implement the `Copy` trait
[00:39:51] - LL |         B::V(s) => (),
[00:39:51] -    |       00:39:51] - LL |         F(ref s, mut t) => (),
[00:39:51] -    |           ^^^^^
[00:39:51] - help: to prevent move, use ref or ref mut
[00:39:51] -    |
[00:39:51] - LL |         F(s, ref mut t) => (),
[00:39:51] - 
[00:39:51] - error[E0507]: cannot move out of borrowed content
[00:39:51] -   --> $DIR/move-errors.rs:123:11
[00:39:51] -    |
[00:39:51] -    |
[00:39:51] - LL |     match *x {
[00:39:51] -    |           |
[00:39:51] -    |           cannot move out of borrowed content
[00:39:51] -    |           cannot move out of borrowed content
[00:39:51] -    |           help: consider removing this dereference operator: `x`
[00:39:51] - LL |     //~^ ERROR
[00:39:51] - LL |         Ok(s) | Err(s) => (),
[00:39:51] -    |            - move occurs because s has type `std::string::String`, which does not implement the `Copy` trait
[00:39:51] - error: aborting due to 14 previous errors
[00:39:51] - 
[00:39:51] - Some errors occurred: E0507, E0508, E0509.
[00:39:51] - For more information about an error, try `rustc --explain E0507`.
[00:39:51] - For more information about an error, try `rustc --explain E0507`.
[00:39:51] + For more information about this error, try `rustc --explain E0507`.
[00:39:51] 141 
[00:39:51] 
[00:39:51] 
[00:39:51] The actual stderr differed from the expected stderr.
[00:39:51] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/move-errors/move-errors.stderr
[00:39:51] To update references, rerun the tests and pass the `--bless` flag
[00:39:51] To only update this specific test, also pass `--test-args nll/move-errors.rs`
[00:39:51] error: 1 errors occurred comparing output.
[00:39:51] error: 1 errors occurred comparing output.
[00:39:51] status: exit codeimpl TheDarkKnight {\n    fn nothing_is_true(&self) {} // First case, we don't take ownership\n}\n\nfn main() {\n    let x = RefCell::new(TheDarkKnight);\n\n    x.borrow().nothing_is_true(); // ok!\n}\n```\n\nOr:\n\n```\nuse std::cell::RefCell;\n\nstruct TheDarkKnight;\n\nimpl TheDarkKnight {\n    fn nothing_is_true(self) {}\n}\n\nfn main() {\n    let x = RefCell::new(TheDarkKnight);\n    let x = x.into_inner(); // we get back ownership\n\n    x.nothing_is_true(); // ok!\n}\n```\n\nOr:\n\n```\nuse std::cell::RefCell;\n\n#[derive(Clone, Copy)] // we implement the Copy trait\nstruct TheDarkKnight;\n\nimpl TheDarkKnight {\n    fn nothing_is_true(self) {}\n}\n\nfn main() {\n    let x = RefCell::new(TheDarkKnight);\n\n    x.borrow().nothing_is_true(); // ok!\n}\n```\n\nMoving a member out of a mutably borrowed struct will also cause E0507 error:\n\n```compile_fail,E0507\nstruct TheDarkKnight;\n\nimpl TheDarkKnight {\n    fn nothing_is_true(self) {}\n}\n\nstruct Batcave {\n    knight: TheDarkKnight\n}\n\nfn main() {\n    let mut cave = Batcave {\n        knight: TheDarkKnight\n    };\n    let borrowed = &mut cave;\n\n    borrowed.knight.nothing_is_true(); // E0507\n}\n```\n\nIt is fine only if you put something back. `mem::replace` can be used for that:\n\n```\n# struct TheDarkKnight;\n# impl TheDarkKnight { fn nothing_is_true(self) {} }\n# struct Batcave { knight: TheDarkKnight }\nuse std::mem;\n\nlet mut cave = Batcave {\n    knight: TheDarkKnight\n};\nlet borrowed = &mut cave;\n\nmem::replace(&mut borrowed.knight, TheDarkKnight).nothing_is_true(); // ok!\n```\n\nYou can find more information about borrowing in the rust-book:\nhttp://doc.rust-lang.org/book/first-edition/references-and-borrowing.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nll/move-errors.rs","byte_start":607,"byte_end":609,"line_start":19,"line_end":19,"column_start":13,"column_end":15,"is_primary":true,"text":[{"text":"    let b = *a;","highlight_start":13,"highlight_end":15}],"label":"cannot move out of borrowed content","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"consider removing this dereference operator","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/nll/move-errors.rs","byte_start":607,"byte_end":609,"line_start":19,"line_end":19,"column_start":13,"column_end":15,"is_primary":true,"text":[{"text":"    let b = *a;","highlight_start":13,"highlight_end":15}],"label":null,"suggested_replacement":"a","suggestion_applicability":"Unspecified","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0507]: cannot move out of borrowed content\n  --> /checkout/src/test/ui/nll/move-errors.rs:19:13\n   |\nLL |     let b = *a;\n   |             ^^\n   |             |\n   |             cannot move out of borrowed content\n   |             help: consider removing this dereference operator: `a`\n\n"}
[00:39:51] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:39:51] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:39:51] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:39:51] {"message":"For more information about this error, try `rustc --explain E0507`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0507`.\n"}
[00:39:51] error: internal compiler error: unexpected panic
[00:39:51] 
[00:39:51] 
[00:39:51] note: the compiler unexpectedly panicked. this is a bug.
[00:39:51] 
[00:39:51] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:39:51] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:39:51] 
[00:39:51] 
[00:39:51] note: compiler flags: -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath
[00:39:51] 
[00:39:51] ------------------------------------------
[00:39:51] 
[00:39:51] thread '[ui] ui/nll/move-errors.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] thread '[ui] ui/nll/move-errors.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3140:9
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/return-ref-mut-issue-46557.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] - error[E0597]: borrowed value does not live long enough
[00:39:51] -   --> $DIR/return-ref-mut-issue-46557.rs:17:21
[00:39:51] -    |
[00:39:51] - LL |   fn gimme_static_mut() -> &'static mut u32 {
[00:39:51] -    |  ___________________________________________-
[00:39:51] - LL | |     let ref mut x = 1234543; //~ ERROR borrowed value does not live long enough [E0597]
[00:39:51] -    | |                     ^^^^^^^ temporary value does not live long enough
[00:39:51] - LL | |     x
[00:39:51] - LL | | }
[00:39:51] -    | | -
[00:39:51] -    | | |
[00:39:51] -    | |_temporary value only lives until here
[00:39:51] -    |   borrow later used here
[00:39:51] - error: aborting due to previous error
[00:39:51] - 
[00:39:51] - For more information about this error, try `rustc --explain E0597`.
[00:39:51] - 
[00:39:51] - 
[00:39:51] 
[00:39:51] 
[00:39:51] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/return-ref-mut-issue-46557/return-ref-mut-issue-46557.stderr`: No such file or directory (os error 2)
[00:39:51] 
[00:39:51] ---- [ui] ui/nll/ty-outlives/projection-no-regions-closure.rs stdout ----
[00:39:51] diff of stderr:
[00:39:51] 
[00:39:51] 
---
[00:39:51]     [ui] ui/nll/return-ref-mut-issue-46557.rs
[00:39:51]     [ui] ui/nll/ty-outlives/projection-implied-bounds.rs
[00:39:51]     [ui] ui/nll/ty-outlives/projection-no-regions-closure.rs
[00:39:51]     [ui] ui/nll/ty-outlives/projection-no-regions-fn.rs
[00:39:51]     [ui] ui/nll/ty-outlives/projection-ones  -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"
[00:39:51] 
[00:39:51] 
[00:39:51] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:39:51] Build completed unsuccessfully in 0:01:51
[00:39:51] Build completed unsuccessfully in 0:01:51
[00:39:51] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0187a000
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:119cf17b:start=1531172934904931201,finish=1531172934911436046,duration=6504845
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:13992d38
$ head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
head: cannot open ‘./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers’ for reading: No such file or directory
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0b7ebdb8
$ dmesg | grep -i kill

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 kennytm 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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 10, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 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:06:22]    Compiling proc_macro v0.0.0 (file:///checkout/src/libproc_macro)
[00:06:36]    Compiling syntax_ext v0.0.0 (file:///checkout/src/libsyntax_ext)
[00:11:41]    Compiling rustc_typeck v0.0.0 (file:///checkout/src/librustc_typeck)
[00:11:41]    Compiling rustc_mir v0.0.0 (file:///checkout/src/librustc_mir)
[00:11:43] error[E0425]: cannot find value `constraints_scc` in this scope
[00:11:43]    --> librustc_mir/borrow_check/nll/region_infer/mod.rs:233:23
[00:11:43]     |
[00:11:43] 233 |             let scc = constraints_scc.scc(region);
[00:11:43]     |                       ^^^^^^^^^^^^^^^ did you mean `constraint_sccs`?
[00:11:52] error: aborting due to previous error
[00:11:52] 
[00:11:52] For more information about this error, try `rustc --explain E0425`.
[00:11:52] error: Could not compile `rustc_mir`.
[00:11:52] error: Could not compile `rustc_mir`.
[00:11:52] 
[00:11:52] Caused by:
[00:11:52]   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=2 -C metadata=eb891085b7b80162 -C extra-filename=-eb891085b7b80162 --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 arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-ebe584ed738e3de8.so --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-c8771f0802893cf2.rlib --extern byteorder=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbyteorder-2a1f5ee3e102fe42.rlib --extern either=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libeither-b51deb005c05dd3b.rlib --extern graphviz=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libgraphviz-6020508f01da724d.so --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-30c8a625cec7af60.rlib --extern log_settings=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog_settings-3ad1691935709254.rlib --extern polonius_engine=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libpolonius_engine-7d678b2486a5f5d9.rlib --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-f3f1ff1495349b05.so --extern rustc_apfloat=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-0b0f824eb96efcb5.rlib --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-dfab6c84d2674220.so --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-fb4c86e007981750.so --extern rustc_target=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-e528c05031478194.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-05774896829b5d87.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-05774896829b5d87.rlib --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-5f603e9854c9c328.so --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-786292eb849f05d6.so -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-e7051d4409bf3a37/out -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-49fbbb5cce716fd4/out` (exit code: 101)
[00:13:15] error: build failed
[00:13:15] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:13:15] expected success, got: exit code: 101
[00:13:15] expected success, got: exit code: 101
[00:13:15] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1117:9
[00:13:15] travis_fold:end:stage0-rustc

[00:13:15] travis_time:end:stage0-rustc:start=1531421410806835964,finish=1531421938780663921,duration=527973827957


[00:13:15] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:13:15] Build completed unsuccessfully in 0:09:40
[00:13:15] Makefile:28: recipe for target 'all' failed
[00:13:15] make: *** [all] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:014d4136
$ 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)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 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_ui
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:43:35] 
[00:43:35] running 1560 tests
[00:43:38] .....................................F......F..F............FFF...................................i.
[00:43:44] ....................................................................................................
[00:43:46] ....................................................................................................
[00:43:49] ....................................................................................................
[00:43:51] ....................................................................................................
[00:43:51] ....................................................................................................
[00:43:54] .................................F...........F.......................................F..............
[00:43:57] ....................................................................................F.FF.F.....F....
[00:44:00] .....................................F.FF...FFF....F.....F....FF.F..................................
[00:44:03] ....................................................................................................
[00:44:06] ......................................i........FFF.FFFFFFFFFFFFFFFFFF.F.F.FF.FFFFF.FFF.FFF.FF.F...FF
[00:44:09] FFFFF.F.....FFFFFFFF.FFFF..iF.......................................................................
[00:44:16] ....................................................................................................
occurs here
occurs here
[00:44:22] - LL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
[00:44:22] -    |                        ^^          - borrow occurs due to use of `x` in closure
[00:44:22] -    |                        second mutable borrow occurs here
[00:44:22] -    |                        second mutable borrow occurs here
[00:44:22] - LL |     //~| ERROR cannot borrow `x` as mutable more than once
[00:44:22] - LL |     drop((c1, c2));
[00:44:22] -    |           -- borrow later used here
[00:44:22] - 
[00:44:22] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |     let c1 = to_fn_mut(|| x = 5);
[00:44:22] -    |                        -- - previous borrow occurs due to use of `x` in closure
[00:44:22] -    |                        first mutable borrow occurs here
[00:44:22] -    |                        first mutable borrow occurs here
[00:44:22] - LL |     let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
[00:44:22] -    |                        ^^                                  - borrow occurs due to use of `x` in closure
[00:44:22] -    |                        second mutable borrow occurs here
[00:44:22] - ...
[00:44:22] - ...
[00:44:22] - LL |     drop((c1, c2));
[00:44:22] -    |           -- borrow later used here
[00:44:22] - 
[00:44:22] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |     let c1 = to_fn_mut(|| set(&mut *x.f));
[00:44:22] -    |                        --           - previous borrow occurs due to use of `x` in closure
[00:44:22] -    |                        first mutable borrow occurs here
[00:44:22] -    |                        first mutable borrow occurs here
[00:44:22] - LL |     let c2 = to_fn_mut(|| set(&mut *x.f));
[00:44:22] -    |                        ^^           - borrow occurs due to use of `x` in closure
[00:44:22] -    |                        second mutable borrow occurs here
[00:44:22] - ...
[00:44:22] - ...
[00:44:22] - LL |     drop((c1, c2));
[00:44:22] -    |           -- borrow later used here
[00:44:22] - error: aborting due to 10 previous errors
[00:44:22] + error: aborting due to 5 previous errors
[00:44:22] 152 
[00:44:22] 153 For more information about this error, try `rustc --explain E0499`.
[00:44:22] 153 For more information about this error, try `rustc --explain E0499`.
[00:44:22] 154 
[00:44:22] 
[00:44:22] 
[00:44:22] The actual stderr differed from the expected stderr.
[00:44:22] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-closures-two-mut/borrowck-closures-two-mut.stderr
[00:44:22] To update references, rerun the tests and pass the `--bless` flag
[00:44:22] To only update this specific test, also pass `--test-args borrowck/borrowck-closures-two-mut.rs`
[00:44:22] error: 1 errors occurred comparing output.
[00:44:22] status: exit code: 101
[00:44:22] status: exit code: 101
[00:44:22] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-closures-two-mut/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=compare" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-closures-two-mut/auxiliary" "-A" "unused"
[00:44:22] ------------------------------------------
[00:44:22] 
[00:44:22] ------------------------------------------
[00:44:22] stderr:
[00:44:22] stderr:
[00:44:22] ------------------------------------------
[00:44:22] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":816,"byte_end":818,"line_start":23,"line_end":23,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 4);","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":850,"byte_end":852,"line_start":24,"line_end":24,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":994,"byte_end":995,"line_start":27,"line_end":27,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":853,"byte_end":854,"line_start":24,"line_end":24,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":27,"highlight_end":28}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":819,"byte_end":820,"line_start":23,"line_end":23,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 4);","highlight_start":27,"highlight_end":28}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:24:24\n   |\nLL |     let c1 = to_fn_mut(|| x = 4);\n   |                        -- - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once\n   |                        ^^ - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:44:22] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/chec"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1099,"byte_end":1100,"line_start":35,"line_end":35,"column_start":36,"column_end":37,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| set(&mut x));","highlight_start":36,"highlight_end":37}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:36:24\n   |\nLL |     let c1 = to_fn_mut(|| set(&mut x));\n   |                        --          - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once\n   |                        ^^          - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:44:22] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1331,"byte_end":1333,"line_start":43,"line_end":43,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 5);","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1365,"byte_end":1367,"line_start":44,"line_end":44,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1515,"byte_end":1516,"line_start":47,"line_end":47,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_stae_end":56,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1639,"byte_end":1640,"line_start":52,"line_end":52,"column_start":60,"column_end":61,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)","highlight_start":60,"highlight_end":61}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1572,"byte_end":1573,"line_start":51,"line_end":51,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 5);","highlight_start":27,"highlight_end":28}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:52:24\n   |\nLL |     let c1 = to_fn_mut(|| x = 5);\n   |                        -- - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)\n   |                        ^^                                  - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:44:22] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1933,"byte_end":1935,"line_start":64,"line_end":64,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| set(&mut *x.f));","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1976,"byte_end":1978,"line_start":65,"line_end":65,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut *x.f));","       - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| set(&mut *x.f));\n   |                        ^^           - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:44:22] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:44:22] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:44:22] {"message":"aborting due to 5 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 5 previous errors\n\n"}
[00:44:22] {"message":"For more information about this error, try `rustc --explain E0499`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0499`.\n"}
[00:44:22] error: internal compiler error: unexpected panic
[00:44:22] 
[00:44:22] 
[00:44:22] note: the compiler unexpectedly panicked. this is a bug.
[00:44:22] 
[00:44:22] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:44:22] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:44:22] 
[00:44:22] 
[00:44:22] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=compare -C prefer-dynamic -C rpath
[00:44:22] 
[00:44:22] ------------------------------------------
[00:44:22] 
[00ed here
[00ed here
[00:44:22] - 
[00:44:22] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
[00:44:22] -    |                    ------------- immutable borrow occurs here
[00:44:22] - ...
[00:44:22] - LL |         if let [_, ref mut from_begin1, ..] = *s { //~ERROR
[00:44:22] -    |                    ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:44:22] - LL |             nop(&[from_begin1, from_end1, from_end3, from_end4]);
[00:44:22] -    |                                                      --------- borrow later used here
[00:44:22] - 
[00:44:22] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
[00:44:22] -    |                                   ------------- immutable borrow occurs here
[00:44:22] - ...
[00:44:22] - LL |         if let [_, _, ref mut from_begin2, ..] = *s { //~ERROR
[00:44:22] -    |                       ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:44:22] - LL |             nop(&[from_begin2, from_end1, from_end3, from_end4]);
[00:44:22] -    |                                           --------- borrow later used here
[00:44:22] - 
[00:44:22] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
[00:44:22] -    |                                   ------------- immutable borrow occurs here
[00:44:22] - ...
[00:44:22] - LL |         if let [_, _, _, ref mut from_begin3, ..] = *s { //~ERROR
[00:44:22] -    |                          ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:44:22] - LL |             nop(&[from_begin3, from_end1, from_end3, from_end4]);
[00:44:22] -    |                                           --------- borrow later used here
[00:44:22] - 
[00:44:22] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
[00:44:22] -    |                                                  --------------- immutable borrow occurs here
[00:44:22] - ...
[00:44:22] - LL |         if let [.., ref mut from_end2, _] = *s { //~ERROR
[00:44:22] -    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:44:22] - LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end2]);
[00:44:22] -    |                                             ----------- borrow later used here
[00:44:22] - 
[00:44:22] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |     if  try `rustc --explain E0502`.
[00:44:22] 
[00:44:22] 
[00:44:22] 
[00:44:22] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-slice-pattern-element-loan/borrowck-slice-pattern-element-loan.stderr`: No such file or directory (os error 2)
[00:44:22] 
[00:44:22] ---- [ui] ui/borrowck/issue-41962.rs stdout ----
[00:44:22] diff of stderr:
[00:44:22] 
[00:44:22] 
[00:44:22] 16    |
[00:44:22] 17    = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
[00:44:22] 18 
[00:44:22] - error[E0382]: use of moved value: `maybe` (Mir)
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |           if let Some(thing) = maybe {
[00:44:22] -    |           ^           ----- value moved here
[00:44:22] -    |  _________|
[00:44:22] -    | |
[00:44:22] - LL | |         }
[00:44:22] -    | |_________^ value used here after move
[00:44:22] -    |
[00:44:22] -    = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
[00:44:22] - 
[00:44:22] - error[E0382]: borrow of moved value: `maybe` (Mir)
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |           if let Some(thing) = maybe {
[00:44:22] -    |           ^           ----- value moved here
[00:44:22] -    |  _________|
[00:44:22] -    | |
[00:44:22] - LL | |         }
[00:44:22] -    | |_________^ value borrowed here afs` flag
[00:44:22] To only update this specific test, also pass `--test-args borrowck/issue-41962.rs`
[00:44:22] error: 1 errors occurred comparing output.
[00:44:22] status: exit code: 101
[00:44:22] status: exit code: 101
[00:44:22] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/issue-41962.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/issue-41962/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=compare" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/issue-41962/auxiliary" "-A" "unused"
[00:44:22] ------------------------------------------
[00:44:22] 
[00:44:22] ------------------------------------------
[00:44:22] stderr:
[00:44:22] stderr:
[00:44:22] ------------------------------------------
[00:44:22] {"message":"use of partially moved value: `maybe` (Ast)","code":{"code":"E0382","explanation":"\nThis error occurs when an attempt is made to use a variable after its contents\nhave been moved elsewhere. For example:\n\n```compile_fail,E0382\nstruct MyStruct { s: u32 }\n\nfn main() {\n    let mut x = MyStruct{ s: 5u32 };\n    let y = x;\n    x.s = 6;\n    println!(\"{}\", x.s);\n}\n```\n\nSince `MyStruct` is a type that is not marked `Copy`, the data gets moved out\nof `x` when we set `y`. This is fundamental to Rust's ownership system: outside\nof workarounds like `Rc`, a value cannot be owned by more than one variable.\n\nSometimes we don't need to move the value. Using a reference, we can let another\nfunction borrow the value without changing its ownership. In the example below,\nwe don't actually have to move our string to `calculate_length`, we can give it\na reference to it with `&` instead.\n\n```\nfn main() {\n    let s1 = String::from(\"hello\");\n\n    let len = calculate_length(&s1);\n\n    println!(\"The length of '{}' is {}.\", s1, len);\n}\n\nfn calculate_length(s: &String) -> usize {\n    s.len()\n}\n```\n\nA mutable reference can be created with `&mut`.\n\nSometimes we don't want a reference, but a duplicate. All types marked `Clone`\ncan be duplicated by calling `.clone()`. Subsequent changes to a clone do not\naffect the original variable.\n\nMost types in the standard library are marked `Clone`. The example below\ndemonstrates using `clone()` on a string. `s1` is first set to \"many\", and then\ncopied to `s2`. Then the first character of `s1` is removed, without affecting\n`s2`. \"any many\" is printed to the console.\n\n```\nfn main() {\n    let mut s1 = String::from(\"many\");\n    let s2 = s1.clone();\n    s1.remove(0);\n    println!(\"{} {}\", s1, s2);\n}\n```\n\nIf we control the definition of a type, we can implement `Clone` on it ourselves\nwith `#[derive(Clone)]`.\n\nSome types have no ownership semantics at all and are trivial to duplicate. An\nexample is `i32` and the other number types. We don't have to call `.clone()` to\nclone them, because they are marked `Copy` in addition to `Clone`.  Implicit\ncloning is more convenient in this case. We can mark our own types `Copy` if\nall their members also are marked `Copy`.\n\nIn the example belole.\n\nSometimes we don't need to move the value. Using a reference, we can let another\nfunction borrow the value without changing its ownership. In the example below,\nwe don't actually have to move our string to `calculate_length`, we can give it\na reference to it with `&` instead.\n\n```\nfn main() {\n    let s1 = String::from(\"hello\");\n\n    let len = calculate_length(&s1);\n\n    println!(\"The length of '{}' is {}.\", s1, len);\n}\n\nfn calculate_length(s: &String) -> usize {\n    s.len()\n}\n```\n\nA mutable reference can be created with `&mut`.\n\nSometimes we don't want a reference, but a duplicate. All types marked `Clone`\ncan be duplicated by calling `.clone()`. Subsequent changes to a clone do not\naffect the original variable.\n\nMost types in the standard library are marked `Clone`. The example below\ndemonstrates using `clone()` on a string. `s1` is first set to \"many\", and then\ncopied to `s2`. Then the first character of `s1` is removed, without affecting\n`s2`. \"any many\" is printed to the console.\n\n```\nfn main() {\n    let mut s1 = String::from(\"many\");\n    let s2 = s1.clone();\n    s1.remove(0);\n    println!(\"{} {}\", s1, s2);\n}\n```\n\nIf we control the definition of a type, we can implement `Clone` on it ourselves\nwith `#[derive(Clone)]`.\n\nSome types have no ownership semantics at all and are trivial to duplicate. An\nexample is `i32` and the other number types. We don't have to call `.clone()` to\nclone them, because they are marked `Copy` in addition to `Clone`.  Implicit\ncloning is more convenient in this case. We can mark our own types `Copy` if\nall their members also are marked `Copy`.\n\nIn the example below, we implement a `Point` type. Because it only stores two\nintegers, we opt-out of ownership semantics with `Copy`. Then we can\n`let p2 = p1` without `p1` being moved.\n\n```\n#[derive(Copy, Clone)]\nstruct Point { x: i32, y: i32 }\n\nfn main() {\n    let mut p1 = Point{ x: -1, y: 2 };\n    let p2 = p1;\n    p1.x = 1;\n    println!(\"p1: {}, {}\", p1.x, p1.y);\n    println!(\"p2: {}, {}\", p2.x, p2.y);\n}\n```\n\nAlternatively, if we don't control the struct's definition, or mutable shared\nownership is truly required, we can use `Rc` and `RefCell`:\n\n```\nuse std::cell::RefCell;\nuse std::rc::Rc;\n\nstruct MyStruct { s: u32 }\n\nfn main() {\n    let mut x = Rc::new(RefCell::new(MyStruct{ s: 5u32 }));\n    let y = x.clone();\n    x.borrow_mut().s = 6;\n    println!(\"{}\", x.borrow().s);\n}\n```\n\nWith this approach, x and y share ownership of the data via the `Rc` (reference\ncount type). `RefCell` essentially performs runtime borrow checking: ensuring\nthat at most one writer or multiple readers can access the data at any one time.\n\nIf you wish to learn more about ownership in Rust, start with the chapter in the\nBook:\n\nhttps://doc.rust-lang.org/book/first-edition/ownership.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/issue-41962.rs","byte_start":593,"byte_end":598,"line_start":17,"line_end":17,"column_start":21,"column_end":26,"is_primary":true,"text":[{"text":"        if let Some(thing) = maybe {","highlight_start":21,"highlight_end":26}],"label":"value moved here in previous iteration of loop","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0382]: use of moved value: `(maybe as std::prelude::v1::Some).0` (Ast)\n  --> /checkout/src/test/ui/borrowck/issue-41962.rs:17:21\n   |\nLL |         if let Some(thing) = maybe {\n   |                     ^^^^^ value moved here in previous iteration of loop\n   |\n   = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait\n\n"}
[00:44:22] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:44:22] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:44:22] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:44:22] {"message":"For more information about this error, try `rustc --explain E0382`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0382`.\n"}
[00:44:22] error: internal compiler error: unexpected panic
[00:44:22] 
[00:44:22] 
[00:44:22] note: the compiler unexpectedly panicked. this is a bug.
[00:44:22] 
[00:44:22] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:44:22] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:44:22] 
[00:44:22] 
[00:44:22] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=compare -C prefer-dynamic -C rpath
[00:44:22] 
[00:44:22] ------------------------------------------
[00:44:22] 
[00:44:22] thread '[ui] ui/borrowck/issue-41962.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:44:22] thread '[ui] ui/borrowck/issue-41962.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:44:22] 
[00:44:22] ---- [ui] ui/borrowck/two-phase-method-receivers.rs stdout ----
[00:44:22] 
[00:44:22] error: test compilation failed although it shouldn't!
[00:44:22] status: exit code: 101
[00:44:22] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/two-phase-method-receivers.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-method-receivers/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=mir" "-Z" "two-phase-borrows" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-method-receivers/auxiliary" "-A" "unused"
[00:44:22] ------------------------------------------
[00:44:22] 
[00:44:22] ------------------------------------------
[00:44:22] stderr:
[00:44:22] stderr:
[00:44:22] ------------------------------------------
[00:44:22] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:44:22] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:44:22] 
[00:44:22] error: internal compiler error: unexpected panic
able borrow occurs here
[00:44:22] -    |     borrow later used here
[00:44:22] - error: aborting due to 2 previous errors
[00:44:22] - 
[00:44:22] - For more information about this error, try `rustc --explain E0499`.
[00:44:22] - 
[00:44:22] - 
[00:44:22] 
[00:44:22] 
[00:44:22] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-multi-mut/two-phase-multi-mut.stderr`: No such file or directory (os error 2)
[00:44:22] 
[00:44:22] ---- [ui] ui/borrowck/two-phase-multiple-activations.rs stdout ----
[00:44:22] 
[00:44:22] 
[00:44:22] error: test compilation failed although it shouldn't!
[00:44:22] status: exit code: 101
[00:44:22] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/two-phase-multiple-activations.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-multiple-activations/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=mir" "-Z" "two-phase-borrows" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-multiple-activations/auxiliary" "-A" "unused"
[00:44:22] ------------------------------------------
[00:44:22] 
[00:44:22] ------------------------------------------
[00:44:22] stderr:
[00:44:22] stderr:
[00:44:22] ------------------------------------------
[00:44:22] thread 'main' panicked at 'assertion failed: mid <= len', libcore/slice/mod.rs:875:13
[00:44:22] 
[00:44:22] error: internal compiler error: unexpected panic
[00:44:22] 
[00:44:22] 
[00:44:22] note: the compiler unexpectedly panicked. this is a bug.
[00:44:22] 
[00:44:22] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:44:22] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:44:22] 
[00:44:22] 
[00:44:22] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=mir -Z two-phase-borrows -C prefer-dynamic -C rpath
[00:44:22] 
[00:44:22] ------------------------------------------
[00:44:22] 
[00:44:22] thread '[ui] ui/borrowck/two-phase-multiple-activations.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:44:22] thread '[ui] ui/borrowck/two-phase-multiple-activations.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:44:22] 
[00:44:22] ---- [ui] ui/generator/generator-with-nll.rs stdout ----
[00:44:22] diff of stderr:
[00:44:22] 
[00:44:22] 16 LL |         yield ();
[00:44:22] 17    |         -------- possible yield occurs here
[00:44:22] 18 
[00:44:22] - error[E0626]: borrow may still be in use when generator yields (Mir)
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |         let b = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)
[00:44:22] -    |                 ^^^^^^^^^
[00:44:22] - LL |         //~^ borrow may still be in use when generator yields (Mir)
[00:44:22] - LL |         yield ();
[00:44:22] -    |         -------- possible yield /test/ui/generator/generator-with-nll.rs:19:23\n   |\nLL |         let _a = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)\n   |                       ^^^^\n...\nLL |         yield ();\n   |         -------- possible yield occurs here\n\n"}
[00:44:22] {"message":"borrow may still be in use when generator yields (Ast)","code":{"code":"E0626","explanation":"\nThis error occurs because a borrow in a generator persists across a\nyield point.\n\n```compile_fail,E0626\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n    let a = &String::new(); // <-- This borrow...\n    yield (); // ...is still in scope here, when the yield occurs.\n    println!(\"{}\", a);\n};\nunsafe { b.resume() };\n```\n\nAt present, it is not permitted to have a yield that occurs while a\nborrow is still in scope. To resolve this error, the borrow must\neither be \"contained\" to a smaller scope that does not overlap the\nyield or else eliminated in another way. So, for example, we might\nresolve the previous example by removing the borrow and just storing\nthe integer by value:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n    let a = 3;\n    yield ();\n    println!(\"{}\", a);\n};\nunsafe { b.resume() };\n```\n\nThis is a very simple case, of course. In more complex cases, we may\nwish to have more than one reference to the value that was borrowed --\nin those cases, something like the `Rc` or `Arc` types may be useful.\n\nThis error also frequently arises with iteration:\n\n```compile_fail,E0626\n# #![feature(generators, generator_trai"text":"        let b = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)","highlight_start":22,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0626]: borrow may still be in use when generator yields (Ast)\n  --> /checkout/src/test/ui/generator/generator-with-nll.rs:20:22\n   |\nLL |         let b = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)\n   |                      ^^^^\nLL |         //~^ borrow may still be in use when generator yields (Mir)\nLL |         yield ();\n   |         -------- possible yield occurs here\n\n"}
[00:44:22] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:44:22] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:44:22] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:44:22] {"message":"For more information about this error, try `rustc --explain E0626`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0626`.\n"}
[00:44:22] error: internal compiler error: unexpected panic
[00:44:22] 
[00:44:22] 
[00:44:22] note: the compiler unexpectedly panicked. this is a bug.
[00:44:22] 
[00:44:22] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:44:22] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:44:22] 
[00:44:22] 
[00:44:22] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=compare -C prefer-dynamic -C rpath
[00:44:22] 
[00:44:22] ------------------------------------------
[00:44:22] 
[00:44:22] thread '[ui] ui/generator/generator-with-nll.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:44:22] thread '[ui] ui/generator/generator-with-nll.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:44:22] 
[00:44:22] ---- [ui] ui/generator/yield-while-local-borrowed.rs stdout ----
[00:44:22] diff of stderr:
[00:44:22] 
[00:44:22] 16 LL |             yield();
[00:44:22] 17    |             ------- possible yield occurs here
[00:44:22] 18 
[00:44:22] - error[E0626]: borrow may still be in use when generator yields (Mir)
[00:44:22] -   --> $DIR/yield-while-local-borrowed.rs:24:17
[00:44:22] -    |
[00:44:22] - LL |         let a = &mut 3;
[00:44:22] - ...
[00:44:22] - ...
[00:44:22] - LL |         yield();
[00:44:22] -    |         ------- possible yield occurs here
[00:44:22] - 
[00:44:22] - error[E0626]: borrow may still be in use when generator yields (Mir)
[00:44:22] -   --> $DIR/yield-while-local-borrowed.rs:52:21
[00:44:22] -    |
[00:44:22] - LL |             let b = &a;
[00:44:22] - ...
[00:44:22] - ...
[00:44:22] - LL |             yield();
[00:44:22] -    |             ------- possible yield occurs here
[00:44:22] - error: aborting due to 4 previous errors
[00:44:22] + error: aborting due to 2 previous errors
[00:44:22] 38 
[00:44:22] 39 For more information about this error, try `rustc --explain E0626`.
[00:44:22] 39 For more information about this error, try `rustc --explain E0626`.
[00:44:22] 40 
[00:44:22] 
[00:44:22] 
```\n\nIf taking ownership is not an option, using indices can work too:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  let len = v.len(); // (*)\n  for i in 0..len {\n    let x = v[i]; // (*)\n    yield x; // <-- Now yield is OK.\n  }\n};\nunsafe { b.resume() };\n\n// (*) -- Unfortunately, these temporaries are currently required.\n// See <https://github.com/rust-lang/rust/issues/43122>.\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/generator/yield-while-local-borrowed.rs","byte_start":1033,"byte_end":1040,"line_start":27,"line_end":27,"column_start":9,"column_end":16,"is_primary":false,"text":[{"text":"        yield();","highlight_start":9,"highlight_end":16}],"label":"possible yield occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/generator/yield-while-local-borrowed.rs","byte_start":874,"byte_end":875,"line_start":24,"line_end":24,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":"        let a = &mut 3;","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0626]: borrow may still be in use when generator yields (Ast)\n  --> /checkout/src/test/ui/generator/yield-while-local-borrowed.rs:24:22\n   |\nLL |         let a = &mut 3;\n   |                      ^\n...\nLL |         yield();\n   |         ------- possible yield occurs here\n\n"}
[00:44:22] {"message":"borrow may still be in use when generator yields (Ast)","code":{"code":"E0626","explanation":"\nThis error occurs because a borrow in a generator persists across a\nyield point.\n\n```compile_fail,E0626\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n    let a = &String::new(); // <-- This borrow...\n    yield (); // ...is still in scope here, when the yield occurs.\n    println!(\"{}\", a);\n};\nunsafe { b.resume() };\n```\n\nAt present, it is not permitted to have a yield that occurs while a\nborrow is still in scope. To resolve this error, the borrow must\neither be \"contained\" to a smaller scope that does not overlap the\nyield or else eliminated in another way. So, for example, we might\nresolve the previous example by removing the borrow and just storing\nthe integer by value:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n    let a = 3;\n    yield ();\n    println!(\"{}\", a);\n};\nunsafe { b.resume() };\n```\n\nThis is a very simple case, of course. In more complex cases, we may\nwish to have more than one reference to the value that was borrowed --\nin those cases, something like the `Rc` or `Arc` types may be useful.\n\nThis error also frequently arises with iteration:\n\n```compile_fail,E0626\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  for &x in &v { // <-- borrow of `v` is still in scope...\n    yield x; // ...when this yield occurs.\n  }\n};\nunsafe { b.resume() };\n```\n\nSuch cases can sometimes be resolved by iterating \"by value\" (or using\n`into_iter()`) to avoid borrowing:\n\n```\n# #![feature(4:22] error: test compilation failed although it shouldn't!
[00:44:22] status: exit code: 101
[00:44:22] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/region-escape-via-bound-contravariant-closure/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/region-escape-via-bound-contravariant-closure/auxiliary" "-A" "unused"
[00:44:22] ------------------------------------------
[00:44:22] 
[00:44:22] ------------------------------------------
[00:44:22] stderr:
[00:44:22] stderr:
[00:44:22] ------------------------------------------
[00:44:22] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:44:22] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:44:22] 
[00:44:22] error: internal compiler error: unexpected panic
[00:44:22] 
[00:44:22] note: the compiler unexpectedly panicked. this is a bug.
[00:44:22] 
[00:44:22] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:44:22] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:44:22] 
[00:44:22] 
[00:44:22] note: compiler flags: -Z ui-testing -Z unstable-options -C prefer-dynamic -[00:44:22] - ...
[00:44:22] - LL |         &mut true => { println!("You might think we should get here"); },
[00:44:22] -    |              ^^^^ value used here after move
[00:44:22] - error: aborting due to 2 previous errors
[00:44:22] - 
[00:44:22] - Some errors occurred: E0382, E0505.
[00:44:22] - For more information about an error, try `rustc --explain E0382`.
[00:44:22] - For more information about an error, try `rustc --explain E0382`.
[00:44:22] - 
[00:44:22] 
[00:44:22] 
[00:44:22] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-27282-move-match-input-into-guard/issue-27282-move-match-input-into-guard.stderr`: No such file or directory (os error 2)
[00:44:22] 
[00:44:22] ---- [ui] ui/issue-27282-mutate-before-diverging-arm-1.rs stdout ----
[00:44:22] diff of stderr:
[00:44:22] 
[00:44:22] 
[00:44:22] - error[E0500]: closure requires unique access to `x` but it is already borrowed
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |        match x {
[00:44:22] -    |   _____-
[00:44:22] -    |  |_____|
[00:44:22] -    | ||
[00:44:22] - LL | ||         &mut None => panic!("unreachable"),
[00:44:22] - LL | ||         &mut Some(&_) if {
[00:44:22] - LL | ||             // ForceFnOnce needed to exploit #27282
[00:44:22] - LL | ||             (|| { *x = None; drop(force_fn_once); })();
[00:44:22] -    | ||              ^^    - borrow occurs due to use of `x` in closure
[00:44:22] -    | ||              |
[00:44:22] -    | ||              closure construction occurs here
[00:44:22] - ...  ||
[00:44:22] - LL | ||         _ => panic!("unreachable"),
[00:44:22] - LL | ||     }
[00:44:22] -    | ||     -
[00:44:22] -    | ||_____|
[00:44:22] -    | |______borrow occurs here
[00:44:22] -    |        borrow later used here
[00:44:22] - error: aborting due to previous error
[00:44:22] - 
[00:44:22] - For more information about this error, try `rustc --explain E0500`.
[00:44:22] - 
[00:44:22] - 
[00:44:22] 
[00:44:22] 
[00:44:22] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-27282-mutate-before-diverging-arm-1/issue-27282-mutate-before-diverging-arm-1.stderr`: No such file or directory (os error 2)
[00:44:22] 
[00:44:22] ---- [ui] ui/issue-27282-mutate-before-diverging-arm-2.rs stdout ----
[00:44:22] diff of stderr:
[00:44:22] 
[00:44:22] 
[00:44:22] - error[E0500]: closure requires unique access to `x` but it is already borrowed
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |        match x {
[00:44:22] -    |   _____-
[00:44:22] -    |  |_____|
[00:44:22] -    | ||
[00:44:22] - LL | ||         &mut None => panic!("unreachable"),
[00:44:22] - LL | ||         &mut Some(&_)
[00:44:22] - LL | ||             if {
[00:44:22] - LL | ||                 // ForceFnOnce needed to exploit #27282
[00:44:22] - LL | ||                 (|| { *x = None; drop(force_fn_once); })();
[00:44:22] -    | ||                  ^^   se it is also borrowed as mutable
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |         let mref = &mut u.s.a;
[00:44:22] -    |                    ---------- mutable borrow occurs here
[00:44:22] - ...
[00:44:22] - LL |         let nref = &u.z.c;
[00:44:22] -    |                    ^^^^^^ immutable borrow occurs here
[00:44:22] - LL |         //~^ ERROR cannot borrow `u.z.c` as immutable because it is also borrowed as mutable [E0502]
[00:44:22] - LL |         println!("{} {}", mref, nref)
[00:44:22] -    |                           ---- borrow later used here
[00:44:22] - error: aborting due to previous error
[00:44:22] - 
[00:44:22] - For more information about this error, try `rustc --explain E0502`.
[00:44:22] - 
[00:44:22] - 
[00:44:22] 
[00:44:22] 
[00:44:22] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-45157/issue-45157.stderr`: No such file or directory (os error 2)
[00:44:22] 
[00:44:22] ---- [ui] ui/issue-45697-1.rs stdout ----
[00:44:22] diff of stderr:
[00:44:22] 
[00:44:22] 
[00:44:22] 6 LL |         *y.pointer += 1;
[00:44:22] 7    |         ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
[00:44:22] 8 
[00:44:22] - error[E0503]: cannot use `*y.pointer` because it was mutably borrowed (Mir)
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |         let z = copy_borrowed_ptr(&mut y);
[00:44:22] -    |                                   ------ borrow of `y` occurs here
[00:44:22] - LL |         *y.pointer += 1;
[00:44:22] -    |         ^^^^^^^^^^^^^^^ use of borrowed `y`
[00:44:22] - ...
[00:44:22] - LL |         *z.pointer += 1;
[00:44:22] -    |         --------------- borrow later used here
[00:44:22] + error: aborting due to previous error
[00:44:22] 19 
[00:44:22] - error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir)
[00:44:22] -    |
[00:44:22] -    |
[00:44:22] - LL |         let z = copy_borrowed_ptr(&mut y);
[00:44:22] -    |                                   ------ borrow of `*y.pointer` occurs here
[00:44:22] - LL |         *y.pointer += 1;
[00:44:22] -    |         ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
[00:44:22] - ...
[00:44:22] - LL |         *z.pointer += 1;
[00:44:22] -    |         --------------- borrow later used here
[00:44:22] - error: aborting due to 3 previous errors
[00:44:22] - 
[00:44:22] - Some errors occurred: E0503, E0506.
[00:44:22] - For more information about an error, try `rustc --explain E0503`.
[00:44:22] - For more information about an error, try `rustc --explain E0503`.
[00:44:22] + For more information about this error, try `rustc --explain E0506`.
[00:44:22] 35 
[00:44:22] 
[00:44:22] 
[00:44:22] The actual stderr differed from the expected stderr.
[00:44:22] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-45697-1/issue-45697-1.stderr
[00:44:22] To update references, rerun the tests and pass the `--bless` flag
[00:44:22] To only update this specific test, also pass `--test-args issue-45697-1.rs`
[00:44:22] error: 1 errors occurred comparing output.
[00:44:22] status: exit code: 101
[00:44:22] status: exit code: 101
[00:44:22] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issue-45697-1.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-45697-1/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "emit-end-regions" "-Z" "borrowck=compare" "-C" "overflow-checks=on" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-45697-1/auxiliary" "-A" "unused"
[00:44:22] ------------------------------------------
[00:44:22] 
[00:44:22] ------------------------------------------
[00:44:22] stderr:
[00:44:22] stderr:
[00:44:22] ------------------------------------------
[00:44:22] {"message":"cannot assign to `*y.pointer` because it is borrowed (Ast)","code":{"code":"E0506","explanation":"\nThis error occurs when an attempt is made to assign to a borrowed value.\n\nExample of erroneous code:\n\n```compile_fail,E0506\nstruct FancyNum {\n    num: u8,\n}\n\nfn main() {\n    let mut fancy_num = FancyNum { num: 5 };\n    let fancy_ref = &fancy_num;\n    fancy_num = FancyNum { num: 6 };\n    // error: cannot assign to `fancy_num` because it is borrowed\n\n    println!(\"Num: {}, Ref: {}\", fancy_num.num, fancy_ref.num);\n}\n```\n\nBecause `fancy_ref` still holds a reference to `fancy_num`, `fancy_num` can't\nbe assigned to a new value as it would invalidate the reference.\n\nAlternatively, we can move out of `fancy_num` into a second `fancy_num`:\n\n```\nstruct FancyNum {\n    num: u8nd":24,"is_primary":true,"text":[{"text":"        *y.pointer += 1;","highlight_start":9,"highlight_end":24}],"label":"assignment to borrowed `*y.pointer` occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Ast)\n  --> /checkout/src/test/ui/issue-45697-1.rs:30:9\n   |\nLL |         let z = copy_borrowed_ptr(&mut y);\n   |                                        - borrow of `*y.pointer` occurs here\nLL |         *y.pointer += 1;\n   |         ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here\n\n"}
[00:44:22] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:44:22] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:44:22] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:44:22] {"message":"For more information about this error, try `rustc --explain E0506`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0506`.\n"}
[00:44:22] error: internal compiler error: unexpected panic
[00:44:22] 
---
[00:44:22]     [ui] ui/issue-46472.rs
[00:44:22]     [ui] ui/issue-47184.rs
[00:44:22]     [ui] ui/issue-47646.rs
[00:44:22]     [ui] ui/issue-48132.rs
[00:44:22]     [ui] ui/issue-4817ons " "--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" "5.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:44:22] 
[00:44:22] 
[00:44:22] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:44:22] Build completed unsuccessfully in 0:01:20
[00:44:22] Build completed unsuccessfully in 0:01:20
[00:44:22] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:11c1e75e
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:052b90b4:start=1531427916097782749,finish=1531427916105146062,duration=7363313
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:098d19d8
$ head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
head: cannot open ‘./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers’ for reading: No such file or directory
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:01dd66ea
$ dmesg | grep -i kill

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)

@bors
Copy link
Contributor

bors commented Jul 13, 2018

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

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 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_ui
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:45:55] 
[00:45:55] running 1561 tests
[00:45:58] ....................................F.......F.F...........F..FF...................................i.
[00:46:05] ....................................................................................................
[00:46:07] ....................................................................................................
[00:46:09] ....................................................................................................
[00:46:11] ....................................................................................................
[00:46:11] ....................................................................................................
[00:46:15] ..................................F..........F......................................F...............
[00:46:18] ....................................................................................F.FFF......F....
[00:46:21] ......................................FFF...FFF...F......F..FF..F...................................
[00:46:24] ....................................................................................................
[00:46:28] ......................................i........FF.FFFFFFFFFFFFFFFFFFF..FF.FF.FFFFF.FFF.FFFF.F.FF...F
[00:46:31] FFFF.FF.....FFFFFFF.FFFFF.Fi........................................................................
[00:46:38] ....................................................................................................
[00:46:38] ....................................................................................................
[00:46:42] ...........................................F...............................i........................
[00:46:44] failures:
[00:46:44] 
[00:46:44] ---- [ui] ui/borrowck/borrowck-closures-two-mut.rs stdout ----
[00:46:44] diff of stderr:
[00:46:44] diff of stderr:
[00:46:44] 
[00:46:44] 73 LL | }
[00:46:44] 74    | - first borrow ends here
[00:46:44] 75 
[00:46:44] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     let c1 = to_fn_mut(|| x = 4);
[00:46:44] -    |                        -- - previous borrow occurs due to use of `x` in closure
[00:46:44] -    |                        first mutable borrow occurs here
[00:46:44] -    |                        first mutable borrow occurs here
[00:46:44] - LL |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
[00:46:44] -    |                        ^^ - borrow occurs due to use of `x` in closure
[00:46:44] -    |                        second mutable borrow occurs here
[00:46:44] -    |                        second mutable borrow occurs here
[00:46:44] - LL |     //~| ERROR cannot borrow `x` as mutable more than once
[00:46:44] - LL |     drop((c1, c2));
[00:46:44] -    |           -- borrow later used here
[00:46:44] - 
[00:46:44] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     let c1 = to_fn_mut(|| set(&mut x));
[00:46:44] -    |                        --          - previous borrow occurs due to use of `x` in closure
[00:46:44] -    |                        first mutable borrow occurs here
[00:46:44] -    |                        first mutable borrow occurs here
[00:46:44] - LL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
[00:46:44] -    |                        ^^          - borrow occurs due to use of `x` in closure
[00:46:44] -    |                        second mutable borrow occurs here
[00:46:44] -    |                        second mutable borrow occurs here
[00:46:44] - LL |     //~| ERROR cannot borrow `x` as mutable more than once
[00:46:44] - LL |     drop((c1, c2));
[00:46:44] -    |           -- borrow later used here
[00:46:44] - 
[00:46:44] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     let c1 = to_fn_mut(|| x = 5);
[00:46:44] -    |                        -- - previous borrow occurs due to use of `x` in closure
[00:46:44] -    |                        first mutable borrow occurs here
[00:46:44] -    |                        first mutable borrow occurs here
[00:46:44] - LL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
[00:46:44] -    |                        ^^          - borrow occurs due to use of `x` in closure
[00:46:44] -    |                        second mutable borrow occurs here
[00:46:44] -    |                        second mutable borrow occurs here
[00:46:44] - LL |     //~| ERROR cannot borrow `x` as mutable more than once
[00:46:44] - LL |     drop((c1, c2));
[00:46:44] -    |           -- borrow later used here
[00:46:44] - 
[00:46:44] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     let c1 = to_fn_mut(|| x = 5);
[00:46:44] -    |                        -- - previous borrow occurs due to use of `x` in closure
[00:46:44] -    |                        first mutable borrow occurs here
[00:46:44] -    |                        first mutable borrow occurs here
[00:46:44] - LL |     let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
[00:46:44] -    |                        ^^                                  - borrow occurs due to use of `x` in closure
[00:46:44] -    |                        second mutable borrow occurs here
[00:46:44] - ...
[00:46:44] - ...
[00:46:44] - LL |     drop((c1, c2));
[00:46:44] -    |           -- borrow later used here
[00:46:44] - 
[00:46:44] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     let c1 = to_fn_mut(|| set(&mut *x.f));
[00:46:44] -    |                        --           - previous borrow occurs due to use of `x` in closure
[00:46:44] -    |                        first mutable borrow occurs here
[00:46:44] -    |                        first mutable borrow occurs here
[00:46:44] - LL |     let c2 = to_fn_mut(|| set(&mut *x.f));
[00:46:44] -    |                        ^^           - borrow occurs due to use of `x` in closure
[00:46:44] -    |                        second mutable borrow occurs here
[00:46:44] - ...
[00:46:44] - ...
[00:46:44] - LL |     drop((c1, c2));
[00:46:44] -    |           -- borrow later used here
[00:46:44] - error: aborting due to 10 previous errors
[00:46:44] + error: aborting due to 5 previous errors
[00:46:44] 152 
[00:46:44] 153 For more information about this error, try `rustc --explain E0499`.
[00:46:44] 153 For more information about this error, try `rustc --explain E0499`.
[00:46:44] 154 
[00:46:44] 
[00:46:44] 
[00:46:44] The actual stderr differed from the expected stderr.
[00:46:44] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-closures-two-mut/borrowck-closures-two-mut.stderr
[00:46:44] To update references, rerun the tests and pass the `--bless` flag
[00:46:44] To only update this specific test, also pass `--test-args borrowck/borrowck-closures-two-mut.rs`
[00:46:44] error: 1 errors occurred comparing output.
[00:46:44] status: exit code: 101
[00:46:44] status: exit code: 101
[00:46:44] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-closures-two-mut/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=compare" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-closures-two-mut/auxiliary" "-A" "unused"
[00:46:44] ------------------------------------------
[00:46:44] 
[00:46:44] ------------------------------------------
[00:46:44] stderr:
[00:46:44] stderr:
[00:46:44] ------------------------------------------
[00:46:44] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":816,"byte_end":818,"line_start":23,"line_end":23,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 4);","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":850,"byte_end":852,"line_start":24,"line_end":24,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":994,"byte_end":995,"line_start":27,"line_end":27,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":853,"byte_end":854,"line_start":24,"line_end":24,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":27,"highlight_end":28}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":819,"byte_end":820,"line_start":23,"line_end":23,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 4);","highlight_start":27,"highlight_end":28}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:24:24\n   |\nLL |     let c1 = to_fn_mut(|| x = 4);\n   |                        -- - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once\n   |                        ^^ - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:46:44] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1087,"byte_end":1089,"line_start":35,"line_end":35,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| set(&mut x));","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1127,"byte_end":1129,"line_start":36,"line_end":36,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1277,"byte_end":1278,"line_start":39,"line_end":39,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1139,"byte_end":1140,"line_start":36,"line_end":36,"column_start":36,"column_end":37,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":36,"highlight_end":37}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1099,"byte_end":1100,"line_start":35,"line_end":35,"column_start":36,"column_end":37,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| set(&mut x));","highlight_start":36,"highlight_end":37}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:36:24\n   |\nLL |     let c1 = to_fn_mut(|| set(&mut x));\n   |                        --          - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once\n   |                        ^^          - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:46:44] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1331,"byte_end":1333,"line_start":43,"line_end":43,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 5);","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1365,"byte_end":1367,"line_start":44,"line_end":44,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1515,"byte_end":1516,"line_start":47,"line_end":47,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1377,"byte_end":1378,"line_start":44,"line_end":44,"column_start":36,"column_end":37,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":36,"highlight_end":37}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1334,"byte_end":1335,"line_start":43,"line_end":43,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 5);","highlight_start":27,"highlight_end":28}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:44:24\n   |\nLL |     let c1 = to_fn_mut(|| x = 5);\n   |                        -- - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once\n   |                        ^^          - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:46:44] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1569,"byte_end":1571,"line_start":51,"line_end":51,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 5);","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1603,"byte_end":1605,"line_start":52,"line_end":52,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1806,"byte_end":1807,"line_start":56,"line_end":56,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1639,"byte_end":1640,"line_start":52,"line_end":52,"column_start":60,"column_end":61,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)","highlight_start":60,"highlight_end":61}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1572,"byte_end":1573,"line_start":51,"line_end":51,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 5);","highlight_start":27,"highlight_end":28}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:52:24\n   |\nLL |     let c1 = to_fn_mut(|| x = 5);\n   |                        -- - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)\n   |                        ^^                                  - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:46:44] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1933,"byte_end":1935,"line_start":64,"line_end":64,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| set(&mut *x.f));","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1976,"byte_end":1978,"line_start":65,"line_end":65,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut *x.f));","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":2134,"byte_end":2135,"line_start":69,"line_end":69,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1989,"byte_end":1990,"line_start":65,"line_end":65,"column_start":37,"column_end":38,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut *x.f));","highlight_start":37,"highlight_end":38}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1946,"byte_end":1947,"line_start":64,"line_end":64,"column_start":37,"column_end":38,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| set(&mut *x.f));","highlight_start":37,"highlight_end":38}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:65:24\n   |\nLL |     let c1 = to_fn_mut(|| set(&mut *x.f));\n   |                        --           - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| set(&mut *x.f));\n   |                        ^^           - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:46:44] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:46:44] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:46:44] {"message":"aborting due to 5 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 5 previous errors\n\n"}
[00:46:44] {"message":"For more information about this error, try `rustc --explain E0499`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0499`.\n"}
[00:46:44] error: internal compiler error: unexpected panic
[00:46:44] 
[00:46:44] 
[00:46:44] note: the compiler unexpectedly panicked. this is a bug.
[00:46:44] 
[00:46:44] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:46:44] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:46:44] 
[00:46:44] 
[00:46:44] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=compare -C prefer-dynamic -C rpath
[00:46:44] 
[00:46:44] ------------------------------------------
[00:46:44] 
[00:46:44] thread '[ui] ui/borrowck/borrowck-closures-two-mut.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:46:44] thread '[ui] ui/borrowck/borrowck-closures-two-mut.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:46:44] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:46:44] 
[00:46:44] ---- [ui] ui/borrowck/borrowck-slice-pattern-element-loan.rs stdout ----
[00:46:44] diff of stderr:
[00:46:44] 
[00:46:44] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     if let [ref first, ref second, ..] = *s {
[00:46:44] -    |                        ---------- immutable borrow occurs here
[00:46:44] - LL |         if let [_, ref mut  second2, ref mut third, ..] = *s { //~ERROR
[00:46:44] -    |                    ^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:46:44] - LL |             nop(&[first, second, second2, third]);
[00:46:44] -    |                          ------ borrow later used here
[00:46:44] - 
[00:46:44] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     if let [.., ref fourth, ref third, _, ref first] = *s {
[00:46:44] -    |                             --------- immutable borrow occurs here
[00:46:44] - LL |         if let [.., ref mut third2, _, _] = *s { //~ERROR
[00:46:44] -    |                     ^^^^^^^^^^^^^^ mutable borrow occurs here
[00:46:44] - LL |             nop(&[first, third, third2, fourth]);
[00:46:44] -    |                          ----- borrow later used here
[00:46:44] - 
[00:46:44] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
[00:46:44] -    |                    ------------- immutable borrow occurs here
[00:46:44] - ...
[00:46:44] - LL |         if let [_, ref mut from_begin1, ..] = *s { //~ERROR
[00:46:44] -    |                    ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:46:44] - LL |             nop(&[from_begin1, from_end1, from_end3, from_end4]);
[00:46:44] -    |                                                      --------- borrow later used here
[00:46:44] - 
[00:46:44] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
[00:46:44] -    |                                   ------------- immutable borrow occurs here
[00:46:44] - ...
[00:46:44] - LL |         if let [_, _, ref mut from_begin2, ..] = *s { //~ERROR
[00:46:44] -    |                       ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:46:44] - LL |             nop(&[from_begin2, from_end1, from_end3, from_end4]);
[00:46:44] -    |                                           --------- borrow later used here
[00:46:44] - 
[00:46:44] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
[00:46:44] -    |                                   ------------- immutable borrow occurs here
[00:46:44] - ...
[00:46:44] - LL |         if let [_, _, _, ref mut from_begin3, ..] = *s { //~ERROR
[00:46:44] -    |                          ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:46:44] - LL |             nop(&[from_begin3, from_end1, from_end3, from_end4]);
[00:46:44] -    |                                           --------- borrow later used here
[00:46:44] - 
[00:46:44] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
[00:46:44] -    |                                                  --------------- immutable borrow occurs here
[00:46:44] - ...
[00:46:44] - LL |         if let [.., ref mut from_end2, _] = *s { //~ERROR
[00:46:44] -    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:46:44] - LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end2]);
[00:46:44] -    |                                             ----------- borrow later used here
[00:46:44] - 
[00:46:44] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
[00:46:44] -    |                                                  --------------- immutable borrow occurs here
[00:46:44] - ...
[00:46:44] - LL |         if let [.., ref mut from_end3, _,  _] = *s { //~ERROR
[00:46:44] -    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:46:44] - LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end3]);
[00:46:44] -    |                                             ----------- borrow later used here
[00:46:44] - 
[00:46:44] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
[00:46:44] -    |                              --------------- immutable borrow occurs here
[00:46:44] - ...
[00:46:44] - LL |         if let [.., ref mut from_end4, _, _, _] = *s { //~ERROR
[00:46:44] -    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:46:44] - LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end4]);
[00:46:44] -    |                                ----------- borrow later used here
[00:46:44] - 
[00:46:44] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     if let [ref first, ref second, ..] = *s {
[00:46:44] -    |                        ---------- immutable borrow occurs here
[00:46:44] - LL |         if let [_, ref mut tail..] = *s { //~ERROR
[00:46:44] -    |                    ^^^^^^^^^^^^ mutable borrow occurs here
[00:46:44] - LL |             nop(&[first, second]);
[00:46:44] -    |                          ------ borrow later used here
[00:46:44] - 
[00:46:44] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     if let [.., ref second, ref first] = *s {
[00:46:44] -    |                 ---------- immutable borrow occurs here
[00:46:44] - LL |         if let [ref mut tail.., _] = *s { //~ERROR
[00:46:44] -    |                 ^^^^^^^^^^^^ mutable borrow occurs here
[00:46:44] - LL |             nop(&[first, second]);
[00:46:44] -    |                          ------ borrow later used here
[00:46:44] - 
[00:46:44] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     if let [_, _, _, ref s1..] = *s {
[00:46:44] -    |                      ------ immutable borrow occurs here
[00:46:44] - LL |         if let [ref mut s2.., _, _, _] = *s { //~ERROR
[00:46:44] -    |                 ^^^^^^^^^^ mutable borrow occurs here
[00:46:44] - LL |             nop_subslice(s1);
[00:46:44] -    |                          -- borrow later used here
[00:46:44] - error: aborting due to 11 previous errors
[00:46:44] - 
[00:46:44] - For more information about this error, try `rustc --explain E0502`.
[00:46:44] - 
[00:46:44] - 
[00:46:44] 
[00:46:44] 
[00:46:44] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-slice-pattern-element-loan/borrowck-slice-pattern-element-loan.stderr`: No such file or directory (os error 2)
[00:46:44] 
[00:46:44] ---- [ui] ui/borrowck/issue-41962.rs stdout ----
[00:46:44] diff of stderr:
[00:46:44] 
[00:46:44] 
[00:46:44] 16    |
[00:46:44] 17    = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
[00:46:44] 18 
[00:46:44] - error[E0382]: use of moved value: `maybe` (Mir)
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |           if let Some(thing) = maybe {
[00:46:44] -    |           ^           ----- value moved here
[00:46:44] -    |  _________|
[00:46:44] -    | |
[00:46:44] - LL | |         }
[00:46:44] -    | |_________^ value used here after move
[00:46:44] -    |
[00:46:44] -    = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
[00:46:44] - 
[00:46:44] - error[E0382]: borrow of moved value: `maybe` (Mir)
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |           if let Some(thing) = maybe {
[00:46:44] -    |           ^           ----- value moved here
[00:46:44] -    |  _________|
[00:46:44] -    | |
[00:46:44] - LL | |         }
[00:46:44] -    | |_________^ value borrowed here after move
[00:46:44] -    |
[00:46:44] -    = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
[00:46:44] - 
[00:46:44] - error[E0382]: use of moved value: `maybe` (Mir)
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |         if let Some(thing) = maybe {
[00:46:44] -    |                ^^^^^-----^
[00:46:44] -    |                |    value moved here
[00:46:44] -    |                |    value moved here
[00:46:44] -    |                value used here after move
[00:46:44] -    |
[00:46:44] -    = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
[00:46:44] - 
[00:46:44] - error[E0382]: use of moved value (Mir)
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |         if let Some(thing) = maybe {
[00:46:44] -    |                     ^^^^^ value moved here in previous iteration of loop
[00:46:44] -    |
[00:46:44] -    = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
[00:46:44] - error: aborting due to 6 previous errors
[00:46:44] + error: aborting due to 2 previous errors
[00:46:44] 63 
[00:46:44] 64 For more information about this error, try `rustc --explain E0382`.
[00:46:44] 64 For more information about this error, try `rustc --explain E0382`.
[00:46:44] 65 
[00:46:44] 
[00:46:44] 
[00:46:44] The actual stderr differed from the expected stderr.
[00:46:44] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/issue-41962/issue-41962.stderr
[00:46:44] To update references, rerun the tests and pass the `--bless` flag
[00:46:44] To only update this specific test, also pass `--test-args borrowck/issue-41962.rs`
[00:46:44] error: 1 errors occurred comparing output.
[00:46:44] status: exit code: 101
[00:46:44] status: exit code: 101
[00:46:44] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/issue-41962.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/issue-41962/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=compare" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/issue-41962/auxiliary" "-A" "unused"
[00:46:44] ------------------------------------------
[00:46:44] 
[00:46:44] ------------------------------------------
[00:46:44] stderr:
[00:46:44] stderr:
[00:46:44] ------------------------------------------
[00:46:44] {"message":"use of partially moved value: `maybe` (Ast)","code":{"code":"E0382","explanation":"\nThis error occurs when an attempt is made to use a variable after its contents\nhave been moved elsewhere. For example:\n\n```compile_fail,E0382\nstruct MyStruct { s: u32 }\n\nfn main() {\n    let mut x = MyStruct{ s: 5u32 };\n    let y = x;\n    x.s = 6;\n    println!(\"{}\", x.s);\n}\n```\n\nSince `MyStruct` is a type that is not marked `Copy`, the data gets moved out\nof `x` when we set `y`. This is fundamental to Rust's ownership system: outside\nof workarounds like `Rc`, a value cannot be owned by more than one variable.\n\nSometimes we don't need to move the value. Using a reference, we can let another\nfunction borrow the value without changing its ownership. In the example below,\nwe don't actually have to move our string to `calculate_length`, we can give it\na reference to it with `&` instead.\n\n```\nfn main() {\n    let s1 = String::from(\"hello\");\n\n    let len = calculate_length(&s1);\n\n    println!(\"The length of '{}' is {}.\", s1, len);\n}\n\nfn calculate_length(s: &String) -> usize {\n    s.len()\n}\n```\n\nA mutable reference can be created with `&mut`.\n\nSometimes we don't want a reference, but a duplicate. All types marked `Clone`\ncan be duplicated by calling `.clone()`. Subsequent changes to a clone do not\naffect the original variable.\n\nMost types in the standard library are marked `Clone`. The example below\ndemonstrates using `clone()` on a string. `s1` is first set to \"many\", and then\ncopied to `s2`. Then the first character of `s1` is removed, without affecting\n`s2`. \"any many\" is printed to the console.\n\n```\nfn main() {\n    let mut s1 = String::from(\"many\");\n    let s2 = s1.clone();\n    s1.remove(0);\n    println!(\"{} {}\", s1, s2);\n}\n```\n\nIf we control the definition of a type, we can implement `Clone` on it ourselves\nwith `#[derive(Clone)]`.\n\nSome types have no ownership semantics at all and are trivial to duplicate. An\nexample is `i32` and the other number types. We don't have to call `.clone()` to\nclone them, because they are marked `Copy` in addition to `Clone`.  Implicit\ncloning is more convenient in this case. We can mark our own types `Copy` if\nall their members also are marked `Copy`.\n\nIn the example below, we implement a `Point` type. Because it only stores two\nintegers, we opt-out of ownership semantics with `Copy`. Then we can\n`let p2 = p1` without `p1` being moved.\n\n```\n#[derive(Copy, Clone)]\nstruct Point { x: i32, y: i32 }\n\nfn main() {\n    let mut p1 = Point{ x: -1, y: 2 };\n    let p2 = p1;\n    p1.x = 1;\n    println!(\"p1: {}, {}\", p1.x, p1.y);\n    println!(\"p2: {}, {}\", p2.x, p2.y);\n}\n```\n\nAlternatively, if we don't control the struct's definition, or mutable shared\nownership is truly required, we can use `Rc` and `RefCell`:\n\n```\nuse std::cell::RefCell;\nuse std::rc::Rc;\n\nstruct MyStruct { s: u32 }\n\nfn main() {\n    let mut x = Rc::new(RefCell::new(MyStruct{ s: 5u32 }));\n    let y = x.clone();\n    x.borrow_mut().s = 6;\n    println!(\"{}\", x.borrow().s);\n}\n```\n\nWith this approach, x and y share ownership of the data via the `Rc` (reference\ncount type). `RefCell` essentially performs runtime borrow checking: ensuring\nthat at most one writer or multiple readers can access the data at any one time.\n\nIf you wish to learn more about ownership in Rust, start with the chapter in the\nBook:\n\nhttps://doc.rust-lang.org/book/first-edition/ownership.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/issue-41962.rs","byte_start":602,"byte_end":607,"line_start":17,"line_end":17,"column_start":30,"column_end":35,"is_primary":true,"text":[{"text":"        if let Some(thing) = maybe {","highlight_start":30,"highlight_end":35}],"label":"value used here after move","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/issue-41962.rs","byte_start":593,"byte_end":598,"line_start":17,"line_end":17,"column_start":21,"column_end":26,"is_primary":false,"text":[{"text":"        if let Some(thing) = maybe {","highlight_start":21,"highlight_end":26}],"label":"value moved here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0382]: use of partially moved value: `maybe` (Ast)\n  --> /checkout/src/test/ui/borrowck/issue-41962.rs:17:30\n   |\nLL |         if let Some(thing) = maybe {\n   |                     -----    ^^^^^ value used here after move\n   |                     |\n   |                     value moved here\n   |\n   = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait\n\n"}
[00:46:44] {"message":"use of moved value: `(maybe as std::prelude::v1::Some).0` (Ast)","code":{"code":"E0382","explanation":"\nThis error occurs when an attempt is made to use a variable after its contents\nhave been moved elsewhere. For example:\n\n```compile_fail,E0382\nstruct MyStruct { s: u32 }\n\nfn main() {\n    let mut x = MyStruct{ s: 5u32 };\n    let y = x;\n    x.s = 6;\n    println!(\"{}\", x.s);\n}\n```\n\nSince `MyStruct` is a type that is not marked `Copy`, the data gets moved out\nof `x` when we set `y`. This is fundamental to Rust's ownership system: outside\nof workarounds like `Rc`, a value cannot be owned by more than one variable.\n\nSometimes we don't need to move the value. Using a reference, we can let another\nfunction borrow the value without changing its ownership. In the example below,\nwe don't actually have to move our string to `calculate_length`, we can give it\na reference to it with `&` instead.\n\n```\nfn main() {\n    let s1 = String::from(\"hello\");\n\n    let len = calculate_length(&s1);\n\n    println!(\"The length of '{}' is {}.\", s1, len);\n}\n\nfn calculate_length(s: &String) -> usize {\n    s.len()\n}\n```\n\nA mutable reference can be created with `&mut`.\n\nSometimes we don't want a reference, but a duplicate. All types marked `Clone`\ncan be duplicated by calling `.clone()`. Subsequent changes to a clone do not\naffect the original variable.\n\nMost types in the standard library are marked `Clone`. The example below\ndemonstrates using `clone()` on a string. `s1` is first set to \"many\", and then\ncopied to `s2`. Then the first character of `s1` is removed, without affecting\n`s2`. \"any many\" is printed to the console.\n\n```\nfn main() {\n    let mut s1 = String::from(\"many\");\n    let s2 = s1.clone();\n    s1.remove(0);\n    println!(\"{} {}\", s1, s2);\n}\n```\n\nIf we control the definition of a type, we can implement `Clone` on it ourselves\nwith `#[derive(Clone)]`.\n\nSome types have no ownership semantics at all and are trivial to duplicate. An\nexample is `i32` and the other number types. We don't have to call `.clone()` to\nclone them, because they are marked `Copy` in addition to `Clone`.  Implicit\ncloning is more convenient in this case. We can mark our own types `Copy` if\nall their members also are marked `Copy`.\n\nIn the example below, we implement a `Point` type. Because it only stores two\nintegers, we opt-out of ownership semantics with `Copy`. Then we can\n`let p2 = p1` without `p1` being moved.\n\n```\n#[derive(Copy, Clone)]\nstruct Point { x: i32, y: i32 }\n\nfn main() {\n    let mut p1 = Point{ x: -1, y: 2 };\n    let p2 = p1;\n    p1.x = 1;\n    println!(\"p1: {}, {}\", p1.x, p1.y);\n    println!(\"p2: {}, {}\", p2.x, p2.y);\n}\n```\n\nAlternatively, if we don't control the struct's definition, or mutable shared\nownership is truly required, we can use `Rc` and `RefCell`:\n\n```\nuse std::cell::RefCell;\nuse std::rc::Rc;\n\nstruct MyStruct { s: u32 }\n\nfn main() {\n    let mut x = Rc::new(RefCell::new(MyStruct{ s: 5u32 }));\n    let y = x.clone();\n    x.borrow_mut().s = 6;\n    println!(\"{}\", x.borrow().s);\n}\n```\n\nWith this approach, x and y share ownership of the data via the `Rc` (reference\ncount type). `RefCell` essentially performs runtime borrow checking: ensuring\nthat at most one writer or multiple readers can access the data at any one time.\n\nIf you wish to learn more about ownership in Rust, start with the chapter in the\nBook:\n\nhttps://doc.rust-lang.org/book/first-edition/ownership.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/issue-41962.rs","byte_start":593,"byte_end":598,"line_start":17,"line_end":17,"column_start":21,"column_end":26,"is_primary":true,"text":[{"text":"        if let Some(thing) = maybe {","highlight_start":21,"highlight_end":26}],"label":"value moved here in previous iteration of loop","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0382]: use of moved value: `(maybe as std::prelude::v1::Some).0` (Ast)\n  --> /checkout/src/test/ui/borrowck/issue-41962.rs:17:21\n   |\nLL |         if let Some(thing) = maybe {\n   |                     ^^^^^ value moved here in previous iteration of loop\n   |\n   = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait\n\n"}
[00:46:44] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:46:44] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:46:44] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:46:44] {"message":"For more information about this error, try `rustc --explain E0382`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0382`.\n"}
[00:46:44] error: internal compiler error: unexpected panic
[00:46:44] 
[00:46:44] 
[00:46:44] note: the compiler unexpectedly panicked. this is a bug.
[00:46:44] 
[00:46:44] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:46:44] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:46:44] 
[00:46:44] 
[00:46:44] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=compare -C prefer-dynamic -C rpath
[00:46:44] 
[00:46:44] ------------------------------------------
[00:46:44] 
[00:46:44] thread '[ui] ui/borrowck/issue-41962.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:46:44] thread '[ui] ui/borrowck/issue-41962.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:46:44] 
[00:46:44] ---- [ui] ui/borrowck/two-phase-method-receivers.rs stdout ----
[00:46:44] 
[00:46:44] error: test compilation failed although it shouldn't!
[00:46:44] status: exit code: 101
[00:46:44] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/two-phase-method-receivers.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-method-receivers/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=mir" "-Z" "two-phase-borrows" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-method-receivers/auxiliary" "-A" "unused"
[00:46:44] ------------------------------------------
[00:46:44] 
[00:46:44] ------------------------------------------
[00:46:44] stderr:
[00:46:44] stderr:
[00:46:44] ------------------------------------------
[00:46:44] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:46:44] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:46:44] 
[00:46:44] error: internal compiler error: unexpected panic
[00:46:44] 
[00:46:44] note: the compiler unexpectedly panicked. this is a bug.
[00:46:44] 
[00:46:44] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:46:44] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:46:44] 
[00:46:44] 
[00:46:44] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=mir -Z two-phase-borrows -C prefer-dynamic -C rpath
[00:46:44] 
[00:46:44] ------------------------------------------
[00:46:44] 
[00:46:44] thread '[ui] ui/borrowck/two-phase-method-receivers.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:46:44] thread '[ui] ui/borrowck/two-phase-method-receivers.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:46:44] 
[00:46:44] ---- [ui] ui/borrowck/two-phase-multi-mut.rs stdout ----
[00:46:44] diff of stderr:
[00:46:44] 
[00:46:44] - error[E0499]: cannot borrow `foo` as mutable more than once at a time
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     foo.method(&mut foo);
[00:46:44] -    |     -----------^^^^^^^^-
[00:46:44] -    |     |          second mutable borrow occurs here
[00:46:44] -    |     first mutable borrow occurs here
[00:46:44] -    |     first mutable borrow occurs here
[00:46:44] -    |     borrow later used here
[00:46:44] - 
[00:46:44] - error[E0499]: cannot borrow `foo` as mutable more than once at a time
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |     foo.method(&mut foo);
[00:46:44] -    |     ^^^^^^^^^^^--------^
[00:46:44] -    |     |          first mutable borrow occurs here
[00:46:44] -    |     second mutable borrow occurs here
[00:46:44] -    |     second mutable borrow occurs here
[00:46:44] -    |     borrow later used here
[00:46:44] - error: aborting due to 2 previous errors
[00:46:44] - 
[00:46:44] - For more information about this error, try `rustc --explain E0499`.
[00:46:44] - 
[00:46:44] - 
[00:46:44] 
[00:46:44] 
[00:46:44] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-multi-mut/two-phase-multi-mut.stderr`: No such file or directory (os error 2)
[00:46:44] 
[00:46:44] ---- [ui] ui/borrowck/two-phase-multiple-activations.rs stdout ----
[00:46:44] 
[00:46:44] 
[00:46:44] error: test compilation failed although it shouldn't!
[00:46:44] status: exit code: 101
[00:46:44] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/two-phase-multiple-activations.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-multiple-activations/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=mir" "-Z" "two-phase-borrows" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-multiple-activations/auxiliary" "-A" "unused"
[00:46:44] ------------------------------------------
[00:46:44] 
[00:46:44] ------------------------------------------
[00:46:44] stderr:
[00:46:44] stderr:
[00:46:44] ------------------------------------------
[00:46:44] thread 'main' panicked at 'assertion failed: mid <= len', libcore/slice/mod.rs:878:13
[00:46:44] 
[00:46:44] error: internal compiler error: unexpected panic
[00:46:44] 
[00:46:44] 
[00:46:44] note: the compiler unexpectedly panicked. this is a bug.
[00:46:44] 
[00:46:44] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:46:44] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:46:44] 
[00:46:44] 
[00:46:44] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=mir -Z two-phase-borrows -C prefer-dynamic -C rpath
[00:46:44] 
[00:46:44] ------------------------------------------
[00:46:44] 
[00:46:44] thread '[ui] ui/borrowck/two-phase-multiple-activations.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:46:44] thread '[ui] ui/borrowck/two-phase-multiple-activations.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[00:46:44] 
[00:46:44] ---- [ui] ui/generator/generator-with-nll.rs stdout ----
[00:46:44] diff of stderr:
[00:46:44] 
[00:46:44] 16 LL |         yield ();
[00:46:44] 17    |         -------- possible yield occurs here
[00:46:44] 18 
[00:46:44] - error[E0626]: borrow may still be in use when generator yields (Mir)
[00:46:44] -    |
[00:46:44] -    |
[00:46:44] - LL |         let b = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)
[00:46:44] -    |                 ^^^^^^^^^
[00:46:44] - LL |         //~^ borrow may still be in use when generator yields (Mir)
[00:46:44] - LL |         yield ();
[00:46:44] -    |         -------- possible yield occurs here
[00:46:44] - error: aborting due to 3 previous errors
[00:46:44] + error: aborting due to 2 previous errors
[00:46:44] 29 
[00:46:44] 30 For more information about this error, try `rustc --explain E0626`.
[00:46:44] 30 For more information about this error, try `rustc --explain E0626`.
[00:46:44] 31 
[00:46:44] 
[00:46:44] 
[00:46:44] The actual stderr differed from the expected stderr.
[00:46:44] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/generator-with-nll/generator-with-nll.stderr
[00:46:44] To update references, rerun the tests and pass the `--bless` flag
[00:46:44] To only update this specific test, also pass `--test-args generator/generator-with-nll.rs`
[00:46:44] error: 1 errors occurred comparing output.
[00:46:44] status: exit code: 101
[00:46:44] status: exit code: 101
[00:46:44] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/generator/generator-with-nll.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/generator-with-nll/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=compare" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/generator-with-nll/auxiliary" "-A" "unused"
[00:46:44] ------------------------------------------
[00:46:44] 
[00:46:44] ------------------------------------------
[00:46:44] stderr:
[00:46:44] stderr:
[00:46:44] ------------------------------------------
[00:46:44] {"message":"borrow may still be in use when generator yields (Ast)","code":{"code":"E0626","explanation":"\nThis error occurs because a borrow in a generator persists across a\nyield point.\n\n```compile_fail,E0626\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n    let a = &String::new(); // <-- This borrow...\n    yield (); // ...is still in scope here, when the yield occurs.\n    println!(\"{}\", a);\n};\nunsafe { b.resume() };\n```\n\nAt present, it is not permitted to have a yield that occurs while a\nborrow is still in scope. To resolve this error, the borrow must\neither be \"contained\" to a smaller scope that does not overlap the\nyield or else eliminated in another way. So, for example, we might\nresolve the previous example by removing the borrow and just storing\nthe integer by value:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n    let a = 3;\n    yield ();\n    println!(\"{}\", a);\n};\nunsafe { b.resume() };\n```\n\nThis is a very simple case, of course. In more complex cases, we may\nwish to have more than one reference to the value that was borrowed --\nin those cases, something like the `Rc` or `Arc` types may be useful.\n\nThis error also frequently arises with iteration:\n\n```compile_fail,E0626\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  for &x in &v { // <-- borrow of `v` is still in scope...\n    yield x; // ...when this yield occurs.\n  }\n};\nunsafe { b.resume() };\n```\n\nSuch cases can sometimes be resolved by iterating \"by value\" (or using\n`into_iter()`) to avoid borrowing:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  for x in v { // <-- Take ownership of the values instead!\n    yield x; // <-- Now yield is OK.\n  }\n};\nunsafe { b.resume() };\n```\n\nIf taking ownership is not an option, using indices can work too:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  let len = v.len(); // (*)\n  for i in 0..len {\n    let x = v[i]; // (*)\n    yield x; // <-- Now yield is OK.\n  }\n};\nunsafe { b.resume() };\n\n// (*) -- Unfortunately, these temporaries are currently required.\n// See <https://github.com/rust-lang/rust/issues/43122>.\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/generator/generator-with-nll.rs","byte_start":914,"byte_end":922,"line_start":22,"line_end":22,"column_start":9,"column_end":17,"is_primary":false,"text":[{"text":"        yield ();","highlight_start":9,"highlight_end":17}],"label":"possible yield occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/generator/generator-with-nll.rs","byte_start":675,"byte_end":679,"line_start":19,"line_end":19,"column_start":23,"column_end":27,"is_primary":true,"text":[{"text":"        let _a = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)","highlight_start":23,"highlight_end":27}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0626]: borrow may still be in use when generator yields (Ast)\n  --> /checkout/src/test/ui/generator/generator-with-nll.rs:19:23\n   |\nLL |         let _a = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)\n   |                       ^^^^\n...\nLL |         yield ();\n   |         -------- possible yield occurs here\n\n"}
[00:46:44] {"message":"borrow may still be in use when generator yields (Ast)","code":{"code":"E0626","explanation":"\nThis error occurs because a borrow in a generator persists across a\nyield point.\n\n```compile_fail,E0626\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n    let a = &String::new(); // <-- This borrow...\n    yield (); // ...is still in scope here, when the yield occurs.\n    println!(\"{}\", a);\n};\nunsafe { b.resume() };\n```\n\nAt present, it is not permitted to have a yield that occurs while a\nborrow is still in scope. To resolve this error, the borrow must\neither be \"contained\" to a smaller scope that does not overlap the\nyield or else eliminated in another way. So, for example, we might\nresolve the previous example by removing the borrow and just storing\nthe integer by value:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n    let a = 3;\n    yield ();\n    println!(\"{}\", a);\n};\nunsafe { b.resume() };\n```\n\nThis is a very simple case, of course. In more complex cases, we may\nwish to have more than one reference to the value that was borrowed --\nin those cases, something like the `Rc` or `Arc` types may be useful.\n\nThis error also frequently arises with iteration:\n\n```compile_fail,E0626\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  for &x in &v { // <-- borrow of `v` is still in scope...\n    yield x; // ...when this yield occurs.\n  }\n};\nunsafe { b.resume() };\n```\n\nSuch cases can sometimes be resolved by iterating \"by value\" (or using\n`into_iter()`) to avoid borrowing:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  for x in v { // <-- Take ownership of the values instead!\n    yield x; // <-- Now yield is OK.\n  }\n};\nunsafe { b.resume() };\n```\n\nIf taking ownership is not an option, using indices can work too:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  let len = v.len(); // (*)\n  for i in 0..len {\n    let x = v[i]; // (*)\n    yield x; // <-- Now yield is OK.\n  }\n};\nunsafe { b.resume() };\n\n// (*) -- Unfortunately, these temporaries are currently required.\n// See <https://github.com/rust-lang/rust/issues/43122>.\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/generator/generator-with-nll.rs","byte_start":914,"byte_end":922,"line_start":22,"line_end":22,"column_start":9,"column_end":17,"is_primary":false,"text":[{"text":"        yield ();","highlight_start":9,"highlight_end":17}],"label":"possible yield occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/generator/generator-with-nll.rs","byte_start":767,"byte_end":771,"line_start":20,"line_end":20,"column_start":22,"column_end":26,"is_primary":true,"text":[{"text":"        let b = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)","highlight_start":22,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0626]: borrow may still be in use when generator yields (Ast)\n  --> /checkout/src/test/ui/generator/generator-with-nll.rs:20:22\n   |\nLL |         let b = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)\n   |                      ^^^^\nLL |         //~^ borrow may still be in use when generator yields (Mir)\nLL |         yield ();\n   |         -------- possible yield occurs here\n\n"}
[00:46:44] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:46:44] note: Run with `RUST_BACKTRACE=1` for a backtrace.
---
[00:46:44] test result: FAILED. 1470 passed; 86 failed; 5 ignored; 0 measured; 0 filtered out
[00:46:44] 
[00:46:44] 
[00:46:44] 
[00:46:44] 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/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/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" "5.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:46:44] 
[00:46:44] 
[00:46:44] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:46:44] Build completed unsuccessfully in 0:01:26
[00:46:44] Build completed unsuccessfully in 0:01:26
[00:46:44] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0536706a
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:00bbad1e:start=1531504794718181845,finish=1531504794724908651,duration=6726806
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:03aa7712
$ head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
head: cannot open ‘./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers’ for reading: No such file or directory
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:15a86dd4
$ dmesg | grep -i kill

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)

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

First round of review, on the changes to Sparse etc

@@ -293,15 +293,23 @@ impl<R: Idx, C: Idx> SparseBitMatrix<R, C> {
///
/// Returns true if this changed the matrix, and false otherwise.
pub fn add(&mut self, row: R, column: C) -> bool {
self.vector[row].insert(column)
if let None = self.vector.get(row) {
self.vector.push(SparseBitSet::new());
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem right -- imagine that the vector starts out as empty, but we invoke add(2, 0) -- then we have to push two things. I think the method you want is either resize or -- perhaps mildly more efficient -- resize_with. If index where a plain vector, you would do something like this:

self.vector.resize_with(row + 1, || SparseBitSet::new())

However, that won't work because vector is an IndexVec and it doesn't offer resize_with. You could use self.vector.raw.resize_with, but better would be to add a method to IndexVec:

impl<I, T> IndexVec<I, T> {
    fn resize_to_elem(&mut self, elem: I, fill_value: impl FnMut() -> T) {
        let min_new_len = elem.as_usize() + 1;
        self.raw.resize_with(min_new_len, fill_value);
    }
}

and then invoke self.vector.resize_to_elem(row, || SparseBitSet::new());.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this.

self.vector.push(SparseBitSet::new());
}

if let Some(row) = self.vector.get_mut(row) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Now this can be self.vector[row].insert(column) as before

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this.

@@ -325,6 +333,14 @@ impl<R: Idx, C: Idx> SparseBitMatrix<R, C> {
changed
}

/// Merge a row, `from`, into the `into` row.
pub fn merge_into(&mut self, into: R, from: &SparseBitSet<C>) -> bool {
match self.vector.get_mut(into) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should again use the resize_to_elem helper;

self.vector.resize_to_elem(into, || SparseBitSet::new());
self.vector[row].merge_into(from);

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this.

@@ -445,6 +471,15 @@ impl<I: Idx> SparseBitSet<I> {
}
}

/// Merge two sparse bit sets.
pub fn merge_into(&mut self, from: &SparseBitSet<I>) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think should be called insert_from.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this.

let p2 = location_table.mid_index(*location);
iter::once((r, p1)).chain(iter::once((r, p2)))
}));
for (r, _) in regioncx.liveness_constraints() {
Copy link
Contributor

Choose a reason for hiding this comment

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

We could also generate these during typeck -- we generate other facts then iirc

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this.

@@ -94,20 +94,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
}
return;
}

for constraint in self.constraint_graph.outgoing_edges(current_region) {
assert_eq!(self.constraints[constraint].sup, current_region);
Copy link
Contributor

Choose a reason for hiding this comment

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

wait — why this diff?

Copy link
Contributor

Choose a reason for hiding this comment

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

looks accidental

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this.

@@ -38,7 +38,7 @@ mod dump_mir;
mod error_reporting;
mod graphviz;
mod values;
use self::values::{RegionValueElements, RegionValues};
crate use self::values::{RegionElement, RegionElementIndex, RegionValueElements, RegionValues};
Copy link
Contributor

Choose a reason for hiding this comment

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

In this code, I've been trying to stick to a style that avoids crate use and I'd prefer to keep doing so. In particular, I want to have things have just one home and that is where you import them from (unlike the rest of the compiler where I cannot tell, based on the filename where I find some code, what path I am supposed to use).

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this.


for (region, location_set) in liveness_constraints.iter_enumerated() {
let scc = constraint_sccs.scc(region);
scc_values.merge_into(scc, location_set);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

self.liveness_constraints.iter_enumerated()
}

/// Number of liveness constaints in region inference context.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: s/containts/constraints

Copy link
Contributor

Choose a reason for hiding this comment

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

I would usually call this num_liveness_constraints, but then again I've been trying to use fewer and fewer contractions...

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this.

}

/// Returns all the elements contained in a given region's value.
crate fn elements_contained_in<'a>(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think should be called something like region_live_at or region_liveness_elements

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this.

cx.constraints.liveness_set.push((live_region, location));
if let Some(borrowck_context) = cx.borrowck_context {
let region_vid = borrowck_context.universal_regions.to_region_vid(live_region);
borrowck_context.constraints.liveness_constraints.add_element(region_vid, location);
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we can also do

if let Some(all_facts) = &mut borrowck_context.all_facts {
    all_facts.region_live_at.push(...);
}

and then -- I suspect -- we can remove that big awkward loop above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this.

@@ -603,20 +617,19 @@ struct TypeChecker<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
region_bound_pairs: &'a [(ty::Region<'tcx>, GenericKind<'tcx>)],
implicit_region_bound: Option<ty::Region<'tcx>>,
reported_errors: FxHashSet<(Ty<'tcx>, Span)>,
constraints: MirTypeckRegionConstraints<'tcx>,
borrowck_context: Option<BorrowCheckContext<'a, 'tcx>>,
borrowck_context: &'a mut Option<BorrowCheckContext<'a, 'tcx>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems odd for this to be &mut Option<> and not Option<&mut>, but it doesn't really matter. If you did the latter, you would have to do:

if let Some(borrowck_context) = &mut self.borrowck_context

instead of this

if let Some(borrowck_context) = self.borrowck_context

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this.

late_bound_region);
borrowck_context.constraints
.liveness_constraints
.add_element(region_vid, term_location);
Copy link
Contributor

Choose a reason for hiding this comment

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

We wouldn't need to modify all-facts here necessarily -- iirc, polonius only cares about liveness in variables -- i.e., regions that exist across many points in the CFG.

@davidtwco
Copy link
Member Author

Pushed a commit that addresses the comments above. This still ICEs in the SCC code and I've yet to find time to dig into why that is.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 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_ui
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:42:10] 
[00:42:10] running 1567 tests
[00:42:13] ....................................F.......F..............F.FF...................................i.
[00:42:20] ....................................................................................................
[00:42:22] ....................................................................................................
[00:42:24] ....................................................................................................
[00:42:26] ....................................................................................................
[00:42:26] ....................................................................................................
[00:42:29] .................................F...........F........................................F.............
[00:42:32] .....................................................................................F.FF.F.........
[00:42:36] ......................................F.FF...FFF..F.F.....F....FF..F................................
[00:42:39] ....................................................................................................
[00:42:42] ........................................i........FF.FFF.FFFFFFFFFFFFFFFFFFFFFFFFFFFF.FFFFFFFFFF...F.
[00:42:45] F.FFFFF.FF.....FFFFFFFFFFFFF.Fi.....................................................................
[00:42:52] ....................................................................................................
[00:42:52] ....................................................................................................
[00:42:56] .................................................F...............F..............i...................
[00:42:59] failures:
[00:42:59] 
[00:42:59] ---- [ui] ui/borrowck/borrowck-closures-two-mut.rs stdout ----
[00:42:59] diff of stderr:
[00:42:59] diff of stderr:
[00:42:59] 
[00:42:59] 73 LL | }
[00:42:59] 74    | - first borrow ends here
[00:42:59] 75 
[00:42:59] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     let c1 = to_fn_mut(|| x = 4);
[00:42:59] -    |                        -- - previous borrow occurs due to use of `x` in closure
[00:42:59] -    |                        first mutable borrow occurs here
[00:42:59] -    |                        first mutable borrow occurs here
[00:42:59] - LL |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
[00:42:59] -    |                        ^^ - borrow occurs due to use of `x` in closure
[00:42:59] -    |                        second mutable borrow occurs here
[00:42:59] -    |                        second mutable borrow occurs here
[00:42:59] - LL |     //~| ERROR cannot borrow `x` as mutable more than once
[00:42:59] - LL |     drop((c1, c2));
[00:42:59] -    |           -- borrow later used here
[00:42:59] - 
[00:42:59] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     let c1 = to_fn_mut(|| set(&mut x));
[00:42:59] -    |                        --          - previous borrow occurs due to use of `x` in closure
[00:42:59] -    |                        first mutable borrow occurs here
[00:42:59] -    |                        first mutable borrow occurs here
[00:42:59] - LL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
[00:42:59] -    |                        ^^          - borrow occurs due to use of `x` in closure
[00:42:59] -    |                        second mutable borrow occurs here
[00:42:59] -    |                        second mutable borrow occurs here
[00:42:59] - LL |     //~| ERROR cannot borrow `x` as mutable more than once
[00:42:59] - LL |     drop((c1, c2));
[00:42:59] -    |           -- borrow later used here
[00:42:59] - 
[00:42:59] - error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     let c1 = to_fn_mut(|| x = 5);
[00:42:59] -    |                        -- - previous borrow occurs due to use of `x` in closure
[00:42:59] -    |     o_fn_mut(|| x = 4);","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":850,"byte_end":852,"line_start":24,"line_end":24,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":994,"byte_end":995,"line_start":27,"line_end":27,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":853,"byte_end":854,"line_start":24,"line_end":24,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":27,"highlight_end":28}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":819,"byte_end":820,"line_start":23,"line_end":23,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 4);","highlight_start":27,"highlight_end":28}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:24:24\n   |\nLL |     let c1 = to_fn_mut(|| x = 4);\n   |                        -- - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once\n   |                        ^^ - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:42:59] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1087,"byte_end":1089,"line_start":35,"line_end":35,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| set(&mut x));","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1127,"byte_end":1129,"line_start":36,"line_end":36,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1277,"byte_end":1278,"line_start":39,"line_end":39,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1139,"byte_end":1140,"line_start":36,"line_end":36,"column_start":36,"column_end":37,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":36,"highlight_end":37}{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1377,"byte_end":1378,"line_start":44,"line_end":44,"column_start":36,"column_end":37,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once","highlight_start":36,"highlight_end":37}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1334,"byte_end":1335,"line_start":43,"line_end":43,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 5);","highlight_start":27,"highlight_end":28}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:44:24\n   |\nLL |     let c1 = to_fn_mut(|| x = 5);\n   |                        -- - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once\n   |                        ^^          - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:42:59] {"messaborrowck-closures-two-mut.rs","byte_start":1806,"byte_end":1807,"line_start":56,"line_end":56,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1639,"byte_end":1640,"line_start":52,"line_end":52,"column_start":60,"column_end":61,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)","highlight_start":60,"highlight_end":61}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1572,"byte_end":1573,"line_start":51,"line_end":51,"column_start":27,"column_end":28,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| x = 5);","highlight_start":27,"highlight_end":28}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:52:24\n   |\nLL |     let c1 = to_fn_mut(|| x = 5);\n   |                        -- - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)\n   |                        ^^                                  - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:42:59] {"message":"cannot borrow `x` as mutable more than once at a time (Ast)","code":{"code":"E0499","explanation":"\nA variable was borrowed as mutable more than once. Erroneous code example:\n\n```compile_fail,E0499\nlet mut i = 0;\nlet mut x = &mut i;\nlet mut a = &mut i;\n// error: cannot borrow `i` as mutable more than once at a time\n```\n\nPlease note that in rust, you can either have many immutable references, or one\nmutable reference. Take a look at\nhttps://doc.rust-lang.org/stable/book/references-and-borrowing.html for more\ninformation. Example:\n\n\n```\nlet mut i = 0;\nlet mut x = &mut i; // ok!\n\n// or:\nlet mut i = 0;\nlet a = &i; // ok!\nlet b = &i; // still ok!\nlet c = &i; // still ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1933,"byte_end":1935,"line_start":64,"line_end":64,"column_start":24,"column_end":26,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| set(&mut *x.f));","highlight_start":24,"highlight_end":26}],"label":"first mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1976,"byte_end":1978,"line_start":65,"line_end":65,"column_start":24,"column_end":26,"is_primary":true,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut *x.f));","highlight_start":24,"highlight_end":26}],"label":"second mutable borrow occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":2134,"byte_end":2135,"line_start":69,"line_end":69,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"first borrow ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1989,"byte_end":1990,"line_start":65,"line_end":65,"column_start":37,"column_end":38,"is_primary":false,"text":[{"text":"    let c2 = to_fn_mut(|| set(&mut *x.f));","highlight_start":37,"highlight_end":38}],"label":"borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs","byte_start":1946,"byte_end":1947,"line_start":64,"line_end":64,"column_start":37,"column_end":38,"is_primary":false,"text":[{"text":"    let c1 = to_fn_mut(|| set(&mut *x.f));","highlight_start":37,"highlight_end":38}],"label":"previous borrow occurs due to use of `x` in closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)\n  --> /checkout/src/test/ui/borrowck/borrowck-closures-two-mut.rs:65:24\n   |\nLL |     let c1 = to_fn_mut(|| set(&mut *x.f));\n   |                        --           - previous borrow occurs due to use of `x` in closure\n   |                        |\n   |                        first mutable borrow occurs here\nLL |     let c2 = to_fn_mut(|| set(&mut *x.f));\n   |                        ^^           - borrow occurs due to use of `x` in closure\n   |                        |\n   |                        second mutable borrow occurs here\n...\nLL | }\n   | - first borrow ends here\n\n"}
[00:42:59] thread 'main' panicked at 'index out of bounds: the len is 2 but the index is 2', /checkout/src/libcore/slice/mod.rs:2085:10
[00:42:59] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:42:59] {"message":"aborting due to 5 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 5 previous errors\n\n"}
[00:42:59] {"message":"For more information about this error, try `rustc --explain E0499`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0499`.\n"}
[00:42:59] error: internal compiler error: unexpected panic
[00:42:59] 
[00:42:59] 
[00:42:59] note: the compiler unexpectedly panicked. this is a bug.
[00:42:59] 
[00:42:59] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:42:59] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:42:59] 
[00:42:59] 
[00:42:59] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=compare -C prefer-dynamic -C rpath
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] thread '[ui] ui/borrowck/borrowck-closures-two-mut.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] thread '[ui] ui/borrowck/borrowck-closures-two-mut.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:42:59] 
[00:42:59] ---- [ui] ui/borrowck/borrowck-slice-pattern-element-loan.rs stdout ----
[00:42:59] diff of stderr:
[00:42:59] 
[00:42:59] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     if let [ref first, ref second, ..] = *s {
[00:42:59] -    |                        ---------- immutable borrow occurs here
[00:42:59] - LL |         if let [_, ref mut  second2, ref mut third, ..] = *s { //~ERROR
[00:42:59] -    |                    ^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:42:59] - LL |             nop(&[first, second, second2, third]);
[00:42:59] -    |                          ------ borrow later used here
[00:42:59] - 
[00:42:59] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     if let [.., ref fourth, ref third, _, ref first] = *s {
[00:42:59] -    |                             --------- immutable borrow occurs here
[00:42:59] - LL |         if let [.., ref mut third2, _, _] = *s { //~ERROR
[00:42:59] -    |                     ^^^^^^^^^^^^^^ mutable borrow occurs here
[00:42:59] - LL |             nop(&[first, third, third2, fourth]);
[00:42:59] -    |                          ----- borrow later used here
[00:42:59] - 
[00:42:59] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
[00:42:59] -    |                    ------------- immutable borrow occurs here
[00:42:59] - ...
[00:42:59] - LL |         if let [_, ref mut from_begin1, ..] = *s { //~ERROR
[00:42:59] -    |                    ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:42:59] - LL |             nop(&[from_begin1, from_end1, from_end3, from_end4]);
[00:42:59] -    |                                                      --------- borrow later used here
[00:42:59] - 
[00:42:59] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
[00:42:59] -    |                                   ------------- immutable borrow occurs here
[00:42:59] - ...
[00:42:59] - LL |         if let [_, _, ref mut from_begin2, ..] = *s { //~ERROR
[00:42:59] -    |                       ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:42:59] - LL |             nop(&[from_begin2, from_end1, from_end3, from_end4]);
[00:42:59] -    |                                           --------- borrow later used here
[00:42:59] - 
[00:42:59] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
[00:42:59] -    |                                   ------------- immutable borrow occurs here
[00:42:59] - ...
[00:42:59] - LL |         if let [_, _, _, ref mut from_begin3, ..] = *s { //~ERROR
[00:42:59] -    |                          ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:42:59] - LL |             nop(&[from_begin3, from_end1, from_end3, from_end4]);
[00:42:59] -    |                                           --------- borrow later used here
[00:42:59] - 
[00:42:59] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
[00:42:59] -    |                                                  --------------- immutable borrow occurs here
[00:42:59] - ...
[00:42:59] - LL |         if let [.., ref mut from_end2, _] = *s { //~ERROR
[00:42:59] -    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:42:59] - LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end2]);
[00:42:59] -    |                                             ----------- borrow later used here
[00:42:59] - 
[00:42:59] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
[00:42:59] -    |                                                  --------------- immutable borrow occurs here
[00:42:59] - ...
[00:42:59] - LL |         if let [.., ref mut from_end3, _,  _] = *s { //~ERROR
[00:42:59] -    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:42:59] - LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end3]);
[00:42:59] -    |                                             ----------- borrow later used here
[00:42:59] - 
[00:42:59] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
[00:42:59] -    |                              --------------- immutable borrow occurs here
[00:42:59] - ...
[00:42:59] - LL |         if let [.., ref mut from_end4, _, _, _] = *s { //~ERROR
[00:42:59] -    |                     ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
[00:42:59] - LL |             nop(&[from_begin0, from_begin1, from_begin3, from_end4]);
[00:42:59] -    |                                ----------- borrow later used here
[00:42:59] - 
[00:42:59] - error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     if let [ref first, ref second, ..] = *s {
[0src/librustc_data_structures/indexed_vec.rs:505:32
[00:42:59] 
[00:42:59] error: internal compiler error: unexpected panic
[00:42:59] 
[00:42:59] 
[00:42:59] note: the compiler unexpectedly panicked. this is a bug.
[00:42:59] 
[00:42:59] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:42:59] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:42:59] 
[00:42:59] 
[00:42:59] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=mir -Z two-phase-borrows -C prefer-dynamic -C rpath
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] thread '[ui] ui/borrowck/two-phase-method-receivers.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] thread '[ui] ui/borrowck/two-phase-method-receivers.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] 
[00:42:59] ---- [ui] ui/borrowck/two-phase-multi-mut.rs stdout ----
[00:42:59] diff of stderr:
[00:42:59] 
[00:42:59] - error[E0499]: cannot borrow `foo` as mutable more than once at a time
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     foo.method(&mut foo);
[00:42:59] -    |     -----------^^^^^^^^-
[00:42:59] -    |     |          second mutable borrow occurs here
[00:42:59] -    |     first mutable borrow occurs here
[00:42:59] -    |     first mutable borrow occurs here
[00:42:59] -    |     borrow later used here
[00:42:59] - 
[00:42:59] - error[E0499]: cannot borrow `foo` as mutable more than once at a time
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     foo.method(&mut foo);
[00:42:59] -    |     ^^^^^^^^^^^--------^
[00:42:59] -    |     |          first mutable borrow occurs here
[00:42:59] -    |     second mutable borrow occurs here
[00:42:59] -    |     second mutable borrow occurs here
[00:42:59] -    |     borrow later used here
[00:42:59] - error: aborting due to 2 previous errors
[00:42:59] - 
[00:42:59] - For more information about this error, try `rustc --explain E0499`.
[00:42:59] - 
[00:42:59] - 
[00:42:59] 
[00:42:59] 
[00:42:59] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-multi-mut/two-phase-multi-mut.stderr`: No such file or directory (os error 2)
[00:42:59] 
[00:42:59] ---- [ui] ui/borrowck/two-phase-multiple-activations.rs stdout ----
[00:42:59] 
[00:42:59] 
[00:42:59] error: test compilation failed although it shouldn't!
[00:42:59] status: exit code: 101
[00:42:59] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/two-phase-multiple-activations.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-multiple-activations/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=mir" "-Z" "two-phase-borrows" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/two-phase-multiple-activations/auxiliary" "-A" "unused"
[00:42:59] stdout:
[00:n generator yields (Ast)
[00:42:59] -    |                 ^^^^^^^^^
[00:42:59] - LL |         //~^ borrow may still be in use when generator yields (Mir)
[00:42:59] - LL |         yield ();
[00:42:59] -    |         -------- possible yield occurs here
[00:42:59] - error: aborting due to 3 previous errors
[00:42:59] + error: aborting due to 2 previous errors
[00:42:59] 29 
[00:42:59] 30 For more information about this error, try `rustc --explain E0626`.
[00:42:59] 30 For more information about this error, try `rustc --explain E0626`.
[00:42:59] 31 
[00:42:59] 
[00:42:59] 
[00:42:59] The actual stderr differed from the expected stderr.
[00:42:59] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/generator-with-nll/generator-with-nll.stderr
[00:42:59] To update references, rerun the tests and pass the `--bless` flag
[00:42:59] To only update this specific test, also pass `--test-args generator/generator-with-nll.rs`
[00:42:59] error: 1 errors occurred comparing output.
[00:42:59] status: exit code: 101
[00:42:59] status: exit code: 101
[00:42:59] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/generator/generator-with-nll.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/generator-with-nll/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=compare" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/generator-with-nll/auxiliary" "-A" "unused"
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] stderr:
[00:42:59] stderr:
[00:42:59] ------------------------------------------
[00:42:59] {"message":"borrow may still be in use when generator yields (Ast)","code":{"code":"E0626","explanation":"\nThis error occurs because a borrow in a generator persists across a\nyield point.\n\n```compile_fail,E0626\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n    let a = &String::new(); // <-- This borrow...\n    yield (); // ...is still in scope here, when the yield occurs.\n    println!(\"{}\", a);\n};\nunsafe { b.resume() };\n```\n\nAt present, it is not permitted to have a yield that occurs while a\nborrow is still in scope. To resolve this error, the borrow must\neither be \"contained\" to a smaller scope that does not overlap the\nyield or else eliminated in another way. So, for example, we might\nresolve the previous example by removing the borrow and just storing\nthe integer by value:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n    let a = 3;\n    yield ();\n    println!(\"{}\", a);\n};\nunsafe { b.resume() };\n```\n\nThis is a very simple case, of course. In more complex cases, we may\nwish to have more than one reference to the value that was borrowed --\nin those cases, something like the `Rc` or `Arc` types may be useful.\n\nThis error also frequently arises with iteration:\n\n```compile_fail,E0626\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  for &x in &v { // <-- borrow of `v` is still in scope...\n    yield x; // ...when this yield occurs.\n  }\n};\nunsafe { b.resume() };\n```\n\nSuch cases can sometimes be resolved by iterating \"by value\" (or using\n`into_iter()`) to avoid borrowing:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  for x in v { // <-- Take ownership of the values instead!\n    yield x; // <-- Now yield is OK.\n  }\n};\nunsafe { b.resume() };\n```\n\nIf taking ownership is not an option, using indices can work too:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  let len = v.len(); // (*)\n  for i in 0..len {\n    let x = v[i]; // (*)\n    yield x; // <-- Now yield is OK.\n  }\n};\nunsafe { b.resume() };\n\n// (*) -- Unfortunately, these temporaries are currently required.\n// See <https://github.com/rust-lang/rust/issues/43122>.\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/generator/generator-with-nll.rs","byte_start":914,"byte_end":922,"line_start":22,"line_end":22,"column_start":9,"column_end":17,"is_primary":false,"text":[{"text":"        yield ();","highlight_start":9,"highlight_end":17}],"label":"possible yield occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/generator/generator-with-nll.rs","byte_start":675,"byte_end":679,"line_start":19,"line_end":19,"column_start":23,"column_end":27,"is_primary":true,"text":[{"text":"        let _a = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)","highll,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/generator/generator-with-nll.rs","byte_start":767,"byte_end":771,"line_start":20,"line_end":20,"column_start":22,"column_end":26,"is_primary":true,"text":[{"text":"        let b = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)","highlight_start":22,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0626]: borrow may still be in use when generator yields (Ast)\n  --> /checkout/src/test/ui/generator/generator-with-nll.rs:20:22\n   |\nLL |         let b = &mut true; //~ ERROR borrow may still be in use when generator yields (Ast)\n   |                      ^^^^\nLL |         //~^ borrow may still be in use when generator yields (Mir)\nLL |         yield ();\n   |         -------- possible yield occurs here\n\n"}
[00:42:59] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:42:59] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:42:59] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:42:59] {"message":"For more information about this error, try `rustc --explain E0626`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0626`.\n"}
[00:42:59] error: internal compiler error: unexpected panic
[00:42:59] 
[00:42:59] note: t2:59] - error: aborting due to 4 previous errors
[00:42:59] + error: aborting due to 2 previous errors
[00:42:59] + error: aborting due to 2 previous errors
[00:42:59] 38 
[00:42:59] 39 For more information about this error, try `rustc --explain E0626`.
[00:42:59] 40 
[00:42:59] 
[00:42:59] 
[00:42:59] The actual stderr differed from the expected stderr.
[00:42:59] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/yield-while-local-borrowed/yield-while-local-borrowed.stderr
[00:42:59] To update references, rerun the tests and pass the `--bless` flag
[00:42:59] To only update this specific test, also pass `--test-args generator/yield-while-local-borrowed.rs`
[00:42:59] error: 1 errors occurred comparing output.
[00:42:59] status: exit code: 101
[00:42:59] status: exit code: 101
[00:42:59] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/generator/yield-while-local-borrowed.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/yield-while-local-borrowed/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=compare" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/yield-while-local-borrowed/auxiliary" "-A" "unused"
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] stderr:
[00:42:59] stderr:
[00:42:59] ------------------------------------------
[00:42:59] {"message":"borrow may still be in use when generator yields (Ast)","code":{"code":"E0626","explanation":"\nThis error occurs because a borrow in a generator persists across a\nyield point.\n\n```compile_fail,E0626\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n    let a = &String::new(); // <-- This borrow...\n    yield (); // ...is still in scope here, when the yield occurs.\n    println!(\"{}\", a);\n};\nunsafe { b.resume() };\n```\n\nAt present, it is not permitted to have a yield that occurs while a\nborrow is still in scope. To resolve this error, the borrow must\neither be \"contained\" to a smaller scope that does not overlap the\nyield or else eliminated in another way. So, for example, we might\nresolve the previous example by removing the borrow and just storing\nthe integer by value:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n    let a = 3;\n    yield ();\n    println!(\"{}\", a);\n};\nunsafe { b.resume() };\n```\n\nThis is a very simple case, of course. In more complex cases, we may\nwish to have more than one reference to the value that was borrowed --\nin those cases, something like the `Rc` or `Arc` types may be useful.\n\nThis error also frequently arises with iteration:\n\n```compile_fail,E0626\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  for &x in &v { // <-- borrow of `v` is still in scope...\n    yield x; // ...when this yield occurs.\n  }\n};\nunsafe { b.resume() };\n```\n\nSuch cases can sometimes be resolved by iterating \"by value\" (or using\n`into_iter()`) to avoid borrowing:\n\n```\n#w of `v` is still in scope...\n    yield x; // ...when this yield occurs.\n  }\n};\nunsafe { b.resume() };\n```\n\nSuch cases can sometimes be resolved by iterating \"by value\" (or using\n`into_iter()`) to avoid borrowing:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  for x in v { // <-- Take ownership of the values instead!\n    yield x; // <-- Now yield is OK.\n  }\n};\nunsafe { b.resume() };\n```\n\nIf taking ownership is not an option, using indices can work too:\n\n```\n# #![feature(generators, generator_trait)]\n# use std::ops::Generator;\nlet mut b = || {\n  let v = vec![1,2,3];\n  let len = v.len(); // (*)\n  for i in 0..len {\n    let x = v[i]; // (*)\n    yield x; // <-- Now yield is OK.\n  }\n};\nunsafe { b.resume() };\n\n// (*) -- Unfortunately, these temporaries are currently required.\n// See <https://github.com/rust-lang/rust/issues/43122>.\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/generator/yield-while-local-borrowed.rs","byte_start":1774,"byte_end":1781,"line_start":55,"line_end":55,"column_start":13,"column_end":20,"is_primary":false,"text":[{"text":"            yield();","highlight_start":13,"highlight_end":20}],"label":"possible yield occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/generator/yield-while-local-borrowed.rs","byte_start":1603,"byte_end":1604,"line_start":52,"line_end":52,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":"            let b = &a;","highlight_start":22,"highlight_end":23}],"lab] ui/generator/yield-while-local-borrowed.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] ---- [ui] ui/impl-trait/region-escape-via-bound-contravariant-closure.rs stdout ----
[00:42:59] 
[00:42:59] 
[00:42:59] error: test compilation failed although it shouldn't!
[00:42:59] status: exit code: 101
[00:42:59] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/region-escape-via-bound-contravariant-closure/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/region-escape-via-bound-contravariant-closure/auxiliary" "-A" "unused"
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] stderr:
[00:42:59] stderr:
[00:42:59] ------------------------------------------
[00:42:59] thread 'main' panicked at 'index out of bounds: the len is 6 but the index is 6', /checkout/src/libcore/slice/mod.rs:2085:10
[00:42:59] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:42:59] 
[00:42:59] error: internal compiler error: unexpected panic
[00:42:59] 
[00:42:59] note: the compiler unexpectedly panicked. this is a bug.
[00:42:59] 
[00:42:59] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:42:59] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:42:59] 
[00:42:59] 
[00:42:59] note: compiler flags: -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] thread '[ui] ui/impl-trait/region-escape-via-bound-contravariant-closure.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] thread '[ui] ui/impl-trait/region-escape-via-bound-contravariant-closure.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] 
[00:42:59] ---- [ui] ui/issue-27282-move-match-input-into-guard.rs stdout ----
[00:42:59] diff of stderr:
[00:42:59] 
[00:42:59] - error[E0505]: cannot move out of `b` because it is borrowed
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |        match b {
[00:42:59] -    |   _____-
[00:42:59] -    |  |_____|
[00:42:59] -    | ||
[00:42:59] - LL | ||         &mut false => {},
[00:42:59] - LL | ||         _ if { (|| { let bar = b; *bar = false; })();
[00:42:59] -    | ||                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ move out of `b` occurs here
[00:42:59] - LL | ||                      //~^ ERROR cannot move out of `b` because it is borrowed [E0505]
[00:42:59] - ...  ||
[00:42:59] - LL | ||         _ => panic!("surely we could never get here, since rustc warns it is unreachable."),
[00:42:59] - LL | ||     }
[00:42:59] -    | ||     -
[00:42:59] -    | ||_____|
[00:42:59] -    | |______borrow of `b` occurs here
[00:42:59] -    |        borrow later used here
[00:42:59] - 
[00:42:59] - error[E0382]: use of moved value: `*b`
[00:42:59] -   --> $DIR/isr-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-27282-mutate-before-diverging-arm-1/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-27282-mutate-before-diverging-arm-1/auxiliary" "-A" "unused"
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] stderr:
[00:42:59] stderr:
[00:42:59] ------------------------------------------
[00:42:59] {"message":"librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs:289: could not find any constraint to blame for '_#6r: bb11[3]","code":null,"level":"error: internal compiler error","spans":[],"children":[],"rendered":"error: internal compiler error: librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs:289: could not find any constraint to blame for '_#6r: bb11[3]\n\n"}
[00:42:59] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:42:59] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:42:59] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:42:59] 
[00:42:59] note: the compiler unexpectedly panicked. this is a bug.
[00:42:59] 
[00:42:59] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:42:59] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:42:59] 
[00:42:59] 
[00:42:59] note: compiler flags: -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] thread '[ui] ui/issue-27282-mutate-before-diverging-arm-1.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] thread '[ui] ui/issue-27282-mutate-before-diverging-arm-1.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] 
[00:42:59] ---- [ui] ui/issue-27282-mutate-before-diverging-arm-2.rs stdout ----
[00:42:59] diff of stderr:
[00:42:59] 
[00:42:59] - error[E0500]: closure requires unique access to `x` but it is already borrowed
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |        match x {
[00:42:59] -    |   _____-
[00:42:59] -    |  |_____|
[00:42:59] -    | ||
[00:42:59] - LL | ||         &mut None => panic!("unreachable"),
[00:42:59] - LL | ||         &mut Some(&_)
[00:42:59] - LL | ||             if {
[00:42:59] - LL | ||                 // ForceFnOnce needed to exploit #27282
[00:42:59] - LL | ||                 (|| { *x = None; drop(force_fn_once); })();
[00:42:59] -    | ||                  ^^    - borrow occurs due to use of `x` in closure
[00:42:59] -    | ||                  |
[00:42:59] -    | ||                  closure construction occurs here
[00:42:59] - ...  ||
[00:42:59] - LL | ||         _ => panic!("unreachable"),
[00:42:59] - LL | ||     }
[00:42:59] -    | ||     -
[00:42:59] -    | ||_____|
[00:42:59] -    | |______borrow occurs here
[00:42:59] -    |        borrow later used here
[00:42:59] + error: internal compiler error: librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.r9] {"message":"librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs:289: could not find any constraint to blame for '_#6r: bb11[3]","code":null,"level":"error: internal compiler error","spans":[],"children":[],"rendered":"error: internal compiler error: librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs:289: could not find any constraint to blame for '_#6r: bb11[3]\n\n"}
[00:42:59] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:42:59] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:42:59] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:42:59] 
[00:42:59] note: the compiler unexpectedly panicked. this is a bug.
[00:42:59] 
[00:42:59] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:42:59] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:42:59] 
[00:42:59] 
[00:42:59] note: compiler flags: -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] thread '[ui] ui/issue-27282-mutate-before-diverging-arm-2.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] thread '[ui] ui/issue-27282-mutate-before-diverging-arm-2.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] 
[00:42:59] ---- [ui] ui/issue-27282-reborrow-ref-mut-in-guard.rs stdout ----
[00:42:59] diff of stderr:
[00:42:59] 
[00:42:59] - error[E0596]: cannot borrow immutable item `*r` as mutable
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |         ref mut r if { (|| { let bar = &mut *r; **bar = false; })();
[00:42:59] -    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
[00:42:59] - error: aborting due to previous error
[00:42:59] - 
[00:42:59] - For more information about this error, try `rustc --explain E0596`.
[00:42:59] - 
[00:42:59] - 
[00:42:59] 
[00:42:59] 
[00:42:59] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-27282-reborrow-ref-mut-in-guard/issue-27282-reborrow-ref-mut-in-guard.stderr`: No such file or directory (os error 2)
[00:42:59] 
[00:42:59] ---- [ui] ui/issue-45157.rs stdout ----
[00:42:59] diff of stderr:
[00:42:59] 
[00:42:59] 
[00:42:59] - error[E0502]: cannot borrow `u.z.c` as immutable because it is also borrowed as mutable
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |         let mref = &mut u.s.a;
[00:42:59] -    |                    ---------- mutable borrow occurs here
[00:42:59] - ...
[00:42:59] - LL |         let nref = &u.z.c;
[00:42:59] -    |                    ^^^^^^ immutable borrow occurs here
[00:42:59] - LL |         //~^ ERROR cannot borrow `u.z.c` as immutable because it is also borrowed as mutable [E0502]
[00:42:59] - LL |         println!("{} {}", mref, nref)
[00:42:59] -    |                           ---- borrow later used here
[00:42:59] - error: aborting due to previous error
[00:42:59] - 
[00:42:59] - For more information about this error, try `rustc --explain E0502`.
[00:42:59] - 
[00:42:59] - 
[00:42:59] 
[00:42:59] 
[00:42:59] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-45157/issue-45157.stderr`: No such file or directory (os error 2)
[00:42:59] 
[00:42:59] ---- [ui] ui/issue-45697-1.rs stdout ----
[00:42:59] diff of stderr:
[00:42:59] 
[00:42:59] 
[00:42:59] 6 LL |         *y.pointer += 1;
[00:42:59] 7    |         ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
[00:42:59] 8 
[00:42:59] - error[E0503]: cannot use `*y.pointer` because it was mutably borrowed (Mir)
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |         let z = copy_borrowed_ptr(&mut y);
[00:42:59] -    |                                   ------ borrow of `y` occurs here
[00:42:59] - LL |         *y.pointer += 1;
[00:42:59] -    |         ^^^^^^^^^^^^^^^ use of borrowed `y`
[00:42:59] - ...
[00:42:59] - LL |         *z.pointer += 1;
[00:42:59] -    |         --------------- borrow later used here
[00:42:59] + error: aborting due to previous error
[00:42:59] 19 
[00:42:59] - error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir)
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |         let z = copy_borrowed_ptr(&mut y);
[00:42:59] -    |                                   ------ borrow of `*y.pointer` occurs here
[00:42:59] - LL |         *y.pointer += 1;
[00:42:59] -    |         ^^^^^^^^^^^^^^^ assignment to bo```\nstruct FancyNum {\n    num: u8,\n}\n\nfn main() {\n    let mut fancy_num = FancyNum { num: 5 };\n\n    print_fancy_ref(&fancy_num);\n\n    // Works because function borrow has ended\n    fancy_num = FancyNum { num: 6 };\n    println!(\"Num: {}\", fancy_num.num);\n}\n\nfn print_fancy_ref(fancy_ref: &FancyNum){\n    println!(\"Ref: {}\", fancy_ref.num);\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issue-45697-1.rs","byte_start":935,"byte_end":936,"line_start":29,"line_end":29,"column_start":40,"column_end":41,"is_primary":false,"text":[{"text":"        let z = copy_borrowed_ptr(&mut y);","highlight_start":40,"highlight_end":41}],"label":"borrow of `*y.pointer` occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/issue-45697-1.rs","byte_start":947,"byte_end":962,"line_start":30,"line_end":30,"column_start":9,"column_end":24,"is_primary":true,"text":[{"text":"        *y.pointer += 1;","highlight_start":9,"highlight_end":24}],"label":"assignment to borrowed `*y.pointer` occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Ast)\n  --> /checkout/src/test/ui/issue-45697-1.rs:30:9\n   |\nLL |         let z = copy_borrowed_ptr(&mut y);\n   |                                        - borrow of `*y.pointer` occurs here\nLL |         *y.pointer += 1;\n   |         ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here\n\n"}
[00:42:59] thread 'main' panicked at 'index out of bounds: the len is flag
[00:42:59] To only update this specific test, also pass `--test-args issue-45697.rs`
[00:42:59] error: 1 errors occurred comparing output.
[00:42:59] status: exit code: 101
[00:42:59] status: exit code: 101
[00:42:59] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issue-45697.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-45697/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "emit-end-regions" "-Z" "borrowck=compare" "-C" "overflow-checks=off" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-45697/auxiliary" "-A" "unused"
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] stderr:
[00:42:59] stderr:
[00:42:59] ------------------------------------------
[00:42:59] {"message":"cannot assign to `*y.pointer` because it is borrowed (Ast)","code":{"code":"E0506","explanation":"\nThis error occurs when an attempt is made to assign to a borrowed value.\n\nExample of erroneous code:\n\n```compile_fail,E0506\nstruct FancyNum {\n    num: u8,\n}\n\nfn main() {\n    let mut fancy_num = FancyNum { num: 5 };\n    let fancy_ref = &fancy_num;\n    fancy_num = FancyNum { num: 6 };\n    // error: cannot assign to `fancy_num` because it is borrowed\n\n    println!(\"Num: {}, Ref: {}\", fancy_num.num, fancy_ref.num);\n}\n```\n\nBecause `fancy_ref` still holds a reference to `fancy_num`, `fancy_num` can't\nbe assigned to a new value as it would invalidate the reference.\n\nAlternatively, we can move out of `fancy_num` into a second `fancy_num`:\n\n```\nstruct FancyNum {\n    num: u8,\n}\n\nfn main() {\n    let mut fancy_num = FancyNum { num: 5 };\n    let moved_num = fancy_num;\n    fancy_num = FancyNum { num: 6 };\n\n    println!(\"Num: {}, Moved num: {}\", fancy_num.num, moved_num.num);\n}\n```\n\nIf the value has to be borrowed, try limiting the lifetime of the borrow using\na scoped block:\n\n```\nstruct FancyNum {\n    num: u8,\n}\n\nfn main() {\n    let mut fancy_num = FancyNum { num: 5 };\n\n    {\n        let fancy_ref = &fancy_num;\n        println!(\"Ref: {}\", fancy_ref.num);\n    }\n\n    // Works because `fancy_ref` is no longer in scope\n    fancy_num = FancyNum { num: 6 };\n    println!(\"Num: {}\", fancy_num.num);\n}\n```\n\nOr by moving the reference into a function:\n\n```\nstruct FancyNum {\n    num: u8,\n}\n\nfn main() {\n    let mut fancy_num = FancyNum { num: 5 };\n\n    print_fancy_ref(&fancy_num);\n\n    // Works because function borrow has ended\n    fancy_num = FancyNum { num: 6 };\n    println!(\"Num: {}\", fancy_num.num);\n}\n\nfn print_fancy_ref(fancy_ref: &FancyNum){\n    println!(\"Ref: {}\", fancy_ref.num);\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issue-45697.rs","byte_start":936,"byte_end":937,"line_start":29,"line_end":29,"column_start":40,"column_end":41,"is_primary":false,"text":[{"text":"        let z = copy_borrowed_ptr(&mut y);","highlight_start":40,"highlight_end":41}],"label":"borrow of `*y.pointer` occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/issue-45697.rs","byte_start":948,"byte_end":963,"line_start":30,"line_end":30,"column_start":9,"column_end":24,"is_primary":true,"text":[{"text":"        *y.pointer += 1;","highlight_start":9,"highlight_end":24}],"label":"assignment to borrowed `*y.pointer` occurs here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Ast)\n  --> /checkout/src/test/ui/issue-45697.rs:30:9\n   |\nLL |         let z = copy_borrowed_ptr(&mut y);\n   |                                        - borrow of `*y.pointer` occurs here\nLL |         *y.pointer += 1;\n   |         ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here\n\n"}
[00:42:59] thread 'main' panicked at 'index out of bounds: the len is 2 but the index is 2', /checkout/src/libcore/slice/mod.rs:2085:10
[00:42:59] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:42:59] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:42:59] {"message":"For more information about this error, try `rustc --explain E0506`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0506`.\n"}
[00:42:59] error: internal compiler error: unexpected panic
---
[00:42:59] 18 
[00:42:59] - error[E0507]: cannot move out of borrowed content
[00:42:59] -   --> $DIR/move-errors.rs:32:13
[00:42:59] -    |
[00:42:59] - LL |     let s = **r;
[00:42:59] -    |             |
[00:42:59] -    |             cannot move out of borrowed content
[00:42:59] -    |             help: consider using a reference instead: `&**r`
[00:42:59] + error: aborting due to 2 previous errors
[00:42:59] + error: aborting due to 2 previous errors
[00:42:59] 27 
[00:42:59] - error[E0507]: cannot move out of borrowed content
[00:42:59] -   --> $DIR/move-errors.rs:40:13
[00:42:59] -    |
[00:42:59] - LL |     let s = *r;
[00:42:59] -    |             |
[00:42:59] -    |             cannot move out of borrowed content
[00:42:59] -    |             help: consider using a reference instead: `&*r`
[00:42:59] - 
[00:42:59] - 
[00:42:59] - error[E0508]: cannot move out of type `[A; 1]`, a non-copy array
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     let a = [A("".to_string())][0];
[00:42:59] -    |             |
[00:42:59] -    |             cannot move out of here
[00:42:59] -    |             cannot move out of here
[00:42:59] -    |             help: consider using a reference instead: `&[A("".to_string())][0]`
[00:42:59] - error[E0507]: cannot move out of borrowed content
[00:42:59] -   --> $DIR/move-errors.rs:51:16
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     let A(s) = *a;
[00:42:59] -    |           -    ^^
[00:42:59] -    |           |    cannot move out of borrowed content
[00:42:59] -    |           |    help: consider removing this dereference operator: `a`
[00:42:59] -    |           |    help: consider removing this dereference operator: `a`
[00:42:59] -    |           move occurs because s has type `std::string::String`, which does not implement the `Copy` trait
[00:42:59] - 
[00:42:59] - error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     let C(D(s)) = c;
[00:42:59] -    |             -     ^ cannot move out of here
[00:42:59] -    |             |
[00:42:59] -    |             help: to prevent move, use ref or ref mut: `ref s`
[00:42:59] - error[E0507]: cannot move out of borrowed content
[00:42:59] -   --> $DIR/move-errors.rs:64:9
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     b = *a;
[00:42:59] -    |         ^^ cannot move out of borrowed content
[00:42:59] - 
[00:42:59] - error[E0508]: cannot move out of type `[B; 1]`, a non-copy array
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     match x[0] {
[00:42:59] -    |           |
[00:42:59] -    |           cannot move out of here
[00:42:59] -    |           help: consider using a reference instead: `&x[0]`
[00:42:59] -    |           help: consider using a reference instead: `&x[0]`
[00:42:59] - LL |     //~^ ERROR
[00:42:59] - LL |         B::U(d) => (),
[00:42:59] -    |              - move occurs because d has type `D`, which does not implement the `Copy` trait
[00:42:59] - LL |         B::V(s) => (),
[00:42:59] -    |              - move occurs because s has type `std::string::String`, which does not implement the `Copy` trait
[00:42:59] - 
[00:42:59] - error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     match x {
[00:42:59] -    |           ^ cannot move out of here
[00:42:59] - ...
[00:42:59] - LL |         B::U(D(s)) => (),
[00:42:59] -    |                - help: to prevent move, use ref or ref mut: `ref s`
[00:42:59] - 
[00:42:59] - error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     match x {
[00:42:59] -    |           ^ cannot move out of here
[00:42:59] - ...
[00:42:59] - LL |         (D(s), &t) => (),
[00:42:59] -    |            - help: to prevent move, use ref or ref mut: `ref s`
[00:42:59] - error[E0507]: cannot move out of borrowed content
[00:42:59] -   --> $DIR/move-errors.rs:105:11
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     match x {
[00:42:59] -    |           ^ cannot move out of borrowed content
[00:42:59] - ...
[00:42:59] - LL |         (D(s), &t) => (),
[00:42:59] -    |                 - help: to prevent move, use ref or ref mut: `ref t`
[00:42:59] - 
[00:42:59] - error[E0509]: cannot move out of type `F`, which implements the `Drop` trait
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     match x {
[00:42:59] -    |           ^ cannot move out of here
[00:42:59] - help: to prevent eDarkKnight;\n\nimpl TheDarkKnight {\n    fn nothing_is_true(&self) {} // First case, we don't take ownership\n}\n\nfn main() {\n    let x = RefCell::new(TheDarkKnight);\n\n    x.borrow().nothing_is_true(); // ok!\n}\n```\n\nOr:\n\n```\nuse std::cell::RefCell;\n\nstruct TheDarkKnight;\n\nimpl TheDarkKnight {\n    fn nothing_is_true(self) {}\n}\n\nfn main() {\n    let x = RefCell::new(TheDarkKnight);\n    let x = x.into_inner(); // we get back ownership\n\n    x.nothing_is_true(); // ok!\n}\n```\n\nOr:\n\n```\nuse std::cell::RefCell;\n\n#[derive(Clone, Copy)] // we implement the Copy trait\nstruct TheDarkKnight;\n\nimpl TheDarkKnight {\n    fn nothing_is_true(self) {}\n}\n\nfn main() {\n    let x = RefCell::new(TheDarkKnight);\n\n    x.borrow().nothing_is_true(); // ok!\n}\n```\n\nMoving a member out of a mutably borrowed struct will also cause E0507 error:\n\n```compile_fail,E0507\nstruct TheDarkKnight;\n\nimpl TheDarkKnight {\n    fn nothing_is_true(self) {}\n}\n\nstruct Batcave {\n    knight: TheDarkKnight\n}\n\nfn main() {\n    let mut cave = Batcave {\n        knight: TheDarkKnight\n    };\n    let borrowed = &mut cave;\n\n    borrowed.knight.nothing_is_true(); // E0507\n}\n```\n\nIt is fine only if you put something back. `mem::replace` can be used for that:\n\n```\n# struct TheDarkKnight;\n# impl TheDarkKnight { fn nothing_is_true(self) {} }\n# struct Batcave { knight: TheDarkKnight }\nuse std::mem;\n\nlet mut cave = Batcave {\n    knight: TheDarkKnight\n};\nlet borrowed = &mut cave;\n\nmem::replace(&mut borrowed.knight, TheDarkKnight).nothing_is_true(); // ok!\n```\n\nYou can find more information about borrowing in thay\n  --> /checkout/src/test/ui/nll/move-errors.rs:25:13\n   |\nLL |     let b = a[0];\n   |             ^^^^\n   |             |\n   |             cannot move out of here\n   |             help: consider using a reference instead: `&a[0]`\n\n"}
[00:42:59] thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /checkout/src/librustc_data_structures/indexed_vec.rs:505:32
[00:42:59] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:42:59] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:42:59] {"message":"Some errors occurred: E0507, E0508.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0507, E0508.\n"}
[00:42:59] {"message":"For more information about an error, try `rustc --explain E0507`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0507`.\n"}
[00:42:59] error: internal compiler error: unexpected panic
[00:42:59] 
[00:42:59] 
[00:42:59] note: the compiler unexpectedly panicked. this is a bug.
[00:42:59] 
[00:42:59] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:42:59] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:42:59] 
[00:42:59] 
[00:42:59] note: compiler flags: -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] thread '[ui] ui/nll/move-errors.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] thread '[ui] ui/nll/move-errors.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] 
[00:42:59] ---- [ui] ui/nll/return-ref-mut-issue-46557.rs stdout ----
[00:42:59] diff of stderr:
[00:42:59] 
[00:42:59] - error[E0597]: borrowed value does not live long enough
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |   fn gimme_static_mut() -> &'static mut u32 {
[00:42:59] -    |  ___________________________________________-
[00:42:59] - LL | |     let ref mut x = 1234543; //~ ERROR borrowed value does not live long enough [E0597]
[00:42:59] -    | |                     ^^^^^^^ temporary value does not live long enough
[00:42:59] - LL | |     x
[00:42:59] - LL | | }
[00:42:59] -    | | -
[00:42:59] -    | | |
[00:42:59] -    | |_temporary value only lives until here
[00:42:59] -    |   borrow later used here
[00:42:59] - error: aborting due to previous error
[00:42:59] - 
[00:42:59] - For more information about this error, try `rustc --explain E0597`.
[00:42:59] - 
[00:42:59] - 
[00:42:59] 
[00:42:59] 
[00:42:59] error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/return-ref-mut-issue-46557/return-ref-mut-issue-46557.stderr`: No such file or directory (os error 2)
[00:42:59] 
[00:42:59] ---- [ui] ui/nll/ty-outlives/projection-implied-bounds.rs stdout ----
[00:42:59] diff of stderr:
[00:42:59] 
[00:42:59] 
[00:42:59] 4 LL |     twice(value, |value_ref, item| invoke2(value_ref, item));
[00:42:59] 6 
[00:42:59] 6 
[00:42:59] - error[E0310]: the parameter type `T` may not live long enough
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     twice(value, |value_ref, item| invoke2(value_ref, item));
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = help: consider adding an explicit lifetime bound `T: 'static`...
[00:42:59] - error: aborting due to previous error
[00:42:59] - 
[00:42:59] - For more information about this error, try `rustc --explain E0310`.
[00:42:59] 18 
[00:42:59] 18 
[00:42:59] 
[00:42:59] 
[00:42:59] The actual stderr differed from the expected stderr.
[00:42:59] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-implied-bounds/projection-implied-bounds.stderr
[00:42:59] To update references, rerun the tests and pass the `--bless` flag
[00:42:59] To only update this specific test, also pass `--test-args nll/ty-outlives/projection-implied-bounds.rs`
[00:42:59] error: 1 errors occurred comparing output.
[00:42:59] status: exit code: 101
[00:42:59] status: exit code: 101
[00:42:59] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/nll/ty-outlives/projection-implied-bounds.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-implied-bounds/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-42:59] - 
[00:42:59] - For more information about this error, try `rustc --explain E0309`.
[00:42:59] 
[00:42:59] 
[00:42:59] The actual stderr differed from the expected stderr.
[00:42:59] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-no-regions-fn/projection-no-regions-fn.stderr
[00:42:59] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-no-regions-fn/projection-no-regions-fn.stderr
[00:42:59] To update references, rerun the tests and pass the `--bless` flag
[00:42:59] To only update this specific test, also pass `--test-args nll/ty-outlives/projection-no-regions-fn.rs`
[00:42:59] error: 1 errors occurred comparing output.
[00:42:59] status: exit code: 101
[00:42:59] status: exit code: 101
[00:42:59] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-no-regions-fn/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Zborrowck=mir" "-Zverbose" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-no-regions-fn/auxiliary" "-A" "unused"
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] stderr:
[00:42:59] stderr:
[00:42:59] ------------------------------------------
[00:42:59] {"message":"not reporting region error due to nll","code":null,"level":"warning","spans":[{"file_name":"/checkout/src/test/ui/nll/ty-outlives/pte a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:42:59] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:42:59] 
[00:42:59] 
[00:42:59] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=mir -Z verbose -C prefer-dynamic -C rpath
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] thread '[ui] ui/nll/ty-outlives/projection-no-regions-fn.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] thread '[ui] ui/nll/ty-outlives/projection-no-regions-fn.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] 
[00:42:59] ---- [ui] ui/nll/ty-outlives/projection-no-regions-closure.rs stdout ----
[00:42:59] diff of stderr:
[00:42:59] 
[00:42:59] 10 LL |     with_signature(x, |mut y| Box::new(y.next()))
[00:42:59] 12 
[00:42:59] - note: External requirements
[00:42:59] -   --> $DIR/projection-no-regions-closure.rs:35:23
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     with_signature(x, |mut y| Box::new(y.next()))
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = note: defining type: DefId(0/1:15 ~ projection_no_regions_closure[317d]::no_region[0]::{{closure}}[0]) with closure substs [
[00:42:59] -                '_#1r,
[00:42:59] -                T,
[00:42:59] -                i32,
[00:42:59] -                extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#2r)>
[00:42:59] -            ]
[00:42:59] -    = note: number of external vids: 3
[00:42:59] -    = note: where <T as std::iter::Iterator>::Item: '_#2r
[00:42:59] - 
[00:42:59] - error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     with_signature(x, |mut y| Box::new(y.next()))
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`...
[00:42:59] - note: No external requirements
[00:42:59] -   --> $DIR/projection-no-regions-closure.rs:31:1
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL | / fn no_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a>
[00:42:59] - LL | | where
[00:42:59] - LL | |     T: Iterator,
[00:42:59] - LL | | {
[00:42:59] - ...  |
[00:42:59] - LL | |     //~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough
[00:42:59] - LL | | }
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = note: defining type: DefId(0/0:6 ~ projection_no_regions_closure[317d]::no_region[0]) with substs [
[00:42:59] -                '_#1r,
[00:42:59] -            ]
[00:42:59] - 
[00:42:59] - note: External requirements
[00:42:59] -   --> $DIR/projection-no-regions-closure.rs:45:23
[00:42:59] -   --> $DIR/projection-no-regions-closure.rs:45:23
[00:42:59] -    |
[00:42:59] - LL |     with_signature(x, |mut y| Box::new(y.next()))
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = note: defining type: DefId(0/1:18 ~ projection_no_regions_closure[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
[00:42:59] -                '_#1r,
[00:42:59] -                T,
[00:42:59] -                i32,
[00:42:59] -                extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#2r)>
[00:42:59] -            ]
[00:42:59] -    = note: number of external vids: 3
[00:42:59] -    = note: where <T as std::iter::Iterator>::Item: '_#2r
[00:42:59] - note: No external requirements
[00:42:59] -   --> $DIR/projection-no-regions-closure.rs:41:1
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL | / fn correct_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a>
[00:42:59] - LL | | where
[00:42:59] - LL | |     T: 'a + Iterator,
[00:42:59] - LL | | {
[00:42:59] - LL | |     with_signature(x, |mut y| Box::new(y.next()))
[00:42:59] - LL | | }
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = note: defining type: DefId(0/0:7 ~ projection_no_regions_closure[317d]::correct_region[0]) with substs [
[00:42:59] -                '_#1r,
[00:42:59] -            ]
[00:42:59] - 
[00:42:59] - note: External requirements
[00:42:59] -   --> $DIR/projection-no-regions-closure.rs:53:23
[00:42:59] -   --> $DIR/projection-no-regions-closure.rs:53:23
[00:42:59] -    |
[00:42:59] - LL |     with_signature(x, |mut y| Box::new(y.next()))
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = note: defining type: DefId(0/1:22 ~ projection_no_regions_closure[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
[00:42:59] -                '_#1r,
[00:42:59] -                '_#2r,
[00:42:59] -                T,
[00:42:59] -                i32,
[00:42:59] -                extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#3r)>
[00:42:59] -            ]
[00:42:59] -    = note: number of external vids: 4
[00:42:59] -    = note: where <T as std::iter::Iterator>::Item: '_#3r
[00:42:59] - 
[00:42:59] - error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     with_signature(x, |mut y| Box::new(y.next()))
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`...
[00:42:59] - note: No external requirements
[00:42:59] -   --> $DIR/projection-no-regions-closure.rs:49:1
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL | / fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a>
[00:42:59] - LL | | where
[00:42:59] - LL | |     T: 'b + Iterator,
[00:42:59] - LL | | {
[00:42:59] - ...  |
[00:42:59] - LL | |     //~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough
[00:42:59] - LL | | }
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = note: defining type: DefId(0/0:8 ~ projection_no_regions_closure[317d]::wrong_region[0]) with substs [
[00:42:59] -                '_#1r,
[00:42:59] -                '_#2r,
[00:42:59] -            ]
[00:42:59] - 
[00:42:59] - note: External requirements
[00:42:59] -   --> $DIR/projection-no-regions-closure.rs:64:23
[00:42:59] -   --> $DIR/projection-no-regions-closure.rs:64:23
[00:42:59] -    |
[00:42:59] - LL |     with_signature(x, |mut y| Box::new(y.next()))
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = note: defining type: DefId(0/1:26 ~ projection_no_regions_closure[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
[00:42:59] -                '_#1r,
[00:42:59] -                '_#2r,
[00:42:59] -                T,
[00:42:59] -                i32,
[00:42:59] -                extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#3r)>
[00:42:59] -            ]
[00:42:59] -    = note: number of external vids: 4
[00:42:59] -    = note: where <T as std::iter::Iterator>::Item: '_#3r
[00:42:59] - note: No external requirements
[00:42:59] -   --> $DIR/projection-no-regions-closure.rs:59:1
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL | / fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a>
[00:42:59] - LL | | where
[00:42:59] - LL | |     T: 'b + Iterator,
[00:42:59] - LL | |     'b: 'a,
[00:42:59] - LL | | {
[00:42:59] - LL | |     with_signature(x, |mut y| Box::new(y.next()))
[00:42:59] - LL | | }
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = note: defining type: DefId(0/0:9 ~ projection_no_regions_closure[317d]::outlives_region[0]) with substs [
[00:42:59] -                '_#1r,
[00:42:59] -                '_#2r,
[00:42:59] -            ]
[00:42:59] - 
[00:42:59] - error: aborting due to 2 previous errors
[00:42:59] - 
[00:42:59] - 
[00:42:59] - For more information about this error, try `rustc --explain E0309`.
[00:42:59] 163 
[00:42:59] 
[00:42:59] 
[00:42:59] The actual stderr differed from the expected stderr.
[00:42:59] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-no-regions-closure/projection-no-regions-closure.stderr
[00:42:59] To update references, rerun the tests and pass the `--bless` flag
[00:42:59] To only update this specific test, also pass `--test-args nll/ty-outlives/projection-no-regions-closure.rs`
[00:42:59] error: 1 errors occurred comparing output.
[00:42:59] status: exit code: 101
[00:42:59] status: exit code: 101
[00:42:59] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-no-regions-closure/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Zborrowck=mir" "-Zverbose" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-no-regions-closure/auxiliary" "-A" "unused"
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] stderr:
[00:42:59] stderr:
[00:42:59] ------------------------------------------
[00:42:59] {"message":"not reporting region error due to nll","code":null,"level":"warning","spans":[{"file_name":"/checkout/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs","byte_start":1046,"byte_end":1064,"line_start":35,"line_end":35,"column_start":31,"column_end":49,"is_primary":true,"text":[{"text":"    with_signature(x, |mut y| Box::new(y.next()))","highlight_start":31,"highlight_end":49}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"warning: not reporting region error due to nll\n  --> /checkout/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs:35:31\n   |\nLL |     with_signature(x, |mut y| Box::new(y.next()))\n   |                               ^^^^^^^^^^^^^^^^^^\n\n"}
[00:42:59] {"message":"not reporting region error due to nll","code":null,"level":"warning","spans":[{"file_name":"/checkout/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs","byte_start":1522,"byte_end":1540,"line_start":53,"line_end":53,"column_start":31,"column_end":49,"is_primary":true,"text":[{"text":"    with_signature(x, |mut y| Box::new(y.next()))","highlight_start":31,"highlight_end":49}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"warning: not reporting region error due to nll\n  --> /checkout/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs:53:31\n   |\nLL |     with_signature(x, |mut y| Box::new(y.next()))\n   |                               ^^^^^^^^^^^^^^^^^^\n\n"}
[00:42:59] thread 'main' panicked at 'index out of bounds: the len is 2 but the index is 2', /checkout/src/libcore/slice/mod.rs:2085:10
[00:42:59] 
[00:42:59] error: internal compiler error: unexpected panic
[00:42:59] 
[00:42:59] 
[00:42:59] note: the compiler unexpectedly panicked. this is a bug.
[00:42:59] 
[00:42:59] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:42:59] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:42:59] 
[00:42:59] 
[00:42:59] note: compiler flags: -Z ui-testing -Z unstable-options -Z borrowck=mir -Z verbose -C prefer-dynamic -C rpath
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] thread '[ui] ui/nll/ty-outlives/projection-no-regions-closure.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] thread '[ui] ui/nll/ty-outlives/projection-no-regions-closure.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3162:9
[00:42:59] 
[00:42:59] ---- [ui] ui/nll/ty-outlives/projection-one-region-closure.rs stdout ----
[00:42:59] diff of stderr:
[00:42:59] 
[00:42:59] 16 LL |     with_signature(cell, t, |cell, t| require(cell, t));
[00:42:59] 18 
[00:42:59] - note: External requirements
[00:42:59] -   --> $DIR/projection-one-region-closure.rs:55:29
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     with_signature(cell, t, |cell, t| require(cell, t));
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = note: defining type: DefId(0/1:19 ~ projection_one_region_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
[00:42:59] -                '_#1r,
[00:42:59] -                T,
[00:42:59] -                i32,
[00:42:59] -                extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T))
[00:42:59] -            ]
[00:42:59] -    = note: number of external vids: 3
[00:42:59] -    = note: where T:ements
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     with_signature(cell, t, |cell, t| require(cell, t));
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = note: defining type: DefId(0/1:23 ~ projection_one_region_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
[00:42:59] -                '_#1r,
[00:42:59] -                '_#2r,
[00:42:59] -                T,
[00:42:59] -                i32,
[00:42:59] -                extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
[00:42:59] -            ]
[00:42:59] -    = note: number of external vids: 4
[00:42:59] -    = note: where T: '_#3r
[00:42:59] -    = note: where '_#2r: '_#3r
[00:42:59] - 
[00:42:59] - error[E0309]: the parameter type `T` may not live long enough
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     with_signature(cell, t, |cell, t| require(cell, t));
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
[00:42:59] - error: unsatisfied lifetime constraints
[00:42:59] -   --> $DIR/projection-one-region-closure.rs:67:5
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL |     with_signature(cell, t, |cell, t| require(cell, t));
[00:42:59] -    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
[00:42:59] - note: No external requirements
[00:42:59] -   --> $DIR/projection-one-region-closure.rs:62:1
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] - LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
[00:42:59] - LL | | where
[00:42:59] - LL | |     T: Anything<'b>,
[00:42:59] - LL | |     'a: 'a,
[00:42:59] - ...  |
[00:42:59] - LL | |     //~| ERROR
[00:42:59] - LL | | }
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = note: defining type: DefId(0/0:9 ~ projection_one_region_closure[317d]::no_relationships_early[0]) with substs [
[00:42:59] -                '_#1r,
[00:42:59] -                '_#2r,
[00:42:59] -            ]
[00:42:59] - 
[00:42:59] - note: External requirements
[00:42:59] -   --> $DIR/projection-one-region-closure.rs:89:29
[00:42:59] -   --> $DIR/projection-one-region-closure.rs:89:29
[00:42:59] -    |
[00:42:59] - LL |     with_signature(cell, t, |cell, t| require(cell, t));
[00:42:59] -    |
[00:42:59] -    |
[00:42:59] -    = note: defining type: DefId(0/1:27 ~ projection_one_region_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
[00:42:59] -                '_#1r,
[00:42:59] -                '_#2r,
[00:42:59] -                T,
[00:42:59] -                i32,
[00:42:59] -                extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
[00:42:59] -            ]
[00:42:59] -    = note: number of external vids: 4
[00:42:59] -    = note: where T: '_#3r
[00:42:59] -    = note: where '_#2r: '_#3r
[00:42:59] - 
[00:42:59] - error[E0309]: the parameter type `T` may not live long enough
[0tlives/projection-one-region-closure/projection-one-region-closure.stderr
[0tlives/projection-one-region-closure/projection-one-region-closure.stderr
[00:42:59] To update references, rerun the tests and pass the `--bless` flag
[00:42:59] To only update this specific test, also pass `--test-args nll/ty-outlives/projection-one-region-closure.rs`
[00:42:59] error: 1 errors occurred comparing output.
[00:42:59] status: exit code: 101
[00:42:59] status: exit code: 101
[00:42:59] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-one-region-closure/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Zborrowck=mir" "-Zverbose" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-one-region-closure/auxiliary" "-A" "unused"
[00:42:59] ------------------------------------------
[00:42:59] 
[00:42:59] ------------------------------------------
[00:42:59] stderr:
[00:42:59] stderr:
[00:42:59] ------------------------------------------
[00:42:59] {"message":"not reporting region error due to nll","code":null,"level":"warning","spans":[{"file_name":"/checkout/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs","byte_start":1582,"byte_end":1589,"line_start":55,"line_end":55,"column_start":39,"column_end":46,"is_primary":true,"text":[{"text":"    with_signature(cell, t, |cell, t| require(cell, t));","highlight_start":39,"highlight_end":46}],/projection-one-region-trait-bound-closure.rs:47:29
[00:42:59] -    |
[00:42:59] - LL |     with_signature(cell, t, |cell, t| require(cell, t));

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)

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

Seems good to me -- let me check the travis errors..

@@ -293,6 +293,11 @@ impl<R: Idx, C: Idx> SparseBitMatrix<R, C> {
///
/// Returns true if this changed the matrix, and false otherwise.
pub fn add(&mut self, row: R, column: C) -> bool {
self.vector.resize_to_elem(row, || SparseBitSet::new());
if let None = self.vector.get(row) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this if let is dead-code now, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, must have forgot to clean that up. I'll remove this in my next commit.

@@ -767,7 +781,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
locations, data
);

if let Some(borrowck_context) = &mut self.borrowck_context {
if let Some(ref mut borrowck_context) = self.borrowck_context {
Copy link
Contributor

Choose a reason for hiding this comment

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

These two are equivalent, no? I moderately prefer Some(foo) = &mut self.borrowck_context but it doesn't matter much.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I misread your previous comment about Option<&mut T> rather than &mut Option<T> and made this change due to that. I can change it back if you'd prefer.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer to change it back, yes.

Copy link
Contributor

Choose a reason for hiding this comment

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

ref mut is dead to me now :)

..
} = match &mut self.borrowck_context {
Some(borrowck_context) => borrowck_context,
} = match self.borrowck_context {
Copy link
Contributor

Choose a reason for hiding this comment

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

likely, here I personally prefer the more modern style

@nikomatsakis
Copy link
Contributor

OK, I fixed the problems I see locally. I'm going to try for a try run so we can measure the impact. I'm quite curious.

@nikomatsakis
Copy link
Contributor

@bors try

@bors
Copy link
Contributor

bors commented Jul 16, 2018

⌛ Trying commit cf3f9b9 with merge c1ea2d1...

bors added a commit that referenced this pull request Jul 16, 2018
WIP: html5ever in the rustc-perf repository is memory-intensive

Part of #52028. Rebased atop of #51987.

r? @nikomatsakis
@nikomatsakis
Copy link
Contributor

@rust-timer build c1ea2d1

@rust-timer
Copy link
Collaborator

Success: Queued c1ea2d1 with parent 3d5753f, comparison URL.

@Eh2406
Copy link
Contributor

Eh2406 commented Jul 17, 2018

11% on instructions and 83.5% max-rss for html5ever-check! and within the noize for the rest!

Also modify `SparseBitMatrix` so that it does not require knowing the
dimensions in advance, but instead grows on demand.
@nikomatsakis
Copy link
Contributor

@davidtwco I took the liberty of squashing the commits

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jul 17, 2018

@bors r+ p=1

Giving high priority because this high memory usage is a major NLL problem

@bors
Copy link
Contributor

bors commented Jul 17, 2018

📋 Looks like this PR is still in progress, ignoring approval.

Hint: Remove WIP from this PR's title when it is ready for review.

@nikomatsakis nikomatsakis changed the title WIP: html5ever in the rustc-perf repository is memory-intensive html5ever in the rustc-perf repository is memory-intensive Jul 17, 2018
@nikomatsakis
Copy link
Contributor

@bors r+ p=1

Giving high priority because this high memory usage is a major NLL problem

@bors
Copy link
Contributor

bors commented Jul 17, 2018

📌 Commit 8b94d16 has been approved by nikomatsakis

@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 Jul 17, 2018
@bors
Copy link
Contributor

bors commented Jul 17, 2018

⌛ Testing commit 8b94d16 with merge 3395384319ccc52765a13627ad41f72b40ae650b...

@bors
Copy link
Contributor

bors commented Jul 17, 2018

💔 Test failed - status-travis

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 17, 2018
@rust-highfive
Copy link
Collaborator

The job dist-powerpc64le-linux 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.
  0     0    0     0    0     0      0      0 --:--:--  0:00:51 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:52 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:53 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:54 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:55 --:--:--     0curl: (6) Could not resolve host: s3-us-west-1.amazonaws.com
[01:06:03] thread 'main' panicked at 'failed to download openssl source: exit code: 6', bootstrap/native.rs:589:17
[01:06:03] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap dist --host powerpc64le-unknown-linux-gnu --target powerpc64le-unknown-linux-gnu
[01:06:03] Build completed unsuccessfully in 1:02:17
travis_time:end:19415eb6:start=1531806310107455564,finish=1531810273565711396,duration=3963458255832

---
travis_time:end:191e222b:start=1531810274097272363,finish=1531810274102496866,duration=5224503
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:24dfc11a
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:02d6d179
travis_time:start:02d6d179
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0e95b5c8
$ dmesg | grep -i kill

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)

1 similar comment
@rust-highfive
Copy link
Collaborator

The job dist-powerpc64le-linux 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.
  0     0    0     0    0     0      0      0 --:--:--  0:00:51 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:52 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:53 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:54 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:55 --:--:--     0curl: (6) Could not resolve host: s3-us-west-1.amazonaws.com
[01:06:03] thread 'main' panicked at 'failed to download openssl source: exit code: 6', bootstrap/native.rs:589:17
[01:06:03] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap dist --host powerpc64le-unknown-linux-gnu --target powerpc64le-unknown-linux-gnu
[01:06:03] Build completed unsuccessfully in 1:02:17
travis_time:end:19415eb6:start=1531806310107455564,finish=1531810273565711396,duration=3963458255832

---
travis_time:end:191e222b:start=1531810274097272363,finish=1531810274102496866,duration=5224503
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:24dfc11a
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:02d6d179
travis_time:start:02d6d179
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0e95b5c8
$ dmesg | grep -i kill

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)

@eddyb
Copy link
Member

eddyb commented Jul 17, 2018

@bors retry

@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 Jul 17, 2018
@kennytm
Copy link
Member

kennytm commented Jul 17, 2018

@bors p=15

@bors
Copy link
Contributor

bors commented Jul 17, 2018

⌛ Testing commit 8b94d16 with merge 025e04e...

bors added a commit that referenced this pull request Jul 17, 2018
html5ever in the rustc-perf repository is memory-intensive

Part of #52028. Rebased atop of #51987.

r? @nikomatsakis
@bors
Copy link
Contributor

bors commented Jul 17, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 025e04e to master...

@bors bors merged commit 8b94d16 into rust-lang:master Jul 17, 2018
@davidtwco davidtwco deleted the issue-52028 branch July 17, 2018 14:23
nnethercote added a commit to nnethercote/rust that referenced this pull request Jul 20, 2018
Using a `BTreeMap` to represent rows in the bit matrix is really slow.
This patch changes things so that each row is represented by a
`BitVector`. This is a less sparse representation, but a much faster
one.

As a result, `SparseBitSet` and `SparseChunk` can be removed.

Other minor changes in this patch.

- It renames `BitVector::insert()` as `merge()`, which matches the
  terminology in the other classes in bitvec.rs.

- It removes `SparseBitMatrix::is_subset()`, which is unused.

- It reinstates `RegionValueElements::num_elements()`, which rust-lang#52190 had
  removed.

- It removes a low-value `debug!` call in `SparseBitMatrix::add()`.
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