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

Fix lint attributes on non-item nodes. #38806

Merged
merged 5 commits into from
Jan 16, 2017
Merged

Commits on Jan 3, 2017

  1. Fix lint attributes on non-item nodes.

    Currently, late lint checking uses two HIR visitors: LateContext and
    IdVisitor.  IdVisitor only overrides visit_id, and for each node searches
    for builtin lints previously added to the session; LateContext overrides
    a number of methods, and runs late lints.  When LateContext encounters an
    item, it first has IdVisitor walk everything in it except nested items
    (OnlyBodies), then recurses into it itself - i.e. there are two separate
    walks.
    
    Aside from apparently being unnecessary, this separation prevents lint
    attributes (allow/deny/warn) on non-item HIR nodes from working
    properly.  Test case:
    
    // generates warning without this change
    fn main() { #[allow(unreachable_code)] loop { break; break; } }
    
    LateContext contains logic to merge attributes seen into the current lint
    settings while walking (with_lint_attrs), but IdVisitor does not.  So
    such attributes will affect late lints (because they are called from
    LateContext), and if the node contains any items within it, they will
    affect builtin lints within those items (because that IdVisitor is run
    while LateContext is within the attributed node), but otherwise the
    attributes will be ignored for builtin lints.
    
    This change simply removes IdVisitor and moves its visit_id into
    LateContext itself.  Hopefully this doesn't break anything...
    
    Also added walk calls to visit_lifetime and visit_lifetime_def
    respectively, so visit_lifetime_def will recurse into the lifetime and
    visit_lifetime will recurse into the name.  In principle this could
    confuse lint plugins.  This is "necessary" because walk_lifetime calls
    visit_id on the lifetime; of course, an alternative would be directly
    calling visit_id (which would require manually iterating over the
    lifetimes in visit_lifetime_def), but that seems less clean.
    comex committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    b322462 View commit details
    Browse the repository at this point in the history

Commits on Jan 7, 2017

  1. Configuration menu
    Copy the full SHA
    b16a54d View commit details
    Browse the repository at this point in the history
  2. Fix test/ui/span/issue-24690.stderr

    The errors are now emitted in a different order (in order of source
    location rather than going back and forth) but otherwise everything's
    the same.
    comex committed Jan 7, 2017
    Configuration menu
    Copy the full SHA
    5551369 View commit details
    Browse the repository at this point in the history
  3. Add test case.

    comex committed Jan 7, 2017
    Configuration menu
    Copy the full SHA
    743535a View commit details
    Browse the repository at this point in the history

Commits on Jan 14, 2017

  1. Configuration menu
    Copy the full SHA
    9cfb8b7 View commit details
    Browse the repository at this point in the history