-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Immutable statics should only allow types which are Freeze #12432
Comments
Makes sense, kinda weird that we aren't doing it already. |
Makes sense to me as well! Working on it! |
Just as for the other restrictions, I think The above is based on recent discussions we had on IRC with @nikomatsakis and his last comments here |
Assigning 1.0, P-backcompat-lang. |
[`unused_enumerate_index`]: trigger on method calls The lint used to check for patterns looking like: ```rs for (_, x) in some_iter.enumerate() { // Index is ignored } ``` This commit further checks for chained method calls constructs where we can detect that the index is unused. Currently, this checks only for the following patterns: ```rs some_iter.enumerate().map_function(|(_, x)| ..) let x = some_iter.enumerate(); x.map_function(|(_, x)| ..) ``` where `map_function` is one of `all`, `any`, `filter_map`, `find_map`, `flat_map`, `for_each` or `map`. Fixes rust-lang#12411. *Please write a short comment explaining your change (or "none" for internal only changes)* changelog: [`unused_enumerate_index`]: add detection for method chains such as `iter.enumerate().map(|(_, x)| x)`
All statics are placed in
rodata
by LLVM (we mark them as constant), so any attempt at mutation will not succeed (it will segfault).See #11583 (comment) and #11583 (comment). I wanted to make an official issue out of those comments.
Despite the discussion in #10577 to work on values of immutable statics, I think that this
Freeze
bound should apply to the type of the static instead.Nominating.
The text was updated successfully, but these errors were encountered: