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

Stabilize GlobalAlloc and #[global_allocator] #51241

Merged
merged 20 commits into from
Jun 12, 2018
Merged

Conversation

glandium
Copy link
Contributor

@glandium glandium commented May 31, 2018

This PR implements the changes discussed in #49668 (comment)

Fixes #49668
Fixes #27389

This does not change the default global allocator: #36963

@rust-highfive
Copy link
Collaborator

r? @aidanhs

(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 May 31, 2018
@glandium
Copy link
Contributor Author

Cc: @SimonSapin

@SimonSapin
Copy link
Contributor

Oh, I have pretty much the same branch and was only waiting to add docs before I submit it… :)

@glandium
Copy link
Contributor Author

I wanted to see how that would impact me, so I went ahead but didn't bother with the doc. :)

@rust-highfive
Copy link
Collaborator

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

Click to expand the log.
[00:45:09] ......................................................................i.............................
[00:45:13] ....................................................................................................
[00:45:19] ....................................................................................................
[00:45:25] ....................................................................................................
[00:45:29] ..i.................iiiiiiiii...................................................
[00:45:29] 
[00:45:29] travis_fold:start:test_ui_nll
travis_time:start:test_ui_nll
Check compiletest suite=ui mode=ui compare_mode=nll (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
[00:46:17] ......................................................................i.............................
[00:46:22] ....................................................................................................
[00:46:27] ....................................................................................................
[00:46:32] ....................................................................................................
[00:46:36] ..i.................iiiiiiiii...................................................
[00:46:36] 
[00:46:36]  finished in 67.009
[00:46:36] travis_fold:end:test_ui_nll

---
travis_time:start:test_run-pass
Check compiletest suite=run-pass mode=run-pass (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:46:36] 
[00:46:36] running 3017 tests
[00:46:50] .............F......................................................................................
[00:47:19] ....................................................................................................
[00:47:32] ....................................................................................................
[00:47:44] ....................................................................................................
[00:48:03] ....................................................................................................
---
[00:54:57] 
[00:54:57] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[00:54:57] 
[00:54:57] 
[00:54:57] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/run-pass" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-pass" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:54:57] 
[00:54:57] 
[00:54:57] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:54:57] Build completed unsuccessfully in 0:12:00
[00:54:57] Build completed unsuccessfully in 0:12:00
[00:54:57] Makefile:58: recipe for target 'check' failed
[00:54:57] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0d807eb0
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@glandium glandium force-pushed the globalalloc branch 3 times, most recently from 56439b4 to dccf003 Compare May 31, 2018 09:06
@rust-highfive
Copy link
Collaborator

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

