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 upCode no longer builds because of RFC 1214 #30829
Comments
This comment has been minimized.
This comment has been minimized.
|
Looks like closure inference and overloaded call notation gone amiss: #![feature(unboxed_closures, fn_traits)]
fn test2<R>(r: &mut R) {
let _f = |r: &mut R| {
let x = || -> () { let _ = &r; };
Fn::call(&x, ()); // compiles
// x(); //~ ERROR the parameter type `R` may not live long enough [E0311]
};
}
fn main() {
} |
This comment has been minimized.
This comment has been minimized.
|
triage: P-high |
rust-highfive
added
P-high
and removed
I-nominated
labels
Jan 14, 2016
nikomatsakis
self-assigned this
Jan 14, 2016
This comment has been minimized.
This comment has been minimized.
|
Not sure if this is a bug or what, but it sure looks suspicious. |
This comment has been minimized.
This comment has been minimized.
|
OK so the problem is a complex one. It would (honestly) probably be easier to solve in a MIR context. I don't know why this regressed yet (that is, I don't know why it ever worked), but I suspect it is related to @pnkfelix's fixes for extending the lifetime of return values (but only indirectly). Here is a minimal test case: fn test2<R>() {
|u: &mut R| {
(|| u)();
};
}
fn main() {
}The problem is that we must infer the kind for the inner closure ( I'm not 100% sure of the easiest fix here. I guess we could try to gin up an fcx in In the glorious MIR future, these region details would be erased and would get checked on the desugared representation, which seems much easier. |
brson
added
regression-from-stable-to-stable
and removed
regression-from-stable-to-nightly
labels
Jun 23, 2016
This comment has been minimized.
This comment has been minimized.
|
@rust-lang/compiler No movement on this one. Still P-high? |
brson
added
the
I-nominated
label
Jun 23, 2016
This comment has been minimized.
This comment has been minimized.
|
demoting to P-medium |
pnkfelix
added
P-medium
and removed
I-nominated
P-high
labels
Jun 23, 2016
brson
added
A-typesystem
A-borrow-checker
I-wrong
E-hard
A-mir
and removed
A-borrow-checker
labels
Sep 13, 2016
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis You assigned to yourself a while back, still investigating? Original example:
@arielb1's example compiles. @nikomatsakis's example:
|
This comment has been minimized.
This comment has been minimized.
|
I've not done any investigation, to be honest. |
This comment has been minimized.
This comment has been minimized.
|
This will probably be fixed when we reform lifetime inference for NLL, and not before then. |
Mark-Simulacrum
added
C-bug
and removed
I-wrong
labels
Jul 24, 2017
This comment has been minimized.
This comment has been minimized.
|
Both the original example and the one by @nikomatsakis compile on stable (1.27.0). Should this be declared fixed? |
This comment has been minimized.
This comment has been minimized.
|
Closing this as resolved. If @rust-lang/compiler or anyone else has any objections, please reopen or leave a comment. |
yongqli commentedJan 11, 2016
This code no longer builds on
nightly:Rust playground link
See also https://internals.rust-lang.org/t/rfc-1214-regression-report-where-to-go-from-here/2788/10