Last active
July 28, 2022 09:50
-
-
Save davidtwco/3f3de4690fd646910c13e14e36dc3a12 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
#![crate_type = "lib"] | |
#![feature(staged_api)] | |
#![stable(feature = "the_tortoise_and_the_unstable_function", since = "1.0.0")] | |
#[stable(feature = "the_tortoise_and_the_unstable_function", since = "1.0.0")] | |
pub struct Foo; | |
#[stable(feature = "the_tortoise_and_the_unstable_function", since = "1.0.0")] | |
pub struct Bar; | |
#[stable(feature = "the_tortoise_and_the_unstable_function", since = "1.0.0")] | |
impl std::ops::Deref for Foo { | |
type Target = Bar; | |
fn deref(&self) -> &Self::Target { | |
&Bar | |
} | |
} | |
impl Foo { | |
#[unstable(feature = "tortoise_on_foo", issue = "none")] | |
pub fn tortoise(&self) -> u32 { | |
4 | |
} | |
} | |
impl Bar { | |
#[stable(feature = "the_tortoise_and_the_unstable_function", since = "1.0.0")] | |
pub fn tortoise(&self) -> u32 { | |
3 | |
} | |
} |
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
// aux-build:aux.rs | |
extern crate aux; | |
use aux::Foo; | |
fn main() { | |
let f = Foo; | |
assert_eq!(f.tortoise(), 4); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
or, with
-Zpick-stable-methods-before-any-unstable=no
: