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 `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const #58750

Merged
merged 2 commits into from Mar 9, 2019

Conversation

Projects
None yet
8 participants
@TimDiekmann
Copy link
Contributor

TimDiekmann commented Feb 26, 2019

No description provided.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Feb 26, 2019

r? @Kimundi

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

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Feb 26, 2019

Please add some tests using these in a const context. Also consider making them rustc_const_unstable so the constness isn't insta-stable

@TimDiekmann

This comment has been minimized.

Copy link
Contributor Author

TimDiekmann commented Feb 26, 2019

Should rustc_const_unstable also apply on Unique as it's not pub unstable?

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned Kimundi Feb 26, 2019

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Feb 26, 2019

Since it's unstable, there's no need

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Feb 26, 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:01f4ae1b:start=1551179575121358287,finish=1551179578001919871,duration=2880561584
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---

[00:03:37] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:37] tidy error: /checkout/src/libcore/ptr.rs:2905: trailing whitespace
[00:03:37] tidy error: /checkout/src/test/ui/consts/const-ptr-nonnull.rs:4: line longer than 100 chars
[00:03:37] tidy error: /checkout/src/test/ui/consts/const-ptr-nonnull.rs:5: trailing whitespace
[00:03:37] tidy error: /checkout/src/test/ui/consts/const-ptr-nonnull.rs:8: line longer than 100 chars
[00:03:37] tidy error: /checkout/src/test/ui/consts/const-ptr-unique.rs:8: line longer than 100 chars
[00:03:37] tidy error: /checkout/src/test/run-pass/consts/const-ptr-nonnull.rs:17: trailing whitespace
[00:03:38] some tidy checks failed
[00:03:38] 
[00:03:38] 
[00:03:38] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:03:38] 
[00:03:38] 
[00:03:38] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:38] Build completed unsuccessfully in 0:00:44
[00:03:38] Build completed unsuccessfully in 0:00:44
[00:03:38] make: *** [tidy] Error 1
[00:03:38] Makefile:68: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:015d7ce3
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue Feb 26 11:16:47 UTC 2019
---
travis_time:end:1af693c0:start=1551179807939747195,finish=1551179807944240954,duration=4493759
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:025d155c
$ 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:013a19e7
travis_time:start:013a19e7
$ 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:0672f22e
$ 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)

Show resolved Hide resolved src/libcore/ptr.rs Outdated
@@ -2790,7 +2790,7 @@ impl<T: ?Sized> Unique<T> {
}

/// Acquires the underlying `*mut` pointer.
pub fn as_ptr(self) -> *mut T {
pub const fn as_ptr(self) -> *mut T {

This comment has been minimized.

@oli-obk

oli-obk Feb 26, 2019

Contributor

cc @Centril is it too dangerous that just adding a const doesn't require anything like a #[const_stable(since = "1.2.3")] attribute?

This comment has been minimized.

@Centril

Centril Feb 26, 2019

Contributor

Dangerous from what perspective? If it's used in a min-const-fn it will also need to be min-const-fn... or do you mean from the POV of accidental stabilization?

This comment has been minimized.

@oli-obk

oli-obk Feb 26, 2019

Contributor

yes, accidental stabilization. Like making something stable that is already const fn stabilizes the constness along with it.

This comment has been minimized.

@TimDiekmann

TimDiekmann Feb 26, 2019

Author Contributor

Do you mean any stabilized const fn should have something like a #[const_stable] attribute?

This comment has been minimized.

@Centril

Centril Feb 26, 2019

Contributor

Ah... idk if I find it risky rising to the level of dangerous but there's some risk, no doubt. @varkor wanted it from a different perspective (#57562 (comment)) but I thought it too much of an annotation burden. However, from the POV of accidental stabilization, #[const_stable(...)] makes sense to me.

Can you open up an issue and cc me and varkor?

This comment has been minimized.

@Centril

Centril Feb 26, 2019

Contributor

@TimDiekmann Yeah, that's the idea.

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Feb 26, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 26, 2019

📌 Commit c5f3830 has been approved by oli-obk

Centril added a commit to Centril/rust that referenced this pull request Feb 27, 2019

Rollup merge of rust-lang#58750 - TimDiekmann:master, r=oli-obk
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const

bors added a commit that referenced this pull request Feb 27, 2019

Auto merge of #58763 - Centril:rollup, r=Centril
Rollup of 18 pull requests

Successful merges:

 - #57882 (overhaul unused doc comments lint)
 - #58075 (Fix for issue  #58050)
 - #58627 (rustdoc: move collapse and unindent docs passes earlier)
 - #58629 (rust-lldb: fix crash when printing empty string)
 - #58630 (Make `visit_clobber` panic-safe.)
 - #58678 (Deny `async fn` in 2015 edition)
 - #58680 (Fix an indexing error when using `x.py help`)
 - #58703 (Fix copy-pasted typo for read_string return value)
 - #58743 (Add tests for several E-needstest issues)
 - #58744 (Update dlmalloc to 0.1.3)
 - #58746 (std: docs: Disable running several Stdio doctests)
 - #58748 (update scoped_tls to 1.0)
 - #58749 (Reduce Repetitions of (n << amt) >> amt)
 - #58750 (Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const)
 - #58752 (Update string_cache_codegen to 0.4.2)
 - #58755 (Clarify `rotate_{left,right}` docs)
 - #58757 (Normalize the type Self resolves to in an impl)
 - #58762 (Mention `unwind(aborts)` in diagnostics for `#[unwind]`)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Feb 27, 2019

