Skip to content

Commit

Permalink
Rollup merge of rust-lang#42052 - kennytm:fix-42007-ice-on-decode-lin…
Browse files Browse the repository at this point in the history
…t-id, r=nikomatsakis

Refactor: Move the mutable parts out of LintStore. Fix rust-lang#42007.

* rust-lang#42007 happens because the `Session` `LintStore` is emptied when linting.
* The `Session` `LintStore` is emptied because the checker (`Early`/`LateContext`) wants ownership.
* The checker wants ownership because it wants to mutate the pass objects and lint levels.

The ownership of the whole store is not essential, only the lint levels and pass objects need to be owned. Therefore, these parts are extracted out of the `LintStore` into a separate structure `LintSession`. The "check crates" methods can operate on `&mut LintSession` instead of `&mut LintStore`.

This is a minor *breaking change* for lint writers since the `LintContext` trait is changed: the `mut_lints` and `level_stack` methods are removed. But no one outside of `librustc/lint/context.rs` is using these functions, so it should be safe.
  • Loading branch information
frewsxcv authored May 23, 2017
2 parents 5960da2 + b384b18 commit b2310e1
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 86 deletions.
Loading

0 comments on commit b2310e1

Please sign in to comment.