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

FAQ for borrow check error with find/insert into containers #6806

Closed
pcwalton opened this issue May 29, 2013 · 5 comments
Closed

FAQ for borrow check error with find/insert into containers #6806

pcwalton opened this issue May 29, 2013 · 5 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@pcwalton
Copy link
Contributor

There's a common borrow check error that results from trying to insert into a container (usually a hash map) in the None branch after a find call. We should document the solution to this—namely, find_or_insert and friends.

@bblum
Copy link
Contributor

bblum commented Jul 22, 2013

This seems like something we should make sure to have before unleashing borrow check errors upon the world. Nominating production-ready.

@thestinger
Copy link
Contributor

There's now a container tutorial, so that's a good place to put this. I already covered freezing as relevant to iterators, but not this.

@catamorphism
Copy link
Contributor

Just a bug. More docs are always good, but we don't need to block on this.

@steveklabnik
Copy link
Member

Can this be closed? What's the situation with containers now? The borrow checker has changed a lot.

@steveklabnik
Copy link
Member

It's been a month, and so I'm closing this for inactivity. If there's something still missing here, please let me know.

flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 3, 2021
…p1995,phansch

Add avoid_breaking_exported_api config option

changelog: Add `avoid_breaking_exported_api` config option for [`enum_variant_names`], [`large_types_passed_by_value`], [`trivially_copy_pass_by_ref`], [`unnecessary_wraps`], [`upper_case_acronyms`] and [`wrong_self_convention`].

changelog: Deprecates [`pub_enum_variant_names`] and [`wrong_pub_self_convention`] as the non-pub variants are now configurable.

changelog: Fix various false negatives for `pub` items that are not exported from the crate.

A couple changes to late passes in order to use `cx.access_levels.is_exported` rather than `item.vis.kind.is_pub`.

I'm not sure how to better document the config option or lints that are (not) affected (see comments in rust-lang#6806). Suggestions are welcome. cc `@rust-lang/clippy`

I added `/clippy.toml` to use the config internally and `/tests/clippy.toml` to maintain a default config in ui tests.

Closes rust-lang#6806
Closes rust-lang#4504
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

5 participants