-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Purity #5412
Purity #5412
Conversation
Can you explain partial borrows? I don't understand that (sub-) issue. |
@graydon: When you borrow anything in an |
This much I already knew; just wondering if there is anything more subtle about partial borrows than "they imply a full borrow of their owner"? |
@graydon: Not really; it just can lead to confusion. |
…otation. rs=delifetiming
For bootstrapping purposes, this commit does not remove all uses of the keyword "pure" -- doing so would cause the compiler to no longer bootstrap due to some syntax extensions ("deriving" in particular). Instead, it makes the compiler ignore "pure". Post-snapshot, we can remove "pure" from the language. There are quite a few (~100) borrow check errors that were essentially all the result of mutable fields or partial borrows of `@mut`. Per discussions with Niko I think we want to allow partial borrows of `@mut` but detect obvious footguns. We should also improve the error message when `@mut` is erroneously reborrowed.
librustc: Make the compiler ignore purity. … For bootstrapping purposes, this commit does not remove all uses of the keyword "pure" -- doing so would cause the compiler to no longer bootstrap due to some syntax extensions ("deriving" in particular). Instead, it makes the compiler ignore "pure". Post-snapshot, we can remove "pure" from the language. There are quite a few (~100) borrow check errors that were essentially all the result of mutable fields or partial borrows of `@mut`. Per discussions with Niko I think we want to allow partial borrows of `@mut` but detect obvious footguns. We should also improve the error message when `@mut` is erroneously reborrowed. r? @nikomatsakis
Downgrade inefficient_to_string to pedantic From the [documentation](https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string): > ```diff > - ["foo", "bar"].iter().map(|s| s.to_string()); > > + ["foo", "bar"].iter().map(|&s| s.to_string()); > ``` I feel like saving 10 nanoseconds from the formatting machinery isn't worth asking the programmer to insert extra `&` / `*` noise in the *vast* majority of cases. This is a pedantic lint. changelog: Remove inefficient_to_string from default set of enabled lints
Rollup of 11 pull requests Successful merges: - rust-lang#5406 (Fix update_lints) - rust-lang#5409 (Downgrade let_unit_value to pedantic) - rust-lang#5410 (Downgrade trivially_copy_pass_by_ref to pedantic) - rust-lang#5412 (Downgrade inefficient_to_string to pedantic) - rust-lang#5415 (Add new lint for `Result<T, E>.map_or(None, Some(T))`) - rust-lang#5417 (Update doc links and mentioned names in docs) - rust-lang#5419 (Downgrade unreadable_literal to pedantic) - rust-lang#5420 (Downgrade new_ret_no_self to pedantic) - rust-lang#5422 (CONTRIBUTING.md: fix broken triage link) - rust-lang#5424 (Incorrect suspicious_op_assign_impl) - rust-lang#5425 (Ehance opt_as_ref_deref lint.) Failed merges: - rust-lang#5345 (Add lint for float in array comparison) - rust-lang#5411 (Downgrade implicit_hasher to pedantic) - rust-lang#5428 (Move cognitive_complexity to nursery) r? @ghost changelog: rollup
For bootstrapping purposes, this commit does not remove all uses of
the keyword "pure" -- doing so would cause the compiler to no longer
bootstrap due to some syntax extensions ("deriving" in particular).
Instead, it makes the compiler ignore "pure". Post-snapshot, we can
remove "pure" from the language.
There are quite a few (~100) borrow check errors that were essentially
all the result of mutable fields or partial borrows of
@mut
. Perdiscussions with Niko I think we want to allow partial borrows of
@mut
but detect obvious footguns. We should also improve the errormessage when
@mut
is erroneously reborrowed.r? @nikomatsakis