Rollup merge of rust-lang#58750 - TimDiekmann:master, r=oli-obk
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const

bors added a commit that referenced this pull request Feb 27, 2019

Auto merge of #58764 - Centril:rollup, r=Centril
Rollup of 17 pull requests

Successful merges:

 - #57882 (overhaul unused doc comments lint)
 - #58075 (Fix for issue  #58050)
 - #58627 (rustdoc: move collapse and unindent docs passes earlier)
 - #58629 (rust-lldb: fix crash when printing empty string)
 - #58630 (Make `visit_clobber` panic-safe.)
 - #58678 (Deny `async fn` in 2015 edition)
 - #58680 (Fix an indexing error when using `x.py help`)
 - #58703 (Fix copy-pasted typo for read_string return value)
 - #58744 (Update dlmalloc to 0.1.3)
 - #58746 (std: docs: Disable running several Stdio doctests)
 - #58748 (update scoped_tls to 1.0)
 - #58749 (Reduce Repetitions of (n << amt) >> amt)
 - #58750 (Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const)
 - #58752 (Update string_cache_codegen to 0.4.2)
 - #58755 (Clarify `rotate_{left,right}` docs)
 - #58757 (Normalize the type Self resolves to in an impl)
 - #58762 (Mention `unwind(aborts)` in diagnostics for `#[unwind]`)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Feb 27, 2019

Rollup merge of rust-lang#58750 - TimDiekmann:master, r=oli-obk
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const

bors added a commit that referenced this pull request Feb 27, 2019

Auto merge of #58766 - Centril:rollup, r=Centril
Rollup of 16 pull requests

Successful merges:

 - #57882 (overhaul unused doc comments lint)
 - #58075 (Fix for issue  #58050)
 - #58627 (rustdoc: move collapse and unindent docs passes earlier)
 - #58629 (rust-lldb: fix crash when printing empty string)
 - #58630 (Make `visit_clobber` panic-safe.)
 - #58678 (Deny `async fn` in 2015 edition)
 - #58680 (Fix an indexing error when using `x.py help`)
 - #58703 (Fix copy-pasted typo for read_string return value)
 - #58744 (Update dlmalloc to 0.1.3)
 - #58746 (std: docs: Disable running several Stdio doctests)
 - #58748 (update scoped_tls to 1.0)
 - #58749 (Reduce Repetitions of (n << amt) >> amt)
 - #58750 (Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const)
 - #58752 (Update string_cache_codegen to 0.4.2)
 - #58755 (Clarify `rotate_{left,right}` docs)
 - #58757 (Normalize the type Self resolves to in an impl)

Failed merges:

r? @ghost
@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Feb 27, 2019

Failed in #58766 (comment), @bors r-

@TimDiekmann

This comment has been minimized.

Copy link
Contributor Author

TimDiekmann commented Mar 4, 2019

Yes, indeed, very helpful!

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 4, 2019

⌛️ Testing commit 60a649e with merge 28660c5...

bors added a commit that referenced this pull request Mar 4, 2019

Auto merge of #58750 - TimDiekmann:master, r=oli-obk
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 4, 2019

💔 Test failed - status-appveyor

@TimDiekmann

This comment has been minimized.

Copy link
Contributor Author

TimDiekmann commented Mar 4, 2019

Command exited with code 259

Seems like a spurious failure as mentioned in #58160.

@ljedrz

This comment has been minimized.

Copy link
Contributor

ljedrz commented Mar 4, 2019

@bors retry

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 4, 2019

⌛️ Testing commit 60a649e with merge 053b211...

bors added a commit that referenced this pull request Mar 4, 2019

Auto merge of #58750 - TimDiekmann:master, r=oli-obk
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 4, 2019

