-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Extract core::ffi
primitives to a separate (internal) module
#136334
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @tgross35 (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
@rustbot author |
This comment has been minimized.
This comment has been minimized.
I am having issues with the tidy verification ATM. It seems that when I move c_char and c_long to primitives.rs, I get the tidy errors:
I guess it does not like that I have platform-specific configuration checks in primitive.rs. I am not too familiar with tidy and have not found much on the docs but will continue to look into how I can migrate both types to primitives.rs. |
Searching for "platform-specific cfg" points here rust/src/tools/tidy/src/pal.rs Line 114 in 6c1d960
EXCEPTION_PATHS at the top of that file.
You'll have to move (Fyi |
Yes, adding the tidy exception is fine. |
I am having issues with the type_alias macro in mod.rs during compilation. Basically, although I insert primitives.rs into mod.rs after the macro type_alias, the compiler still throws the error that the types are missing a stability attribute. I am unsure as to why, any ideas @tgross35 @jieyouxu ? mod.rs macro_rules! type_alias {
{
$Docfile:tt, $Alias:ident = $Real:ty;
$( $Cfg:tt )*
} => {
#[doc = include_str!($Docfile)]
$( $Cfg )*
#[stable(feature = "core_ffi_c", since = "1.64.0")]
pub type $Alias = $Real;
}
}
// Primitives contains listed types.
// Contained in seperate file for simple parsing.
mod primitives;
pub use self::primitives::{
c_char, c_double, c_float, c_int, c_long, c_longlong, c_ptrdiff_t, c_schar, c_short, c_size_t,
c_ssize_t, c_uchar, c_uint, c_ulong, c_ulonglong, c_ushort,
}; primitives.rs type_alias! { "c_char.md", c_char = c_char_definition::c_char; #[doc(cfg(all()))] }
[...] error
|
It may be complaining about wanting a stability attribute on |
I just did not think it was necessary to add the stability attribute when adding the primitive module as it uses the type_alias to define the stability attributes for each type. |
core::ffi
primitives to a separate module
core::ffi
primitives to a separate modulecore::ffi
primitives to a separate (internal) module
In a way it is kind of weird since the module is private, but it also makes sense - already-public items may be exported in new modules, unstably. (I had to go through this thought process myself) You will probably have to split the |
I tried the ../ method and it doesn't seem to find the correct path when I was testing. Why could I not keep it how it is ("c_char.md") if primitives.rs is in the same directory as the md files? |
Oh, my bad; I was thinking this moved to a subdirectory, but you're right 👍 |
@rustbot ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Please squash then r=me
@bors r=tgross35 |
@ricci009: 🔑 Insufficient privileges: Not in reviewers |
@tgross35 not sure if I did the r=me thing correctly but squashed and ready to go! |
r=me is just a convention but doesn’t actually do anything, bors still checks permissions. Thanks! @bors r+ |
Rollup of 5 pull requests Successful merges: - rust-lang#134777 (Enable more tests on Windows) - rust-lang#135621 (Move some std tests to integration tests) - rust-lang#135844 ( Add new tool for dumping feature status based on tidy ) - rust-lang#136167 (Implement unstable `new_range` feature) - rust-lang#136334 (Extract `core::ffi` primitives to a separate (internal) module) Failed merges: - rust-lang#136201 (Removed dependency on the field-offset crate, alternate approach) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136334 - ricci009:primitivers, r=tgross35 Extract `core::ffi` primitives to a separate (internal) module ### Introduce library/core/src/ffi/primitives.rs The regex preprocessing for PR rust-lang#133944 would be more robust if the relevant types from core/src/ffi/mod.rs were first moved to library/core/src/ffi/primitives.rs, then there isn't a need to deal with traits / c_str / va_list / whatever might wind up in that module in the future r? `@tgross35`
Introduce library/core/src/ffi/primitives.rs
The regex preprocessing for PR #133944 would be more robust if the relevant types from core/src/ffi/mod.rs were first moved to library/core/src/ffi/primitives.rs, then there isn't a need to deal with traits / c_str / va_list / whatever might wind up in that module in the future
r? @tgross35