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

Refactor: Move the mutable parts out of LintStore. Fix #42007. #42052

Merged
merged 1 commit into from
May 25, 2017

Commits on May 17, 2017

  1. 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.
    kennytm committed May 17, 2017
    Configuration menu
    Copy the full SHA
    b384b18 View commit details
    Browse the repository at this point in the history