💔 Test failed - status-appveyor

@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Mar 5, 2019

@bors retry

Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2019

Rollup merge of rust-lang#58750 - TimDiekmann:master, r=oli-obk
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const

bors added a commit that referenced this pull request Mar 9, 2019

Auto merge of #59043 - Centril:rollup, r=Centril
Rollup of 14 pull requests

Successful merges:

 - #58518 (Use early unwraps instead of bubbling up errors just to unwrap in the end)
 - #58626 (rustdoc: add option to calculate "documentation coverage")
 - #58629 (rust-lldb: fix crash when printing empty string)
 - #58660 (MaybeUninit: add read_initialized, add examples)
 - #58670 (fixes #52482)
 - #58676 (look for python2 symlinks before bootstrap python)
 - #58679 (Refactor passes and pass execution to be more parallel)
 - #58743 (Add tests for several E-needstest issues)
 - #58750 (Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const)
 - #58762 (Mention `unwind(aborts)` in diagnostics for `#[unwind]`)
 - #58900 (Ignore should_panic tests on android)
 - #58924 (Add as_slice() to slice::IterMut and vec::Drain)
 - #58990 (Actually publish miri in the manifest)
 - #59018 (std: Delete a by-definition spuriously failing test)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2019

Rollup merge of rust-lang#58750 - TimDiekmann:master, r=oli-obk
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const

bors added a commit that referenced this pull request Mar 9, 2019

Auto merge of #59046 - Centril:rollup, r=Centril
Rollup of 13 pull requests

Successful merges:

 - #58518 (Use early unwraps instead of bubbling up errors just to unwrap in the end)
 - #58626 (rustdoc: add option to calculate "documentation coverage")
 - #58629 (rust-lldb: fix crash when printing empty string)
 - #58660 (MaybeUninit: add read_initialized, add examples)
 - #58670 (fixes #52482)
 - #58676 (look for python2 symlinks before bootstrap python)
 - #58679 (Refactor passes and pass execution to be more parallel)
 - #58743 (Add tests for several E-needstest issues)
 - #58750 (Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const)
 - #58762 (Mention `unwind(aborts)` in diagnostics for `#[unwind]`)
 - #58924 (Add as_slice() to slice::IterMut and vec::Drain)
 - #58990 (Actually publish miri in the manifest)
 - #59018 (std: Delete a by-definition spuriously failing test)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2019

Rollup merge of rust-lang#58750 - TimDiekmann:master, r=oli-obk
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const

bors added a commit that referenced this pull request Mar 9, 2019

Auto merge of #59050 - Centril:rollup, r=Centril
Rollup of 13 pull requests

Successful merges:

 - #58518 (Use early unwraps instead of bubbling up errors just to unwrap in the end)
 - #58626 (rustdoc: add option to calculate "documentation coverage")
 - #58629 (rust-lldb: fix crash when printing empty string)
 - #58660 (MaybeUninit: add read_initialized, add examples)
 - #58670 (fixes #52482)
 - #58676 (look for python2 symlinks before bootstrap python)
 - #58679 (Refactor passes and pass execution to be more parallel)
 - #58750 (Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const)
 - #58762 (Mention `unwind(aborts)` in diagnostics for `#[unwind]`)
 - #58924 (Add as_slice() to slice::IterMut and vec::Drain)
 - #58990 (Actually publish miri in the manifest)
 - #59018 (std: Delete a by-definition spuriously failing test)
 - #59045 (Expose new_sub_parser_from_file)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Mar 9, 2019

Auto merge of #59050 - Centril:rollup, r=Centril
Rollup of 13 pull requests

Successful merges:

 - #58518 (Use early unwraps instead of bubbling up errors just to unwrap in the end)
 - #58626 (rustdoc: add option to calculate "documentation coverage")
 - #58629 (rust-lldb: fix crash when printing empty string)
 - #58660 (MaybeUninit: add read_initialized, add examples)
 - #58670 (fixes #52482)
 - #58676 (look for python2 symlinks before bootstrap python)
 - #58679 (Refactor passes and pass execution to be more parallel)
 - #58750 (Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const)
 - #58762 (Mention `unwind(aborts)` in diagnostics for `#[unwind]`)
 - #58924 (Add as_slice() to slice::IterMut and vec::Drain)
 - #58990 (Actually publish miri in the manifest)
 - #59018 (std: Delete a by-definition spuriously failing test)
 - #59045 (Expose new_sub_parser_from_file)

Failed merges:

r? @ghost

@bors bors merged commit 60a649e into rust-lang:master Mar 9, 2019

1 check failed

homu Test failed
Details
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.