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

Misc performance tweaks #57916

Merged
merged 10 commits into from
Feb 1, 2019
Merged

Misc performance tweaks #57916

merged 10 commits into from
Feb 1, 2019

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Jan 26, 2019

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 26, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.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:end:0f873c2f:start=1548515656784813265,finish=1548515735215515988,duration=78430702723
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
[00:57:52] .................................................................................................... 500/5345
[00:57:56] .............................i...................................................................... 600/5345
[00:57:59] .................................................................................................... 700/5345
[00:58:04] .................................................................................................... 800/5345
[00:58:10] .............................................F...........................i...............i.......... 900/5345
[00:58:13] ...................................................................................................i 1000/5345
[00:58:20] .................................................................................................... 1200/5345
[00:58:22] .................................................................................................... 1300/5345
[00:58:25] .................................................................................................... 1400/5345
[00:58:28] .................................................................................................... 1500/5345
[00:58:28] .................................................................................................... 1500/5345
[00:58:31] ........................................F.................................................i......... 1600/5345
[00:58:37] .................................................................................................... 1800/5345
[00:58:41] .................................................................................................... 1900/5345
[00:58:45] .................................................................................................... 2000/5345
[00:58:48] .................i.................................................................................. 2100/5345
---
[01:00:34] .................................................................................................... 4800/5345
[01:00:39] .................................................................................................... 4900/5345
[01:00:42] .................................................................................................... 5000/5345
[01:00:46] .................................................................................................... 5100/5345
[01:00:48] ...........................................................................F.F...................... 5200/5345
[01:00:53] .............................................
[01:00:53] failures:
[01:00:53] 
[01:00:53] ---- [ui] ui/consts/min_const_fn/min_const_fn_unsafe.rs stdout ----
[01:00:53] ---- [ui] ui/consts/min_const_fn/min_const_fn_unsafe.rs stdout ----
[01:00:53] diff of stderr:
[01:00:53] 
[01:00:53] + error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
[01:00:53] +    |
[01:00:53] +    |
[01:00:53] + LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe
[01:00:53] +    |                                                                             ^^^ dereference of raw pointer
[01:00:53] +    |
[01:00:53] +    = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
[01:00:53] + 
[01:00:53] 1 error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911)
[01:00:53] 3    |
[01:00:53] 
[01:00:53] 29    |     ^^^^^^^^^^^^^^^
[01:00:53] 30    |
[01:00:53] 30    |
[01:00:53] 31    = help: add #![feature(const_fn_union)] to the crate attributes to enable
[01:00:53] - 
[01:00:53] - error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
[01:00:53] -    |
[01:00:53] -    |
[01:00:53] - LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe
[01:00:53] -    |                                                                             ^^^ dereference of raw pointer
[01:00:53] -    |
[01:00:53] -    = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
[01:00:53] 41 error: aborting due to 5 previous errors
[01:00:53] 42 
[01:00:53] 
[01:00:53] 
[01:00:53] 
[01:00:53] The actual stderr differed from the expected stderr.
[01:00:53] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/min_const_fn/min_const_fn_unsafe/min_const_fn_unsafe.stderr
[01:00:53] To update references, rerun the tests and pass the `--bless` flag
[01:00:53] To only update this specific test, also pass `--test-args consts/min_const_fn/min_const_fn_unsafe.rs`
[01:00:53] error: 1 errors occurred comparing output.
[01:00:53] status: exit code: 1
[01:00:53] status: exit code: 1
[01:00:53] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.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/consts/min_const_fn/min_const_fn_unsafe/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/consts/min_const_fn/min_const_fn_unsafe/auxiliary" "-A" "unused"
[01:00:53] ------------------------------------------
[01:00:53] 
[01:00:53] ------------------------------------------
[01:00:53] stderr:
[01:00:53] stderr:
[01:00:53] ------------------------------------------
[01:00:53] {"message":"dereference of raw pointer is unsafe and requires unsafe function or block","code":{"code":"E0133","explanation":"\nUnsafe code was used outside of an unsafe function or block.\n\nErroneous code example:\n\n```compile_fail,E0133\nunsafe fn f() { return; } // This is the unsafe code\n\nfn main() {\n    f(); // error: call to unsafe function requires unsafe function or block\n}\n```\n\nUsing unsafe functionality is potentially dangerous and disallowed by safety\nchecks. Examples:\n\n* Dereferencing raw pointers\n* Calling functions via FFI\n* Calling functions marked unsafe\n\nThese safety checks can be relaxed for a section of the code by wrapping the\nunsafe instructions with an `unsafe` block. For instance:\n\n```\nunsafe fn f() { return; }\n\nfn main() {\n    unsafe { f(); } // ok!\n}\n```\n\nSee also https://doc.rust-lang.org/book/first-edition/unsafe.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs","byte_start":1789,"byte_end":1792,"line_start":50,"line_end":50,"column_start":77,"column_end":80,"is_primary":true,"text":[{"text":"const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe","highlight_start":77,"highlight_end":80}],"label":"dereference of raw pointer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block\n  --> /checkout/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs:50:77\n   |\nLL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe\n   |                                                                             ^^^ dereference of raw pointer\n   |\n   = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior\n\n"}
[01:00:53] {"message":"dereferencing raw pointers in constant functions is unstable (see issue #51911)","code":{"code":"E0658","explanation":"\nAn unstable feature was used.\n\nErroneous code example:\n\n```compile_fail,E658\n#[repr(u128)] // error: use of unstable library feature 'repr128'\nenum Foo {\n    Bar(u64),\n}\n```\n\nIf you're using a stable or a beta version of rustc, you won't be able to use\nany unstable features. In order to do so, please switch to a nightly version of\nrustc (by using rustup).\n\nIf you're using a nightly version of rustc, just add the corresponding feature\nto be able to use it:\n\n```\n#![feature(repr128)]\n\n#[repr(u128)] // ok!\nenum Foo {\n    Bar(u64),\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs","byte_start":1789,"byte_end":1792,"line_start":50,"line_end":50,"column_start":77,"column_end":80,"is_primary":true,"text":[{"text":"const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe","highlight_start":77,"highlight_end":80}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"add #![feature(const_raw_ptr_deref)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911)\n  --> /checkout/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs:50:77\n   |\nLL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe\n   |                                                                             ^^^\n   |\n   = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable\n\n"}
[01:00:53] {"message":"dereferencing raw pointers in constant functions is unstable (see issue #51911)","code":{"code":"E0658","explanation":"\nAn unstable feature was used.\n\nErroneous code example:\n\n```compile_fail,E658\n#[repr(u128)] // error: use of unstable library feature 'repr128'\nenum Foo {\n    Bar(u64),\n}\n```\n\nIf you're using a stable or a beta version of rustc, you won't be able to use\nany unstable features. In order to do so, please switch to a nightly version of\nrustc (by using rustup).\n\nIf you're using a nightly version of rustc, just add the corresponding feature\nto be able to use it:\n\n```\n#![feature(repr128)]\n\n#[repr(u128)] // ok!\nenum Foo {\n    Bar(u64),\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs","byte_start":1935,"byte_end":1937,"line_start":53,"line_end":53,"column_start":70,"column_end":72,"is_primary":true,"text":[{"text":"const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x }","highlight_start":70,"highlight_end":72}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"add #![feature(const_raw_ptr_deref)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911)\n  --> /checkout/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs:53:70\n   |\nLL | const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x }\n   |                                                                      ^^\n   |\n   = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable\n\n"}
[01:00:53] {"message":"dereferencing raw pointers in constant functions is unstable (see issue #51911)","code":{"code":"E0658","explanation":"\nAn unstable feature was used.\n\nErroneous code example:\n\n```compile_fail,E658\n#[repr(u128)] // error: use of unstable library feature 'repr128'\nenum Foo {\n    Bar(u64),\n}\n```\n\nIf you're using a stable or a beta version of rustc, you won't be able to use\nany unstable features. In order to do so, please switch to a nightly version of\nrustc (by using rustup).\n\nIf you're using a nightly version of rustc, just add the corresponding feature\nto be able to use it:\n\n```\n#![feature(repr128)]\n\n#[repr(u128)] // ok!\nenum Foo {\n    Bar(u64),\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs","byte_start":2077,"byte_end":2080,"line_start":56,"line_end":56,"column_start":83,"column_end":86,"is_primary":true,"text":[{"text":"const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x }","highlight_start":83,"highlight_end":86}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"add #![feature(const_raw_ptr_deref)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911)\n  --> /checkout/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs:56:83\n   |\nLL | const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x }\n   |                                                                                   ^^^\n   |\n   = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable\n\n"}
[01:00:53] {"message":"unions in const fn are unstable (see issue #51909)","code":{"code":"E0658","explanation":"\nAn unstable feature was used.\n\nErroneous code example:\n\n```compile_fail,E658\n#[repr(u128)] // error: use of unstable library feature 'repr128'\nenum Foo {\n    Bar(u64),\n}\n```\n\nIf you're using a stable or a beta version of rustc, you won't be able to use\nany unstable features. In order to do so, please switch to a nightly version of\nrustc (by using rustup).\n\nIf you're using a nightly version of rustc, just add the corresponding feature\nto be able to use it:\n\n```\n#![feature(repr128)]\n\n#[repr(u128)] // ok!\nenum Foo {\n    Bar(u64),\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs","byte_start":2216,"byte_end":2231,"line_start":63,"line_end":63,"column_start":5,"column_end":20,"is_primary":true,"text":[{"text":"    Foo { x: () }.y","highlight_start":5,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"add #![feature(const_fn_union)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0658]: unions in const fn are unstable (see issue #51909)\n  --> /checkout/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs:63:5\n   |\nLL |     Foo { x: () }.y\n   |     ^^^^^^^^^^^^^^^\n   |\n   = help: add #![feature(const_fn_union)] to the crate attributes to enable\n\n"}
[01:00:53] {"message":"aborting due to 5 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 5 previous errors\n\n"}
[01:00:53] {"message":"Some errors occurred: E0133, E0658.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0133, E0658.\n"}
[01:00:53] 
[01:00:53] ------------------------------------------
[01:00:53] 
[01:00:53] thread '[ui] ui/consts/min_const_fn/min_const_fn_unsafe.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3287:9
---
[01:00:53] 16 
[01:00:53] - error[E0208]: []
[01:00:53] -   --> $DIR/feature-gate-rustc-attrs-1.rs:8:1
[01:00:53] -    |
[01:00:53] - LL | fn main() {} //~ ERROR []
[01:00:53] + error: aborting due to 2 previous errors
[01:00:53] 22 
[01:00:53] - error: aborting due to 3 previous errors
[01:00:53] - 
[01:00:53] - 
[01:00:53] - Some errors occurred: E0208, E0658.
[01:00:53] - For more information about an error, try `rustc --explain E0208`.
[01:00:53] + For more information about this error, try `rustc --explain E0658`.
[01:00:53] 27 
[01:00:53] 
[01:00:53] 
[01:00:53] The actual stderr differed from the expected stderr.
[01:00:53] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gates/feature-gate-rustc-attrs-1/feature-gate-rustc-attrs-1.stderr
[01:00:53] To update references, rerun the tests and pass the `--bless` flag
[01:00:53] To only update this specific test, also pass `--test-args feature-gates/feature-gate-rustc-attrs-1.rs`
[01:00:53] error: 1 errors occurred comparing output.
[01:00:53] status: exit code: 1
[01:00:53] status: exit code: 1
[01:00:53] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/feature-gates/feature-gate-rustc-attrs-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/feature-gates/feature-gate-rustc-attrs-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/feature-gates/feature-gate-rustc-attrs-1/auxiliary" "-A" "unused"
[01:00:53] ------------------------------------------
[01:00:53] 
[01:00:53] ------------------------------------------
[01:00:53] stderr:
[01:00:53] stderr:
[01:00:53] ------------------------------------------
[01:00:53] {"message":"the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable (see issue #29642)","code":{"code":"E0658","explanation":"\nAn unstable feature was used.\n\nErroneous code example:\n\n```compile_fail,E658\n#[repr(u128)] // error: use of unstable library feature 'repr128'\nenum Foo {\n    Bar(u64),\n}\n```\n\nIf you're using a stable or a beta version of rustc, you won't be able to use\nany unstable features. In order to do so, please switch to a nightly version of\nrustc (by using rustup).\n\nIf you're using a nightly version of rustc, just add the corresponding feature\nto be able to use it:\n\n```\n#![feature(repr128)]\n\n#[repr(u128)] // ok!\nenum Foo {\n    Bar(u64),\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.rs","byte_start":106,"byte_end":123,"line_start":5,"line_end":5,"column_start":1,"column_end":18,"is_primary":true,"text":[{"text":"#[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable","highlight_start":1,"highlight_end":18}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"add #![feature(rustc_attrs)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0658]: the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable (see issue #29642)\n  --> /checkout/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.rs:5:1\n   |\nLL | #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable\n   | ^^^^^^^^^^^^^^^^^\n   |\n   = help: add #![feature(rustc_attrs)] to the crate attributes to enable\n\n"}
[01:00:53] {"message":"the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable (see issue #29642)","code":{"code":"E0658","explanation":"\nAn unstable feature was used.\n\nErroneous code example:\n\n```compile_fail,E658\n#[repr(u128)] // error: use of unstable library feature 'repr128'\nenum Foo {\n    Bar(u64),\n}\n```\n\nIf you're using a stable or a beta version of rustc, you won't be able to use\nany unstable features. In order to do so, please switch to a nightly version of\nrustc (by using rustup).\n\nIf you're using a nightly version of rustc, just add the corresponding feature\nto be able to use it:\n\n```\n#![feature(repr128)]\n\n#[repr(u128)] // ok!\nenum Foo {\n    Bar(u64),\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.rs","byte_start":227,"byte_end":241,"line_start":6,"line_end":6,"column_start":1,"column_end":15,"is_primary":true,"text":[{"text":"#[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable","highlight_start":1,"highlight_end":15}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"add #![feature(rustc_attrs)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0658]: the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable (see issue #29642)\n  --> /checkout/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.rs:6:1\n   |\nLL | #[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable\n   | ^^^^^^^^^^^^^^\n   |\n   = help: add #![feature(rustc_attrs)] to the crate attributes to enable\n\n"}
[01:00:53] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[01:00:53] 
[01:00:53] ------------------------------------------
[01:00:53] 
[01:00:53] thread '[ui] ui/feature-gates/feature-gate-rustc-attrs-1.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3287:9
[01:00:53] thread '[ui] ui/feature-gates/feature-gate-rustc-attrs-1.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3287:9
[01:00:53] 
[01:00:53] ---- [ui] ui/unsafe/ranged_ints2_const.rs stdout ----
[01:00:53] diff of stderr:
[01:00:53] 
[01:00:53] + error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block
[01:00:53] +    |
[01:00:53] +    |
[01:00:53] + LL |     let y = &mut x.0; //~ ERROR references in const fn are unstable
[01:00:53] +    |             ^^^^^^^^ mutation of layout constrained field
[01:00:53] +    |
[01:00:53] +    = note: mutating layout constrained fields cannot statically be checked for valid values
[01:00:53] 1 error: mutable references in const fn are unstable
[01:00:53] 2   --> $DIR/ranged_ints2_const.rs:11:9
[01:00:53] 3    |
[01:00:53] 
[01:00:53] 
[01:00:53] 9    |
[01:00:53] 10 LL |     let y = unsafe { &mut x.0 }; //~ ERROR mutable references in const fn are unstable
[01:00:53] - 
[01:00:53] - 
[01:00:53] - error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block
[01:00:53] -    |
[01:00:53] -    |
[01:00:53] - LL |     let y = &mut x.0; //~ ERROR references in const fn are unstable
[01:00:53] -    |             ^^^^^^^^ mutation of layout constrained field
[01:00:53] -    |
[01:00:53] -    = note: mutating layout constrained fields cannot statically be checked for valid values
[01:00:53] 21 error: aborting due to 3 previous errors
[01:00:53] 22 
[01:00:53] 
[01:00:53] 
[01:00:53] 
[01:00:53] The actual stderr differed from the expected stderr.
[01:00:53] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unsafe/ranged_ints2_const/ranged_ints2_const.stderr
[01:00:53] To update references, rerun the tests and pass the `--bless` flag
[01:00:53] To only update this specific test, also pass `--test-args unsafe/ranged_ints2_const.rs`
[01:00:53] error: 1 errors occurred comparing output.
[01:00:53] status: exit code: 1
[01:00:53] status: exit code: 1
[01:00:53] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/unsafe/ranged_ints2_const.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/unsafe/ranged_ints2_const/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/unsafe/ranged_ints2_const/auxiliary" "-A" "unused"
[01:00:53] ------------------------------------------
[01:00:53] 
[01:00:53] ------------------------------------------
[01:00:53] stderr:
[01:00:53] stderr:
[01:00:53] ------------------------------------------
[01:00:53] {"message":"mutation of layout constrained field is unsafe and requires unsafe function or block","code":{"code":"E0133","explanation":"\nUnsafe code was used outside of an unsafe function or block.\n\nErroneous code example:\n\n```compile_fail,E0133\nunsafe fn f() { return; } // This is the unsafe code\n\nfn main() {\n    f(); // error: call to unsafe function requires unsafe function or block\n}\n```\n\nUsing unsafe functionality is potentially dangerous and disallowed by safety\nchecks. Examples:\n\n* Dereferencing raw pointers\n* Calling functions via FFI\n* Calling functions marked unsafe\n\nThese safety checks can be relaxed for a section of the code by wrapping the\nunsafe instructions with an `unsafe` block. For instance:\n\n```\nunsafe fn f() { return; }\n\nfn main() {\n    unsafe { f(); } // ok!\n}\n```\n\nSee also https://doc.rust-lang.org/book/first-edition/unsafe.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsafe/ranged_ints2_const.rs","byte_start":234,"byte_end":242,"line_start":11,"line_end":11,"column_start":13,"column_end":21,"is_primary":true,"text":[{"text":"    let y = &mut x.0; //~ ERROR references in const fn are unstable","highlight_start":13,"highlight_end":21}],"label":"mutation of layout constrained field","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"mutating layout constrained fields cannot statically be checked for valid values","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block\n  --> /checkout/src/test/ui/unsafe/ranged_ints2_const.rs:11:13\n   |\nLL |     let y = &mut x.0; //~ ERROR references in const fn are unstable\n   |             ^^^^^^^^ mutation of layout constrained field\n   |\n   = note: mutating layout constrained fields cannot statically be checked for valid values\n\n"}
[01:00:53] {"message":"mutable references in const fn are unstable","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsafe/ranged_ints2_const.rs","byte_start":230,"byte_end":231,"line_start":11,"line_end":11,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    let y = &mut x.0; //~ ERROR references in const fn are unstable","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: mutable references in const fn are unstable\n  --> /checkout/src/test/ui/unsafe/ranged_ints2_const.rs:11:9\n   |\nLL |     let y = &mut x.0; //~ ERROR references in const fn are unstable\n   |         ^\n\n"}
[01:00:53] {"message":"mutable references in const fn are unstable","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsafe/ranged_ints2_const.rs","byte_start":461,"byte_end":462,"line_start":18,"line_end":18,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    let y = unsafe { &mut x.0 }; //~ ERROR mutable references in const fn are unstable","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: mutable references in const fn are unstable\n  --> /checkout/src/test/ui/unsafe/ranged_ints2_const.rs:18:9\n   |\nLL |     let y = unsafe { &mut x.0 }; //~ ERROR mutable references in const fn are unstable\n   |         ^\n\n"}
[01:00:53] {"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 3 previous errors\n\n"}
[01:00:53] 
[01:00:53] ------------------------------------------
[01:00:53] 
[01:00:53] thread '[ui] ui/unsafe/ranged_ints2_const.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3287:9
[01:00:53] thread '[ui] ui/unsafe/ranged_ints2_const.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3287:9
[01:00:53] 
[01:00:53] ---- [ui] ui/unsafe/ranged_ints3_const.rs stdout ----
[01:00:53] diff of stderr:
[01:00:53] 
[01:00:53] + error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block
[01:00:53] +    |
[01:00:53] +    |
[01:00:53] + LL |     let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability
[01:00:53] +    |             ^^^^ borrow of layout constrained field with interior mutability
[01:00:53] +    |
[01:00:53] +    = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values
[01:00:53] + 
[01:00:53] 1 error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead
[01:00:53] 3    |
[01:00:53] 
[01:00:53] 9    |
[01:00:53] 9    |
[01:00:53] 10 LL |     let y = unsafe { &x.0 }; //~ ERROR cannot borrow a constant which may contain interior mut
[01:00:53] - 
[01:00:53] - 
[01:00:53] - error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block
[01:00:53] -    |
[01:00:53] -    |
[01:00:53] - LL |     let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability
[01:00:53] -    |             ^^^^ borrow of layout constrained field with interior mutability
[01:00:53] -    |
[01:00:53] -    = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values
[01:00:53] 21 error: aborting due to 3 previous errors
[01:00:53] 22 
[01:00:53] 
[01:00:53] 
[01:00:53] 
[01:00:53] The actual stderr differed from the expected stderr.
[01:00:53] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unsafe/ranged_ints3_const/ranged_ints3_const.stderr
[01:00:53] To update references, rerun the tests and pass the `--bless` flag
[01:00:53] To only update this specific test, also pass `--test-args unsafe/ranged_ints3_const.rs`
[01:00:53] error: 1 errors occurred comparing output.
[01:00:53] status: exit code: 1
[01:00:53] status: exit code: 1
[01:00:53] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/unsafe/ranged_ints3_const.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/unsafe/ranged_ints3_const/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/unsafe/ranged_ints3_const/auxiliary" "-A" "unused"
[01:00:53] ------------------------------------------
[01:00:53] 
[01:00:53] ------------------------------------------
[01:00:53] stderr:
[01:00:53] stderr:
[01:00:53] ------------------------------------------
[01:00:53] {"message":"borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block","code":{"code":"E0133","explanation":"\nUnsafe code was used outside of an unsafe function or block.\n\nErroneous code example:\n\n```compile_fail,E0133\nunsafe fn f() { return; } // This is the unsafe code\n\nfn main() {\n    f(); // error: call to unsafe function requires unsafe function or block\n}\n```\n\nUsing unsafe functionality is potentially dangerous and disallowed by safety\nchecks. Examples:\n\n* Dereferencing raw pointers\n* Calling functions via FFI\n* Calling functions marked unsafe\n\nThese safety checks can be relaxed for a section of the code by wrapping the\nunsafe instructions with an `unsafe` block. For instance:\n\n```\nunsafe fn f() { return; }\n\nfn main() {\n    unsafe { f(); } // ok!\n}\n```\n\nSee also https://doc.rust-lang.org/book/first-edition/unsafe.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsafe/ranged_ints3_const.rs","byte_start":272,"byte_end":276,"line_start":12,"line_end":12,"column_start":13,"column_end":17,"is_primary":true,"text":[{"text":"    let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability","highlight_start":13,"highlight_end":17}],"label":"borrow of layout constrained field with interior mutability","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block\n  --> /checkout/src/test/ui/unsafe/ranged_ints3_const.rs:12:13\n   |\nLL |     let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability\n   |             ^^^^ borrow of layout constrained field with interior mutability\n   |\n   = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values\n\n"}
[01:00:53] {"message":"cannot borrow a constant which may contain interior mutability, create a static instead","code":{"code":"E0492","explanation":"\nA borrow of a constant containing interior mutability was attempted. Erroneous\ncode example:\n\n```compile_fail,E0492\nuse std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};\n\nconst A: AtomicUsize = ATOMIC_USIZE_INIT;\nstatic B: &'static AtomicUsize = &A;\n// error: cannot borrow a constant which may contain interior mutability,\n//        create a static instead\n```\n\nA `const` represents a constant value that should never change. If one takes\na `&` reference to the constant, then one is taking a pointer to some memory\nlocation containing the value. Normally this is perfectly fine: most values\ncan't be changed via a shared `&` pointer, but interior mutability would allow\nit. That is, a constant value could be mutated. On the other hand, a `static` is\nexplicitly a single memory location, which can be mutated at will.\n\nSo, in order to solve this error, either use statics which are `Sync`:\n\n```\nuse std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};\n\nstatic A: AtomicUsize = ATOMIC_USIZE_INIT;\nstatic B: &'static AtomicUsize = &A; // ok!\n```\n\nYou can also have this error while using a cell type:\n\n```compile_fail,E0492\nuse std::cell::Cell;\n\nconst A: Cell<usize> = Cell::new(1);\nconst B: &Cell<usize> = &A;\n// error: cannot borrow a constant which may contain interior mutability,\n//        create a static instead\n\n// or:\nstruct C { a: Cell<usize> }\n\nconst D: C = C { a: Cell::new(1) };\nconst E: &Cell<usize> = &D.a; // error\n\n// or:\nconst F: &C = &D; // error\n```\n\nThis is because cell types do operations that are not thread-safe. Due to this,\nthey don't implement Sync and thus can't be placed in statics.\n\nHowever, if you still wish to use these types, you can achieve this by an unsafe\nwrapper:\n\n```\nuse std::cell::Cell;\nuse std::marker::Sync;\n\nstruct NotThreadSafe<T> {\n    value: Cell<T>,\n}\n\nunsafe impl<T> Sync for NotThreadSafe<T> {}\n\nstatic A: NotThreadSafe<usize> = NotThreadSafe { value : Cell::new(1) };\nstatic B: &'static NotThreadSafe<usize> = &A; // ok!\n```\n\nRemember this solution is unsafe! You will have to ensure that accesses to the\ncell are synchronized.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsafe/ranged_ints3_const.rs","byte_start":272,"byte_end":276,"line_start":12,"line_end":12,"column_start":13,"column_end":17,"is_primary":true,"text":[{"text":"    let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability","highlight_start":13,"highlight_end":17}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead\n  --> /checkout/src/test/ui/unsafe/ranged_ints3_const.rs:12:13\n   |\nLL |     let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability\n   |             ^^^^\n\n"}
[01:00:53] {"message":"cannot borrow a constant which may contain interior mutability, create a static instead","code":{"code":"E0492","explanation":"\nA borrow of a constant containing interior mutability was attempted. Erroneous\ncode example:\n\n```compile_fail,E0492\nuse std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};\n\nconst A: AtomicUsize = ATOMIC_USIZE_INIT;\nstatic B: &'static AtomicUsize = &A;\n// error: cannot borrow a constant which may contain interior mutability,\n//        create a static instead\n```\n\nA `const` represents a constant value that should never change. If one takes\na `&` reference to the constant, then one is taking a pointer to some memory\nlocation containing the value. Normally this is perfectly fine: most values\ncan't be changed via a shared `&` pointer, but interior mutability would allow\nit. That is, a constant value could be mutated. On the other hand, a `static` is\nexplicitly a single memory location, which can be mutated at will.\n\nSo, in order to solve this error, either use statics which are `Sync`:\n\n```\nuse std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};\n\nstatic A: AtomicUsize = ATOMIC_USIZE_INIT;\nstatic B: &'static AtomicUsize = &A; // ok!\n```\n\nYou can also have this error while using a cell type:\n\n```compile_fail,E0492\nuse std::cell::Cell;\n\nconst A: Cell<usize> = Cell::new(1);\nconst B: &Cell<usize> = &A;\n// error: cannot borrow a constant which may contain interior mutability,\n//        create a static instead\n\n// or:\nstruct C { a: Cell<usize> }\n\nconst D: C = C { a: Cell::new(1) };\nconst E: &Cell<usize> = &D.a; // error\n\n// or:\nconst F: &C = &D; // error\n```\n\nThis is because cell types do operations that are not thread-safe. Due to this,\nthey don't implement Sync and thus can't be placed in statics.\n\nHowever, if you still wish to use these types, you can achieve this by an unsafe\nwrapper:\n\n```\nuse std::cell::Cell;\nuse std::marker::Sync;\n\nstruct NotThreadSafe<T> {\n    value: Cell<T>,\n}\n\nunsafe impl<T> Sync for NotThreadSafe<T> {}\n\nstatic A: NotThreadSafe<usize> = NotThreadSafe { value : Cell::new(1) };\nstatic B: &'static NotThreadSafe<usize> = &A; // ok!\n```\n\nRemember this solution is unsafe! You will have to ensure that accesses to the\ncell are synchronized.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsafe/ranged_ints3_const.rs","byte_start":576,"byte_end":580,"line_start":19,"line_end":19,"column_start":22,"column_end":26,"is_primary":true,"text":[{"text":"    let y = unsafe { &x.0 }; //~ ERROR cannot borrow a constant which may contain interior mut","highlight_start":22,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead\n  --> /checkout/src/test/ui/unsafe/ranged_ints3_const.rs:19:22\n   |\nLL |     let y = unsafe { &x.0 }; //~ ERROR cannot borrow a constant which may contain interior mut\n   |                      ^^^^\n\n"}
[01:00:53] {"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 3 previous errors\n\n"}
[01:00:53] {"message":"Some errors occurred: E0133, E0492.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0133, E0492.\n"}
[01:00:53] 
[01:00:53] ------------------------------------------
[01:00:53] 
[01:00:53] thread '[ui] ui/unsafe/ranged_ints3_const.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3287:9
---
[01:00:53] 
[01:00:53] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:495:22
[01:00:53] 
[01:00:53] 
[01:00:53] 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-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--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" "6.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"
[01:00:53] 
[01:00:53] 
[01:00:53] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:00:53] Build completed unsuccessfully in 0:04:15
[01:00:53] Build completed unsuccessfully in 0:04:15
[01:00:53] make: *** [check] Error 1
[01:00:53] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:09b421c0
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Sat Jan 26 16:16:37 UTC 2019

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)

@Zoxc
Copy link
Contributor Author

Zoxc commented Jan 27, 2019

@bors try

@bors
Copy link
Contributor

bors commented Jan 27, 2019

⌛ Trying commit d3ddf1d with merge 0d4be3f...

bors added a commit that referenced this pull request Jan 27, 2019
@bors
Copy link
Contributor

bors commented Jan 27, 2019

☀️ Test successful - checks-travis
State: approved= try=True

@Zoxc
Copy link
Contributor Author

Zoxc commented Jan 27, 2019

@rust-timer build 0d4be3f

@rust-timer
Copy link
Collaborator

Success: Queued 0d4be3f with parent 01af120, comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 0d4be3f

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.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:end:05fa25d4:start=1548711101806335765,finish=1548711105375543834,duration=3569208069
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
[01:03:37] .................................................................................................... 1200/2946
[01:03:47] .................................................................................................... 1300/2946
[01:03:58] .................................................................................................... 1400/2946
[01:04:10] .................................................................................................... 1500/2946
[01:04:19] ......................................................................i.....................F....... 1600/2946
[01:04:44] .................................................................................................... 1800/2946
[01:04:54] ..................................................................................................i. 1900/2946
[01:05:08] .....................................................................i.............................. 2000/2946
[01:05:32] .................................................................................................... 2100/2946
---
[01:07:39] failures:
[01:07:39] 
[01:07:39] ---- [run-pass] run-pass/issues/issue-50689.rs stdout ----
[01:07:39] 
[01:07:39] error: test compilation failed although it shouldn't!
[01:07:39] status: exit code: 101
[01:07:39] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass/issues/issue-50689.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/run-pass/issues/issue-50689/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/run-pass/issues/issue-50689/auxiliary"
[01:07:39] ------------------------------------------
[01:07:39] 
[01:07:39] ------------------------------------------
[01:07:39] stderr:
[01:07:39] stderr:
[01:07:39] ------------------------------------------
[01:07:39] {"message":"src/librustc_mir/build/mod.rs:71: can't build MIR for DefId(0/0:3 ~ issue_50689[317d]::Foo[0])","code":null,"level":"error: internal compiler error","spans":[{"file_name":"/checkout/src/test/run-pass/issues/issue-50689.rs","byte_start":40,"byte_end":84,"line_start":3,"line_end":5,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"enum Foo {","highlight_start":1,"highlight_end":11},{"text":"    Bar = (|x: i32| { }, 42).1,","highlight_start":1,"highlight_end":32},{"text":"}","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: internal compiler error: src/librustc_mir/build/mod.rs:71: can't build MIR for DefId(0/0:3 ~ issue_50689[317d]::Foo[0])\n  --> /checkout/src/test/run-pass/issues/issue-50689.rs:3:1\n   |\nLL | / enum Foo {\nLL | |     Bar = (|x: i32| { }, 42).1,\nLL | | }\n   | |_^\n\n"}
[01:07:39] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:07:39] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[01:07:39] 
[01:07:39] note: the compiler unexpectedly panicked. this is a bug.
[01:07:39] note: the compiler unexpectedly panicked. this is a bug.
[01:07:39] 
[01:07:39] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[01:07:39] 
[01:07:39] note: rustc 1.34.0-dev running on x86_64-unknown-linux-gnu
[01:07:39] 
[01:07:39] note: compiler flags: -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath
[01:07:39] 
[01:07:39] ------------------------------------------
[01:07:39] 
[01:07:39] thread '[run-pass] run-pass/issues/issue-50689.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3288:9
---
[01:07:39] 
[01:07:39] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:495:22
[01:07:39] 
[01:07:39] 
[01:07:39] 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/run-pass" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-pass" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--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" "6.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"
[01:07:39] 
[01:07:39] 
[01:07:39] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:07:39] Build completed unsuccessfully in 0:10:06
[01:07:39] Build completed unsuccessfully in 0:10:06
[01:07:39] Makefile:48: recipe for target 'check' failed
[01:07:39] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:04d8d054
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Jan 28 22:39:35 UTC 2019
---
travis_time:end:023a2273:start=1548715176468227707,finish=1548715176472529059,duration=4301352
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0fe4f289
$ 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 --batch -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:238f13a4
travis_time:start:238f13a4
$ 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:06779d54
$ 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)

@michaelwoerister
Copy link
Member

Thanks, @Zoxc! The effects are not big but they all go towards compile time reduction. I'll review some time later this week.

impl_disk_cacheable_query!(specialization_graph_of, |_| true);
impl_disk_cacheable_query!(mir_borrowck, |tcx, def_id| {
def_id.is_local() && tcx.is_closure(def_id)
});
Copy link
Member

Choose a reason for hiding this comment

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

What's the motivation here? If the result is requested (even if it's not used) then the query will be re-run. So unless we make sure that only ensure is used in all cases that don't need the result, this could backfire. There's at least one case where ensure is not used here:

|| tcx.par_body_owners(|def_id| { tcx.mir_borrowck(def_id); }));

I wonder if this is worth the risk.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just to avoid spending time storing the results of mir_borrowck for cases where it will never be used again.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that makes sense. I wondering though if there's a way of making sure that this doesn't silently break. If somebody adds a non-ensure() call to mir_borrowck it would go mostly unnoticed. Well, I guess we would notice on perf.rlo after the fact.

@michaelwoerister
Copy link
Member

I like the tcx.ensure().foo() construction :)

@bors r+

@bors
Copy link
Contributor

bors commented Feb 1, 2019

📌 Commit ee229f7 has been approved by michaelwoerister

@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 Feb 1, 2019
@bors
Copy link
Contributor

bors commented Feb 1, 2019

⌛ Testing commit ee229f7 with merge c9a8687...

bors added a commit that referenced this pull request Feb 1, 2019
@bors
Copy link
Contributor

bors commented Feb 1, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants