From 5c82a5434b8370a9ed119577b0cf1afb995d6a17 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 11 Sep 2017 21:09:26 -0400 Subject: [PATCH] Trim and document libc shim --- src/liblibc | 2 +- src/rustc/libc_shim/Cargo.toml | 32 +++++++++++++++++++++++--------- src/rustc/libc_shim/build.rs | 18 ------------------ 3 files changed, 24 insertions(+), 28 deletions(-) delete mode 100644 src/rustc/libc_shim/build.rs diff --git a/src/liblibc b/src/liblibc index 95848f9622dec..136bf195dfa54 160000 --- a/src/liblibc +++ b/src/liblibc @@ -1 +1 @@ -Subproject commit 95848f9622deccc9cbadcd5d3a4faef01a90ead4 +Subproject commit 136bf195dfa546a3589f414c1dfe693aa6ff1018 diff --git a/src/rustc/libc_shim/Cargo.toml b/src/rustc/libc_shim/Cargo.toml index 39df3528be369..0c04402124a2d 100644 --- a/src/rustc/libc_shim/Cargo.toml +++ b/src/rustc/libc_shim/Cargo.toml @@ -1,16 +1,7 @@ -# This is a shim Cargo.toml over the "real Cargo.toml" found in the libc -# repository itself. The purpose for this is to add a build script which prints -# out `--cfg stdbuild` to mirror the makefiles' build system. -# -# Note that other than that this isn't actually needed, and we should probably -# remove this shim in favor of just working with cargo features directly with -# libc. That should make everything nicer! - [package] name = "libc" version = "0.0.0" authors = ["The Rust Project Developers"] -build = "build.rs" [lib] name = "libc" @@ -20,4 +11,27 @@ bench = false doc = false [dependencies] +# Specify the path to libcore; at the time of writing, removing this shim in +# favor of using libc from git results in a compilation failure: +# +# Building stage0 std artifacts (x86_64-apple-darwin -> x86_64-apple-darwin) +# Compiling libc v0.0.0 (file:///Users/tamird/src/rust/src/rustc/libc_shim) +# error[E0463]: can't find crate for `core` +# +# error: aborting due to previous error +# +# error: Could not compile `libc`. +# +# Caused by: +# process didn't exit successfully: `/Users/tamird/src/rust/build/bootstrap/debug/rustc --crate-name libc src/rustc/libc_shim/../../liblibc/src/lib.rs --error-format json --crate-type lib --emit=dep-info,link -C opt-level=2 --cfg feature="default" --cfg feature="no_std" --cfg feature="stdbuild" -C metadata=d758f87058112d7d -C extra-filename=-d758f87058112d7d --out-dir /Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/x86_64-apple-darwin/release/deps --target x86_64-apple-darwin -L dependency=/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/x86_64-apple-darwin/release/deps -L dependency=/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/release/deps` (exit code: 101) +# thread 'main' panicked at 'command did not execute successfully: "/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0/bin/cargo" "build" "-j" "4" "--target" "x86_64-apple-darwin" "--release" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/Users/tamird/src/rust/src/libstd/Cargo.toml" "--message-format" "json" +# expected success, got: exit code: 101', src/bootstrap/compile.rs:883:8 +# +# See https://github.com/rust-lang/rfcs/pull/1133. core = { path = "../../libcore" } + +[features] +# Certain parts of libc are conditionally compiled differently than when used +# outside rustc. See https://github.com/rust-lang/libc/search?l=Rust&q=stdbuild&type=&utf8=%E2%9C%93. +stdbuild = [] +default = ["stdbuild"] diff --git a/src/rustc/libc_shim/build.rs b/src/rustc/libc_shim/build.rs deleted file mode 100644 index 546f60482e7bc..0000000000000 --- a/src/rustc/libc_shim/build.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![deny(warnings)] - -// See comments in Cargo.toml for why this exists - -fn main() { - println!("cargo:rustc-cfg=stdbuild"); - println!("cargo:rerun-if-changed=build.rs"); -}