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 ZSTs in AllocRef #69799

Merged
merged 1 commit into from
Mar 10, 2020
Merged

Allow ZSTs in AllocRef #69799

merged 1 commit into from
Mar 10, 2020

Conversation

TimDiekmann
Copy link
Member

@TimDiekmann TimDiekmann commented Mar 7, 2020

Allows ZSTs in all AllocRef methods. The implementation of AllocRef for Global and System were adjusted to reflect those changes.

This is the second item on the roadmap to support ZSTs in AllocRef: rust-lang/wg-allocators#38 (comment)
After this has landed, I will adapt RawVec, but since this will be a pretty big overhaul, it makes sense to do a different PR for it.

Requires #69794 to land first

r? @Amanieu

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

The job mingw-check 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-03-07T11:13:27.8253265Z ========================== Starting Command Output ===========================
2020-03-07T11:13:27.8255760Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/3439abe8-1922-4590-afb0-ec26d3cc22d9.sh
2020-03-07T11:13:27.8255987Z 
2020-03-07T11:13:27.8259884Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-07T11:13:27.8275893Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69799/merge to s
2020-03-07T11:13:27.8278882Z Task         : Get sources
2020-03-07T11:13:27.8279140Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-07T11:13:27.8279387Z Version      : 1.0.0
2020-03-07T11:13:27.8279568Z Author       : Microsoft
---
2020-03-07T11:13:29.1460579Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-07T11:13:29.1482302Z ##[command]git config gc.auto 0
2020-03-07T11:13:29.1486699Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-07T11:13:29.1490178Z ##[command]git config --get-all http.proxy
2020-03-07T11:13:29.1499555Z ##[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/69799/merge:refs/remotes/pull/69799/merge
---
2020-03-07T11:17:47.9834647Z     Checking alloc v0.0.0 (/checkout/src/liballoc)
2020-03-07T11:17:48.5797017Z error[E0599]: no method named `dangling` found for struct `core::alloc::Layout` in the current scope
2020-03-07T11:17:48.5797856Z    --> src/liballoc/alloc.rs:170:24
2020-03-07T11:17:48.5798309Z     |
2020-03-07T11:17:48.5798829Z 170 |             Ok((layout.dangling(), 0))
2020-03-07T11:17:48.5800519Z 
2020-03-07T11:17:48.5847514Z error[E0599]: no method named `dangling` found for struct `core::alloc::Layout` in the current scope
2020-03-07T11:17:48.5848259Z    --> src/liballoc/alloc.rs:191:34
2020-03-07T11:17:48.5848721Z     |
2020-03-07T11:17:48.5848721Z     |
2020-03-07T11:17:48.5849445Z 191 |             (0, 0) => Ok((layout.dangling(), 0)),
2020-03-07T11:17:48.5850857Z 
2020-03-07T11:17:48.5879787Z error[E0599]: no method named `dangling` found for struct `core::alloc::Layout` in the current scope
2020-03-07T11:17:48.5881146Z    --> src/liballoc/alloc.rs:195:28
2020-03-07T11:17:48.5881616Z     |
2020-03-07T11:17:48.5881616Z     |
2020-03-07T11:17:48.5882182Z 195 |                 Ok((layout.dangling(), 0))
2020-03-07T11:17:48.5883847Z 
2020-03-07T11:17:48.5916293Z error[E0599]: no method named `dangling` found for struct `core::alloc::Layout` in the current scope
2020-03-07T11:17:48.5917683Z    --> src/liballoc/alloc.rs:206:24
2020-03-07T11:17:48.5918153Z     |
2020-03-07T11:17:48.5918153Z     |
2020-03-07T11:17:48.5918685Z 206 |             Ok((layout.dangling(), 0))
2020-03-07T11:17:48.5919989Z 
2020-03-07T11:17:48.7002930Z     Checking rustc-demangle v0.1.16
2020-03-07T11:17:48.9594474Z     Checking panic_abort v0.0.0 (/checkout/src/libpanic_abort)
2020-03-07T11:17:49.1045509Z     Checking backtrace v0.3.44
---
2020-03-07T11:17:49.2896975Z   local time: Sat Mar  7 11:17:49 UTC 2020
2020-03-07T11:17:49.5679688Z   network time: Sat, 07 Mar 2020 11:17:49 GMT
2020-03-07T11:17:49.5682715Z == end clock drift check ==
2020-03-07T11:17:50.6940928Z 
2020-03-07T11:17:50.7014289Z ##[error]Bash exited with code '1'.
2020-03-07T11:17:50.7026457Z ##[section]Finishing: Run build
2020-03-07T11:17:50.7098973Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69799/merge to s
2020-03-07T11:17:50.7103492Z Task         : Get sources
2020-03-07T11:17:50.7103814Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-07T11:17:50.7104597Z Version      : 1.0.0
2020-03-07T11:17:50.7104848Z Author       : Microsoft
2020-03-07T11:17:50.7104848Z Author       : Microsoft
2020-03-07T11:17:50.7105179Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-07T11:17:50.7105563Z ==============================================================================
2020-03-07T11:17:51.0006916Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-07T11:17:51.0050418Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69799/merge to s
2020-03-07T11:17:51.0125076Z Cleaning up task key
2020-03-07T11:17:51.0126196Z Start cleaning up orphan processes.
2020-03-07T11:17:51.0285311Z Terminate orphan process: pid (4130) (python)
2020-03-07T11:17:51.0412150Z ##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

@rust-highfive
Copy link
Collaborator

The job mingw-check 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-03-07T14:49:28.9973336Z ========================== Starting Command Output ===========================
2020-03-07T14:49:28.9980007Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/41cf9404-9b99-4063-86ca-6497e6a523be.sh
2020-03-07T14:49:28.9980589Z 
2020-03-07T14:49:28.9986440Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-07T14:49:29.0012963Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69799/merge to s
2020-03-07T14:49:29.0017045Z Task         : Get sources
2020-03-07T14:49:29.0017414Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-07T14:49:29.0017731Z Version      : 1.0.0
2020-03-07T14:49:29.0017948Z Author       : Microsoft
---
2020-03-07T14:49:29.9877892Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-07T14:49:29.9883889Z ##[command]git config gc.auto 0
2020-03-07T14:49:29.9889231Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-07T14:49:29.9892903Z ##[command]git config --get-all http.proxy
2020-03-07T14:49:29.9899813Z ##[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/69799/merge:refs/remotes/pull/69799/merge
---
2020-03-07T14:54:21.7454936Z     Checking alloc v0.0.0 (/checkout/src/liballoc)
2020-03-07T14:54:22.4682786Z error[E0599]: no method named `dangling` found for struct `core::alloc::Layout` in the current scope
2020-03-07T14:54:22.4683664Z    --> src/liballoc/alloc.rs:170:24
2020-03-07T14:54:22.4684112Z     |
2020-03-07T14:54:22.4684662Z 170 |             Ok((layout.dangling(), 0))
2020-03-07T14:54:22.4686253Z 
2020-03-07T14:54:22.4735553Z error[E0599]: no method named `dangling` found for struct `core::alloc::Layout` in the current scope
2020-03-07T14:54:22.4736283Z    --> src/liballoc/alloc.rs:191:34
2020-03-07T14:54:22.4736756Z     |
2020-03-07T14:54:22.4736756Z     |
2020-03-07T14:54:22.4737323Z 191 |             (0, 0) => Ok((layout.dangling(), 0)),
2020-03-07T14:54:22.4738672Z 
2020-03-07T14:54:22.4785847Z error[E0599]: no method named `dangling` found for struct `core::alloc::Layout` in the current scope
2020-03-07T14:54:22.4786570Z    --> src/liballoc/alloc.rs:195:28
2020-03-07T14:54:22.4787052Z     |
2020-03-07T14:54:22.4787052Z     |
2020-03-07T14:54:22.4787593Z 195 |                 Ok((layout.dangling(), 0))
2020-03-07T14:54:22.4788895Z 
2020-03-07T14:54:22.4830433Z error[E0599]: no method named `dangling` found for struct `core::alloc::Layout` in the current scope
2020-03-07T14:54:22.4831165Z    --> src/liballoc/alloc.rs:206:24
2020-03-07T14:54:22.4831606Z     |
2020-03-07T14:54:22.4831606Z     |
2020-03-07T14:54:22.4832137Z 206 |             Ok((layout.dangling(), 0))
2020-03-07T14:54:22.4833426Z 
2020-03-07T14:54:22.5990693Z     Checking rustc-demangle v0.1.16
2020-03-07T14:54:22.8845959Z     Checking panic_abort v0.0.0 (/checkout/src/libpanic_abort)
2020-03-07T14:54:23.0474766Z     Checking backtrace v0.3.44
---
2020-03-07T14:54:23.3395503Z   local time: Sat Mar  7 14:54:23 UTC 2020
2020-03-07T14:54:23.6286240Z   network time: Sat, 07 Mar 2020 14:54:23 GMT
2020-03-07T14:54:23.6291812Z == end clock drift check ==
2020-03-07T14:54:24.6682653Z 
2020-03-07T14:54:24.6749851Z ##[error]Bash exited with code '1'.
2020-03-07T14:54:24.6767793Z ##[section]Finishing: Run build
2020-03-07T14:54:24.6838782Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69799/merge to s
2020-03-07T14:54:24.6845781Z Task         : Get sources
2020-03-07T14:54:24.6846181Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-07T14:54:24.6846548Z Version      : 1.0.0
2020-03-07T14:54:24.6846826Z Author       : Microsoft
2020-03-07T14:54:24.6846826Z Author       : Microsoft
2020-03-07T14:54:24.6847233Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-07T14:54:24.6847700Z ==============================================================================
2020-03-07T14:54:25.0365141Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-07T14:54:25.0425128Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69799/merge to s
2020-03-07T14:54:25.0525947Z Cleaning up task key
2020-03-07T14:54:25.0527679Z Start cleaning up orphan processes.
2020-03-07T14:54:25.0791647Z Terminate orphan process: pid (3680) (python)
2020-03-07T14:54:25.0963036Z ##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

Copy link
Contributor

@CAD97 CAD97 left a comment

Choose a reason for hiding this comment

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

Documentation nits

src/libcore/alloc.rs Outdated Show resolved Hide resolved
src/libcore/alloc.rs Outdated Show resolved Hide resolved
src/libcore/alloc.rs Show resolved Hide resolved
src/libstd/alloc.rs Outdated Show resolved Hide resolved
@rust-highfive
Copy link
Collaborator

The job mingw-check 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-03-07T22:28:48.7282416Z ========================== Starting Command Output ===========================
2020-03-07T22:28:48.7284780Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/303460c3-aa49-40e3-a130-494e327300aa.sh
2020-03-07T22:28:48.7285475Z 
2020-03-07T22:28:48.7288989Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-07T22:28:48.7310996Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69799/merge to s
2020-03-07T22:28:48.7314768Z Task         : Get sources
2020-03-07T22:28:48.7315599Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-07T22:28:48.7315989Z Version      : 1.0.0
2020-03-07T22:28:48.7316281Z Author       : Microsoft
---
2020-03-07T22:28:49.8999286Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-07T22:28:49.9008581Z ##[command]git config gc.auto 0
2020-03-07T22:28:49.9015032Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-07T22:28:49.9018924Z ##[command]git config --get-all http.proxy
2020-03-07T22:28:49.9029777Z ##[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/69799/merge:refs/remotes/pull/69799/merge
---
2020-03-07T22:34:26.4074017Z     Checking alloc v0.0.0 (/checkout/src/liballoc)
2020-03-07T22:34:27.1449621Z error[E0599]: no method named `dangling` found for struct `core::alloc::Layout` in the current scope
2020-03-07T22:34:27.1451082Z    --> src/liballoc/alloc.rs:170:24
2020-03-07T22:34:27.1451877Z     |
2020-03-07T22:34:27.1452852Z 170 |             Ok((layout.dangling(), 0))
2020-03-07T22:34:27.1459393Z 
2020-03-07T22:34:27.1524559Z error[E0599]: no method named `dangling` found for struct `core::alloc::Layout` in the current scope
2020-03-07T22:34:27.1525600Z    --> src/liballoc/alloc.rs:191:34
2020-03-07T22:34:27.1549906Z     |
2020-03-07T22:34:27.1549906Z     |
2020-03-07T22:34:27.1550618Z 191 |             (0, 0) => Ok((layout.dangling(), 0)),
2020-03-07T22:34:27.1552482Z 
2020-03-07T22:34:27.1583228Z error[E0599]: no method named `dangling` found for struct `core::alloc::Layout` in the current scope
2020-03-07T22:34:27.1584491Z    --> src/liballoc/alloc.rs:195:28
2020-03-07T22:34:27.1585098Z     |
2020-03-07T22:34:27.1585098Z     |
2020-03-07T22:34:27.1585731Z 195 |                 Ok((layout.dangling(), 0))
2020-03-07T22:34:27.1587236Z 
2020-03-07T22:34:27.1638442Z error[E0599]: no method named `dangling` found for struct `core::alloc::Layout` in the current scope
2020-03-07T22:34:27.1639258Z    --> src/liballoc/alloc.rs:206:24
2020-03-07T22:34:27.1639811Z     |
2020-03-07T22:34:27.1639811Z     |
2020-03-07T22:34:27.1640431Z 206 |             Ok((layout.dangling(), 0))
2020-03-07T22:34:27.1641907Z 
2020-03-07T22:34:27.2963333Z     Checking rustc-demangle v0.1.16
2020-03-07T22:34:27.5951125Z     Checking panic_abort v0.0.0 (/checkout/src/libpanic_abort)
2020-03-07T22:34:27.7645153Z     Checking backtrace v0.3.44
---
2020-03-07T22:34:28.0196094Z   local time: Sat Mar  7 22:34:28 UTC 2020
2020-03-07T22:34:28.3079831Z   network time: Sat, 07 Mar 2020 22:34:28 GMT
2020-03-07T22:34:28.3084757Z == end clock drift check ==
2020-03-07T22:34:29.2900679Z 
2020-03-07T22:34:29.2984698Z ##[error]Bash exited with code '1'.
2020-03-07T22:34:29.3000387Z ##[section]Finishing: Run build
2020-03-07T22:34:29.3052521Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69799/merge to s
2020-03-07T22:34:29.3057624Z Task         : Get sources
2020-03-07T22:34:29.3057989Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-07T22:34:29.3058333Z Version      : 1.0.0
2020-03-07T22:34:29.3058585Z Author       : Microsoft
2020-03-07T22:34:29.3058585Z Author       : Microsoft
2020-03-07T22:34:29.3058953Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-07T22:34:29.3059391Z ==============================================================================
2020-03-07T22:34:29.6787958Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-07T22:34:29.6834033Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69799/merge to s
2020-03-07T22:34:29.6930577Z Cleaning up task key
2020-03-07T22:34:29.6931880Z Start cleaning up orphan processes.
2020-03-07T22:34:29.7132741Z Terminate orphan process: pid (3711) (python)
2020-03-07T22:34:29.7282246Z ##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

@TimDiekmann
Copy link
Member Author

TimDiekmann commented Mar 8, 2020

Do we want requirements for realloc, when layout.size() is zero or new_size is zero?

Currently, it's unspecified. The default implementation System and Global uses alloc for layout.size() == 0 and dealloc for new_size == 0.

@Amanieu
Copy link
Member

Amanieu commented Mar 8, 2020

Let's defer the realloc discussion until we split it into shrink and grow.

@bors r+ rollup=always

@bors
Copy link
Contributor

bors commented Mar 8, 2020

📌 Commit f77afc8 has been approved by Amanieu

@bors
Copy link
Contributor

bors commented Mar 8, 2020

🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened

@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 Mar 8, 2020
@Centril
Copy link
Contributor

Centril commented Mar 9, 2020

I don't think this is risk free enough to rollup=always; @bors rollup=maybe

Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2020
Allow ZSTs in `AllocRef`

Allows ZSTs in all `AllocRef` methods. The implementation of `AllocRef` for `Global` and `System` were adjusted to reflect those changes.

This is the second item on the roadmap to support ZSTs in `AllocRef`: rust-lang/wg-allocators#38 (comment)
After this has landed, I will adapt `RawVec`, but since this will be a pretty big overhaul, it makes sense to do a different PR for it.

~~Requires rust-lang#69794 to land first~~

r? @Amanieu
bors added a commit that referenced this pull request Mar 9, 2020
Rollup of 6 pull requests

Successful merges:

 - #69475 (Remove the `no_force` query attribute)
 - #69514 (Remove spotlight)
 - #69677 (rustc_metadata: Give decoder access to whole crate store)
 - #69714 (Make PlaceRef take just one lifetime)
 - #69799 (Allow ZSTs in `AllocRef`)
 - #69836 (Check if output is immediate value)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Mar 10, 2020
Rollup of 10 pull requests

Successful merges:

 - #69475 (Remove the `no_force` query attribute)
 - #69514 (Remove spotlight)
 - #69677 (rustc_metadata: Give decoder access to whole crate store)
 - #69714 (Make PlaceRef take just one lifetime)
 - #69799 (Allow ZSTs in `AllocRef`)
 - #69817 (test(patterns): add patterns feature tests to borrowck test suite)
 - #69836 (Check if output is immediate value)
 - #69847 (clean up E0393 explanation)
 - #69861 (Add note about localization to std::fmt docs)
 - #69877 (Vec::new is const stable in 1.39 not 1.32)

Failed merges:

r? @ghost
@bors bors merged commit 6ad5e69 into rust-lang:master Mar 10, 2020
@TimDiekmann TimDiekmann deleted the zst branch March 10, 2020 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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