Skip to content

Commit bc6eecd

Browse files
authored
Merge branch 'master' into frewsxcv-osstr
2 parents 6adbbfc + 0aeb9c1 commit bc6eecd

File tree

19 files changed

+244
-53
lines changed

19 files changed

+244
-53
lines changed

configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ opt dist-host-only 0 "only install bins for the host architecture"
445445
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
446446
opt llvm-version-check 1 "check if the LLVM version is supported, build anyway"
447447
opt codegen-tests 1 "run the src/test/codegen tests"
448+
opt save-analysis 0 "save API analysis data"
448449
opt option-checking 1 "complain about unrecognized options in this configure script"
449450
opt ninja 0 "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)"
450451
opt locked-deps 0 "force Cargo.lock to be up to date"

src/bootstrap/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub struct Config {
7474
pub rustc_default_ar: Option<String>,
7575
pub rust_optimize_tests: bool,
7676
pub rust_debuginfo_tests: bool,
77+
pub rust_save_analysis: bool,
7778
pub rust_dist_src: bool,
7879

7980
pub build: String,
@@ -225,6 +226,7 @@ struct Rust {
225226
optimize_tests: Option<bool>,
226227
debuginfo_tests: Option<bool>,
227228
codegen_tests: Option<bool>,
229+
save_analysis: Option<bool>,
228230
}
229231

230232
/// TOML representation of how each build target is configured.
@@ -350,6 +352,7 @@ impl Config {
350352
set(&mut config.rust_optimize_tests, rust.optimize_tests);
351353
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
352354
set(&mut config.codegen_tests, rust.codegen_tests);
355+
set(&mut config.rust_save_analysis, rust.save_analysis);
353356
set(&mut config.rust_rpath, rust.rpath);
354357
set(&mut config.debug_jemalloc, rust.debug_jemalloc);
355358
set(&mut config.use_jemalloc, rust.use_jemalloc);
@@ -457,6 +460,7 @@ impl Config {
457460
("LOCAL_REBUILD", self.local_rebuild),
458461
("NINJA", self.ninja),
459462
("CODEGEN_TESTS", self.codegen_tests),
463+
("SAVE_ANALYSIS", self.rust_save_analysis),
460464
("LOCKED_DEPS", self.locked_deps),
461465
("VENDOR", self.vendor),
462466
("FULL_BOOTSTRAP", self.full_bootstrap),

src/bootstrap/config.toml.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@
234234
# saying that the FileCheck executable is missing, you may want to disable this.
235235
#codegen-tests = true
236236

237+
# Flag indicating whether the API analysis data should be saved.
238+
#save-analysis = false
239+
237240
# =============================================================================
238241
# Options for specific targets
239242
#

src/bootstrap/dist.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -311,18 +311,14 @@ pub fn rust_src_location(build: &Build) -> PathBuf {
311311

312312
/// Creates a tarball of save-analysis metadata, if available.
313313
pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
314+
if !build.config.rust_save_analysis {
315+
return
316+
}
317+
314318
println!("Dist analysis");
315319

316-
if build.config.channel != "nightly" {
317-
println!("\tskipping - not on nightly channel");
318-
return;
319-
}
320320
if compiler.host != build.config.build {
321-
println!("\tskipping - not a build host");
322-
return
323-
}
324-
if compiler.stage != 2 {
325-
println!("\tskipping - not stage2");
321+
println!("\tskipping, not a build host");
326322
return
327323
}
328324

src/bootstrap/install.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ pub fn install(build: &Build, stage: u32, host: &str) {
4949
install_sh(&build, "docs", "rust-docs", stage, host, &prefix,
5050
&docdir, &libdir, &mandir, &empty_dir);
5151
}
52+
if build.config.rust_save_analysis {
53+
install_sh(&build, "analysis", "rust-analysis", stage, host, &prefix,
54+
&docdir, &libdir, &mandir, &empty_dir);
55+
}
5256
install_sh(&build, "std", "rust-std", stage, host, &prefix,
5357
&docdir, &libdir, &mandir, &empty_dir);
5458
install_sh(&build, "rustc", "rustc", stage, host, &prefix,

src/bootstrap/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ impl Build {
524524
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
525525
}
526526

527-
if self.config.channel == "nightly" && compiler.is_final_stage(self) {
527+
if self.config.rust_save_analysis && compiler.is_final_stage(self) {
528528
cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string());
529529
}
530530

src/ci/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ fi
4343
if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then
4444
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=nightly"
4545
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
46+
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-save-analysis"
4647

4748
if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
4849
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"

src/libcollections/string.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,22 @@ impl<'a> From<&'a str> for String {
19741974
}
19751975
}
19761976

1977+
// note: test pulls in libstd, which causes errors here
1978+
#[cfg(not(test))]
1979+
#[stable(feature = "string_from_box", since = "1.17.0")]
1980+
impl From<Box<str>> for String {
1981+
fn from(s: Box<str>) -> String {
1982+
s.into_string()
1983+
}
1984+
}
1985+
1986+
#[stable(feature = "box_from_str", since = "1.17.0")]
1987+
impl Into<Box<str>> for String {
1988+
fn into(self) -> Box<str> {
1989+
self.into_boxed_str()
1990+
}
1991+
}
1992+
19771993
#[stable(feature = "string_from_cow_str", since = "1.14.0")]
19781994
impl<'a> From<Cow<'a, str>> for String {
19791995
fn from(s: Cow<'a, str>) -> String {

src/libcollections/vec.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,6 +1897,22 @@ impl<'a, T> From<Cow<'a, [T]>> for Vec<T> where [T]: ToOwned<Owned=Vec<T>> {
18971897
}
18981898
}
18991899

1900+
// note: test pulls in libstd, which causes errors here
1901+
#[cfg(not(test))]
1902+
#[stable(feature = "vec_from_box", since = "1.17.0")]
1903+
impl<T> From<Box<[T]>> for Vec<T> {
1904+
fn from(s: Box<[T]>) -> Vec<T> {
1905+
s.into_vec()
1906+
}
1907+
}
1908+
1909+
#[stable(feature = "box_from_vec", since = "1.17.0")]
1910+
impl<T> Into<Box<[T]>> for Vec<T> {
1911+
fn into(self) -> Box<[T]> {
1912+
self.into_boxed_slice()
1913+
}
1914+
}
1915+
19001916
#[stable(feature = "rust1", since = "1.0.0")]
19011917
impl<'a> From<&'a str> for Vec<u8> {
19021918
fn from(s: &'a str) -> Vec<u8> {

src/libcollectionstest/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#![feature(test)]
2929
#![feature(unboxed_closures)]
3030
#![feature(unicode)]
31+
#![feature(utf8_error_error_len)]
3132

3233
extern crate collections;
3334
extern crate test;

0 commit comments

Comments
 (0)