-
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
Ensure that the type parameters passed to methods outlive the call expression #18940
Conversation
@@ -481,11 +482,13 @@ struct LookupContext<'a, 'tcx: 'a> { | |||
fcx: &'a FnCtxt<'a, 'tcx>, | |||
span: Span, | |||
|
|||
call_expr: &'a ast::Expr, | |||
|
|||
// The receiver to the method call. Only `None` in the case of |
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.
This comment is out of date now that self_expr
isn't Option<_>
18ecdd0
to
85a63de
Compare
@tomjakubowski thanks, fixed. |
This fix causes compilation failures in the libcollections unit tests. These look like inference failures, i.e., inference not taking into account all the constraints and hence inferring a region that is too small, but I could be wrong. |
(It's easy enough to fix the tests, but I want to be sure that we're not reporting spurious errors first.) |
Actually, I think the bitv test code was doing unsound things. |
Fixed. Might be worth trying to check with author of 665555d, which is the commit that introduced these opaque reads, but I think my change preserves the intent. |
Hello @lpy, can you please examine commit 5ec3806 to see if you believe that it will continue to ensure the benchmarks are correctly measuring what they intend to measure? Your original patch was only compiling due to a bug in the type checker which was undetected until recently. (It's explained in the 5ec3806 comment) |
5ec3806
to
6190948
Compare
OK, pushed a new revision to the bitv tests (as suggested by @huonw) that seems to hew closer to the original code. |
…return a pointer to the value they were modifying, but this should not have been legal, since that pointer would have to outlive the closure, and the closure continues to modify the value during the execution. This return value was just passed to `black_box` so as to convince llvm that the value was live, so rather than returning a pointer, modify to just call `black_box` directly inside the fn.
6190948
to
2477bc4
Compare
Ensure that the type parameters passed to methods outlive the call expression.
Fixes #18899.
This is yet another case of forgotten to consistently enforce the constraints in every instance where they apply. Might be nice to try and refactor to make this whole thing more DRY, but for now here's a targeted fix.
r? @pcwalton