-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
place explicit lifetime bound after generic param #124884
Conversation
c3a73dc
to
58b918f
Compare
tests/ui/generic-associated-types/static-lifetime-tip-with-default-type.rs
Show resolved
Hide resolved
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.
Minor changes required, but after that r=me.
.params | ||
.iter() | ||
.find(|param| param.def_id == def_id) | ||
.unwrap(); |
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'm mildly concerned about this unwrap()
and would prefer if we instead used if let
for this, but I can't think of a case where a Param
from another item might end up 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.
Yep, the Self
item will cause a panic when using unwrap
, but it has been handled in other branches. Anyway, I will use if let
for added safety.
let span = self.tcx.def_span(def_id); | ||
span.shrink_to_hi() |
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.
Out of curiosity, is there any case where this can be reached?
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 also think no cases can reach this branch, but using unreachable!()
here seems unnecessary...
Let me know if you have time to address the nitpick. |
@bors r+ |
🌲 The tree is currently closed for pull requests below priority 13. This pull request will be tested once the tree is reopened. |
place explicit lifetime bound after generic param Fixes rust-lang#124785 An easy fix.
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#123962 (change method resolution to constrain hidden types instead of rejecting method candidates) - rust-lang#124884 (place explicit lifetime bound after generic param) - rust-lang#126244 (Update fuchsia commit, and SDK to 21.20240610.2.1) - rust-lang#126270 (Migrate run make const fn mir) - rust-lang#126320 (Avoid ICES after reporting errors on erroneous patterns) - rust-lang#126343 (Remove some msys2 utils) - rust-lang#126351 (std::unix::fs::link using direct linkat call for Solaris.) - rust-lang#126368 (Remove some unnecessary crate dependencies.) - rust-lang#126386 (Migrate `run-make/allow-non-lint-warnings-cmdline` to `rmake.rs`) - rust-lang#126449 (Fill out missing Windows support information) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#124884 (place explicit lifetime bound after generic param) - rust-lang#126343 (Remove some msys2 utils) - rust-lang#126351 (std::unix::fs::link using direct linkat call for Solaris.) - rust-lang#126368 (Remove some unnecessary crate dependencies.) - rust-lang#126386 (Migrate `run-make/allow-non-lint-warnings-cmdline` to `rmake.rs`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#124884 - bvanjoi:fix-124785, r=estebank place explicit lifetime bound after generic param Fixes rust-lang#124785 An easy fix.
Fixes #124785
An easy fix.