-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Tracking issue for internal feature no_core
#29639
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
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 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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: