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

Monomorphize less code in fs::{read|write} #58530

Merged
merged 1 commit into from Feb 20, 2019

Conversation

Projects
None yet
6 participants
@scottmcm
Copy link
Member

scottmcm commented Feb 17, 2019

Since the generic-ness is only for the as_refs, might as well have std just compile the important part once instead of on every use.

Monomorphize less code in fs::{read|write}
Since the generic-ness is only for the as_refs, might as well have std just compile the important part once instead of on every use.
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Feb 17, 2019

r? @TimNN

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

@TimNN

This comment has been minimized.

Copy link
Contributor

TimNN commented Feb 17, 2019

@bors r+ rollup

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 17, 2019

📌 Commit 564c569 has been approved by TimNN

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 17, 2019

Rollup merge of rust-lang#58530 - scottmcm:monomorphize-less, r=TimNN
Monomorphize less code in fs::{read|write}

Since the generic-ness is only for the as_refs, might as well have std just compile the important part once instead of on every use.
@leonardo-m

This comment has been minimized.

Copy link

leonardo-m commented Feb 18, 2019

Is it reasonable to wish rustc to perform something like this by itself?

@scottmcm

This comment has been minimized.

Copy link
Member Author

scottmcm commented Feb 18, 2019

@leonardo-m It's a reasonable wish, but there isn't even a plan for it, AFAIK.

kennytm added a commit to kennytm/rust that referenced this pull request Feb 18, 2019

Rollup merge of rust-lang#58530 - scottmcm:monomorphize-less, r=TimNN
Monomorphize less code in fs::{read|write}

Since the generic-ness is only for the as_refs, might as well have std just compile the important part once instead of on every use.

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Feb 18, 2019

Rollup merge of rust-lang#58530 - scottmcm:monomorphize-less, r=TimNN
Monomorphize less code in fs::{read|write}

Since the generic-ness is only for the as_refs, might as well have std just compile the important part once instead of on every use.

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

Auto merge of #58566 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 16 pull requests

Successful merges:

 - #55632 (Deny the `overflowing_literals` lint for all editions)
 - #56470 (Modify doctest's auto-`fn main()` to allow `Result`s)
 - #58198 (Suggest removing parentheses surrounding lifetimes)
 - #58199 (Add better error message for partial move)
 - #58303 (Improve stability tags display)
 - #58336 (Fix search results interactions)
 - #58392 (Use less explicit shifting in std::net::ip)
 - #58528 (Don't use an allocation for ItemId in StmtKind)
 - #58530 (Monomorphize less code in fs::{read|write})
 - #58534 (Mention capping forbid lints)
 - #58536 (Remove UB in pointer tests)
 - #58539 (Add alias methods to PathBuf for underlying OsString (#58234))
 - #58544 (Fix doc for rustc "-g" flag)
 - #58545 (Add regression test for a specialization-related ICE (#39448))
 - #58551 (Explain a panic in test case net::tcp::tests::double_bind )
 - #58555 (Add a note about 2018e if someone uses `try {` in 2015e)

Failed merges:

r? @ghost

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

Auto merge of #58566 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 16 pull requests

Successful merges:

 - #55632 (Deny the `overflowing_literals` lint for all editions)
 - #56470 (Modify doctest's auto-`fn main()` to allow `Result`s)
 - #58198 (Suggest removing parentheses surrounding lifetimes)
 - #58199 (Add better error message for partial move)
 - #58303 (Improve stability tags display)
 - #58336 (Fix search results interactions)
 - #58392 (Use less explicit shifting in std::net::ip)
 - #58528 (Don't use an allocation for ItemId in StmtKind)
 - #58530 (Monomorphize less code in fs::{read|write})
 - #58534 (Mention capping forbid lints)
 - #58536 (Remove UB in pointer tests)
 - #58539 (Add alias methods to PathBuf for underlying OsString (#58234))
 - #58544 (Fix doc for rustc "-g" flag)
 - #58545 (Add regression test for a specialization-related ICE (#39448))
 - #58551 (Explain a panic in test case net::tcp::tests::double_bind )
 - #58555 (Add a note about 2018e if someone uses `try {` in 2015e)

Failed merges:

r? @ghost

kennytm added a commit to kennytm/rust that referenced this pull request Feb 19, 2019

Rollup merge of rust-lang#58530 - scottmcm:monomorphize-less, r=TimNN
Monomorphize less code in fs::{read|write}

Since the generic-ness is only for the as_refs, might as well have std just compile the important part once instead of on every use.

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

Auto merge of #58578 - kennytm:rollup, r=kennytm
Rollup of 24 pull requests

