Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Disallow linking to items with a mismatched disambiguator #75079
Disallow linking to items with a mismatched disambiguator #75079
Changes from 4 commits
8e0e925
519c854
743f932
99354f5
444f5a0
fc273a0
2dad90d
f05e9da
0c99d80
ef54cde
d240490
17263bc
9914f73
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we set an enum instead of a string here (yes, it will have multiple variants for each spelling)? Bonus: we can make the
kind
derivation a method on it, so we just calldisambiguator.kind()
, and we can do the same thing with the DefKind, and we can also do the thing with the prefix-matching (something likefn strip_prefix(&mut String) -> Option<Self>
)We would have to add a method that converts it back to a useful string though. But we'd be able to nicely move a ton of code out of here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can reuse
DefKind
here. I agree that would be nicer than using strings everywhere, it already hasarticle()
anddescr()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jyn514 I'd rather not use DefKind because we can have multiple disambiguators, like
()
vsfn
vsfunction
and we wanna be able to name them.A cool thing we could do, however, is somehow generate the span for the disambiguator only, and then we don't need to explicitly name it and instead can call it "the function disambiguator here^^". For perf it might be desirable to generate this only when we need to raise an error, i.e. perform a search for it after the fact and adjust the span. Idk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up describing the disambiguator with an article but still naming it . What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh and if you know how to switch the order of the note and the suggestion please let me know, I'd rather it was