-
-
Save lqd/3b9d3142655093a1b0299e13af4098bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait X { | |
type G; | |
fn make_g() -> Self::G; | |
} | |
impl<'a> X for fn(&'a ()) { | |
type G = &'a (); | |
fn make_g() -> Self::G { | |
&() | |
} | |
} | |
// Always an error, but the message is bad | |
fn higher_ranked_region_has_lost_its_binder() { | |
let x = <fn (&())>::make_g(); | |
} | |
// error: implementation of `X` is not general enough | |
// --> src/main.rs:44:13 | |
// | | |
// 44 | let x = <fn (&())>::make_g(); | |
// | ^^^^^^^^^^^^^^^^^^ | |
// | | |
// = note: `for<'r> fn(&'r ())` must implement `X` | |
// = note: but `fn(&'0 ())` only implements `X` for the lifetime `'0` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment