Skip to content

Conversation

@Veykril
Copy link
Member

@Veykril Veykril commented Dec 16, 2020

PR #6787 but rewritten to make use of the HIR now. This only applies to Lifetimes, not labels. Also Higher-Ranked Trait Bounds aren't supported yet, but I feel like this PR is big enough as is which is why I left them out after noticing I forgot about them.

Supporting renaming required slight changes in the renaming module as lifetime names aren't allowed for anything but lifetimes(and labels) and vice versa for normal names.

NavigationTarget {
file_id: src.file_id.original_file(db),
name: self.name(db).to_string().into(),
kind: LIFETIME_PARAM,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to PR, but, now that I look at it, using SyntaxKind here is abstraction sloppiness. This really should be enum DefinitionKind declated in the ide crate, and re-used by HighlightTag enum. Will probably look into fixing that.

@matklad
Copy link
Contributor

matklad commented Dec 17, 2020

The yak is shaved!

bors r+

@bors
Copy link
Contributor

bors bot commented Dec 17, 2020

@bors bors bot merged commit d641bcc into rust-lang:master Dec 17, 2020
@iago-lito
Copy link

@Veykril Does this also encompass loop labels? They are not lifetimes, but their syntax look alike, and attempts to rename them also yield No references found at position.

fn main() {
    'a: loop { // Cannot rename 'a: No references found at position.
        for i in 0..5 {
            if i > 1 {
                break 'a;
            }
        }
    }
}

I'd understand this belongs to another issue though.

@Veykril Veykril deleted the lt-ref branch December 18, 2020 10:23
@Veykril
Copy link
Member Author

Veykril commented Dec 18, 2020

No, loop labels aren't implemented in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants