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

rustc should complain when language items are not correctly implemented. #48342

Closed
glandium opened this issue Feb 18, 2018 · 3 comments
Closed

Comments

@glandium
Copy link
Contributor

While filing issue #48339, I made a mistake in how I was defining the panic_fmt language item. It was missing both a pub and #[no_mangle]. While rustc does complain when the language item is not present when building with no-std, it doesn't complain when it is present, but badly setup, and that leads to the error happening at the linker level. But by the time the linker errors out, the function has a different name, and the reason why it happens is not clear.

/checkout/src/libcore/panicking.rs:71: undefined reference to `rust_begin_unwind'

is the error as it appears, despite the language item having a different name (panic_fmt), and the function as defined in the source might have yet another name.

@ollie27
Copy link
Member

ollie27 commented Feb 19, 2018

Dupe of #9307?

@glandium
Copy link
Contributor Author

Surely related, but that bug doesn't talk about pub and no_mangle, only about the function signatures (arguments and return value, which I've also noticed the compiler doesn't care about)

@pietroalbini
Copy link
Member

Duplicate of #9307, closing this.

Even if that issue doesn't mention pub and no_mangle explicitly, I'm confident that will be checked as part of the function signature (if the check will be implemented in the future).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants