Skip to content

Custom allocator support in rustc_serialize #99920

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 26, 2022

Conversation

emarteca
Copy link

@emarteca emarteca commented Jul 29, 2022

Adding support for rustc_serialize encode/decode for Box and Vec that use a custom allocator.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 29, 2022
@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @oli-obk (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 29, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Aug 24, 2022

Please rebase over the latest master branch and squash the commits

@emarteca emarteca force-pushed the custom-allocator-support branch from e97f121 to e571d52 Compare August 24, 2022 20:44
@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-rustdoc-json Area: Rustdoc JSON backend A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Aug 24, 2022
@rustbot
Copy link
Collaborator

rustbot commented Aug 24, 2022

rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing src/librustdoc/json/conversions.rs; otherwise, make sure you bump the FORMAT_VERSION constant.

cc @CraftSpider, @aDotInTheVoid, @Enselic

Changes rustc_apfloat. rustc_apfloat is currently in limbo and you almost certainly don't want to change it (see #55993).

cc @eddyb

Some changes occurred in library/proc_macro/src/bridge

cc @rust-lang/wg-rls-2

Some changes occurred in src/tools/cargo

cc @ehuss

Some changes occurred in src/librustdoc/clean/types.rs

cc @camelid

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo

rustc_macros::diagnostics was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

This PR changes MIR

cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @celinval, @vakaras

The Miri submodule was changed

cc @rust-lang/miri

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @Folyd, @jsha

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

rustc_errors::translation was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occurred in HTML/CSS themes.

cc @GuillaumeGomez

A change occurred in the Ayu theme.

cc @Cldfire

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

@compiler-errors
Copy link
Member

Uh, I don't think this was rebased corectly.

@emarteca
Copy link
Author

Uh, I don't think this was rebased corectly.

Yeah my mistake, fixed now 😰

@compiler-errors
Copy link
Member

Much better!

}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: missing trailing newline

@rust-log-analyzer

This comment has been minimized.

@RalfJung
Copy link
Member

Rationale: as part of rust-lang/miri#2365 I'm planning to extend the Allocation struct to be able to use a custom allocator (specifically, to allocate the bytes field).

This doesn't even reflect the current plan any more I think?

With the approach I proposed, I don't think we need this PR.

@emarteca
Copy link
Author

With the approach I proposed, I don't think we need this PR.

That's true. But should we keep it anyway, in case someone else wants to serialize a Box or Vec with a custom allocator?

@oli-obk
Copy link
Contributor

oli-obk commented Aug 25, 2022

But should we keep it anyway, in case someone else wants to serialize a Box or Vec with a custom allocator?

yea, this change seems good on its own. I removed the rationale comment from the main post so it doesn't end up in git history.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 25, 2022

📌 Commit d5c90d23a5acd36753ddef0c28437b756551701a has been approved by oli-obk

It is now in the queue for this repository.

@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 Aug 25, 2022
@klensy
Copy link
Contributor

klensy commented Aug 25, 2022

Probably you want to rebase/squash again, bc if you click on first commit, it shows weird things: e571d52

@oli-obk
Copy link
Contributor

oli-obk commented Aug 25, 2022

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 25, 2022
@emarteca emarteca force-pushed the custom-allocator-support branch from 5d7ad36 to 258d367 Compare August 25, 2022 20:21
@emarteca emarteca requested a review from oli-obk August 25, 2022 20:25
@oli-obk
Copy link
Contributor

oli-obk commented Aug 25, 2022

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 25, 2022

📌 Commit 258d367 has been approved by oli-obk

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 25, 2022
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Aug 25, 2022
…r=oli-obk

Custom allocator support in `rustc_serialize`

Adding support for `rustc_serialize` encode/decode for `Box` and `Vec` that use a custom allocator.
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 26, 2022
Rollup of 8 pull requests

Successful merges:

 - rust-lang#99064 (distinguish the method and associated function diagnostic information)
 - rust-lang#99920 (Custom allocator support in `rustc_serialize`)
 - rust-lang#100034 ( Elaborate all box dereferences in `ElaborateBoxDerefs`)
 - rust-lang#100076 (make slice::{split_at,split_at_unchecked} const functions)
 - rust-lang#100604 (Remove unstable Result::into_ok_or_err)
 - rust-lang#100933 (Reduce code size of `assert_matches_failed`)
 - rust-lang#100978 (Handle `Err` in `ast::LitKind::to_token_lit`.)
 - rust-lang#101010 (rustdoc: remove unused CSS for `.multi-column`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 28457e1 into rust-lang:master Aug 26, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 26, 2022
@aDotInTheVoid aDotInTheVoid removed T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-rustdoc-json Area: Rustdoc JSON backend A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic labels Dec 27, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.