Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upNightly regression: Incorrect "parameter type may not live long enough" warning #29048
Comments
pnkfelix
added
regression-from-stable-to-nightly
A-lifetimes
labels
Oct 14, 2015
This comment has been minimized.
This comment has been minimized.
|
(this may be a compiler issue or a lang issue; tagging with both teams until that Q is resolved) |
pnkfelix
added
T-lang
T-compiler
labels
Oct 14, 2015
This comment has been minimized.
This comment has been minimized.
|
Another testcase, which I think is the same issue: pub struct Chan;
pub struct ChanSelect<'c, T> {
chans: Vec<(&'c Chan, T)>,
}
impl<'c, T> ChanSelect<'c, T> {
pub fn add_recv_ret(&mut self, chan: &'c Chan, ret: T)
{
self.chans.push((chan, ret));
}
}
fn main() {} |
This comment has been minimized.
This comment has been minimized.
|
triage: I-nominated |
rust-highfive
added
the
I-nominated
label
Oct 14, 2015
This comment has been minimized.
This comment has been minimized.
|
I've not fully investigated, but problem is almost certainly a missing call to outlives, similar to #29006 |
This comment has been minimized.
This comment has been minimized.
|
Hmm, problem seems to be related to a late-bound region instantiated during the probing phase. We wind up adding a region obligation. I will continue investigating, but definitely the fact that probe leaks variables is worrisome (I may also be getting a bit confused). (As an aside, I wonder if rewriting region inference isn't part of the fix here; the current contraction behavior isn't really doing anyone any favors, and there are many other known deficiencies.) |
This comment has been minimized.
This comment has been minimized.
|
I think this would be fixed by #26324 - I should try to check. |
This comment has been minimized.
This comment has been minimized.
|
triage: P-high Assigning to myself. The problem has to do with a lifetime parameter being created as part of the autoderef loop during method probing. Best fix might be to isolate probing, if we can, but there are other workarounds we could put in place. Improving region compilation would be good too. Not sure what I think is the preferred fix just now. |
nikomatsakis
self-assigned this
Oct 15, 2015
rust-highfive
added
P-high
and removed
I-nominated
labels
Oct 15, 2015
This comment has been minimized.
This comment has been minimized.
|
Annoyingly, the problem variables aren't used in a stack-like way, so #26324 etc. can't really work, unless we refactor method probing. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
So I tend to agree that a transactional approach is the right thing here (and, indeed, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
OK, I've verified that modifying the region inference scheme does indeed solve the regression, though I agree that it's sort of a workaround, in that we really ought not to be solving these constraints in the first place. |
eefriedman commentedOct 14, 2015
Testcase:
This gives no warnings on beta or stable.