Skip to content
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

libc: Prepare for movement to crates.io #20606

Merged
merged 1 commit into from
Jan 7, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 6 additions & 21 deletions src/liblibc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
// except according to those terms.

#![crate_name = "libc"]
#![experimental]
#![no_std] // we don't need std, and we can't have std, since it doesn't exist
// yet. std depends on us.
#![crate_type = "rlib"]
#![cfg_attr(not(feature = "cargo-build"), experimental)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe cfg_attr does anything at the crate level atm (#19372)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I fixed this bug awhile back, but I forget when:

$ cat foo.rs
#![cfg_attr(foo, experimental)]
$ cat bar.rs
#![deny(experimental)]

extern crate foo;
$ rustc foo.rs --cfg foo --crate-type lib && rustc bar.rs -L. --crate-type lib
bar.rs:3:1: 3:18 error: use of experimental item
bar.rs:3 extern crate foo;
         ^~~~~~~~~~~~~~~~~
bar.rs:1:9: 1:21 note: lint level defined here
bar.rs:1 #![deny(experimental)]
                 ^~~~~~~~~~~~
error: aborting due to previous error
$ rustc foo.rs --crate-type lib && rustc bar.rs -L. --crate-type lib      
$

#![no_std]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/",
Expand Down Expand Up @@ -70,20 +69,14 @@
//! in multiple derived systems. This is the 4.4BSD r2 / 1995 release, the final
//! one from Berkeley after the lawsuits died down and the CSRG dissolved.

#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(missing_docs)]
#![allow(non_snake_case)]
#![allow(raw_pointer_derive)]
#![allow(bad_style, raw_pointer_derive)]

extern crate core;
#[cfg(feature = "cargo-build")] extern crate "std" as core;
#[cfg(not(feature = "cargo-build"))] extern crate core;

#[cfg(test)] extern crate std;
#[cfg(test)] extern crate test;

pub use self::Nullable::*;

// Explicit export lists for the intersection (provided here) mean that
// you can write more-platform-agnostic code if you stick to just these
// symbols.
Expand Down Expand Up @@ -311,14 +304,6 @@ pub use types::os::arch::extra::{mach_timebase_info};
#[link(name = "m")]
extern {}

/// A wrapper for a nullable pointer. Don't use this except for interacting
/// with libc. Basically Option, but without the dependence on libstd.
// If/when libprim happens, this can be removed in favor of that
pub enum Nullable<T> {
Null,
NotNull(T)
}

pub mod types {

// Types tend to vary *per architecture* so we pull their definitions out
Expand Down Expand Up @@ -4648,7 +4633,7 @@ pub mod funcs {
extern {
pub fn glob(pattern: *const c_char,
flags: c_int,
errfunc: ::Nullable<extern "C" fn(epath: *const c_char,
errfunc: ::core::option::Option<extern "C" fn(epath: *const c_char,
errno: c_int) -> c_int>,
pglob: *mut glob_t);
pub fn globfree(pglob: *mut glob_t);
Expand Down