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

Rename Alloc to AllocRef #68529

Merged
merged 1 commit into from
Jan 28, 2020
Merged

Rename Alloc to AllocRef #68529

merged 1 commit into from
Jan 28, 2020

Conversation

TimDiekmann
Copy link
Member

@TimDiekmann TimDiekmann commented Jan 25, 2020

The allocator-wg has decided to merge this change upstream in rust-lang/wg-allocators#8 (comment).

This renames Alloc to AllocRef because types that implement Alloc are a reference, smart pointer, or ZSTs. It is not possible to have an allocator like MyAlloc([u8; N]), that owns the memory and also implements Alloc, since that would mean, that moving a Vec<T, MyAlloc> would need to correct the internal pointer, which is not possible as we don't have move constructors.

For further explanation please see rust-lang/wg-allocators#8 (comment) and the comments after that one.

Additionally it clarifies the semantics of Clone on an allocator. In the case of AllocRef, it is clear that the cloned handle still points to the same allocator instance, and that you can free data allocated from one handle with another handle.

The initial proposal was to rename Alloc to AllocHandle, but Ref expresses the semantics better than Handle. Also, the only appearance of Handle in std are for windows specific resources, which might be confusing.

Blocked on rust-lang/miri#1160

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(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 Jan 25, 2020
@Mark-Simulacrum
Copy link
Member

Changes themselves look good, but let's r? @Amanieu as this probably needs some libs signoff

@Amanieu
Copy link
Member

Amanieu commented Jan 26, 2020

I think the documentation for the AllocRef trait could be clarified a bit:

  • Specify that cloning an AllocRef returns a reference to the same allocator. Pointers remain valid as long as at least one AllocRef is still live.
  • Specify that the pointers returned remain valid if the AllocRef is moved (this was already assumed before, but I noticed it is not explicitly said in the docs).
  • Maybe a sentence to explain why this trait is called AllocRef instead of just Alloc. I would expect the word "reference" to appear somewhere in the docs.

cc @rust-lang/libs

@TimDiekmann
Copy link
Member Author

Sounds reasonable, I will adjust the docs!

@Amanieu
Copy link
Member

Amanieu commented Jan 26, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Jan 26, 2020

📌 Commit 61e9667 has been approved by Amanieu

@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 Jan 26, 2020
@bors
Copy link
Contributor

bors commented Jan 26, 2020

⌛ Testing commit 61e9667 with merge 52d2687...

bors added a commit that referenced this pull request Jan 26, 2020
Rename `Alloc` to `AllocRef`

The allocator-wg has decided to merge this change upstream in rust-lang/wg-allocators#8 (comment).

This renames `Alloc` to `AllocRef` because types that implement `Alloc` are a reference, smart pointer, or ZSTs. It is not possible to have an allocator like `MyAlloc([u8; N])`, that owns the memory and also implements `Alloc`, since that would mean, that moving a `Vec<T, MyAlloc>` would need to correct the internal pointer, which is not possible as we don't have move constructors.

For further explanation please see rust-lang/wg-allocators#8 (comment) and the comments after that one.

Additionally it clarifies the semantics of `Clone` on an allocator. In the case of `AllocRef`, it is clear that the cloned handle still points to the same allocator instance, and that you can free data allocated from one handle with another handle.

The initial proposal was to rename `Alloc` to `AllocHandle`, but `Ref` expresses the semantics better than `Handle`. Also, the only appearance of `Handle` in `std` are for windows specific resources, which might be confusing.
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-tools of your PR failed (pretty log, 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.
2020-01-26T16:41:02.8212687Z ---- /checkout/src/doc/nomicon/src/destructors.md - Destructors (line 128) stdout ----
2020-01-26T16:41:02.8212979Z error[E0432]: unresolved import `std::alloc::Alloc`
2020-01-26T16:41:02.8213302Z  --> /checkout/src/doc/nomicon/src/destructors.md:131:18
2020-01-26T16:41:02.8213388Z   |
2020-01-26T16:41:02.8213567Z 4 | use std::alloc::{Alloc, GlobalAlloc, Global, Layout};
2020-01-26T16:41:02.8213754Z   |                  |
2020-01-26T16:41:02.8213833Z   |                  no `Alloc` in `alloc`
2020-01-26T16:41:02.8213940Z   |                  help: a similar name exists in the module: `alloc`
2020-01-26T16:41:02.8214001Z 
2020-01-26T16:41:02.8214001Z 
2020-01-26T16:41:02.8214106Z error[E0599]: no method named `dealloc` found for struct `std::alloc::Global` in the current scope
2020-01-26T16:41:02.8214419Z   --> /checkout/src/doc/nomicon/src/destructors.md:142:20
2020-01-26T16:41:02.8214518Z    |
2020-01-26T16:41:02.8214599Z 15 |             Global.dealloc(c.cast(), Layout::new::<T>());
2020-01-26T16:41:02.8214823Z    |
2020-01-26T16:41:02.8214906Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:02.8214906Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:02.8215035Z help: the following trait is implemented but not in scope; perhaps add a `use` for it:
2020-01-26T16:41:02.8215212Z 4  | use std::alloc::AllocRef;
2020-01-26T16:41:02.8215287Z    |
2020-01-26T16:41:02.8215516Z 
2020-01-26T16:41:02.8215615Z error[E0599]: no method named `dealloc` found for struct `std::alloc::Global` in the current scope
2020-01-26T16:41:02.8215615Z error[E0599]: no method named `dealloc` found for struct `std::alloc::Global` in the current scope
2020-01-26T16:41:02.8216106Z   --> /checkout/src/doc/nomicon/src/destructors.md:157:20
2020-01-26T16:41:02.8216194Z    |
2020-01-26T16:41:02.8216289Z 30 |             Global.dealloc(c.cast(), Layout::new::<T>());
2020-01-26T16:41:02.8216489Z    |
2020-01-26T16:41:02.8216572Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:02.8216572Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:02.8216702Z help: the following trait is implemented but not in scope; perhaps add a `use` for it:
2020-01-26T16:41:02.8216877Z 4  | use std::alloc::AllocRef;
2020-01-26T16:41:02.8216966Z    |
2020-01-26T16:41:02.8217007Z 
2020-01-26T16:41:02.8217086Z error: aborting due to 3 previous errors
---
2020-01-26T16:41:02.8218115Z ---- /checkout/src/doc/nomicon/src/destructors.md - Destructors (line 28) stdout ----
2020-01-26T16:41:02.8218218Z error[E0432]: unresolved import `std::alloc::Alloc`
2020-01-26T16:41:02.8218513Z  --> /checkout/src/doc/nomicon/src/destructors.md:31:18
2020-01-26T16:41:02.8218609Z   |
2020-01-26T16:41:02.8218688Z 4 | use std::alloc::{Alloc, Global, GlobalAlloc, Layout};
2020-01-26T16:41:02.8218871Z   |                  |
2020-01-26T16:41:02.8218962Z   |                  no `Alloc` in `alloc`
2020-01-26T16:41:02.8219053Z   |                  help: a similar name exists in the module: `alloc`
2020-01-26T16:41:02.8219134Z 
2020-01-26T16:41:02.8219134Z 
2020-01-26T16:41:02.8219225Z error[E0599]: no method named `dealloc` found for struct `std::alloc::Global` in the current scope
2020-01-26T16:41:02.8219530Z   --> /checkout/src/doc/nomicon/src/destructors.md:42:20
2020-01-26T16:41:02.8220047Z    |
2020-01-26T16:41:02.8220142Z 15 |             Global.dealloc(c.cast(), Layout::new::<T>())
2020-01-26T16:41:02.8220336Z    |
2020-01-26T16:41:02.8220417Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:02.8220417Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:02.8220536Z help: the following trait is implemented but not in scope; perhaps add a `use` for it:
2020-01-26T16:41:02.8220793Z 4  | use std::alloc::AllocRef;
2020-01-26T16:41:02.8220883Z    |
2020-01-26T16:41:02.8220922Z 
2020-01-26T16:41:02.8220993Z error: aborting due to 2 previous errors
---
2020-01-26T16:41:02.8222080Z ---- /checkout/src/doc/nomicon/src/destructors.md - Destructors (line 55) stdout ----
2020-01-26T16:41:02.8222181Z error[E0432]: unresolved import `std::alloc::Alloc`
2020-01-26T16:41:02.8222475Z  --> /checkout/src/doc/nomicon/src/destructors.md:58:18
2020-01-26T16:41:02.8222571Z   |
2020-01-26T16:41:02.8222649Z 4 | use std::alloc::{Alloc, Global, GlobalAlloc, Layout};
2020-01-26T16:41:02.8222824Z   |                  |
2020-01-26T16:41:02.8222916Z   |                  no `Alloc` in `alloc`
2020-01-26T16:41:02.8223017Z   |                  help: a similar name exists in the module: `alloc`
2020-01-26T16:41:02.8223091Z 
2020-01-26T16:41:02.8223091Z 
2020-01-26T16:41:02.8223182Z error[E0599]: no method named `dealloc` found for struct `std::alloc::Global` in the current scope
2020-01-26T16:41:02.8223497Z   --> /checkout/src/doc/nomicon/src/destructors.md:69:20
2020-01-26T16:41:02.8223581Z    |
2020-01-26T16:41:02.8223673Z 15 |             Global.dealloc(c.cast(), Layout::new::<T>());
2020-01-26T16:41:02.8223872Z    |
2020-01-26T16:41:02.8223952Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:02.8223952Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:02.8224072Z help: the following trait is implemented but not in scope; perhaps add a `use` for it:
2020-01-26T16:41:02.8224245Z 4  | use std::alloc::AllocRef;
2020-01-26T16:41:02.8224333Z    |
2020-01-26T16:41:02.8224373Z 
2020-01-26T16:41:02.8224461Z error[E0599]: no method named `dealloc` found for struct `std::alloc::Global` in the current scope
2020-01-26T16:41:02.8224461Z error[E0599]: no method named `dealloc` found for struct `std::alloc::Global` in the current scope
2020-01-26T16:41:02.8224776Z   --> /checkout/src/doc/nomicon/src/destructors.md:82:20
2020-01-26T16:41:02.8224872Z    |
2020-01-26T16:41:02.8224962Z 28 |             Global.dealloc(c.cast::<u8>(), Layout::new::<T>());
2020-01-26T16:41:02.8225159Z    |
2020-01-26T16:41:02.8225253Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:02.8225253Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:02.8225359Z help: the following trait is implemented but not in scope; perhaps add a `use` for it:
2020-01-26T16:41:02.8225530Z 4  | use std::alloc::AllocRef;
2020-01-26T16:41:02.8225619Z    |
2020-01-26T16:41:02.8225659Z 
2020-01-26T16:41:02.8225744Z error: aborting due to 3 previous errors
---
2020-01-26T16:41:08.9396641Z ---- /checkout/src/doc/nomicon/src/vec-final.md - The_Final_Code (line 3) stdout ----
2020-01-26T16:41:08.9396748Z error[E0432]: unresolved import `std::alloc::Alloc`
2020-01-26T16:41:08.9397075Z   --> /checkout/src/doc/nomicon/src/vec-final.md:12:18
2020-01-26T16:41:08.9397161Z    |
2020-01-26T16:41:08.9397268Z 10 | use std::alloc::{Alloc, GlobalAlloc, Layout, Global, handle_alloc_error};
2020-01-26T16:41:08.9397457Z    |                  |
2020-01-26T16:41:08.9397553Z    |                  no `Alloc` in `alloc`
2020-01-26T16:41:08.9397649Z    |                  help: a similar name exists in the module: `alloc`
2020-01-26T16:41:08.9397728Z 
2020-01-26T16:41:08.9397728Z 
2020-01-26T16:41:08.9397820Z error[E0599]: no method named `alloc` found for struct `std::alloc::Global` in the current scope
2020-01-26T16:41:08.9398136Z   --> /checkout/src/doc/nomicon/src/vec-final.md:37:34
2020-01-26T16:41:08.9398220Z    |
2020-01-26T16:41:08.9398331Z 35 |                 let ptr = Global.alloc(Layout::array::<T>(1).unwrap());
2020-01-26T16:41:08.9398542Z    |
2020-01-26T16:41:08.9398633Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:08.9398633Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:08.9398759Z help: the following trait is implemented but not in scope; perhaps add a `use` for it:
2020-01-26T16:41:08.9398938Z 6  | use std::alloc::AllocRef;
2020-01-26T16:41:08.9399028Z    |
2020-01-26T16:41:08.9399069Z 
2020-01-26T16:41:08.9399159Z error[E0599]: no method named `realloc` found for struct `std::alloc::Global` in the current scope
2020-01-26T16:41:08.9399159Z error[E0599]: no method named `realloc` found for struct `std::alloc::Global` in the current scope
2020-01-26T16:41:08.9399470Z   --> /checkout/src/doc/nomicon/src/vec-final.md:42:34
2020-01-26T16:41:08.9399553Z    |
2020-01-26T16:41:08.9399648Z 40 |                 let ptr = Global.realloc(c.cast(),
2020-01-26T16:41:08.9400022Z    |
2020-01-26T16:41:08.9400120Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:08.9400120Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:08.9400510Z help: the following trait is implemented but not in scope; perhaps add a `use` for it:
2020-01-26T16:41:08.9400690Z 6  | use std::alloc::AllocRef;
2020-01-26T16:41:08.9400783Z    |
2020-01-26T16:41:08.9400823Z 
2020-01-26T16:41:08.9400929Z error[E0599]: no method named `dealloc` found for struct `std::alloc::Global` in the current scope
2020-01-26T16:41:08.9400929Z error[E0599]: no method named `dealloc` found for struct `std::alloc::Global` in the current scope
2020-01-26T16:41:08.9401244Z   --> /checkout/src/doc/nomicon/src/vec-final.md:69:24
2020-01-26T16:41:08.9401343Z    |
2020-01-26T16:41:08.9401418Z 67 |                 Global.dealloc(c.cast(),
2020-01-26T16:41:08.9401616Z    |
2020-01-26T16:41:08.9401713Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:08.9401713Z    = help: items from traits can only be used if the trait is in scope
2020-01-26T16:41:08.9401841Z help: the following trait is implemented but not in scope; perhaps add a `use` for it:
2020-01-26T16:41:08.9402015Z 6  | use std::alloc::AllocRef;
2020-01-26T16:41:08.9402090Z    |
2020-01-26T16:41:08.9402129Z 
2020-01-26T16:41:08.9402224Z error: aborting due to 4 previous errors
---
2020-01-26T16:54:33.4842792Z error: The server responded with 404 Not Found for "https://blog.rust-lang.org/2016/04/19/MIR.html"
2020-01-26T16:54:33.4842963Z 
2020-01-26T16:54:33.4843342Z     ┌── mir/index.md:12:1 ───
2020-01-26T16:54:33.4843695Z     │
2020-01-26T16:54:33.4844105Z  12 │ [rust-lang blog post that introduced MIR][blog].
2020-01-26T16:54:33.4844845Z     │
2020-01-26T16:54:33.4845005Z 
2020-01-26T16:54:33.4851995Z Error: One or more incorrect links
2020-01-26T16:54:33.4852323Z 
---
2020-01-26T17:49:14.7525394Z normalized stderr:
2020-01-26T17:49:14.7533829Z error[E0432]: unresolved import `std::alloc::Alloc`
2020-01-26T17:49:14.7534610Z  --> $DIR/heap_allocator.rs:4:26
2020-01-26T17:49:14.7534736Z   |
2020-01-26T17:49:14.7534818Z 4 | use std::alloc::{Global, Alloc, Layout, System};
2020-01-26T17:49:14.7535001Z   |                          |
2020-01-26T17:49:14.7535114Z   |                          no `Alloc` in `alloc`
2020-01-26T17:49:14.7535227Z   |                          help: a similar name exists in the module: `alloc`
2020-01-26T17:49:14.7535297Z 
---
2020-01-26T17:49:14.7550012Z 
2020-01-26T17:49:14.7550143Z diff of stderr:
2020-01-26T17:49:14.7550219Z 
2020-01-26T17:49:14.7550464Z +error[E0432]: unresolved import `std::alloc::Alloc`
2020-01-26T17:49:14.7551088Z + --> $DIR/heap_allocator.rs:4:26
2020-01-26T17:49:14.7553590Z +  |
2020-01-26T17:49:14.7554647Z +4 | use std::alloc::{Global, Alloc, Layout, System};
2020-01-26T17:49:14.7556875Z +  |                          ^^^^^
2020-01-26T17:49:14.7558318Z +  |                          |
2020-01-26T17:49:14.7560796Z +  |                          no `Alloc` in `alloc`
2020-01-26T17:49:14.7561647Z +  |                          help: a similar name exists in the module: `alloc`
2020-01-26T17:49:14.7568792Z +error: aborting due to previous error
2020-01-26T17:49:14.7568935Z +
2020-01-26T17:49:14.7570026Z +For more information about this error, try `rustc --explain E0432`.
2020-01-26T17:49:14.7578010Z +
2020-01-26T17:49:14.7578010Z +
2020-01-26T17:49:14.7578078Z 
2020-01-26T17:49:14.7578161Z The actual stderr differed from the expected stderr.
2020-01-26T17:49:14.7578945Z Actual stderr saved to /tmp/compiletestQrE0Kv/heap_allocator.stderr
2020-01-26T17:49:14.7579053Z To update references, run this command from build directory:
2020-01-26T17:49:14.7580036Z tests/run-pass/update-references.sh '/tmp/compiletestQrE0Kv' 'heap_allocator.rs'
2020-01-26T17:49:14.7580213Z error: 1 errors occurred comparing output.
2020-01-26T17:49:14.7580292Z status: exit code: 1
2020-01-26T17:49:14.7580292Z status: exit code: 1
2020-01-26T17:49:14.7581118Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools-bin/miri" "tests/run-pass/heap_allocator.rs" "-L" "/tmp/compiletestQrE0Kv" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/tmp/compiletestQrE0Kv/heap_allocator.stage-id" "--edition" "2018" "-Astable-features" "--sysroot" "/home/user/.cache/miri/HOST" "-L" "/tmp/compiletestQrE0Kv/heap_allocator.stage-id.aux" "-A" "unused"
2020-01-26T17:49:14.7581608Z ------------------------------------------
2020-01-26T17:49:14.7581679Z 
2020-01-26T17:49:14.7581932Z ------------------------------------------
2020-01-26T17:49:14.7582027Z stderr:
2020-01-26T17:49:14.7582027Z stderr:
2020-01-26T17:49:14.7582271Z ------------------------------------------
2020-01-26T17:49:14.7585604Z {"message":"unresolved import `std::alloc::Alloc`","code":{"code":"E0432","explanation":"An import was unresolved.\n\nErroneous code example:\n\n```compile_fail,E0432\nuse something::Foo; // error: unresolved import `something::Foo`.\n```\n\nPaths in `use` statements are relative to the crate root. To import items\nrelative to the current and parent modules, use the `self::` and `super::`\nprefixes, respectively. Also verify that you didn't misspell the import\nname and that the import exists in the module from where you tried to\nimport it. Example:\n\n```\nuse self::something::Foo; // ok!\n\nmod something {\n    pub struct Foo;\n}\n# fn main() {}\n```\n\nOr, if you tried to use a module from an external crate, you may have missed\nthe `extern crate` declaration (which is usually placed in the crate root):\n\n```\nextern crate core; // Required to use the `core` crate\n\nuse core::any;\n# fn main() {}\n```\n"},"level":"error","spans":[{"file_name":"tests/run-pass/heap_allocator.rs","byte_start":76,"byte_end":81,"line_start":4,"line_end":4,"column_start":26,"column_end":31,"is_primary":true,"text":[{"text":"use std::alloc::{Global, Alloc, Layout, System};","highlight_start":26,"highlight_end":31}],"label":"no `Alloc` in `alloc`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"a similar name exists in the module","code":null,"level":"help","spans":[{"file_name":"tests/run-pass/heap_allocator.rs","byte_start":76,"byte_end":81,"line_start":4,"line_end":4,"column_start":26,"column_end":31,"is_primary":true,"text":[{"text":"use std::alloc::{Global, Alloc, Layout, System};","highlight_start":26,"highlight_end":31}],"label":null,"suggested_replacement":"alloc","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0432]: unresolved import `std::alloc::Alloc`\n --> tests/run-pass/heap_allocator.rs:4:26\n  |\n4 | use std::alloc::{Global, Alloc, Layout, System};\n  |                          ^^^^^\n  |                          |\n  |                          no `Alloc` in `alloc`\n  |                          help: a similar name exists in the module: `alloc`\n\n"}
2020-01-26T17:49:14.7587553Z {"message":"For more information about this error, try `rustc --explain E0432`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0432`.\n"}
2020-01-26T17:49:14.7587688Z 
2020-01-26T17:49:14.7587940Z ------------------------------------------
2020-01-26T17:49:14.7588008Z 
---
2020-01-26T17:49:31.0023578Z Verifying status of clippy-driver...
2020-01-26T17:49:31.0023680Z Verifying status of miri...
2020-01-26T17:49:31.0023950Z Verifying status of embedded-book...
2020-01-26T17:49:31.0024213Z Verifying status of rustc-guide...
2020-01-26T17:49:31.0024522Z error: Tool `nomicon` should be test-pass but is test-fail during beta week.
2020-01-26T17:49:31.0028937Z Build completed unsuccessfully in 0:00:01
2020-01-26T17:49:31.0088904Z == clock drift check ==
2020-01-26T17:49:31.0104437Z   local time: Sun Jan 26 17:49:31 UTC 2020
2020-01-26T17:49:31.2855462Z   network time: Sun, 26 Jan 2020 17:49:31 GMT
2020-01-26T17:49:31.2855462Z   network time: Sun, 26 Jan 2020 17:49:31 GMT
2020-01-26T17:49:31.2858594Z == end clock drift check ==
2020-01-26T17:49:31.7662108Z 
2020-01-26T17:49:31.7749333Z ##[error]Bash exited with code '1'.
2020-01-26T17:49:31.7788257Z ##[section]Starting: Checkout rust-lang/rust@auto to s
2020-01-26T17:49:31.7790479Z ==============================================================================
2020-01-26T17:49:31.7790575Z Task         : Get sources
2020-01-26T17:49:31.7790686Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@bors
Copy link
Contributor

bors commented Jan 26, 2020

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 26, 2020
TimDiekmann added a commit to TimDiekmann/miri that referenced this pull request Jan 26, 2020
Required to land rust-lang/rust#68529. Please see that PR for details. The CI is expected to fail until the PR is landed.
@TimDiekmann
Copy link
Member Author

In order to workaround the circular submodule dependencies, I re-added the Alloc trait as hidden trait. This can be used by the submodules until they can rely on the new trait.
Bors shouldn't try it for now, as miri will fail until rust-lang/miri#1160 is merged.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, 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.
2020-01-27T16:37:45.0621953Z ========================== Starting Command Output ===========================
2020-01-27T16:37:45.0623899Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/55581fff-bbc6-47a4-a0d5-6964c9507ba3.sh
2020-01-27T16:37:45.0623942Z 
2020-01-27T16:37:45.0627286Z ##[section]Finishing: Disable git automatic line ending conversion
2020-01-27T16:37:45.0635621Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/68529/merge to s
2020-01-27T16:37:45.0637958Z Task         : Get sources
2020-01-27T16:37:45.0637997Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-01-27T16:37:45.0638034Z Version      : 1.0.0
2020-01-27T16:37:45.0638135Z Author       : Microsoft
---
2020-01-27T16:37:46.1330158Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-01-27T16:37:46.1414059Z ##[command]git config gc.auto 0
2020-01-27T16:37:46.1493933Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-01-27T16:37:46.1539520Z ##[command]git config --get-all http.proxy
2020-01-27T16:37:46.1701354Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/68529/merge:refs/remotes/pull/68529/merge

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)

@Amanieu
Copy link
Member

Amanieu commented Jan 27, 2020

Is it really necessary to create a full copy of the trait? Couldn't you simply re-export the trait under the name Alloc (with pub use)?

@TimDiekmann
Copy link
Member Author

Oh, I didn't know type also work for traits 😄

@Amanieu
Copy link
Member

Amanieu commented Jan 27, 2020

Actually type doesn't work on traits, you need pub use.

@TimDiekmann
Copy link
Member Author

TimDiekmann commented Jan 27, 2020

Currently have a local test running. Will push it with pub use when passed. Thanks!

@Amanieu
Copy link
Member

Amanieu commented Jan 27, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Jan 27, 2020

📌 Commit 7ca25db has been approved by Amanieu

@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 Jan 27, 2020
@bors
Copy link
Contributor

bors commented Jan 28, 2020

⌛ Testing commit 7ca25db with merge b181835...

bors added a commit that referenced this pull request Jan 28, 2020
Rename `Alloc` to `AllocRef`

The allocator-wg has decided to merge this change upstream in rust-lang/wg-allocators#8 (comment).

This renames `Alloc` to `AllocRef` because types that implement `Alloc` are a reference, smart pointer, or ZSTs. It is not possible to have an allocator like `MyAlloc([u8; N])`, that owns the memory and also implements `Alloc`, since that would mean, that moving a `Vec<T, MyAlloc>` would need to correct the internal pointer, which is not possible as we don't have move constructors.

For further explanation please see rust-lang/wg-allocators#8 (comment) and the comments after that one.

Additionally it clarifies the semantics of `Clone` on an allocator. In the case of `AllocRef`, it is clear that the cloned handle still points to the same allocator instance, and that you can free data allocated from one handle with another handle.

The initial proposal was to rename `Alloc` to `AllocHandle`, but `Ref` expresses the semantics better than `Handle`. Also, the only appearance of `Handle` in `std` are for windows specific resources, which might be confusing.

Blocked on rust-lang/miri#1160
@bors
Copy link
Contributor

bors commented Jan 28, 2020

☀️ Test successful - checks-azure
Approved by: Amanieu
Pushing b181835 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 28, 2020
@bors bors merged commit 7ca25db into rust-lang:master Jan 28, 2020
@TimDiekmann TimDiekmann deleted the rename-alloc branch January 28, 2020 13:17
TimDiekmann added a commit to TimDiekmann/miri that referenced this pull request Jan 29, 2020
Required to land rust-lang/rust#68529. Please see that PR for details. The CI is expected to fail until the PR is landed.
bors added a commit to rust-lang/miri that referenced this pull request Jan 29, 2020
Rename `Alloc` to `AllocRef`

Required to land rust-lang/rust#68529. Please see that PR for details. The CI is expected to fail until the PR is landed.
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Feb 1, 2020
Remove `Alloc` in favor of `AllocRef`

`AllocRef` was reexported as `Alloc` in rust-lang#68529  in order to not break toolstate in the week before the next stable release.

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

Successfully merging this pull request may close these issues.

6 participants