Click to expand the log.
[00:46:02] ......................................................................i.............................
[00:46:06] ....................................................................................................
[00:46:12] ....................................................................................................
[00:46:19] ....................................................................................................
[00:46:22] ..i.................iiiiiiiii...................................................
[00:46:22] 
[00:46:22] travis_fold:start:test_ui_nll
travis_time:start:test_ui_nll
Check compiletest suite=ui mode=ui compare_mode=nll (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
[00:47:13] ......................................................................i.............................
[00:47:18] ....................................................................................................
[00:47:23] ....................................................................................................
[00:47:29] ....................................................................................................
[00:47:33] ..i.................iiiiiiiii...................................................
[00:47:33] 
[00:47:33]  finished in 70.534
[00:47:33] travis_fold:end:test_ui_nll

---
travis_time:start:test_run-pass
Check compiletest suite=run-pass mode=run-pass (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:47:33] 
[00:47:33] running 3017 tests
[00:47:48] ........F...........................................................................................
[00:48:18] ....................................................................................................
[00:48:32] ....................................................................................................
[00:48:44] ....................................................................................................
[00:49:05] ....................................................................................................
---
[00:56:10] ---- [run-pass] run-pass/allocator/custom.rs stdout ----
[00:56:10] 
[00:56:10] error: compilation failed!
[00:56:10] status: exit code: 101
[00:56:10] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass/allocator/custom.rs" "--target=x86_64-unknown-linux-gnu" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/allocator/custom/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/allocator/custom/auxiliary"
[00:56:10] ------------------------------------------
[00:56:10] 
[00:56:10] ------------------------------------------
[00:56:10] stderr:
[00:56:10] stderr:
[00:56:10] ------------------------------------------
[00:56:10] error[E0599]: no method named `unwrap` found for type `*mut u8` in the current scope
[00:56:10]   --> /checkout/src/test/run-pass/allocator/custom.rs:48:41
[00:56:10]    |
[00:56:10] 48 |         let ptr = alloc(layout.clone()).unwrap();
[00:56:10] 
[00:56:10] 
[00:56:10] error[E0277]: the trait bound `std::fmt::Debug: std::marker::Sized` is not satisfied
[00:56:10]   --> /checkout/src/test/run-pass/allocator/custom.rs:48:13
[00:56:10]    |
[00:56:10] 48 |         let ptr = alloc(layout.clone()).unwrap();
[00:56:10]    |             ^^^ `std::fmt::Debug` does not have a constant size known at compile-time
[00:56:10]    |
[00:56:10]    = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug`
[00:56:10]    = note: all local variables must have a statically known size
[00:56:10] error[E0308]: mismatched types
[00:56:10]   --> /checkout/src/test/run-pass/allocator/custom.rs:51:17
[00:56:10]    |
[00:56:10]    |
[00:56:10] 51 |         dealloc(ptr, layout.clone());
[00:56:10]    |                 ^^^ expected *-ptr, found trait std::fmt::Debug
[00:56:10]    |
[00:56:10]    = note: expected type `*mut u8`
[00:56:10]               found type `std::fmt::Debug`
[00:56:10] 
[00:56:10] error[E0599]: no method named `alloc` found for type `std::heap::System` in the current scope
[00:56:10]   --> /checkout/src/test/run-pass/allocator/custom.rs:60:26
[00:56:10]    |
[00:56:10] 60 |         let ptr = System.alloc(layout.clone()).unwrap();
[00:56:10]    |
[00:56:10]    = help: items from traits can only be used if the trait is in scope
[00:56:10] help: the following trait is implemented but not in scope, perhaps add a `use` for it:
[00:56:10]    |
[00:56:10]    |
[00:56:10] 18 | use std::heap::GlobalAlloc;
[00:56:10]    |
[00:56:10] 
[00:56:10] error[E0277]: the trait bound `std::fmt::Debug: std::marker::Sized` is not satisfied
[00:56:10]   --> /checkout/src/test/run-pass/allocator/custom.rs:60:13
[00:56:10]    |
[00:56:10] 60 |         let ptr = System.alloc(layout.clone()).unwrap();
[00:56:10]    |             ^^^ `std::fmt::Debug` does not have a constant size known at compile-time
[00:56:10]    |
[00:56:10]    = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug`
[00:56:10]    = note: all local variables must have a statically known size
[00:56:10] 
[00:56:10] error[E0599]: no method named `dealloc` found for type `std::heap::System` in the current scope
[00:56:10]   --> /checkout/src/test/run-pass/allocator/custom.rs:63:16
[00:56:10]    |
[00:56:10] 63 |         System.dealloc(ptr, layout);
[00:56:10]    |
[00:56:10]    = help: items from traits can only be used if the trait is in scope
[00:56:10] help: the following trait is implemented but not in scope, perhaps add a `use` for it:
[00:56:10]    |
---
[00:56:10] 
[00:56:10] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[00:56:10] 
[00:56:10] 
[00:56:10] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/run-pass" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-pass" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:56:10] 
[00:56:10] 
[00:56:10] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:56:10] Build completed unsuccessfully in 0:12:30
[00:56:10] Build completed unsuccessfully in 0:12:30
[00:56:10] make: *** [check] Error 1
[00:56:10] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:12c84752
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@SimonSapin SimonSapin changed the title Final changes to GlobalAlloc for stabilization Stabilize GlobalAlloc and #[global_allocator] May 31, 2018
@SimonSapin SimonSapin added A-allocators Area: Custom and system allocators T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels May 31, 2018
@SimonSapin
Copy link
Contributor

