From 2ed112c14e7c9ca53950e83afd3142bf8989b7af Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 6 Sep 2019 13:49:48 -0700 Subject: [PATCH] Add `alloc` and `proc_macro` to libstd crates These two have been stabilized for all targets like `std` so if `std` is requested let's be sure to make them available to other crates as well. --- src/cargo/core/compiler/standard_lib.rs | 2 ++ tests/testsuite/standard_lib.rs | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cargo/core/compiler/standard_lib.rs b/src/cargo/core/compiler/standard_lib.rs index 9a01c41190e..551f67c01b7 100644 --- a/src/cargo/core/compiler/standard_lib.rs +++ b/src/cargo/core/compiler/standard_lib.rs @@ -17,6 +17,8 @@ pub fn parse_unstable_flag(value: Option<&str>) -> Vec { let mut crates: HashSet<&str> = value.split(',').collect(); if crates.contains("std") { crates.insert("core"); + crates.insert("alloc"); + crates.insert("proc_macro"); crates.insert("panic_unwind"); crates.insert("compiler_builtins"); } else if crates.contains("core") { diff --git a/tests/testsuite/standard_lib.rs b/tests/testsuite/standard_lib.rs index 3c7b5823397..4fa1d0edc5a 100644 --- a/tests/testsuite/standard_lib.rs +++ b/tests/testsuite/standard_lib.rs @@ -237,7 +237,15 @@ fn doc() { fn check_std() { let p = project() - .file("src/lib.rs", "pub fn f() {}") + .file( + "src/lib.rs", + " + extern crate core; + extern crate alloc; + extern crate proc_macro; + pub fn f() {} + ", + ) .file("src/main.rs", "fn main() {}") .file( "tests/t1.rs",