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

Make use of `ptr::null(_mut)` instead of casting zero #61864

Merged
merged 1 commit into from Jun 18, 2019

Conversation

Projects
None yet
4 participants
@lzutao
Copy link
Contributor

commented Jun 15, 2019

There are few places that I don't replace the zero casting pointer with ptr::null
or ptr::null_mut:

% git grep -E '[ ([{]0 as \*'
src/libcore/ptr/mod.rs:216:pub const fn null<T>() -> *const T { 0 as *const T }
src/libcore/ptr/mod.rs:231:pub const fn null_mut<T>() -> *mut T { 0 as *mut T }
src/test/run-pass/consts/const-cast-ptr-int.rs:12:static a: TestStruct = TestStruct{x: 0 as *const u8};
src/test/ui/issues/issue-45730.rs:5:    let x: *const _ = 0 as *const _; //~ ERROR cannot cast
src/test/ui/issues/issue-45730.rs:8:    let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast
src/test/ui/issues/issue-45730.stderr:14:LL |     let x: *const _ = 0 as *const _;
src/test/ui/issues/issue-45730.stderr:24:LL |     let x = 0 as *const i32 as *const _ as *mut _;
src/test/ui/lint/lint-forbid-internal-unsafe.rs:15:    println!("{}", evil!(*(0 as *const u8)));
src/test/ui/order-dependent-cast-inference.rs:5:    let mut y = 0 as *const _;
src/test/ui/order-dependent-cast-inference.stderr:4:LL |     let mut y = 0 as *const _;