Successful merges:

 - #56470 (Modify doctest's auto-`fn main()` to allow `Result`s)
 - #58232 (HirId-ify intravisit)
 - #58303 (Improve stability tags display)
 - #58336 (Fix search results interactions)
 - #58384 (Fix tables display)
 - #58392 (Use less explicit shifting in std::net::ip)
 - #58409 (rustdoc: respect alternate flag when formatting impl trait)
 - #58456 (Remove no longer accurate diagnostic code about NLL)
 - #58528 (Don't use an allocation for ItemId in StmtKind)
 - #58530 (Monomorphize less code in fs::{read|write})
 - #58534 (Mention capping forbid lints)
 - #58536 (Remove UB in pointer tests)
 - #58538 (Add missing fmt structs examples)
 - #58539 (Add alias methods to PathBuf for underlying OsString (#58234))
 - #58544 (Fix doc for rustc "-g" flag)
 - #58545 (Add regression test for a specialization-related ICE (#39448))
 - #58546 (librustc_codegen_llvm => 2018)
 - #58551 (Explain a panic in test case net::tcp::tests::double_bind )
 - #58553 (Use more impl header lifetime elision)
 - #58562 (Fix style nits)
 - #58565 (Fix typo in std::future::Future docs)
 - #58568 (Fix a transposition in driver.rs.)
 - #58569 (Reduce Some Code Repetitions like `(n << amt) >> amt`)
 - #58576 (Stabilize iter::successors and iter::from_fn)

Failed merges:

r? @ghost

kennytm added a commit to kennytm/rust that referenced this pull request Feb 20, 2019

Rollup merge of rust-lang#58530 - scottmcm:monomorphize-less, r=TimNN
Monomorphize less code in fs::{read|write}

Since the generic-ness is only for the as_refs, might as well have std just compile the important part once instead of on every use.

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

Auto merge of #58578 - kennytm:rollup, r=kennytm
Rollup of 24 pull requests

Successful merges:

 - #56470 (Modify doctest's auto-`fn main()` to allow `Result`s)
 - #58044 (Make overflowing and wrapping negation const)
 - #58303 (Improve stability tags display)
 - #58336 (Fix search results interactions)
 - #58384 (Fix tables display)
 - #58392 (Use less explicit shifting in std::net::ip)
 - #58409 (rustdoc: respect alternate flag when formatting impl trait)
 - #58456 (Remove no longer accurate diagnostic code about NLL)
 - #58528 (Don't use an allocation for ItemId in StmtKind)
 - #58530 (Monomorphize less code in fs::{read|write})
 - #58534 (Mention capping forbid lints)
 - #58536 (Remove UB in pointer tests)
 - #58538 (Add missing fmt structs examples)
 - #58539 (Add alias methods to PathBuf for underlying OsString (#58234))
 - #58544 (Fix doc for rustc "-g" flag)
 - #58545 (Add regression test for a specialization-related ICE (#39448))
 - #58546 (librustc_codegen_llvm => 2018)
 - #58551 (Explain a panic in test case net::tcp::tests::double_bind)
 - #58553 (Use more impl header lifetime elision)
 - #58562 (Fix style nits)
 - #58565 (Fix typo in std::future::Future docs)
 - #58568 (Fix a transposition in driver.rs.)
 - #58569 (Reduce Some Code Repetitions like `(n << amt) >> amt`)
 - #58576 (Stabilize iter::successors and iter::from_fn)

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

Auto merge of #58578 - kennytm:rollup, r=kennytm
Rollup of 24 pull requests

Successful merges:

 - #56470 (Modify doctest's auto-`fn main()` to allow `Result`s)
 - #58044 (Make overflowing and wrapping negation const)
 - #58303 (Improve stability tags display)
 - #58336 (Fix search results interactions)
 - #58384 (Fix tables display)
 - #58392 (Use less explicit shifting in std::net::ip)
 - #58409 (rustdoc: respect alternate flag when formatting impl trait)
 - #58456 (Remove no longer accurate diagnostic code about NLL)
 - #58528 (Don't use an allocation for ItemId in StmtKind)
 - #58530 (Monomorphize less code in fs::{read|write})
 - #58534 (Mention capping forbid lints)
 - #58536 (Remove UB in pointer tests)
 - #58538 (Add missing fmt structs examples)
 - #58539 (Add alias methods to PathBuf for underlying OsString (#58234))
 - #58544 (Fix doc for rustc "-g" flag)
 - #58545 (Add regression test for a specialization-related ICE (#39448))
 - #58546 (librustc_codegen_llvm => 2018)
 - #58551 (Explain a panic in test case net::tcp::tests::double_bind)
 - #58553 (Use more impl header lifetime elision)
 - #58562 (Fix style nits)
 - #58565 (Fix typo in std::future::Future docs)
 - #58568 (Fix a transposition in driver.rs.)
 - #58569 (Reduce Some Code Repetitions like `(n << amt) >> amt`)
 - #58576 (Stabilize iter::successors and iter::from_fn)

@bors bors merged commit 564c569 into rust-lang:master Feb 20, 2019

@scottmcm scottmcm deleted the scottmcm:monomorphize-less branch Feb 21, 2019

@joshtriplett

This comment has been minimized.

Copy link
Member

joshtriplett commented Feb 27, 2019

@leonardo-m Yes, ideally rustc could generate common code that would be identical for all monomorphizations of a generic function. I'd love to see that optimization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.