I’ve pushed additional commits to this PR. @glandium’s commits look good to me, mine still need review. In particular for the new docs and the API contracts they describe.

Both tracking issues for features being stabilized have already finished FCP, but since we’re making last minute changes let’s have a final Final Comment Perdiod:

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented May 31, 2018

Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels May 31, 2018
@kennytm kennytm added the relnotes Marks issues that should be documented in the release notes of the next release. label May 31, 2018
@@ -357,23 +360,28 @@ impl fmt::Display for AllocErr {
/// The `CannotReallocInPlace` error is used when `grow_in_place` or
/// `shrink_in_place` were unable to reuse the given memory block for
/// a requested layout.
// FIXME: should this be in libcore or liballoc?
Copy link
Member

Choose a reason for hiding this comment

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

This is used in the Alloc trait and therefore needs to be in libcore.

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed. Removed that comment.

impl fmt::Display for CannotReallocInPlace {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}

/// Augments `AllocErr` with a CapacityOverflow variant.
// FIXME: should this be in libcore or liballoc?
Copy link
Member

Choose a reason for hiding this comment

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

This could probably be moved to liballoc since it is only used by collections.

Copy link
Contributor

Choose a reason for hiding this comment

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

I moved it when I created the core::alloc module because it doesn’t depend on anything else, but with "collections" in the name maybe it belongs more where collections are define. I’ll leave this to whenever those APIs are stabilized.

///
/// * Pointers returned from allocation functions must point to valid memory and
/// retain their validity until at least the instance of `GlobalAlloc` is dropped
/// itself.
Copy link
Member

Choose a reason for hiding this comment

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

Does the concept of dropping an instance of GlobalAlloc really make sense? Should we just require pointers to be valid forever until explicitly freed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point, a static is never dropped. I copied this from Alloc docs but it doesn’t make sense here, removed.

@rust-highfive
Copy link
Collaborator

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

Click to expand the log.
[00:42:43]  Documenting core v0.0.0 (file:///checkout/src/libcore)
[00:42:43]    Compiling std v0.0.0 (file:///checkout/src/libstd)
[00:43:30] warning: [1] cannot be resolved, ignoring it...
[00:43:30] 
[00:43:31] warning: [oom] cannot be resolved, ignoring it...
[00:43:31] warning: [x] cannot be resolved, ignoring it...
[00:43:31] 
[00:43:31] warning: [] cannot be resolved, ignoring it...
[00:43:31] 
---
[00:43:40]     Checking unwind v0.0.0 (file:///checkout/src/libunwind)
[00:43:40]     Checking alloc_system v0.0.0 (file:///checkout/src/liballoc_system)
[00:43:40]     Checking panic_abort v0.0.0 (file:///checkout/src/libpanic_abort)
[00:43:40]     Checking alloc_jemalloc v0.0.0 (file:///checkout/src/liballoc_jemalloc)
[00:43:44] warning: [std::alloc::set_oom_hook] cannot be resolved, ignoring it...
[00:43:44] 
[00:43:44] warning: [std::alloc::take_oom_hook] cannot be resolved, ignoring it...
[00:43:44]     Checking rustc_tsan v0.0.0 (file:///checkout/src/librustc_tsan)
[00:43:44]     Checking rustc_msan v0.0.0 (file:///checkout/src/librustc_msan)
[00:43:44]     Checking rustc_lsan v0.0.0 (file:///checkout/src/librustc_lsan)
[00:43:44]     Checking panic_unwind v0.0.0 (file:///checkout/src/libpanic_unwind)
[00:43:44]     Checking panic_unwind v0.0.0 (file:///checkout/src/libpanic_unwind)
[00:43:44]     Checking rustc_asan v0.0.0 (file:///checkout/src/librustc_asan)
[00:43:44]  Documenting std v0.0.0 (file:///checkout/src/libstd)
[00:43:55] warning: [oom] cannot be resolved, ignoring it...
[00:43:55] 
[00:43:57] warning: [System] cannot be resolved, ignoring it...
[00:43:57] 
[00:43:57] warning: [GlobalAlloc] cannot be resolved, ignoring it...
[00:44:02]     Finished release [optimized] target(s) in 1m 19.61s
[00:44:02] Documenting stage2 test (x86_64-unknown-linux-gnu)
[00:44:03]     Checking getopts v0.2.17
[00:44:03]     Checking term v0.0.0 (file:///checkout/src/libterm)
[00:44:03]     Checking term v0.0.0 (file:///checkout/src/libterm)
[00:44:03]  Documenting test v0.0.0 (file:///checkout/src/libtest)
[00:44:04] warning: [System] cannot be resolved, ignoring it...
[00:44:04] 
[00:44:04] warning: [GlobalAlloc] cannot be resolved, ignoring it...
[00:44:04]     Finished release [optimized] target(s) in 2.07s
[00:44:05] Documenting stage2 whitelisted compiler (x86_64-unknown-linux-gnu)
[00:44:05]     Checking nodrop v0.1.12
[00:44:05]     Checking cfg-if v0.1.2
---
[00:44:15]     Checking syntax_pos v0.0.0 (file:///checkout/src/libsyntax_pos)
[00:44:17]     Checking rustc_errors v0.0.0 (file:///checkout/src/librustc_errors)
[00:44:18]     Checking syntax v0.0.0 (file:///checkout/src/libsyntax)
[00:44:35]  Documenting proc_macro v0.0.0 (file:///checkout/src/libproc_macro)
[00:44:36] warning: [System] cannot be resolved, ignoring it...
[00:44:36] 
[00:44:36] warning: [GlobalAlloc] cannot be resolved, ignoring it...
[00:44:36] warning: [cfg] cannot be resolved, ignoring it...
[00:44:36] 
[00:44:36] warning: [rayon::prelude] cannot be resolved, ignoring it...
[00:44:36] 
---
[00:47:02] ......................................................................i.............................
[00:47:06] ....................................................................................................
[00:47:12] ....................................................................................................
[00:47:18] ....................................................................................................
[00:47:22] ..i.................iiiiiiiii...................................................
[00:47:22] 
[00:47:22] travis_fold:start:test_ui_nll
travis_time:start:test_ui_nll
Check compiletest suite=ui mode=ui compare_mode=nll (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
[00:48:10] ......................................................................i.............................
[00:48:14] ....................................................................................................
[00:48:19] ....................................................................................................
[00:48:25] ....................................................................................................
[00:48:29] ..i..................iiiiiiiii..................................................
[00:48:29] 
[00:48:29]  finished in 66.965
[00:48:29] travis_fold:end:test_ui_nll

---
[01:29:30] 
[01:29:30] ---- [ui] rustdoc-ui/intra-links-warning.rs stdout ----
[01:29:30] diff of stderr:
[01:29:30] 
[01:29:30] + warning: [System] cannot be resolved, ignoring it...
[01:29:30] + 
[01:29:30] + warning: [GlobalAlloc] cannot be resolved, ignoring it...
[01:29:30] + 
[01:29:30] 1 warning: [Foo::baz] cannot be resolved, ignoring it...
[01:29:30] 2 
[01:29:30] 3 warning: [Bar::foo] cannot be resolved, ignoring it...
[01:29:30] 
[01:29:30] The actual stderr differed from the expected stderr.
[01:29:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/intra-links-warning/intra-links-warning.stderr
[01:29:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/intra-links-warning/intra-links-warning.stderr
[01:29:30] To update references, rerun the tests and pass the `--bless` flag
[01:29:30] To only update this specific test, also pass `--test-args intra-links-warning.rs`
[01:29:30] error: 1 errors occurred comparing output.
[01:29:30] status: exit code: 0
[01:29:30] status: exit code: 0
[01:29:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "/checkout/src/test/rustdoc-ui/intra-links-warning.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/intra-links-warning/a" "-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/rustdoc-ui/intra-links-warning/auxiliary"
[01:29:30] ------------------------------------------
[01:29:30] 
[01:29:30] ------------------------------------------
[01:29:30] stderr:
[01:29:30] stderr:
[01:29:30] ------------------------------------------
[01:29:30] {"message":"[System] cannot be resolved, ignoring it...","code":null,"level":"warning","spans":[],"children":[],"rendered":"warning: [System] cannot be resolved, ignoring it...\n\n"}
[01:29:30] {"message":"[GlobalAlloc] cannot be resolved, ignoring it...","code":null,"level":"warning","spans":[],"children":[],"rendered":"warning: [GlobalAlloc] cannot be resolved, ignoring it...\n\n"}
[01:29:30] {"message":"[Foo::baz] cannot be resolved, ignoring it...","code":null,"level":"warning","spans":[],"children":[],"rendered":"warning: [Foo::baz] cannot be resolved, ignoring it...\n\n"}
[01:29:30] {"message":"[Bar::foo] cannot be resolved, ignoring it...","code":null,"level":"warning","spans":[],"children":[],"rendered":"warning: [Bar::foo] cannot be resolved, ignoring it...\n\n"}
[01:29:30] {"message":"[Uniooon::X] cannot be resolved, ignoring it...","code":null,"level":"warning","spans":[],"children":[],"rendered":"warning: [Uniooon::X] cannot be resolved, ignoring it...\n\n"}
[01:29:30] ------------------------------------------
[01:29:30] 
[01:29:30] thread '[ui] rustdoc-ui/intra-links-warning.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3096:9
[01:29:30] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:29:30] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:29:30] 
[01:29:30] ---- [ui] rustdoc-ui/deprecated-attrs.rs stdout ----
[01:29:30] diff of stderr:
[01:29:30] 
[01:29:30] + warning: [System] cannot be resolved, ignoring it...
[01:29:30] + 
[01:29:30] + warning: [GlobalAlloc] cannot be resolved, ignoring it...
[01:29:30] + 
[01:29:30] 1 warning: the `#![doc(no_default_passes)]` attribute is considered deprecated
[01:29:30] 3   = warning: please see https://github.com/rust-lang/rust/issues/44136
[01:29:30] 
[01:29:30] 
[01:29:30] The actual stderr differed from the expected stderr.
[01:29:30] The actual stderr differed from the expected stderr.
[01:29:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/deprecated-attrs/deprecated-attrs.stderr
[01:29:30] To update references, rerun the tests and pass the `--bless` flag
[01:29:30] To only update this specific test, also pass `--test-args deprecated-attrs.rs`
[01:29:30] error: 1 errors occurred comparing output.
[01:29:30] status: exit code: 0
[01:29:30] status: exit code: 0
[01:29:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "/checkout/src/test/rustdoc-ui/deprecated-attrs.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/deprecated-attrs/a" "-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/rustdoc-ui/deprecated-attrs/auxiliary"
[01:29:30] ------------------------------------------
[01:29:30] 
[01:29:30] ------------------------------------------
[01:29:30] stderr:
[01:29:30] stderr:
[01:29:30] ------------------------------------------
[01:29:30] {"message":"[System] cannot be resolved, ignoring it...","code":null,"level":"warning","spans":[],"children":[],"rendered":"warning: [System] cannot be resolved, ignoring it...\n\n"}
[01:29:30] {"message":"[GlobalAlloc] cannot be resolved, ignoring it...","code":null,"level":"warning","spans":[],"children":[],"rendered":"warning: [GlobalAlloc] cannot be resolved, ignoring it...\n\n"}
[01:29:30] {"message":"the `#![doc(no_default_passes)]` attribute is considered deprecated","code":null,"level":"warning","spans":[],"children":[{"message":"please see https://github.com/rust-lang/rust/issues/44136","code":null,"level":"warning","spans":[],"children":[],"rendered":null},{"message":"you may want to use `#![doc(document_private_items)]`","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"warning: the `#![doc(no_default_passes)]` attribute is considered deprecated\n  |\n  = warning: please see https://github.com/rust-lang/rust/issues/44136\n  = help: you may want to use `#![doc(document_private_items)]`\n\n"}
[01:29:30] {"message":"the `#![doc(passes = \"...\")]` attribute is considered deprecated","code":null,"level":"warning","spans":[],"children":[{"message":"please see https://github.com/rust-lang/rust/issues/44136","code":null,"level":"warning","spans":[],"children":[],"rendered":null}],"rendered":"warning: the `#![doc(passes = \"...\")]` attribute is considered deprecated\n  |\n  = warning: please see https://github.com/rust-lang/rust/issues/44136\n\n"}
[01:29:30] ------------------------------------------
[01:29:30] 
[01:29:30] thread '[ui] rustdoc-ui/deprecated-attrs.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3096:9
[01:29:30] 
---
[01:29:30] test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out
[01:29:30] 
[01:29:30] 
[01:29:30] 
[01:29:30] 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" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/rustdoc-ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-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-3.9/bin/FileCheck" "--host-rustcflags" "-Zunstable-options " "--target-rustcflags" "-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" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:29:30] 
[01:29:30] 
[01:29:30] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:29:30] Build completed unsuccessfully in 0:44:46
[01:29:30] Build completed unsuccessfully in 0:44:46
[01:29:30] make: *** [check] Error 1
[01:29:30] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:11e8453e
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

/// library that aborts on memory exhaustion.)
///
/// Clients wishing to abort computation in response to an
/// allocation error are encouraged to call the [`oom`] function,
Copy link
Member

Choose a reason for hiding this comment

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

Will this link work?

Copy link
Contributor

Choose a reason for hiding this comment

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

I hoped it would, but it doesn’t when the target is not in the source crate (or its dependencies?). Will fix.

/// or NULL to indicate reallocation failure.
/// If this returns a non-null pointer, then ownership of the memory block
/// referenced by `ptr` has been transferred to this alloctor.
/// The memory may or may not have been deallocated,
Copy link
Member

Choose a reason for hiding this comment

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

In what situation would the memory not be deallocated?

Copy link
Contributor

Choose a reason for hiding this comment

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

I’m not sure, I copied this form Alloc::realloc docs. Maybe when realloc succeeds in place and returns the same pointer? Would you rather I remove that sentence?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ownership of the memory block referenced by ptr has been transferred to this alloctor.

There's a typo on allocator. I'd add a "back" after transferred, too, to make it subtly clearer that ownership of the memory block started from this allocator.

@SimonSapin
Copy link
Contributor

@bors r=sfackler,SimonSapin

@bors
Copy link
Contributor

bors commented Jun 11, 2018

📌 Commit 7f0d54d has been approved by sfackler,SimonSapin

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

bors commented Jun 12, 2018

⌛ Testing commit 7f0d54d with merge 4367e41...

bors added a commit that referenced this pull request Jun 12, 2018
Stabilize GlobalAlloc and #[global_allocator]

This PR implements the changes discussed in #49668 (comment)

Fixes #49668
Fixes #27389

This does not change the default global allocator: #36963
@bors
Copy link
Contributor

bors commented Jun 12, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: sfackler,SimonSapin
Pushing 4367e41 to master...

@glandium
Copy link
Contributor Author

Now that docs are up-to-date on https://doc.rust-lang.org/nightly/std/alloc/index.html, it feels like the docs for the reexports should be "inlined" (e.g. alloc, alloc_zeroed, oom), since the alloc crate is still unstable.

@glandium glandium deleted the globalalloc branch June 13, 2018 05:53
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jun 13, 2018
Bug 1458161 added a rust OOM handler based on an unstable API that was
removed in 1.27, replaced with something that didn't allow to get the
failed allocation size.

Latest 1.28 nightly (2018-06-13) has
rust-lang/rust#50880,
rust-lang/rust#51264 and
rust-lang/rust#51241 merged, which allow to
hook the OOM handler and get the failed allocation size again.

Because this is still an unstable API, we explicitly depend on strict
versions of rustc. We also explicitly error out if automation builds
end up using a rustc version that doesn't allow us to get the allocation
size for rust OOM, because we don't want that to happen without knowing.

--HG--
extra : rebase_source : 6c097151046d088cf51f4755dd69bde97bb8bd8b
@SimonSapin
Copy link
Contributor

@glandium Indeed. This is a rustdoc bug: #51252. Maybe until that’s fixed we should explicitly re-export each item, but that leaves the opportunity to forget adding a re-export when a new item is added to core::alloc or alloc::alloc.

@SimonSapin
Copy link
Contributor

@glandium, #51584 just fixed this

bors added a commit that referenced this pull request Jun 25, 2018
Prohibit `global_allocator` in submodules

Background: #44113 is caused by weird interactions with hygiene. Hygiene is hard. After a lot of playing around, we decided that the best path forward would be to prohibit `global_allocator`s from being in submodules for now. When somebody gets it working, we can re-enable it.

This PR contains the following
- Some hygiene "fixes" -- things I suspect are the correct thing to do that will make life easier in the future. This includes using call_site hygiene for the generated module and passing the correct crate name to the expansion config.
- Comments and minor formatting fixes
- Some debugging code
- Code to prohibit `global_allocator` in submodules
- Test checking that the proper error occurs.

cc #44113 #49320 #51241

r? @alexcrichton
bors added a commit that referenced this pull request Nov 8, 2018
Add tracking issue for Layout methods (and some API changes)

These methods are already useful when used with the stable global allocator API (stabilized in #51241).

```rust
pub fn align_to(&self, align: usize) -> Result<Layout, LayoutErr>;
pub fn padding_needed_for(&self, align: usize) -> usize;
pub fn repeat(&self, n: usize) -> Result<(Layout, usize), LayoutErr>;
pub fn extend(&self, next: Layout) -> Result<(Layout, usize), LayoutErr>;
pub fn repeat_packed(&self, n: usize) -> Result<Layout, LayoutErr>;
pub fn extend_packed(&self, next: Layout) -> Result<Layout, LayoutErr>;
pub fn array<T>(n: usize) -> Result<Layout, LayoutErr>;
```

cc #32838

r? @SimonSapin
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 3, 2019
Bug 1458161 added a rust OOM handler based on an unstable API that was
removed in 1.27, replaced with something that didn't allow to get the
failed allocation size.

Latest 1.28 nightly (2018-06-13) has
rust-lang/rust#50880,
rust-lang/rust#51264 and
rust-lang/rust#51241 merged, which allow to
hook the OOM handler and get the failed allocation size again.

Because this is still an unstable API, we explicitly depend on strict
versions of rustc. We also explicitly error out if automation builds
end up using a rustc version that doesn't allow us to get the allocation
size for rust OOM, because we don't want that to happen without knowing.

UltraBlame original commit: 5182bca90d0609f182d5a7b6b48ed2ffbbce32c2
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 3, 2019
Bug 1458161 added a rust OOM handler based on an unstable API that was
removed in 1.27, replaced with something that didn't allow to get the
failed allocation size.

Latest 1.28 nightly (2018-06-13) has
rust-lang/rust#50880,
rust-lang/rust#51264 and
rust-lang/rust#51241 merged, which allow to
hook the OOM handler and get the failed allocation size again.

Because this is still an unstable API, we explicitly depend on strict
versions of rustc. We also explicitly error out if automation builds
end up using a rustc version that doesn't allow us to get the allocation
size for rust OOM, because we don't want that to happen without knowing.

UltraBlame original commit: 5182bca90d0609f182d5a7b6b48ed2ffbbce32c2
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 3, 2019
Bug 1458161 added a rust OOM handler based on an unstable API that was
removed in 1.27, replaced with something that didn't allow to get the
failed allocation size.

Latest 1.28 nightly (2018-06-13) has
rust-lang/rust#50880,
rust-lang/rust#51264 and
rust-lang/rust#51241 merged, which allow to
hook the OOM handler and get the failed allocation size again.

Because this is still an unstable API, we explicitly depend on strict
versions of rustc. We also explicitly error out if automation builds
end up using a rustc version that doesn't allow us to get the allocation
size for rust OOM, because we don't want that to happen without knowing.

UltraBlame original commit: 5182bca90d0609f182d5a7b6b48ed2ffbbce32c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-allocators Area: Custom and system allocators disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.