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

Clarify what #![no_std] is useful for #20537

Closed
SimonSapin opened this issue Jan 4, 2015 · 9 comments
Closed

Clarify what #![no_std] is useful for #20537

SimonSapin opened this issue Jan 4, 2015 · 9 comments

Comments

@SimonSapin
Copy link
Contributor

I’ve initially made rust-wtf8 use #![no_std] out of the theoretical concern that potential users (maybe html5ever) would want #![no_std] as well. (And because it wasn’t hard.)

But now that the runtime was removed, what are the real benefits of using #![no_std]? The html5ever source has a "This helps us make a C-friendly library." comment. @kmc, how does it help?

@kmcallister
Copy link
Contributor

servo/html5ever#63 proposes to drop #![no_std]. I don't think there's any need now that the runtime has been removed.

@sfackler
Copy link
Member

sfackler commented Jan 5, 2015

I think it's still useful for libraries that want to work in environments where std won't work, like a kernel. It doesn't seem like rust-wtf8 is one of those libraries, though.

@SimonSapin
Copy link
Contributor Author

What makes std not work in a kernel?

@sfackler
Copy link
Member

sfackler commented Jan 5, 2015

std::thread, std::io::stdio, std::sync minus std::sync::atomics at the very least.

@sfackler
Copy link
Member

sfackler commented Jan 5, 2015

You'd probably want to avoid box and anything that allocates as well, since killing the entire system if the kernel runs out of memory may not be the right strategy.

@SimonSapin
Copy link
Contributor Author

Is merely linking against libstd problematic, if these modules are not used?

@sfackler
Copy link
Member

sfackler commented Jan 5, 2015

I think so, since you'd probably end up pulling in a dynamic dependency on glibc.

@kmcallister kmcallister changed the title Is #![no_std] useful for libraries? Clarify what #![no_std] is useful for Jan 9, 2015
@kmcallister
Copy link
Contributor

This is basically a doc bug. cc @steveklabnik

@steveklabnik
Copy link
Member

I'm moving this thread to rust-lang/rfcs#1005, given that it's an unstable feature.

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

4 participants