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

Allow ptr::{null, null_mut} to create pointers to ?Sized types #53954

Closed
wants to merge 1 commit into from

Conversation

burtonageo
Copy link
Contributor

No description provided.

@rust-highfive
Copy link
Collaborator

r? @Kimundi

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

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

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

Click to expand the log.
[00:04:41]    Compiling compiler_builtins v0.0.0 (file:///checkout/src/rustc/compiler_builtins_shim)
[00:04:41]    Compiling cmake v0.1.33
[00:04:41]    Compiling alloc_jemalloc v0.0.0 (file:///checkout/src/liballoc_jemalloc)
[00:04:44]    Compiling std v0.0.0 (file:///checkout/src/libstd)
[00:04:45] error[E0606]: casting `usize` as `*const T` is invalid
[00:04:45]   --> libcore/ptr.rs:77:46
[00:04:45]    |
[00:04:45] 77 | pub const fn null<T: ?Sized>() -> *const T { 0 as *const T }
[00:04:45] 
[00:04:45] 
[00:04:45] error[E0606]: casting `usize` as `*mut T` is invalid
[00:04:45]   --> libcore/ptr.rs:91:48
[00:04:45]    |
[00:04:45] 91 | pub const fn null_mut<T: ?Sized>() -> *mut T { 0 as *mut T }
[00:04:45] 
[00:04:46]    Compiling rustc_lsan v0.0.0 (file:///checkout/src/librustc_lsan)
[00:04:47]    Compiling rustc_asan v0.0.0 (file:///checkout/src/librustc_asan)
[00:04:47]    Compiling rustc_msan v0.0.0 (file:///checkout/src/librustc_msan)
---
[00:04:50] warning: build failed, waiting for other jobs to finish...
[00:04:58] error: build failed
[00:04:58] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--message-format" "json"
[00:04:58] expected success, got: exit code: 101
[00:04:58] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1155:9
[00:04:58] travis_fold:end:stage0-std

[00:04:58] travis_time:end:stage0-std:start=1536090588188875505,finish=1536090611497103197,duration=23308227692


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

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0dd13f90
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:0828d65e:start=1536090612271972762,finish=1536090612279805142,duration=7832380
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:16123a10
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:029773f2
travis_time:start:029773f2
$ 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:133f3f50
$ 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)

@cuviper
Copy link
Member

cuviper commented Sep 4, 2018

The CI failure is that you can't use as casting for this. The compiler doesn't know what to put in the second part of the fat pointer. For slices, it could conceivably just use length 0, but for trait objects we need a vtable, and this must not be NULL.

Related discussion: https://internals.rust-lang.org/t/should-pointer-methods-functions-accept-sized/8166

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 7, 2018
@TimNN
Copy link
Contributor

TimNN commented Sep 11, 2018

Ping from triage, @burtonageo! It looks like your PR can't be merged as is. As I understand things, this probably requires some additional design work, so I'm marking this PR as blocked either on a future RFC or the linked internals thread.

@TimNN TimNN added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 11, 2018
@bors
Copy link
Contributor

bors commented Oct 4, 2018

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

@Dylan-DPC-zz
Copy link

Ping from triage @burtonageo. This PR has been blocked for more than 2 months and I can't find any active discussion or consensus regarding it. Closing this issue but you are free to create a new PR, if details are finalised. Thanks for contributing.

@Dylan-DPC-zz Dylan-DPC-zz added S-blocked-closed and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Nov 26, 2018
@jyn514 jyn514 added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-blocked-closed labels Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Blocked on something else such as an RFC or other implementation work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants