From 0d933a83a768fb27e4ee947d05b7e883b7486c54 Mon Sep 17 00:00:00 2001 From: Kinsey Favre Date: Fri, 24 Jan 2020 13:07:16 -0600 Subject: [PATCH 1/2] Uncomment None constant I'm assuming this was commented out to avoid shadowing `std::option::Option::None`. However, aside from the fact that this essentially excludes a symbol from the library bindings that should be included, this is really not necessary. There are other ways for client code to avoid this issue, such as avoiding importing `x11::xlib::*` or re-exporting either `std::option::Option::None` or `x11::xlib::None` under a different name. --- src/xlib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xlib.rs b/src/xlib.rs index 4bc5cbe..1ad88d9 100644 --- a/src/xlib.rs +++ b/src/xlib.rs @@ -3224,7 +3224,7 @@ pub const LSBFirst: c_int = 0; pub const MSBFirst: c_int = 1; // Reserved resource and constant definitions -//pub const None: c_int = 0; +pub const None: c_int = 0; pub const ParentRelative: c_int = 1; pub const CopyFromParent: c_int = 0; pub const PointerWindow: c_int = 0; From 35bcddc30086e262c2a80f3c8cd0a95f4397ec1e Mon Sep 17 00:00:00 2001 From: Kinsey Favre Date: Fri, 24 Jan 2020 14:13:40 -0600 Subject: [PATCH 2/2] Feature-gate None constant in xlib If simply restored as-is, the `None` constant may break existing code that imports `x11::xlib::*` and expects `None` to refer to `std::option::Option::None`. Gate the declaration behind a feature that is not enabled by default to prevent this. --- src/xlib.rs | 1 + x11-dl/Cargo.toml | 3 +++ x11/Cargo.toml | 1 + 3 files changed, 5 insertions(+) diff --git a/src/xlib.rs b/src/xlib.rs index 1ad88d9..d3ff63a 100644 --- a/src/xlib.rs +++ b/src/xlib.rs @@ -3224,6 +3224,7 @@ pub const LSBFirst: c_int = 0; pub const MSBFirst: c_int = 1; // Reserved resource and constant definitions +#[cfg(feature = "none-symbol")] pub const None: c_int = 0; pub const ParentRelative: c_int = 1; pub const CopyFromParent: c_int = 0; diff --git a/x11-dl/Cargo.toml b/x11-dl/Cargo.toml index e9e38e8..c0b93a2 100644 --- a/x11-dl/Cargo.toml +++ b/x11-dl/Cargo.toml @@ -12,6 +12,9 @@ build = "build.rs" documentation = "https://docs.rs/x11-dl" workspace = ".." +[features] +none-symbol = [] + [dependencies] lazy_static = "1" libc = "0.2" diff --git a/x11/Cargo.toml b/x11/Cargo.toml index 83cdd2c..4800da7 100644 --- a/x11/Cargo.toml +++ b/x11/Cargo.toml @@ -15,6 +15,7 @@ workspace = ".." [features] dpms = [] glx = [] +none-symbol = ["xlib"] xcursor = [] xf86vmode = [] xft = []