-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Emit a note that static bounds from HRTBs are a bug #101433
Emit a note that static bounds from HRTBs are a bug #101433
Conversation
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki |
note: due to current limitations in the borrow checker, this implies a `'static` lifetime | ||
--> $DIR/hrtb-implied-1.rs:28:26 | ||
| | ||
LL | for<'a> I::Item<'a>: Debug, |
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.
@estebank maybe you have some thoughts on how to make this point to the whole clause?
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 thought a bit about this since you had mentioned it earlier -- it's probably not generalizable to point to the whole clause because we can have things like where Ty: Trait + OtherTrait
-- the choice for the spans in predicates_of
to point to just the trait part was probably made for that reason.
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.
Right, it's not simply enough to say "point to the entire clause. Instead, I'm imagining something like:
for<'a> T: Trait<'a>
^^^^^^^^^^^^^^^^^^^^
for<'a> T: Send + Trait<'a>
^^^^^^^^^^ ^^^^^^^^^
for<'a> T: Trait<'a> + Send
^^^^^^^^^^^^^^^^^^^^
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.
The problem is that we currently have no way (that I know of) to even get that span info from an InstantiatedPredicate
. We lose that when generating the GenericPredicates
, and there's no mapping back, AFAICT. I was looking a bit at instead storing like the owner and which predicate it is, but that also doesn't quite work, since lowering is done in a bit more complicated fashion.
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.
Yeah, we do lose too much metadata when dealing with predicates :-/
Ideally the spans should be something along the lines of
for<'a> T: Send + Trait<'a>
^^^^^^^ ^^^^^^^^^
but it's perfectly fine to land as is.
☔ The latest upstream changes (presumably #101560) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
r=me after rebased past conflict
@@ -645,6 +645,20 @@ impl<'a, 'tcx> Lift<'tcx> for ty::InstanceDef<'a> { | |||
} | |||
} | |||
|
|||
impl<'tcx> Lift<'tcx> for Field { |
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.
nit: there's some trivial lift macro i 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.
There is not (that I could find)
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.
TrivialTypeTraversalAndLiftImpls
is what it's called, which itself uses CloneLiftImpls
if you don't want to derive the traversal/folder traits. But up to you to keep this manual impl.
96e6985
to
6fd6283
Compare
6fd6283
to
bdd64c6
Compare
I'm going to wait for the stabilization PR to merge, since they're going to conflict and this will be easier to rebase. |
bdd64c6
to
cdd18af
Compare
cdd18af
to
aae37f8
Compare
@bors r=compiler-errors |
Rollup of 6 pull requests Successful merges: - rust-lang#101433 (Emit a note that static bounds from HRTBs are a bug) - rust-lang#101684 (smol grammar changes to README.md) - rust-lang#101769 (rustdoc: remove redundant CSS `.out-of-band > span.since { position }`) - rust-lang#101772 (Also replace the placeholder for the stable_features lint) - rust-lang#101773 (rustdoc: remove outdated CSS `.content table` etc) - rust-lang#101779 (Update test output for drop tracking) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…=nikomatsakis Partially revert rust-lang#101433 reverts rust-lang#101433 to fix rust-lang#101844 We should get this into the beta cut, since the ICE is getting hit quite a bit.
Marking as a perf regression per results from this PR's merge in the rollup (#101805 (comment)). (For clarity: the results are from just this PR in that comment, and match the effects of the rollup as a whole). It looks like we partially reverted in #101902, but that didn't fully recover the performance here. |
This note isn't perfect, but opening this to either 1) land as is or 2) get some feedback on how to improve it
Let r? @compiler-errors and cc. @nikomatsakis