Skip to content

Add an expect intrinsic to the stdlib. #22805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mahkoh opened this issue Feb 25, 2015 · 4 comments
Closed

Add an expect intrinsic to the stdlib. #22805

mahkoh opened this issue Feb 25, 2015 · 4 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@mahkoh
Copy link
Contributor

mahkoh commented Feb 25, 2015

extern {
    #[link_name = "llvm.expect.i8"]
    fn expect(val: u8, expected_val: u8) -> u8;
}
@pnkfelix
Copy link
Member

For those not famililar with LLVM, here's the spec for what this does:

(i.e. its a hint to LLVM that the expression passed in for val is likely to be the value expected_val.)

@dotdash dotdash added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Feb 25, 2015
@dotdash
Copy link
Contributor

dotdash commented Feb 25, 2015

We're already using that internally, just needs to be exposed (does that need an RFC?). The relevant places are declare_intrinsics(), get_simple_intrinsic() and the extern "rust-intrinsic" block in src/libcore/intrinsics.rs.

@steveklabnik
Copy link
Member

(does that need an RFC?)

The rules are very... in-flux now, but adding new public things will soon, yes. I almost closed this and suggested the RFCs repo, but I'm leaving it for now since it's gray area.

@nagisa
Copy link
Member

nagisa commented Feb 28, 2015

Duplicate of #20579. Also see #17317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

6 participants