История изменений
Исправление shkolnick-kun, (текущая версия) :
Апдейт от топикстартера на GutHub-е после «починили».
Update from @pnkfelix :
While the test as written above is rejected by Rust today (with the error message for line 6 saying "in type &'static &'a (), reference has a longer lifetime than the data it references"), that is just an artifact of the original source code (with its explicit type signature) running up against one new WF-check.
The fundamental issue persists, since one can today write instead:
static UNIT: &'static &'static () = &&();
fn foo<'a, 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v }
fn bad<'a, T>(x: &'a T) -> &'static T {
let f: fn(_, &'a T) -> &'static T = foo;
f(UNIT, x)
}
(and this way, still get the bad behaving fn bad, by just side-stepping one of the explicit type declarations.)
Что какбе говорит на о качестве кода в конпеляторе.
Что касается zurg, то они изволили мне клоуна поставить, но по существу ничего сказать нишмагли.
Интересно, что скажут LightDiver,
unC0Rr,
hateyoufeel,
WatchCat,
FishHook и прочие достойные представители «сообщества» )))
Исправление shkolnick-kun, :
Апдейт от топикстартера на GutHub-е после «починили».
Update from @pnkfelix :
While the test as written above is rejected by Rust today (with the error message for line 6 saying "in type &'static &'a (), reference has a longer lifetime than the data it references"), that is just an artifact of the original source code (with its explicit type signature) running up against one new WF-check.
The fundamental issue persists, since one can today write instead:
static UNIT: &'static &'static () = &&();
fn foo<'a, 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v }
fn bad<'a, T>(x: &'a T) -> &'static T {
let f: fn(_, &'a T) -> &'static T = foo;
f(UNIT, x)
}
(and this way, still get the bad behaving fn bad, by just side-stepping one of the explicit type declarations.)
Что какбе говорит на о качестве кода в конпеляторе.
Что касается zurg, то они изволили поставит мне клоуна, но по существу ничего возразить нишмагли.
Интересно, что скажут LightDiver,
unC0Rr,
hateyoufeel,
WatchCat,
FishHook и прочие достойные представители «сообщества» )))
Исправление shkolnick-kun, :
Апдейт от топикстартера на GutHub-е после «починили».
Update from @pnkfelix :
While the test as written above is rejected by Rust today (with the error message for line 6 saying "in type &'static &'a (), reference has a longer lifetime than the data it references"), that is just an artifact of the original source code (with its explicit type signature) running up against one new WF-check.
The fundamental issue persists, since one can today write instead:
static UNIT: &'static &'static () = &&();
fn foo<'a, 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v }
fn bad<'a, T>(x: &'a T) -> &'static T {
let f: fn(_, &'a T) -> &'static T = foo;
f(UNIT, x)
}
(and this way, still get the bad behaving fn bad, by just side-stepping one of the explicit type declarations.)
Что какбе говорит на о качестве кода в конпеляторе
Исходная версия shkolnick-kun, :
Апдейт от топикстартера на GutHub-е после «исправления».
Update from @pnkfelix :
While the test as written above is rejected by Rust today (with the error message for line 6 saying "in type &'static &'a (), reference has a longer lifetime than the data it references"), that is just an artifact of the original source code (with its explicit type signature) running up against one new WF-check.
The fundamental issue persists, since one can today write instead:
static UNIT: &'static &'static () = &&();
fn foo<'a, 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v }
fn bad<'a, T>(x: &'a T) -> &'static T {
let f: fn(_, &'a T) -> &'static T = foo;
f(UNIT, x)
}
(and this way, still get the bad behaving fn bad, by just side-stepping one of the explicit type declarations.)