r? @sfackler

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jun 15, 2019

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:1c78860c:start=1560585662043220414,finish=1560585664303217672,duration=2259997258
$ 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
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:56:28] .................................................................................................... 400/5680
[00:56:31] .................................................................................................... 500/5680
[00:56:35] ...................................i................................................................ 600/5680
[00:56:39] .................................................................................................... 700/5680
[00:56:43] ........................................................................................F........... 800/5680
[00:56:53] ......................................i...........i................................................. 1000/5680
[00:56:55] ...................................................................iiiii............................ 1100/5680
[00:56:59] .................................................................................................... 1200/5680
[00:57:02] .................................................................................................... 1300/5680
[00:57:02] .................................................................................................... 1300/5680
[00:57:04] ................................................................................................F.F. 1400/5680
[00:57:07] .....................................F.............................................................. 1500/5680
[00:57:10] ...........................F........................................................................ 1600/5680
[00:57:16] ..i................................................................................................. 1800/5680
[00:57:20] .................................................................................................... 1900/5680
[00:57:23] .................................................................................................... 2000/5680
[00:57:27] .................................................................................................... 2100/5680
[00:57:27] .................................................................................................... 2100/5680
[00:57:30] ...........................................i........................F............................... 2200/5680
[00:57:38] .................................................................................................... 2400/5680
[00:57:42] .................................................................................................... 2500/5680
[00:57:46] .................................................................................................... 2600/5680
[00:57:50] .................................................................................................... 2700/5680
---
[00:58:10] .................................................................................................... 3200/5680
[00:58:14] .................................................................................................... 3300/5680
[00:58:17] ........................................................................................i........... 3400/5680
[00:58:21] .................................................................................................... 3500/5680
[00:58:24] ..............................F...............................ii...i...ii........................... 3600/5680
[00:58:32] .................................................................................................... 3800/5680
[00:58:35] ........................................................................ii.......................... 3900/5680
[00:58:38] .............................................................................................i...... 4000/5680
[00:58:40] .................................................................................................... 4100/5680
---
[00:59:49] failures:
[00:59:49] 
[00:59:49] ---- [ui] ui/consts/const-eval/ice-generic-assoc-const.rs stdout ----
[00:59:49] 
[00:59:49] error: test compilation failed although it shouldn't!
[00:59:49] status: exit code: 1
[00:59:49] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/consts/const-eval/ice-generic-assoc-const.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/ice-generic-assoc-const" "-Crpath" "-O" "-Cdebuginfo=0" "-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/const-eval/ice-generic-assoc-const/auxiliary" "-A" "unused"
[00:59:49] ------------------------------------------
[00:59:49] 
[00:59:49] ------------------------------------------
[00:59:49] stderr:
[00:59:49] stderr:
[00:59:49] ------------------------------------------
[00:59:49] error: chained comparison operators require parentheses
[00:59:49]   --> /checkout/src/test/ui/consts/const-eval/ice-generic-assoc-const.rs:10:39
[00:59:49]    |
[00:59:49] LL |     const NULL: Self = core::ptr::null<T>();
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49]    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] error[E0423]: expected value, found type parameter `T`
[00:59:49]   --> /checkout/src/test/ui/consts/const-eval/ice-generic-assoc-const.rs:10:40
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     const NULL: Self = core::ptr::null<T>();
[00:59:49]    |                                        ^ not a value
[00:59:49] 
[00:59:49] error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     const NULL: Self = core::ptr::null<T>();
[00:59:49]    |                        ---------------^- _
[00:59:49]    |                        |
[00:59:49]    |                        fn() -> *const _ {std::ptr::null::<_>}
[00:59:49]    |
[00:59:49]    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] error[E0308]: mismatched types
[00:59:49]   --> /checkout/src/test/ui/consts/const-eval/ice-generic-assoc-const.rs:10:24
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     const NULL: Self = core::ptr::null<T>();
[00:59:49]    |                        ^^^^^^^^^^^^^^^^^^^^ expected *-ptr, found bool
[00:59:49]    = note: expected type `*const T`
[00:59:49]               found type `bool`
[00:59:49] 
[00:59:49] error: aborting due to 4 previous errors
---
[00:59:49] 
[00:59:49] + error: chained comparison operators require parentheses
[00:59:49] +   --> $DIR/E0605.rs:5:27
[00:59:49] +    |
[00:59:49] + LL |     let v = std::ptr::null<u8>;
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] +    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49] +    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] + error: expected expression, found `;`
[00:59:49] +   --> $DIR/E0605.rs:5:31
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let v = std::ptr::null<u8>;
[00:59:49] + 
[00:59:49] 1 error[E0605]: non-primitive cast: `u8` as `std::vec::Vec<u8>`
[00:59:49] 2   --> $DIR/E0605.rs:3:5
[00:59:49] 3    |
[00:59:49] 3    |
[00:59:49] 
[00:59:49] 6    |
[00:59:49] 7    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 8 
[00:59:49] - error[E0605]: non-primitive cast: `*const u8` as `&u8`
[00:59:49] -   --> $DIR/E0605.rs:6:5
[00:59:49] -    |
[00:59:49] - LL |     v as &u8;
[00:59:49] -    |
[00:59:49] -    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] - 
[00:59:49] - error: aborting due to 2 previous errors
[00:59:49] - error: aborting due to 2 previous errors
[00:59:49] + error: aborting due to 3 previous errors
[00:59:49] 18 
[00:59:49] 19 For more information about this error, try `rustc --explain E0605`.
[00:59:49] 20 
[00:59:49] 
[00:59:49] 
[00:59:49] The actual stderr differed from the expected stderr.
[00:59:49] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0605/E0605.stderr
[00:59:49] To update references, rerun the tests and pass the `--bless` flag
[00:59:49] To only update this specific test, also pass `--test-args error-codes/E0605.rs`
[00:59:49] error: 1 errors occurred comparing output.
[00:59:49] status: exit code: 1
[00:59:49] status: exit code: 1
[00:59:49] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/error-codes/E0605.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0605" "-Crpath" "-O" "-Cdebuginfo=0" "-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/error-codes/E0605/auxiliary" "-A" "unused"
[00:59:49] ------------------------------------------
[00:59:49] 
[00:59:49] ------------------------------------------
[00:59:49] stderr:
[00:59:49] stderr:
[00:59:49] ------------------------------------------
[00:59:49] error: chained comparison operators require parentheses
[00:59:49]   --> /checkout/src/test/ui/error-codes/E0605.rs:5:27
[00:59:49]    |
[00:59:49] LL |     let v = std::ptr::null<u8>;
[00:59:49]    |                           ^^^^^
[00:59:49]    |
[00:59:49]    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49]    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] error: expected expression, found `;`
[00:59:49]   --> /checkout/src/test/ui/error-codes/E0605.rs:5:31
[00:59:49]    |
[00:59:49] LL |     let v = std::ptr::null<u8>;
[00:59:49] LL |     let v = std::ptr::null<u8>;
[00:59:49]    |                               ^ expected expression
[00:59:49] 
[00:59:49] error[E0605]: non-primitive cast: `u8` as `std::vec::Vec<u8>`
[00:59:49]   --> /checkout/src/test/ui/error-codes/E0605.rs:3:5
[00:59:49]    |
[00:59:49] LL |     x as Vec<u8>; //~ ERROR E0605
[00:59:49]    |
[00:59:49]    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 
[00:59:49] error: aborting due to 3 previous errors
---
[00:59:49] 
[00:59:49] ---- [ui] ui/error-codes/E0607.rs stdout ----
[00:59:49] diff of stderr:
[00:59:49] 
[00:59:49] - error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]`
[00:59:49] + error: chained comparison operators require parentheses
[00:59:49] +   --> $DIR/E0607.rs:2:28
[00:59:49] +    |
[00:59:49] + LL |     let v = core::ptr::null<u8>();
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] +    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49] +    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] + error[E0423]: expected value, found builtin type `u8`
[00:59:49] +   --> $DIR/E0607.rs:2:29
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let v = core::ptr::null<u8>();
[00:59:49] +    |                             ^^ not a value
[00:59:49] + 
[00:59:49] + error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] +   --> $DIR/E0607.rs:2:28
[00:59:49] +    |
[00:59:49] + LL |     let v = core::ptr::null<u8>();
[00:59:49] +    |             ---------------^-- _
[00:59:49] +    |             |
[00:59:49] +    |             fn() -> *const _ {std::ptr::null::<_>}
[00:59:49] +    |
[00:59:49] +    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] + 
[00:59:49] + error[E0606]: casting `bool` as `*const [u8]` is invalid
[00:59:49] 2   --> $DIR/E0607.rs:3:5
[00:59:49] 3    |
[00:59:49] 4 LL |     v as *const [u8];
[00:59:49] 5    |     ^^^^^^^^^^^^^^^^
[00:59:49] 6 
[00:59:49] - error: aborting due to previous error
[00:59:49] + error: aborting due to 4 previous errors
---
[00:59:49] 10 
[00:59:49] 
[00:59:49] 
[00:59:49] The actual stderr differed from the expected stderr.
[00:59:49] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0607/E0607.stderr
[00:59:49] To update references, rerun the tests and pass the `--bless` flag
[00:59:49] To only update this specific test, also pass `--test-args error-codes/E0607.rs`
[00:59:49] error: 1 errors occurred comparing output.
[00:59:49] status: exit code: 1
[00:59:49] status: exit code: 1
[00:59:49] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/error-codes/E0607.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0607" "-Crpath" "-O" "-Cdebuginfo=0" "-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/error-codes/E0607/auxiliary" "-A" "unused"
[00:59:49] ------------------------------------------
[00:59:49] 
[00:59:49] ------------------------------------------
[00:59:49] stderr:
[00:59:49] stderr:
[00:59:49] ------------------------------------------
[00:59:49] error: chained comparison operators require parentheses
[00:59:49]   --> /checkout/src/test/ui/error-codes/E0607.rs:2:28
[00:59:49]    |
[00:59:49] LL |     let v = core::ptr::null<u8>();
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49]    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] error[E0423]: expected value, found builtin type `u8`
[00:59:49]   --> /checkout/src/test/ui/error-codes/E0607.rs:2:29
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let v = core::ptr::null<u8>();
[00:59:49]    |                             ^^ not a value
[00:59:49] 
[00:59:49] error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let v = core::ptr::null<u8>();
[00:59:49]    |             ---------------^-- _
[00:59:49]    |             |
[00:59:49]    |             fn() -> *const _ {std::ptr::null::<_>}
[00:59:49]    |
[00:59:49]    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] 
[00:59:49] error[E0606]: casting `bool` as `*const [u8]` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     v as *const [u8]; //~ ERROR E0607
[00:59:49] 
[00:59:49] error: aborting due to 4 previous errors
[00:59:49] 
[00:59:49] Some errors have detailed explanations: E0369, E0423, E0606.
---
[00:59:49] 
[00:59:49] + error: chained comparison operators require parentheses
[00:59:49] +   --> $DIR/error-festival.rs:40:28
[00:59:49] +    |
[00:59:49] + LL |     let v = core::ptr::null<u8>();
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] +    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49] +    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] 1 error[E0425]: cannot find value `y` in this scope
[00:59:49] 2   --> $DIR/error-festival.rs:14:5
[00:59:49] 3    |
[00:59:49] 
[00:59:49] 
[00:59:49] 4 LL |     y = 2;
[00:59:49] 5    |     ^ help: a local variable with a similar name exists: `x`
[00:59:49] 6 
[00:59:49] + error[E0423]: expected value, found builtin type `u8`
[00:59:49] +   --> $DIR/error-festival.rs:40:29
[00:59:49] +    |
[00:59:49] + LL |     let v = core::ptr::null<u8>();
[00:59:49] +    |                             ^^ not a value
[00:59:49] 7 error[E0603]: constant `FOO` is private
[00:59:49] 8   --> $DIR/error-festival.rs:22:10
[00:59:49] 9    |
[00:59:49] 
[00:59:49] 
[00:59:49] 34    |
[00:59:49] 35    = note: an implementation of `std::ops::Not` might be missing for `Question`
[00:59:49] 36 
[00:59:49] + error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let v = core::ptr::null<u8>();
[00:59:49] +    |             ---------------^-- _
[00:59:49] +    |             |
[00:59:49] +    |             fn() -> *const _ {std::ptr::null::<_>}
[00:59:49] +    |
[00:59:49] +    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] + 
[00:59:49] 37 error[E0604]: only `u8` can be cast as `char`, not `u32`
[00:59:49] 39    |
[00:59:49] 
[00:59:49] 
[00:59:49] 63    |                  cannot cast `&u8` as `u32`
[00:59:49] 64    |                  help: dereference the expression: `*x`
[00:59:49] 65 
[00:59:49] - error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]`
[00:59:49] + error[E0606]: casting `bool` as `*const [u8]` is invalid
[00:59:49] 68    |
[00:59:49] 68    |
[00:59:49] 69 LL |     v as *const [u8];
[00:59:49] 70    |     ^^^^^^^^^^^^^^^^
[00:59:49] 71 
[00:59:49] - error: aborting due to 10 previous errors
[00:59:49] + error: aborting due to 13 previous errors
[00:59:49] + error: aborting due to 13 previous errors
[00:59:49] 73 
[00:59:49] - Some errors have detailed explanations: E0054, E0368, E0425, E0599, E0600, E0603, E0604, E0605, E0606...
[00:59:49] + Some errors have detailed explanations: E0054, E0368, E0369, E0423, E0425, E0599, E0600, E0603, E0604...
[00:59:49] 76 
[00:59:49] 
[00:59:49] 
[00:59:49] The actual stderr differed from the expected stderr.
[00:59:49] The actual stderr differed from the expected stderr.
[00:59:49] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-festival/error-festival.stderr
[00:59:49] To update references, rerun the tests and pass the `--bless` flag
[00:59:49] To only update this specific test, also pass `--test-args error-festival.rs`
[00:59:49] error: 1 errors occurred comparing output.
[00:59:49] status: exit code: 1
[00:59:49] status: exit code: 1
[00:59:49] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/error-festival.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-festival" "-Crpath" "-O" "-Cdebuginfo=0" "-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/error-festival/auxiliary" "-A" "unused"
[00:59:49] ------------------------------------------
[00:59:49] 
[00:59:49] ------------------------------------------
[00:59:49] stderr:
[00:59:49] stderr:
[00:59:49] ------------------------------------------
[00:59:49] error: chained comparison operators require parentheses
[00:59:49]   --> /checkout/src/test/ui/error-festival.rs:40:28
[00:59:49]    |
[00:59:49] LL |     let v = core::ptr::null<u8>();
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49]    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] error[E0425]: cannot find value `y` in this scope
[00:59:49]   --> /checkout/src/test/ui/error-festival.rs:14:5
[00:59:49]    |
[00:59:49] LL |     y = 2;
[00:59:49] LL |     y = 2;
[00:59:49]    |     ^ help: a local variable with a similar name exists: `x`
[00:59:49] 
[00:59:49] error[E0423]: expected value, found builtin type `u8`
[00:59:49]   --> /checkout/src/test/ui/error-festival.rs:40:29
[00:59:49]    |
[00:59:49] LL |     let v = core::ptr::null<u8>();
[00:59:49]    |                             ^^ not a value
[00:59:49] error[E0603]: constant `FOO` is private
[00:59:49]   --> /checkout/src/test/ui/error-festival.rs:22:10
[00:59:49]    |
[00:59:49] LL |     foo::FOO;
---
[00:59:49]    |
[00:59:49] LL |     x += 2;
[00:59:49]    |     -^^^^^
[00:59:49]    |     |
[00:59:49]    |     cannot use `+=` on type `&str`
[00:59:49]    = note: an implementation of `std::ops::AddAssign` might be missing for `&str`
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0599]: no method named `z` found for type `&str` in the current scope
[00:59:49]    |
[00:59:49] LL |     x.z();
[00:59:49]    |       ^
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0600]: cannot apply unary operator `!` to type `Question`
[00:59:49]   --> /checkout/src/test/ui/error-festival.rs:19:5
[00:59:49]    |
[00:59:49] LL |     !Question::Yes;
[00:59:49]    |
[00:59:49]    = note: an implementation of `std::ops::Not` might be missing for `Question`
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let v = core::ptr::null<u8>();
[00:59:49]    |             ---------------^-- _
[00:59:49]    |             |
[00:59:49]    |             fn() -> *const _ {std::ptr::null::<_>}
[00:59:49]    |
[00:59:49]    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] 
[00:59:49] error[E0604]: only `u8` can be cast as `char`, not `u32`
[00:59:49]    |
[00:59:49] LL |     0u32 as char;
[00:59:49]    |     ^^^^^^^^^^^^
[00:59:49] 
---
[00:59:49] 
[00:59:49] error[E0054]: cannot cast as `bool`
[00:59:49]   --> /checkout/src/test/ui/error-festival.rs:33:24
[00:59:49]    |
[00:59:49] LL |     let x_is_nonzero = x as bool;
[00:59:49]    |                        ^^^^^^^^^ help: compare with zero instead: `x != 0`
[00:59:49] error[E0606]: casting `&u8` as `u32` is invalid
[00:59:49]   --> /checkout/src/test/ui/error-festival.rs:37:18
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let y: u32 = x as u32;
[00:59:49]    |                  -^^^^^^^
[00:59:49]    |                  |
[00:59:49]    |                  cannot cast `&u8` as `u32`
[00:59:49]    |                  help: dereference the expression: `*x`
[00:59:49] 
[00:59:49] error[E0606]: casting `bool` as `*const [u8]` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     v as *const [u8];
[00:59:49] 
[00:59:49] error: aborting due to 13 previous errors
[00:59:49] 
[00:59:49] Some errors have detailed explanations: E0054, E0368, E0369, E0423, E0425, E0599, E0600, E0603, E0604...
---
[00:59:49] 
[00:59:49] + error[E0308]: mismatched types
[00:59:49] +   --> $DIR/fat-ptr-cast.rs:22:41
[00:59:49] +    |
[00:59:49] + LL |     let t: *mut (dyn Trait + 'static) = core::ptr::null();
[00:59:49] +    |                                         ^^^^^^^^^^^^^^^^^ types differ in mutability
[00:59:49] +    |
[00:59:49] +    = note: expected type `*mut (dyn Trait + 'static)`
[00:59:49] +               found type `*const _`
[00:59:49] + error[E0277]: the size for values of type `str` cannot be known at compilation time
[00:59:49] +   --> $DIR/fat-ptr-cast.rs:23:32
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let mut fail: *const str = core::ptr::null();
[00:59:49] +    |
[00:59:49] +    = help: the trait `std::marker::Sized` is not implemented for `str`
[00:59:49] +    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:59:49] +    = note: required by `std::ptr::null`
[00:59:49] +    = note: required by `std::ptr::null`
[00:59:49] + 
[00:59:49] 1 error[E0606]: casting `&[i32]` as `usize` is invalid
[00:59:49] 2   --> $DIR/fat-ptr-cast.rs:10:5
[00:59:49] 
[00:59:49] 
[00:59:49] 52 LL |     q as *const [i32];
[00:59:49] 54 
[00:59:49] 54 
[00:59:49] - error[E0606]: casting `usize` as `*mut (dyn Trait + 'static)` is invalid
[00:59:49] -   --> $DIR/fat-ptr-cast.rs:22:41
[00:59:49] -    |
[00:59:49] - LL |     let t: *mut (dyn Trait + 'static) = core::ptr::null();
[00:59:49] - 
[00:59:49] - error[E0606]: casting `usize` as `*const str` is invalid
[00:59:49] -   --> $DIR/fat-ptr-cast.rs:23:32
[00:59:49] -    |
[00:59:49] -    |
[00:59:49] - LL |     let mut fail: *const str = core::ptr::null();
[00:59:49] - 
[00:59:49] 67 error: aborting due to 9 previous errors
[00:59:49] 68 
[00:59:49] - Some errors have detailed explanations: E0605, E0606, E0607.
[00:59:49] - Some errors have detailed explanations: E0605, E0606, E0607.
[00:59:49] - For more information about an error, try `rustc --explain E0605`.
[00:59:49] + Some errors have detailed explanations: E0277, E0308, E0605, E0606, E0607.
[00:59:49] + For more information about an error, try `rustc --explain E0277`.
[00:59:49] 71 
[00:59:49] 
[00:59:49] 
[00:59:49] The actual stderr differed from the expected stderr.
[00:59:49] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/fat-ptr-cast/fat-ptr-cast.stderr
[00:59:49] To update references, rerun the tests and pass the `--bless` flag
[00:59:49] To only update this specific test, also pass `--test-args fat-ptr-cast.rs`
[00:59:49] error: 1 errors occurred comparing output.
[00:59:49] status: exit code: 1
[00:59:49] status: exit code: 1
[00:59:49] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/fat-ptr-cast.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/fat-ptr-cast" "-Crpath" "-O" "-Cdebuginfo=0" "-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/fat-ptr-cast/auxiliary" "-A" "unused"
[00:59:49] ------------------------------------------
[00:59:49] 
[00:59:49] ------------------------------------------
[00:59:49] stderr:
[00:59:49] stderr:
[00:59:49] ------------------------------------------
[00:59:49] error[E0308]: mismatched types
[00:59:49]   --> /checkout/src/test/ui/fat-ptr-cast.rs:22:41
[00:59:49]    |
[00:59:49] LL |     let t: *mut (dyn Trait + 'static) = core::ptr::null(); //~ ERROR casting
[00:59:49]    |                                         ^^^^^^^^^^^^^^^^^ types differ in mutability
[00:59:49]    |
[00:59:49]    = note: expected type `*mut (dyn Trait + 'static)`
[00:59:49]               found type `*const _`
[00:59:49] error[E0277]: the size for values of type `str` cannot be known at compilation time
[00:59:49]   --> /checkout/src/test/ui/fat-ptr-cast.rs:23:32
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let mut fail: *const str = core::ptr::null(); //~ ERROR casting
[00:59:49]    |
[00:59:49]    = help: the trait `std::marker::Sized` is not implemented for `str`
[00:59:49]    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:59:49]    = note: required by `std::ptr::null`
[00:59:49]    = note: required by `std::ptr::null`
[00:59:49] 
[00:59:49] error[E0606]: casting `&[i32]` as `usize` is invalid
[00:59:49]    |
[00:59:49] LL |     a as usize; //~ ERROR casting
[00:59:49]    |     ^^^^^^^^^^
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = help: cast through a raw pointer first
[00:59:49] 
[00:59:49] error[E0606]: casting `&[i32]` as `isize` is invalid
[00:59:49]    |
[00:59:49] LL |     a as isize; //~ ERROR casting
[00:59:49]    |     ^^^^^^^^^^
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = help: cast through a raw pointer first
[00:59:49] 
[00:59:49] error[E0606]: casting `&[i32]` as `i16` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid
[00:59:49]    |
[00:59:49]    = help: cast through a raw pointer first
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0606]: casting `&[i32]` as `u32` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid
[00:59:49]    |
[00:59:49]    = help: cast through a raw pointer first
[00:59:49] 
[00:59:49] error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize`
[00:59:49] error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize`
[00:59:49]   --> /checkout/src/test/ui/fat-ptr-cast.rs:14:5
[00:59:49]    |
[00:59:49] LL |     b as usize; //~ ERROR non-primitive cast
[00:59:49]    |     ^^^^^^^^^^
[00:59:49]    |
[00:59:49]    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 
[00:59:49] error[E0606]: casting `*const [i32]` as `usize` is invalid
[00:59:49]    |
[00:59:49] LL |     p as usize;
[00:59:49]    |     ^^^^^^^^^^
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = help: cast through a thin pointer first
[00:59:49] 
[00:59:49] error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     q as *const [i32]; //~ ERROR cannot cast
[00:59:49] 
[00:59:49] error: aborting due to 9 previous errors
[00:59:49] 
[00:59:49] Some errors have detailed explanations: E0277, E0308, E0605, E0606, E0607.
---
[00:59:49] - error[E0658]: casting pointers to integers in statics is unstable
[00:59:49] + error: chained comparison operators require parentheses
[00:59:49] +   --> $DIR/issue-17458.rs:1:43
[00:59:49] +    |
[00:59:49] + LL | static X: usize = unsafe { core::ptr::null<usize>() as usize };
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] +    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49] +    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] + error[E0423]: expected value, found builtin type `usize`
[00:59:49] +   --> $DIR/issue-17458.rs:1:44
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL | static X: usize = unsafe { core::ptr::null<usize>() as usize };
[00:59:49] + 
[00:59:49] + 
[00:59:49] + error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL | static X: usize = unsafe { core::ptr::null<usize>() as usize };
[00:59:49] +    |                            ---------------^----- _
[00:59:49] +    |                            |
[00:59:49] +    |                            fn() -> *const _ {std::ptr::null::<_>}
[00:59:49] +    |
[00:59:49] +    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] + error[E0308]: mismatched types
[00:59:49] 2   --> $DIR/issue-17458.rs:1:28
[00:59:49] 3    |
[00:59:49] 3    |
[00:59:49] 4 LL | static X: usize = unsafe { core::ptr::null<usize>() as usize };
[00:59:49] -    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:59:49] +    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected usize, found bool
[00:59:49] + 
[00:59:49] + 
[00:59:49] + error[E0605]: non-primitive cast: `()` as `usize`
[00:59:49] 6    |
[00:59:49] -    = note: for more information, see https://github.com/rust-lang/rust/issues/51910
[00:59:49] -    = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable
[00:59:49] -    = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable
[00:59:49] + LL | static X: usize = unsafe { core::ptr::null<usize>() as usize };
[00:59:49] +    |
[00:59:49] +    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 9 
[00:59:49] - error: aborting due to previous error
---
[00:59:49] 
[00:59:49] 
[00:59:49] The actual stderr differed from the expected stderr.
[00:59:49] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-17458/issue-17458.stderr
[00:59:49] To update references, rerun the tests and pass the `--bless` flag
[00:59:49] To only update this specific test, also pass `--test-args issues/issue-17458.rs`
[00:59:49] error: 1 errors occurred comparing output.
[00:59:49] status: exit code: 1
[00:59:49] status: exit code: 1
[00:59:49] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-17458.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-17458" "-Crpath" "-O" "-Cdebuginfo=0" "-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/issues/issue-17458/auxiliary" "-A" "unused"
[00:59:49] ------------------------------------------
[00:59:49] 
[00:59:49] ------------------------------------------
[00:59:49] stderr:
[00:59:49] stderr:
[00:59:49] ------------------------------------------
[00:59:49] error: chained comparison operators require parentheses
[00:59:49]   --> /checkout/src/test/ui/issues/issue-17458.rs:1:43
[00:59:49]    |
[00:59:49] LL | static X: usize = unsafe { core::ptr::null<usize>() as usize };
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49]    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] 
[00:59:49] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[00:59:49] error[E0423]: expected value, found builtin type `usize`
[00:59:49]   --> /checkout/src/test/ui/issues/issue-17458.rs:1:44
[00:59:49]   --> /checkout/src/test/ui/issues/issue-17458.rs:1:44
[00:59:49]    |
[00:59:49] LL | static X: usize = unsafe { core::ptr::null<usize>() as usize };
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL | static X: usize = unsafe { core::ptr::null<usize>() as usize };
[00:59:49]    |                            ---------------^----- _
[00:59:49]    |                            |
[00:59:49]    |                            fn() -> *const _ {std::ptr::null::<_>}
[00:59:49]    |
[00:59:49]    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] error[E0308]: mismatched types
[00:59:49]   --> /checkout/src/test/ui/issues/issue-17458.rs:1:28
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL | static X: usize = unsafe { core::ptr::null<usize>() as usize };
[00:59:49] 
[00:59:49] error[E0605]: non-primitive cast: `()` as `usize`
[00:59:49]   --> /checkout/src/test/ui/issues/issue-17458.rs:1:50
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL | static X: usize = unsafe { core::ptr::null<usize>() as usize };
[00:59:49]    |
[00:59:49]    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 
[00:59:49] error: aborting due to 5 previous errors
---
[00:59:49] 
[00:59:49] + error: chained comparison operators require parentheses
[00:59:49] +   --> $DIR/cast-rfc0401.rs:24:28
[00:59:49] +    |
[00:59:49] + LL |     let v = core::ptr::null<u8>();
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] +    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49] +    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] + error: chained comparison operators require parentheses
[00:59:49] +   --> $DIR/cast-rfc0401.rs:25:58
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let fat_v : *const [u8] = unsafe { &*(core::ptr::null<[u8; 1]>())};
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] +    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49] +    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] + error: chained comparison operators require parentheses
[00:59:49] +   --> $DIR/cast-rfc0401.rs:26:59
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let fat_sv : *const [i8] = unsafe { &*(core::ptr::null<[i8; 1]>())};
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] +    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49] +    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] + error[E0423]: expected value, found builtin type `u8`
[00:59:49] +   --> $DIR/cast-rfc0401.rs:24:29
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let v = core::ptr::null<u8>();
[00:59:49] +    |                             ^^ not a value
[00:59:49] + error[E0423]: expected value, found builtin type `u8`
[00:59:49] +   --> $DIR/cast-rfc0401.rs:25:60
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let fat_v : *const [u8] = unsafe { &*(core::ptr::null<[u8; 1]>())};
[00:59:49] +    |                                                            ^^ not a value
[00:59:49] + error[E0423]: expected value, found builtin type `i8`
[00:59:49] +   --> $DIR/cast-rfc0401.rs:26:61
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let fat_sv : *const [i8] = unsafe { &*(core::ptr::null<[i8; 1]>())};
[00:59:49] +    |                                                             ^^ not a value
[00:59:49] + 
[00:59:49] 1 error[E0606]: casting `*const U` as `*const V` is invalid
[00:59:49] 3    |
[00:59:49] 
[00:59:49] 14    |
[00:59:49] 14    |
[00:59:49] 15    = note: vtable kinds may not match
[00:59:49] 16 
[00:59:49] + error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let v = core::ptr::null<u8>();
[00:59:49] +    |             ---------------^-- _
[00:59:49] +    |             |
[00:59:49] +    |             fn() -> *const _ {std::ptr::null::<_>}
[00:59:49] +    |
[00:59:49] +    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] + 
[00:59:49] + error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let fat_v : *const [u8] = unsafe { &*(core::ptr::null<[u8; 1]>())};
[00:59:49] +    |                                           ---------------^------- _
[00:59:49] +    |                                           |
[00:59:49] +    |                                           fn() -> *const _ {std::ptr::null::<_>}
[00:59:49] +    |
[00:59:49] +    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] + error[E0614]: type `bool` cannot be dereferenced
[00:59:49] +   --> $DIR/cast-rfc0401.rs:25:41
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let fat_v : *const [u8] = unsafe { &*(core::ptr::null<[u8; 1]>())};
[00:59:49] + 
[00:59:49] + 
[00:59:49] + error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let fat_sv : *const [i8] = unsafe { &*(core::ptr::null<[i8; 1]>())};
[00:59:49] +    |                                            ---------------^------- _
[00:59:49] +    |                                            |
[00:59:49] +    |                                            fn() -> *const _ {std::ptr::null::<_>}
[00:59:49] +    |
[00:59:49] +    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] + error[E0614]: type `bool` cannot be dereferenced
[00:59:49] +   --> $DIR/cast-rfc0401.rs:26:42
[00:59:49] +    |
[00:59:49] +    |
[00:59:49] + LL |     let fat_sv : *const [i8] = unsafe { &*(core::ptr::null<[i8; 1]>())};
[00:59:49] + 
[00:59:49] + 
[00:59:49] 17 error[E0609]: no field `f` on type `fn() {main}`
[00:59:49] 19    |
[00:59:49] 
[00:59:49] 
[00:59:49] 20 LL |     let _ = main.f as *const u32;
[00:59:49] 22 
[00:59:49] 22 
[00:59:49] - error[E0605]: non-primitive cast: `*const u8` as `&u8`
[00:59:49] + error[E0605]: non-primitive cast: `bool` as `&u8`
[00:59:49] 25    |
[00:59:49] 25    |
[00:59:49] 26 LL |     let _ = v as &u8;
[00:59:49] 28    |
[00:59:49] 29    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 30 
[00:59:49] 30 
[00:59:49] - error[E0605]: non-primitive cast: `*const u8` as `E`
[00:59:49] + error[E0605]: non-primitive cast: `bool` as `E`
[00:59:49] 33    |
[00:59:49] 33    |
[00:59:49] 34 LL |     let _ = v as E;
[00:59:49] 36    |
[00:59:49] 37    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 38 
[00:59:49] 38 
[00:59:49] - error[E0605]: non-primitive cast: `*const u8` as `fn()`
[00:59:49] + error[E0605]: non-primitive cast: `bool` as `fn()`
[00:59:49] 41    |
[00:59:49] 41    |
[00:59:49] 42 LL |     let _ = v as fn();
[00:59:49] 44    |
[00:59:49] 45    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 46 
[00:59:49] 46 
[00:59:49] - error[E0605]: non-primitive cast: `*const u8` as `(u32,)`
[00:59:49] + error[E0605]: non-primitive cast: `bool` as `(u32,)`
[00:59:49] 49    |
[00:59:49] 49    |
[00:59:49] 50 LL |     let _ = v as (u32,);
[00:59:49] 52    |
[00:59:49] 53    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 54 
[00:59:49] 54 
[00:59:49] - error[E0605]: non-primitive cast: `std::option::Option<&*const u8>` as `*const u8`
[00:59:49] + error[E0605]: non-primitive cast: `std::option::Option<&bool>` as `*const u8`
[00:59:49] 57    |
[00:59:49] 58 LL |     let _ = Some(&v) as *const u8;
[00:59:49] 
[00:59:49] 60    |
[00:59:49] 60    |
[00:59:49] 61    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 62 
[00:59:49] - error[E0606]: casting `*const u8` as `f32` is invalid
[00:59:49] + error[E0606]: casting `bool` as `f32` is invalid
[00:59:49] 65    |
[00:59:49] 65    |
[00:59:49] 66 LL |     let _ = v as f32;
[00:59:49] 67    |             ^^^^^^^^
[00:59:49] +    |
[00:59:49] +    = help: cast through an integer first
[00:59:49] 68 
[00:59:49] 68 
[00:59:49] 69 error[E0606]: casting `fn() {main}` as `f64` is invalid
[00:59:49] 
[00:59:49] 72 LL |     let _ = main as f64;
[00:59:49] 73    |             ^^^^^^^^^^^
[00:59:49] 74 
[00:59:49] 74 
[00:59:49] - error[E0606]: casting `&*const u8` as `usize` is invalid
[00:59:49] + error[E0606]: casting `&bool` as `usize` is invalid
[00:59:49] 77    |
[00:59:49] 77    |
[00:59:49] 78 LL |     let _ = &v as usize;
[00:59:49] 152 LL |     let _ = 42usize as *const [u8];
[00:59:49] 153    |             ^^^^^^^^^^^^^^^^^^^^^^
[00:59:49] 154 
[00:59:49] 154 
[00:59:49] - error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]`
[00:59:49] + error[E0606]: casting `bool` as `*const [u8]` is invalid
[00:59:49] 157    |
[00:59:49] 157    |
[00:59:49] 158 LL |     let _ = v as *const [u8];
[00:59:49] 
[00:59:49] 241    |                              cannot cast `&{float}` as `f32`
[00:59:49] 242    |                              help: dereference the expression: `*s`
[00:59:49] - error: aborting due to 34 previous errors
[00:59:49] + error: aborting due to 45 previous errors
[00:59:49] 245 
[00:59:49] - Some errors have detailed explanations: E0054, E0277, E0604, E0605, E0606, E0607, E0609.
[00:59:49] - Some errors have detailed explanations: E0054, E0277, E0604, E0605, E0606, E0607, E0609.
[00:59:49] + Some errors have detailed explanations: E0054, E0277, E0369, E0423, E0604, E0605, E0606, E0609, E0614.
[00:59:49] 247 For more information about an error, try `rustc --explain E0054`.
[00:59:49] 248 
[00:59:49] 
[00:59:49] 
[00:59:49] The actual stderr differed from the expected stderr.
[00:59:49] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/mismatched_types/cast-rfc0401/cast-rfc0401.stderr
[00:59:49] To update references, rerun the tests and pass the `--bless` flag
[00:59:49] To only update this specific test, also pass `--test-args mismatched_types/cast-rfc0401.rs`
[00:59:49] error: 1 errors occurred comparing output.
[00:59:49] status: exit code: 1
[00:59:49] status: exit code: 1
[00:59:49] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/mismatched_types/cast-rfc0401.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/mismatched_types/cast-rfc0401" "-Crpath" "-O" "-Cdebuginfo=0" "-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/mismatched_types/cast-rfc0401/auxiliary" "-A" "unused"
[00:59:49] ------------------------------------------
[00:59:49] 
[00:59:49] ------------------------------------------
[00:59:49] stderr:
[00:59:49] stderr:
[00:59:49] ------------------------------------------
[00:59:49] error: chained comparison operators require parentheses
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:24:28
[00:59:49]    |
[00:59:49] LL |     let v = core::ptr::null<u8>();
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49]    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] error: chained comparison operators require parentheses
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:25:58
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let fat_v : *const [u8] = unsafe { &*(core::ptr::null<[u8; 1]>())};
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49]    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] error: chained comparison operators require parentheses
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:26:59
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let fat_sv : *const [i8] = unsafe { &*(core::ptr::null<[i8; 1]>())};
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
[00:59:49]    = help: or use `(...)` if you meant to specify fn arguments
[00:59:49] error[E0423]: expected value, found builtin type `u8`
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:24:29
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let v = core::ptr::null<u8>();
[00:59:49]    |                             ^^ not a value
[00:59:49] error[E0423]: expected value, found builtin type `u8`
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:25:60
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let fat_v : *const [u8] = unsafe { &*(core::ptr::null<[u8; 1]>())};
[00:59:49]    |                                                            ^^ not a value
[00:59:49] error[E0423]: expected value, found builtin type `i8`
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:26:61
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let fat_sv : *const [i8] = unsafe { &*(core::ptr::null<[i8; 1]>())};
[00:59:49]    |                                                             ^^ not a value
[00:59:49] 
[00:59:49] error[E0606]: casting `*const U` as `*const V` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     u as *const V //~ ERROR is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = note: vtable kinds may not match
[00:59:49] error[E0606]: casting `*const U` as `*const str` is invalid
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:8:5
[00:59:49]    |
[00:59:49] LL |     u as *const str //~ ERROR is invalid
[00:59:49] LL |     u as *const str //~ ERROR is invalid
[00:59:49]    |     ^^^^^^^^^^^^^^^
[00:59:49]    |
[00:59:49]    = note: vtable kinds may not match
[00:59:49] 
[00:59:49] error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let v = core::ptr::null<u8>();
[00:59:49]    |             ---------------^-- _
[00:59:49]    |             |
[00:59:49]    |             fn() -> *const _ {std::ptr::null::<_>}
[00:59:49]    |
[00:59:49]    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] 
[00:59:49] error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let fat_v : *const [u8] = unsafe { &*(core::ptr::null<[u8; 1]>())};
[00:59:49]    |                                           ---------------^------- _
[00:59:49]    |                                           |
[00:59:49]    |                                           fn() -> *const _ {std::ptr::null::<_>}
[00:59:49]    |
[00:59:49]    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] error[E0614]: type `bool` cannot be dereferenced
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:25:41
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let fat_v : *const [u8] = unsafe { &*(core::ptr::null<[u8; 1]>())};
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0369]: binary operation `<` cannot be applied to type `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let fat_sv : *const [i8] = unsafe { &*(core::ptr::null<[i8; 1]>())};
[00:59:49]    |                                            ---------------^------- _
[00:59:49]    |                                            |
[00:59:49]    |                                            fn() -> *const _ {std::ptr::null::<_>}
[00:59:49]    |
[00:59:49]    = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> *const _ {std::ptr::null::<_>}`
[00:59:49] error[E0614]: type `bool` cannot be dereferenced
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:26:42
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let fat_sv : *const [i8] = unsafe { &*(core::ptr::null<[i8; 1]>())};
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0609]: no field `f` on type `fn() {main}`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = main.f as *const u32; //~ ERROR no field
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0605]: non-primitive cast: `bool` as `&u8`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = v as &u8; //~ ERROR non-primitive cast
[00:59:49]    |
[00:59:49]    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0605]: non-primitive cast: `bool` as `E`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = v as E; //~ ERROR non-primitive cast
[00:59:49]    |
[00:59:49]    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0605]: non-primitive cast: `bool` as `fn()`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = v as fn(); //~ ERROR non-primitive cast
[00:59:49]    |
[00:59:49]    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0605]: non-primitive cast: `bool` as `(u32,)`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = v as (u32,); //~ ERROR non-primitive cast
[00:59:49]    |
[00:59:49]    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0605]: non-primitive cast: `std::option::Option<&bool>` as `*const u8`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = Some(&v) as *const u8; //~ ERROR non-primitive cast
[00:59:49]    |
[00:59:49]    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:59:49] 
[00:59:49] error[E0606]: casting `bool` as `f32` is invalid
[00:59:49] error[E0606]: casting `bool` as `f32` is invalid
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:35:13
[00:59:49]    |
[00:59:49] LL |     let _ = v as f32; //~ ERROR is invalid
[00:59:49]    |
[00:59:49]    = help: cast through an integer first
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0606]: casting `fn() {main}` as `f64` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = main as f64; //~ ERROR is invalid
[00:59:49] 
[00:59:49] error[E0606]: casting `&bool` as `usize` is invalid
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:37:13
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = &v as usize; //~ ERROR is invalid
[00:59:49]    |
[00:59:49]    = help: cast through a raw pointer first
[00:59:49] 
[00:59:49] error[E0606]: casting `f32` as `*const u8` is invalid
[00:59:49] error[E0606]: casting `f32` as `*const u8` is invalid
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:38:13
[00:59:49]    |
[00:59:49] LL |     let _ = f as *const u8; //~ ERROR is invalid
[00:59:49] 
[00:59:49] error[E0054]: cannot cast as `bool`
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:39:13
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = 3_i32 as bool; //~ ERROR cannot cast
[00:59:49]    |             ^^^^^^^^^^^^^ help: compare with zero instead: `3_i32 != 0`
[00:59:49] error[E0054]: cannot cast as `bool`
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:40:13
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = E::A as bool; //~ ERROR cannot cast
[00:59:49]    |             ^^^^^^^^^^^^ unsupported cast
[00:59:49] 
[00:59:49] error[E0604]: only `u8` can be cast as `char`, not `u32`
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = 0x61u32 as char; //~ ERROR can be cast as
[00:59:49] 
[00:59:49] error[E0606]: casting `bool` as `f32` is invalid
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:43:13
[00:59:49]    |
---
[00:59:49] 
[00:59:49] error[E0606]: casting `E` as `f32` is invalid
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:44:13
[00:59:49]    |
[00:59:49] LL |     let _ = E::A as f32; //~ ERROR is invalid
[00:59:49]    |
[00:59:49]    = help: cast through an integer first
[00:59:49] 
[00:59:49] error[E0606]: casting `char` as `f32` is invalid
[00:59:49] error[E0606]: casting `char` as `f32` is invalid
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:45:13
[00:59:49]    |
[00:59:49] LL |     let _ = 'a' as f32; //~ ERROR is invalid
[00:59:49]    |
[00:59:49]    = help: cast through an integer first
[00:59:49] 
[00:59:49] error[E0606]: casting `bool` as `*const u8` is invalid
---
[00:59:49] 
[00:59:49] error[E0606]: casting `E` as `*const u8` is invalid
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:48:13
[00:59:49]    |
[00:59:49] LL |     let _ = E::A as *const u8; //~ ERROR is invalid
[00:59:49] 
[00:59:49] error[E0606]: casting `char` as `*const u8` is invalid
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:49:13
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = 'a' as *const u8; //~ ERROR is invalid
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0606]: casting `usize` as `*const [u8]` is invalid
[00:59:49]    |
[00:59:49] LL |     let _ = 42usize as *const [u8]; //~ ERROR is invalid
[00:59:49]    |             ^^^^^^^^^^^^^^^^^^^^^^
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0606]: casting `bool` as `*const [u8]` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = v as *const [u8]; //~ ERROR cannot cast
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0606]: casting `&dyn Foo` as `*const str` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = foo as *const str; //~ ERROR is invalid
[00:59:49] 
[00:59:49] error[E0606]: casting `&dyn Foo` as `*mut str` is invalid
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:55:13
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = foo as *mut str; //~ ERROR is invalid
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0606]: casting `fn() {main}` as `*mut str` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = main as *mut str; //~ ERROR is invalid
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0606]: casting `&f32` as `*mut f32` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = &f as *mut f32; //~ ERROR is invalid
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0606]: casting `&f32` as `*const f64` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = &f as *const f64; //~ ERROR is invalid
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0606]: casting `*const [i8]` as `usize` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = fat_sv as usize; //~ ERROR is invalid
[00:59:49]    |
[00:59:49]    = help: cast through a thin pointer first
[00:59:49] 
[00:59:49] 
[00:59:49] error[E0606]: casting `*const dyn Foo` as `*const [u16]` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = cf as *const [u16]; //~ ERROR is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = note: vtable kinds may not match
[00:59:49] 
[00:59:49] error[E0606]: casting `*const dyn Foo` as `*const dyn Bar` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = cf as *const dyn Bar; //~ ERROR is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49]    = note: vtable kinds may not match
[00:59:49] error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
[00:59:49]   --> /checkout/src/test/ui/mismatched_types/cast-rfc0401.rs:53:13
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     let _ = fat_v as *const dyn Foo; //~ ERROR the size for values of type
[00:59:49]    |
[00:59:49]    = help: the trait `std::marker::Sized` is not implemented for `[u8]`
[00:59:49]    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:59:49]    = note: required for the cast to the object type `dyn Foo`
---
[00:59:49]    = help: the trait `std::marker::Sized` is not implemented for `str`
[00:59:49]    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:59:49]    = note: required for the cast to the object type `dyn Foo`
[00:59:49] 
[00:59:49] error[E0606]: casting `&{float}` as `f32` is invalid
[00:59:49]    |
[00:59:49]    |
[00:59:49] LL |     vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); //~ ERROR is invalid
[00:59:49]    |                              -^^^^^^^
[00:59:49]    |                              |
[00:59:49]    |                              cannot cast `&{float}` as `f32`
[00:59:49]    |                              help: dereference the expression: `*s`
[00:59:49] error: aborting due to 45 previous errors
[00:59:49] 
[00:59:49] Some errors have detailed explanations: E0054, E0277, E0369, E0423, E0604, E0605, E0606, E0609, E0614.
[00:59:49] For more information about an error, try `rustc --explain E0054`.
---
[00:59:49] test result: FAILED. 5652 passed; 7 failed; 21 ignored; 0 measured; 0 filtered out
[00:59:49] 
[00:59:49] 
[00:59:49] 
[00:59:49] 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 -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -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"
[00:59:49] 
[00:59:49] 
[00:59:49] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:59:49] Build completed unsuccessfully in 0:55:04
---
travis_time:end:154a03de:start=1560589265689105713,finish=1560589265694203670,duration=5097957
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0389f5e9
$ 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:260bd30e
travis_time:start:260bd30e
$ 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:2d92c9b2
$ 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)

@lzutao lzutao force-pushed the lzutao:ptr-null branch 3 times, most recently from 3666052 to b652879 Jun 15, 2019

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jun 15, 2019

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:1d74860f:start=1560601873690909352,finish=1560601874503988692,duration=813079340
$ 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
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:55:52] .................................................................................................... 1200/5680
[00:55:54] .................................................................................................... 1300/5680
[00:55:56] .................................................................................................... 1400/5680
[00:55:59] .................................................................................................... 1500/5680
[00:56:02] ...........................F........................................................................ 1600/5680
[00:56:08] ..i................................................................................................. 1800/5680
[00:56:12] .................................................................................................... 1900/5680
[00:56:15] .................................................................................................... 2000/5680
[00:56:19] .................................................................................................... 2100/5680
---
[00:58:41] 
[00:58:41] + error[E0308]: mismatched types
[00:58:41] +   --> $DIR/fat-ptr-cast.rs:22:41
[00:58:41] +    |
[00:58:41] + LL |     let t: *mut (dyn Trait + 'static) = core::ptr::null();
[00:58:41] +    |                                         ^^^^^^^^^^^^^^^^^ types differ in mutability
[00:58:41] +    |
[00:58:41] +    = note: expected type `*mut (dyn Trait + 'static)`
[00:58:41] +               found type `*const _`
[00:58:41] + error[E0277]: the size for values of type `str` cannot be known at compilation time
[00:58:41] +   --> $DIR/fat-ptr-cast.rs:23:32
[00:58:41] +    |
[00:58:41] +    |
[00:58:41] + LL |     let mut fail: *const str = core::ptr::null();
[00:58:41] +    |
[00:58:41] +    = help: the trait `std::marker::Sized` is not implemented for `str`
[00:58:41] +    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:58:41] +    = note: required by `std::ptr::null`
[00:58:41] +    = note: required by `std::ptr::null`
[00:58:41] + 
[00:58:41] 1 error[E0606]: casting `&[i32]` as `usize` is invalid
[00:58:41] 2   --> $DIR/fat-ptr-cast.rs:10:5
[00:58:41] 
[00:58:41] 
[00:58:41] 52 LL |     q as *const [i32];
[00:58:41] 54 
[00:58:41] 54 
[00:58:41] - error[E0606]: casting `usize` as `*mut (dyn Trait + 'static)` is invalid
[00:58:41] -   --> $DIR/fat-ptr-cast.rs:22:41
[00:58:41] -    |
[00:58:41] - LL |     let t: *mut (dyn Trait + 'static) = core::ptr::null();
[00:58:41] - 
[00:58:41] - error[E0606]: casting `usize` as `*const str` is invalid
[00:58:41] -   --> $DIR/fat-ptr-cast.rs:23:32
[00:58:41] -    |
[00:58:41] -    |
[00:58:41] - LL |     let mut fail: *const str = core::ptr::null();
[00:58:41] - 
[00:58:41] 67 error: aborting due to 9 previous errors
[00:58:41] 68 
[00:58:41] - Some errors have detailed explanations: E0605, E0606, E0607.
[00:58:41] - Some errors have detailed explanations: E0605, E0606, E0607.
[00:58:41] - For more information about an error, try `rustc --explain E0605`.
[00:58:41] + Some errors have detailed explanations: E0277, E0308, E0605, E0606, E0607.
[00:58:41] + For more information about an error, try `rustc --explain E0277`.
[00:58:41] 71 
[00:58:41] 
[00:58:41] 
[00:58:41] The actual stderr differed from the expected stderr.
[00:58:41] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/fat-ptr-cast/fat-ptr-cast.stderr
[00:58:41] To update references, rerun the tests and pass the `--bless` flag
[00:58:41] To only update this specific test, also pass `--test-args fat-ptr-cast.rs`
[00:58:41] error: 1 errors occurred comparing output.
[00:58:41] status: exit code: 1
[00:58:41] status: exit code: 1
[00:58:41] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/fat-ptr-cast.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/fat-ptr-cast" "-Crpath" "-O" "-Cdebuginfo=0" "-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/fat-ptr-cast/auxiliary" "-A" "unused"
[00:58:41] ------------------------------------------
[00:58:41] 
[00:58:41] ------------------------------------------
[00:58:41] stderr:
[00:58:41] stderr:
[00:58:41] ------------------------------------------
[00:58:41] error[E0308]: mismatched types
[00:58:41]   --> /checkout/src/test/ui/fat-ptr-cast.rs:22:41
[00:58:41]    |
[00:58:41] LL |     let t: *mut (dyn Trait + 'static) = core::ptr::null(); //~ ERROR casting
[00:58:41]    |                                         ^^^^^^^^^^^^^^^^^ types differ in mutability
[00:58:41]    |
[00:58:41]    = note: expected type `*mut (dyn Trait + 'static)`
[00:58:41]               found type `*const _`
[00:58:41] error[E0277]: the size for values of type `str` cannot be known at compilation time
[00:58:41]   --> /checkout/src/test/ui/fat-ptr-cast.rs:23:32
[00:58:41]    |
[00:58:41]    |
[00:58:41] LL |     let mut fail: *const str = core::ptr::null(); //~ ERROR casting
[00:58:41]    |
[00:58:41]    = help: the trait `std::marker::Sized` is not implemented for `str`
[00:58:41]    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:58:41]    = note: required by `std::ptr::null`
[00:58:41]    = note: required by `std::ptr::null`
[00:58:41] 
[00:58:41] error[E0606]: casting `&[i32]` as `usize` is invalid
[00:58:41]    |
[00:58:41] LL |     a as usize; //~ ERROR casting
[00:58:41]    |     ^^^^^^^^^^
[00:58:41]    |
[00:58:41]    |
[00:58:41]    = help: cast through a raw pointer first
[00:58:41] 
[00:58:41] error[E0606]: casting `&[i32]` as `isize` is invalid
[00:58:41]    |
[00:58:41] LL |     a as isize; //~ ERROR casting
[00:58:41]    |     ^^^^^^^^^^
[00:58:41]    |
[00:58:41]    |
[00:58:41]    = help: cast through a raw pointer first
[00:58:41] 
[00:58:41] error[E0606]: casting `&[i32]` as `i16` is invalid
[00:58:41]    |
[00:58:41]    |
[00:58:41] LL |     a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid
[00:58:41]    |
[00:58:41]    = help: cast through a raw pointer first
[00:58:41] 
[00:58:41] 
[00:58:41] error[E0606]: casting `&[i32]` as `u32` is invalid
[00:58:41]    |
[00:58:41]    |
[00:58:41] LL |     a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid
[00:58:41]    |
[00:58:41]    = help: cast through a raw pointer first
[00:58:41] 
[00:58:41] error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize`
[00:58:41] error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize`
[00:58:41]   --> /checkout/src/test/ui/fat-ptr-cast.rs:14:5
[00:58:41]    |
[00:58:41] LL |     b as usize; //~ ERROR non-primitive cast
[00:58:41]    |     ^^^^^^^^^^
[00:58:41]    |
[00:58:41]    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[00:58:41] 
[00:58:41] error[E0606]: casting `*const [i32]` as `usize` is invalid
[00:58:41]    |
[00:58:41] LL |     p as usize;
[00:58:41]    |     ^^^^^^^^^^
[00:58:41]    |
[00:58:41]    |
[00:58:41]    = help: cast through a thin pointer first
[00:58:41] 
[00:58:41] error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]`
[00:58:41]    |
[00:58:41]    |
[00:58:41] LL |     q as *const [i32]; //~ ERROR cannot cast
[00:58:41] 
[00:58:41] error: aborting due to 9 previous errors
[00:58:41] 
[00:58:41] Some errors have detailed explanations: E0277, E0308, E0605, E0606, E0607.
---
[00:58:41] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:521:22
[00:58:41] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[00:58:41] 
[00:58:41] 
[00:58:41] 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 -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -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"
[00:58:41] 
[00:58:41] 
[00:58:41] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:58:41] Build completed unsuccessfully in 0:54:02
---
travis_time:end:06e2daaf:start=1560605408197126352,finish=1560605408204037993,duration=6911641
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:2150e942
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || 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)

Show resolved Hide resolved src/libpanic_unwind/seh.rs Outdated

@lzutao lzutao force-pushed the lzutao:ptr-null branch from b652879 to 879b841 Jun 15, 2019

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jun 15, 2019

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:0bf2987c:start=1560619217754724721,finish=1560619219874405165,duration=2119680444
$ 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
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:58:01] .................................................................................................... 1200/5681
[00:58:04] .................................................................................................... 1300/5681
[00:58:06] .................................................................................................... 1400/5681
[00:58:09] .................................................................................................... 1500/5681
[00:58:12] ..........................F......................................................................... 1600/5681
[00:58:18] ..i................................................................................................. 1800/5681
[00:58:22] .................................................................................................... 1900/5681
[00:58:26] .................................................................................................... 2000/5681
[00:58:29] .................................................................................................... 2100/5681
---
[01:00:56] 
[01:00:56] + error[E0277]: the size for values of type `str` cannot be known at compilation time
[01:00:56] +   --> $DIR/fat-ptr-cast.rs:23:32
[01:00:56] +    |
[01:00:56] + LL |     let mut fail: *const str = core::ptr::null();
[01:00:56] +    |
[01:00:56] +    = help: the trait `std::marker::Sized` is not implemented for `str`
[01:00:56] +    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[01:00:56] +    = note: required by `std::ptr::null`
[01:00:56] +    = note: required by `std::ptr::null`
[01:00:56] + 
[01:00:56] 1 error[E0606]: casting `&[i32]` as `usize` is invalid
[01:00:56] 2   --> $DIR/fat-ptr-cast.rs:10:5
[01:00:56] 
[01:00:56] 
[01:00:56] 52 LL |     q as *const [i32];
[01:00:56] 54 
[01:00:56] 54 
[01:00:56] - error[E0606]: casting `usize` as `*mut (dyn Trait + 'static)` is invalid
[01:00:56] -   --> $DIR/fat-ptr-cast.rs:22:41
[01:00:56] -    |
[01:00:56] - LL |     let t: *mut (dyn Trait + 'static) = core::ptr::null();
[01:00:56] + error: aborting due to 8 previous errors
[01:00:56] 60 
[01:00:56] - error[E0606]: casting `usize` as `*const str` is invalid
[01:00:56] -   --> $DIR/fat-ptr-cast.rs:23:32
[01:00:56] -   --> $DIR/fat-ptr-cast.rs:23:32
[01:00:56] -    |
[01:00:56] - LL |     let mut fail: *const str = core::ptr::null();
[01:00:56] - 
[01:00:56] - error: aborting due to 9 previous errors
[01:00:56] - 
[01:00:56] - Some errors have detailed explanations: E0605, E0606, E0607.
[01:00:56] - Some errors have detailed explanations: E0605, E0606, E0607.
[01:00:56] - For more information about an error, try `rustc --explain E0605`.
[01:00:56] + Some errors have detailed explanations: E0277, E0605, E0606, E0607.
[01:00:56] + For more information about an error, try `rustc --explain E0277`.
[01:00:56] 71 
[01:00:56] 
[01:00:56] 
[01:00:56] The actual stderr differed from the expected stderr.
[01:00:56] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/fat-ptr-cast/fat-ptr-cast.stderr
[01:00:56] To update references, rerun the tests and pass the `--bless` flag
[01:00:56] To only update this specific test, also pass `--test-args fat-ptr-cast.rs`
[01:00:56] error: 1 errors occurred comparing output.
[01:00:56] status: exit code: 1
[01:00:56] status: exit code: 1
[01:00:56] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/fat-ptr-cast.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/fat-ptr-cast" "-Crpath" "-O" "-Cdebuginfo=0" "-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/fat-ptr-cast/auxiliary" "-A" "unused"
[01:00:56] ------------------------------------------
[01:00:56] 
[01:00:56] ------------------------------------------
[01:00:56] stderr:
[01:00:56] stderr:
[01:00:56] ------------------------------------------
[01:00:56] error[E0277]: the size for values of type `str` cannot be known at compilation time
[01:00:56]   --> /checkout/src/test/ui/fat-ptr-cast.rs:23:32
[01:00:56]    |
[01:00:56] LL |     let mut fail: *const str = core::ptr::null(); //~ ERROR casting
[01:00:56]    |
[01:00:56]    = help: the trait `std::marker::Sized` is not implemented for `str`
[01:00:56]    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[01:00:56]    = note: required by `std::ptr::null`
[01:00:56]    = note: required by `std::ptr::null`
[01:00:56] 
[01:00:56] error[E0606]: casting `&[i32]` as `usize` is invalid
[01:00:56]    |
[01:00:56] LL |     a as usize; //~ ERROR casting
[01:00:56]    |     ^^^^^^^^^^
[01:00:56]    |
[01:00:56]    |
[01:00:56]    = help: cast through a raw pointer first
[01:00:56] 
[01:00:56] error[E0606]: casting `&[i32]` as `isize` is invalid
[01:00:56]    |
[01:00:56] LL |     a as isize; //~ ERROR casting
[01:00:56]    |     ^^^^^^^^^^
[01:00:56]    |
[01:00:56]    |
[01:00:56]    = help: cast through a raw pointer first
[01:00:56] 
[01:00:56] error[E0606]: casting `&[i32]` as `i16` is invalid
[01:00:56]    |
[01:00:56]    |
[01:00:56] LL |     a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid
[01:00:56]    |
[01:00:56]    = help: cast through a raw pointer first
[01:00:56] 
[01:00:56] 
[01:00:56] error[E0606]: casting `&[i32]` as `u32` is invalid
[01:00:56]    |
[01:00:56]    |
[01:00:56] LL |     a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid
[01:00:56]    |
[01:00:56]    = help: cast through a raw pointer first
[01:00:56] 
[01:00:56] error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize`
[01:00:56] error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize`
[01:00:56]   --> /checkout/src/test/ui/fat-ptr-cast.rs:14:5
[01:00:56]    |
[01:00:56] LL |     b as usize; //~ ERROR non-primitive cast
[01:00:56]    |     ^^^^^^^^^^
[01:00:56]    |
[01:00:56]    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
[01:00:56] 
[01:00:56] error[E0606]: casting `*const [i32]` as `usize` is invalid
[01:00:56]    |
[01:00:56] LL |     p as usize;
[01:00:56]    |     ^^^^^^^^^^
[01:00:56]    |
[01:00:56]    |
[01:00:56]    = help: cast through a thin pointer first
[01:00:56] 
[01:00:56] error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]`
[01:00:56]    |
[01:00:56]    |
[01:00:56] LL |     q as *const [i32]; //~ ERROR cannot cast
[01:00:56] 
[01:00:56] error: aborting due to 8 previous errors
[01:00:56] 
[01:00:56] Some errors have detailed explanations: E0277, E0605, E0606, E0607.
---
[01:00:56] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:521:22
[01:00:56] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:00:56] 
[01:00:56] 
[01:00:56] 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 -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -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:56] 
[01:00:56] 
[01:00:56] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:00:56] Build completed unsuccessfully in 0:56:05
---
166908 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps
156504 ./src/llvm-project/clang
149984 ./obj/build/bootstrap/debug/incremental
134712 ./obj/build/bootstrap/debug/incremental/bootstrap-oxgzobynhmm1
134708 ./obj/build/bootstrap/debug/incremental/bootstrap-oxgzobynhmm1/s-fd6ynnsorc-60higm-3ekas8ujxant2
127152 ./obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-toohen 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:057adb9e
travis_time:start:057adb9e
$ 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:03f6d614
$ 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)

@lzutao lzutao force-pushed the lzutao:ptr-null branch from 879b841 to cede64e Jun 16, 2019

let t: *mut (dyn Trait + 'static) = 0 as *mut _; //~ ERROR casting
let mut fail: *const str = 0 as *const str; //~ ERROR casting

let x: *mut (dyn Trait + 'static) = std::ptr::null_mut();
//~^ ERROR E0277

This comment has been minimized.

Copy link
@lzutao

lzutao Jun 16, 2019

Author Contributor

cc #61870

This comment has been minimized.

Copy link
@sfackler

sfackler Jun 17, 2019

Member

Might be best to leave this one unchanged if it breaks the test.

This comment has been minimized.

Copy link
@lzutao

lzutao Jun 17, 2019

Author Contributor

Okey thanks! I removed it.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jun 16, 2019

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:038864ac:start=1560704341607239672,finish=1560704431399135379,duration=89791895707
$ 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
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:57:17] .................................................................................................... 1200/5682
[00:57:19] .................................................................................................... 1300/5682
[00:57:22] .................................................................................................... 1400/5682
[00:57:25] .................................................................................................... 1500/5682
[00:57:28] ..........................F......................................................................... 1600/5682
[00:57:34] ...i................................................................................................ 1800/5682
[00:57:38] .................................................................................................... 1900/5682
[00:57:41] .................................................................................................... 2000/5682
[00:57:45] .................................................................................................... 2100/5682
---
[01:00:11] error: /checkout/src/test/ui/fat-ptr-cast.rs:26: expected error not found: E0277
[01:00:11] 
[01:00:11] error: 0 unexpected errors found, 1 expected errors not found
[01:00:11] status: exit code: 1
[01:00:11] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/fat-ptr-cast.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/fat-ptr-cast" "-Crpath" "-O" "-Cdebuginfo=0" "-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/fat-ptr-cast/auxiliary" "-A" "unused"
[01:00:11]     Error {
[01:00:11]         line_num: 26,
[01:00:11]         kind: Some(
[01:00:11]             Error,
---
[01:00:11] 
[01:00:11] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:521:22
[01:00:11] 
[01:00:11] 
[01:00:11] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/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 -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -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:11] 
[01:00:11] 
[01:00:11] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:00:11] Build completed unsuccessfully in 0:56:12
---
travis_time:end:00c85192:start=1560708053565137874,finish=1560708053572057214,duration=6919340
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:20bac2b3
$ 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:05b51f58
$ 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)

@lzutao lzutao marked this pull request as ready for review Jun 17, 2019

@lzutao

This comment has been minimized.

Copy link
Contributor Author

commented Jun 17, 2019

Mark as ready for review as I don't know what to do with #61864 (comment) .
I would expect that case would be error, but it doesn't at this time.

@lzutao lzutao force-pushed the lzutao:ptr-null branch 2 times, most recently from 92db647 to ae0c043 Jun 17, 2019

@lzutao lzutao changed the title Make use of `ptr::{null,null_mut}` instead of casting zero Make use of `ptr::null(mut)` instead of casting zero Jun 17, 2019

@lzutao lzutao changed the title Make use of `ptr::null(mut)` instead of casting zero Make use of `ptr::null(_mut)` instead of casting zero Jun 17, 2019

@lzutao lzutao force-pushed the lzutao:ptr-null branch from ae0c043 to 7d69d4c Jun 17, 2019

@lzutao

This comment has been minimized.

Copy link
Contributor Author

commented Jun 17, 2019

The build is green.

@sfackler

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2019

📌 Commit 7d69d4c has been approved by sfackler

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2019

⌛️ Testing commit 7d69d4c with merge a6a8f6c...

bors added a commit that referenced this pull request Jun 18, 2019

Auto merge of #61864 - lzutao:ptr-null, r=sfackler
Make use of `ptr::null(_mut)` instead of casting zero

There are few places that I don't replace the zero casting pointer with `ptr::null`
or `ptr::null_mut`:
```bash
% git grep -E '[ ([{]0 as \*'
src/libcore/ptr/mod.rs:216:pub const fn null<T>() -> *const T { 0 as *const T }
src/libcore/ptr/mod.rs:231:pub const fn null_mut<T>() -> *mut T { 0 as *mut T }
src/test/run-pass/consts/const-cast-ptr-int.rs:12:static a: TestStruct = TestStruct{x: 0 as *const u8};
src/test/ui/issues/issue-45730.rs:5:    let x: *const _ = 0 as *const _; //~ ERROR cannot cast
src/test/ui/issues/issue-45730.rs:8:    let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast
src/test/ui/issues/issue-45730.stderr:14:LL |     let x: *const _ = 0 as *const _;
src/test/ui/issues/issue-45730.stderr:24:LL |     let x = 0 as *const i32 as *const _ as *mut _;
src/test/ui/lint/lint-forbid-internal-unsafe.rs:15:    println!("{}", evil!(*(0 as *const u8)));
src/test/ui/order-dependent-cast-inference.rs:5:    let mut y = 0 as *const _;
src/test/ui/order-dependent-cast-inference.stderr:4:LL |     let mut y = 0 as *const _;
```

r? @sfackler
@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2019

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

@bors bors added the merged-by-bors label Jun 18, 2019

@bors bors merged commit 7d69d4c into rust-lang:master Jun 18, 2019

3 checks passed

Travis CI - Pull Request Build Passed
Details
homu Test successful
Details
pr Build #20190617.10 succeeded
Details

@lzutao lzutao deleted the lzutao:ptr-null branch Jun 18, 2019

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jun 18, 2019

📣 Toolstate changed by #61864!

Tested on commit a6a8f6c.
Direct link to PR: #61864

🎉 rls on linux: test-fail → test-pass (cc @Xanewok, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Jun 18, 2019

📣 Toolstate changed by rust-lang/rust#61864!
Tested on commit rust-lang/rust@a6a8f6c.
Direct link to PR: <rust-lang/rust#61864>

🎉 rls on linux: test-fail → test-pass (cc @Xanewok, @rust-lang/infra).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.