Skip to content
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

const extern fn's dont need fn specifier #68062

Closed
DutchGhost opened this issue Jan 9, 2020 · 3 comments · Fixed by #68073
Closed

const extern fn's dont need fn specifier #68062

DutchGhost opened this issue Jan 9, 2020 · 3 comments · Fixed by #68073
Assignees
Labels
A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. F-const_extern_fn `#![feature(const_extern_fn)]` P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@DutchGhost
Copy link
Contributor

The following program compiles, and prints 1:

#![feature(const_extern_fn)]

const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 }

fn main() {
    dbg!(bug());
}
@jonas-schievink jonas-schievink added A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. F-const_extern_fn `#![feature(const_extern_fn)]` requires-nightly This issue requires a nightly compiler in some way. labels Jan 9, 2020
@DutchGhost
Copy link
Contributor Author

As pointed out by @Nemo157 on discord , this also works on stable:

const unsafe WhereIsFerris Now() {}

@jonas-schievink jonas-schievink added I-nominated and removed F-const_extern_fn `#![feature(const_extern_fn)]` requires-nightly This issue requires a nightly compiler in some way. labels Jan 9, 2020
@Centril Centril added the P-high High priority label Jan 9, 2020
@Centril Centril self-assigned this Jan 9, 2020
@Centril
Copy link
Contributor

Centril commented Jan 9, 2020

Regression introduced in 1.40.0, specifically this line: https://github.com/rust-lang/rust/pull/64906/files#diff-af81683dfdae5890b2c6fa2d9b047f0aR163.

@Centril Centril added the F-const_extern_fn `#![feature(const_extern_fn)]` label Jan 9, 2020
@Centril
Copy link
Contributor

Centril commented Jan 9, 2020

I have a fix in #68073.

Centril added a commit to Centril/rust that referenced this issue Jan 10, 2020
@bors bors closed this as completed in 6f3f1c5 Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. F-const_extern_fn `#![feature(const_extern_fn)]` P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants