Skip to content

sockopt_impl hygiene - #2814

Open
Frost-54 wants to merge 1 commit into
nix-rust:masterfrom
Frost-54:master
Open

sockopt_impl hygiene#2814
Frost-54 wants to merge 1 commit into
nix-rust:masterfrom
Frost-54:master

Conversation

@Frost-54

Copy link
Copy Markdown

What does this PR do

Currently

macro_rules! sockopt_impl {
($(#[$attr:meta])* $name:ident, GetOnly, $level:expr, $flag:path, bool) => {
sockopt_impl!($(#[$attr])*
$name, GetOnly, $level, $flag, bool, $crate::sys::socket::sockopt::GetBool);
};
references other macros and libc defined in nix without $crate.
This will cause compile error when using it outside of nix.

This PR adds $crate:: to all usages of macros in sockopt_impl and reference libc using $crate::libc.

However, just adding $crate:: will trigger deny(macro_expanded_macro_exports_accessed_by_absolute_paths), because pub mod socket is defined in a feature! macro.

nix/src/sys/mod.rs

Lines 129 to 133 in fb79966

feature! {
#![feature = "socket"]
#[allow(missing_docs)]
pub mod socket;
}

I just manually expand feature! to work around it.

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

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

Successfully merging this pull request may close these issues.

1 participant