-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Tracking issue for internal feature no_core
#29639
Comments
Perhaps it would be better to give this a 'positive' name, like |
|
Traige: no change |
If we make |
@gnzlbg makes a great point. Additionally I'd like it if it was renamed to not mention the name of any create. If we get core depending on more crates, core might not seem so On the other hand, maybe we'll someday want to make primitives like |
This idea seems fishy and impractical for me, let me quote @Ericson2314 to elaborate why:
If This is not true for procedural macros, which are loaded into the compiler when |
Please don't make |
=== stdout === === stderr === error[E0658]: language items are subject to change --> /home/runner/work/glacier/glacier/ices/86238.rs:6:1 | 6 | #[lang = "sized"] | ^^^^^^^^^^^^^^^^^ | = help: add `#![feature(lang_items)]` to the crate attributes to enable error[E0658]: language items are subject to change --> /home/runner/work/glacier/glacier/ices/86238.rs:8:1 | 8 | #[lang = "copy"] | ^^^^^^^^^^^^^^^^ | = help: add `#![feature(lang_items)]` to the crate attributes to enable error[E0658]: the `#[no_core]` attribute is an experimental feature --> /home/runner/work/glacier/glacier/ices/86238.rs:1:1 | 1 | #![no_core] | ^^^^^^^^^^^ | = note: see issue #29639 <rust-lang/rust#29639> for more information = help: add `#![feature(no_core)]` to the crate attributes to enable error: failed to find an overloaded call trait for closure call --> /home/runner/work/glacier/glacier/ices/86238.rs:4:5 | 4 | one() | ^^^^^ | = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0658`. ==============
=== stdout === === stderr === error[E0658]: language items are subject to change --> /home/runner/work/glacier/glacier/ices/86238.rs:6:1 | 6 | #[lang = "sized"] | ^^^^^^^^^^^^^^^^^ | = help: add `#![feature(lang_items)]` to the crate attributes to enable error[E0658]: language items are subject to change --> /home/runner/work/glacier/glacier/ices/86238.rs:8:1 | 8 | #[lang = "copy"] | ^^^^^^^^^^^^^^^^ | = help: add `#![feature(lang_items)]` to the crate attributes to enable error[E0658]: the `#[no_core]` attribute is an experimental feature --> /home/runner/work/glacier/glacier/ices/86238.rs:1:1 | 1 | #![no_core] | ^^^^^^^^^^^ | = note: see issue #29639 <rust-lang/rust#29639> for more information = help: add `#![feature(no_core)]` to the crate attributes to enable error: failed to find an overloaded call trait for closure call --> /home/runner/work/glacier/glacier/ices/86238.rs:4:5 | 4 | one() | ^^^^^ | = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0658`. ============== Co-authored-by: rustbot <rustbot@users.noreply.github.com>
Marking as "needs-summary", because we need a closer look at the use cases for |
That's not to say that there couldn't be other things that would make sense to have on stable, like a "please don't use simd" kind of flag/attribute or "I wish LTO worked better to remove parts I don't need" or ..., but those wouldn't be this issue. |
In a recent embedded project, I needed to calculate CRC. I knew there is the The project is written mostly in C, so in order to save time, I exported a simple interface: #[no_mangle]
unsafe extern "C" fn calculate_crc(data: *const u8, len: usize) -> u32 {
...
} ... and turned that into an object file with This had no dependency on Does this count in any way? |
|
Should I be opening bug reports related to my use of |
@gheoan As for diagnostics, I don't think we should do anything for |
Contradicts #92495 (comment):
|
I think getting ICEs in |
Imho, I think that it would be good to give Rust some hooks that would allow for use in safety-critical systems that could potentially eliminate the need for a separate core (for at least the basic SIL levels) - which would probably have benefits to the language as a whole. Some things I've considered that would help that -
The first two things are basically clippy lints, but they would need to be applied recursively to everything linked. Stack size analysis is another thing, but this is already sort of coming via Regarding the cfg-if thing, is there any reasons the implementations aren't just exported from core? |
IIUC you might want to have core depend on an external crate for its implementation without exposing that crate's API in core's API. E.g., per @gnzlbg, "we currently duplicate |
If I understand the argument correctly, it is essentially "except |
I really don't understand why you would use this. A lot of people have given issues and said that "this isn't useful." But nobody has asked why you would even want not to use core. Is there a reason that I haven't realized? Why would I want to get rid of core, which has so many amazing features that do not depend on the operating system. |
just writing here to throw in my $0.02. I’d like to avoid libcore in some places where I’d rather not be obligated to follow the license of the libcore code for some particular binary (this seems to indicate its licensed under MIT/Apache2). Now in 99% of cases this is a complete non-issue, but surely it should at least be possible to write a (non-trivial) rust program without needing to do so? It’s not even really documented anywhere that an empty rust program with Aside from that (little bit of pedantry) though, I figure it’s at least worth having for completeness’s sake, as crates like Either way, I think this is a good thing assuming it wouldn’t be a stability nightmare or anything. |
Well, if we talk about licenses... are the compiler intrinsics distributed under MIT/Apache too? |
LLVM has a specific exception for these
(From LICENSE.txt in LLVM). Does Rust have some equivalent that I wasn't aware of? I couldn't find any such thing but that would make the licensing thing a non-issue. |
LLVM is only distributed under the Apache 2.0 license, and excluded sections 4(a), 4(b) and 4(d) exempt the parts about needing to provide the license upon redistribution and giving attribution. Rust is dual licensed under either Apache or MIT at your choice Lines 16 to 19 in 43f4f2a
core under the MIT license already means you don't have to worry about these attribution things, nor the GPL / patent provision / indemnity provision waiver.
Under what specific circumstances would this be surprising? Having the MIT license allows the source and software to be distributed liberally. Having no license is less free, unlicensed software cannot be distributed at all. LLVM intrinsics are still under the Apache2 license, just with some exceptions. Using Rust's |
This isn't correct. The MIT license definitely requires attribution and including a copy of the license with distribution.
Under the circumstances that both gcc and clang both have exceptions so that this isn't the case. The norm for people coming from C/C++ is that "compiling without the standard library means you don't have to worry about licenses", and it's surprising that rust differs in this way.
Again: the differences granted by the exception are what I'm after here. Whether or not something is licensed under Apache 2 or MIT, the point is whether or not the user has some hidden obligation to give a copy of the license and give attribution when it's not obvious. With both gcc and clang, these exceptions mean that someone compiling with The proposed solution here isn't "no license is better", just that having |
I am not a lawyer, but I believe the clause Whether this is the correct way to interpret it or not I do not know. The question really isn't related to |
I agree that the specific issue on what the MIT license requires in binary distribution is off topic, I'll continue that discussion elsewhere. |
I think I have a use-case for this. I want to specify a logical data model using Rust's syntax and type system so that implementations can map in and out (a la serde). It is important to keep it zero-sized to maintain maximum flexibility for both the people mapping in and out as well as the end users relying on those crates. I want to mark my definition crate as I can achieve my overhead and compatibility goals by sticking to |
|
no_core
stabilizationno_core
Right, but if I make a One could informally not use std and have the same observable effects (minus linked std which might be stripped), but the existence of an optional |
The
no_core
feature allows you to avoid linking tolibcore
.The text was updated successfully, but these errors were encountered: