From b39b3a2f49cb1147dcbdf4d554b4cc8c677c3d43 Mon Sep 17 00:00:00 2001 From: krk Date: Tue, 17 Apr 2018 18:59:27 +0300 Subject: [PATCH 1/7] Clarified E0015 message, r=estebank --- src/librustc_mir/transform/qualify_consts.rs | 4 ++-- src/test/compile-fail/issue-43105.rs | 2 +- src/test/compile-fail/issue32829.rs | 9 ++++++--- src/test/ui/const-fn-error.stderr | 2 +- src/test/ui/mir_check_nonconst.rs | 21 ++++++++++++++++++++ src/test/ui/mir_check_nonconst.stderr | 9 +++++++++ 6 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 src/test/ui/mir_check_nonconst.rs create mode 100644 src/test/ui/mir_check_nonconst.stderr diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index aeefd5ab1d5ac..591732fbba911 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -964,7 +964,7 @@ This does not pose a problem by itself because they can't be accessed directly." let (msg, note) = if let UnstableFeatures::Disallow = self.tcx.sess.opts.unstable_features { (format!("calls in {}s are limited to \ - struct and enum constructors", + tuple structs and tuple variants", self.mode), Some("a limited form of compile-time function \ evaluation is available on a nightly \ @@ -972,7 +972,7 @@ This does not pose a problem by itself because they can't be accessed directly." } else { (format!("calls in {}s are limited \ to constant functions, \ - struct and enum constructors", + tuple structs and tuple variants", self.mode), None) }; diff --git a/src/test/compile-fail/issue-43105.rs b/src/test/compile-fail/issue-43105.rs index c0af3b4b9e695..6fa65a541b39b 100644 --- a/src/test/compile-fail/issue-43105.rs +++ b/src/test/compile-fail/issue-43105.rs @@ -11,7 +11,7 @@ fn xyz() -> u8 { 42 } const NUM: u8 = xyz(); -//~^ ERROR calls in constants are limited to constant functions, struct and enum constructors +//~^ ERROR calls in constants are limited to constant functions, tuple structs and tuple variants //~| ERROR constant evaluation error fn main() { diff --git a/src/test/compile-fail/issue32829.rs b/src/test/compile-fail/issue32829.rs index e0b847fc99470..9a84322ad063b 100644 --- a/src/test/compile-fail/issue32829.rs +++ b/src/test/compile-fail/issue32829.rs @@ -7,6 +7,9 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. + +// ignore-tidy-linelength + #![feature(const_fn)] const bad : u32 = { @@ -20,7 +23,7 @@ const bad_two : u32 = { { invalid(); //~^ ERROR: blocks in constants are limited to items and tail expressions - //~^^ ERROR: calls in constants are limited to constant functions, struct and enum + //~^^ ERROR: calls in constants are limited to constant functions, tuple structs and tuple variants 0 } }; @@ -44,7 +47,7 @@ static bad_five : u32 = { { invalid(); //~^ ERROR: blocks in statics are limited to items and tail expressions - //~^^ ERROR: calls in statics are limited to constant functions, struct and enum + //~^^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants 0 } }; @@ -68,7 +71,7 @@ static mut bad_eight : u32 = { { invalid(); //~^ ERROR: blocks in statics are limited to items and tail expressions - //~^^ ERROR: calls in statics are limited to constant functions, struct and enum + //~^^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants 0 } }; diff --git a/src/test/ui/const-fn-error.stderr b/src/test/ui/const-fn-error.stderr index 077c4d60e649c..767f28ff7b190 100644 --- a/src/test/ui/const-fn-error.stderr +++ b/src/test/ui/const-fn-error.stderr @@ -4,7 +4,7 @@ error[E0016]: blocks in constant functions are limited to items and tail express LL | let mut sum = 0; | ^ -error[E0015]: calls in constant functions are limited to constant functions, struct and enum constructors +error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants --> $DIR/const-fn-error.rs:18:14 | LL | for i in 0..x { diff --git a/src/test/ui/mir_check_nonconst.rs b/src/test/ui/mir_check_nonconst.rs new file mode 100644 index 0000000000000..898ee8bbd44ed --- /dev/null +++ b/src/test/ui/mir_check_nonconst.rs @@ -0,0 +1,21 @@ +// Copyright 2017 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. + +#![allow(dead_code)] + +struct Foo { a: u8 } +fn bar() -> Foo { + Foo { a: 5 } +} + +static foo: Foo = bar(); +//~^ ERROR calls in statics are limited to constant functions, tuple structs and tuple variants + +fn main() {} diff --git a/src/test/ui/mir_check_nonconst.stderr b/src/test/ui/mir_check_nonconst.stderr new file mode 100644 index 0000000000000..1fddaf30576c5 --- /dev/null +++ b/src/test/ui/mir_check_nonconst.stderr @@ -0,0 +1,9 @@ +error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants + --> $DIR/mir_check_nonconst.rs:18:19 + | +LL | static foo: Foo = bar(); + | ^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0015`. From 670448d4485202fe3b84c9d342901f0a000b9b9b Mon Sep 17 00:00:00 2001 From: Kerem Date: Wed, 18 Apr 2018 20:06:05 +0300 Subject: [PATCH 2/7] Added build disk usage information Closes https://github.com/rust-lang/rust/issues/50019 --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 73d4188d69549..c5dd3cd720548 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -136,6 +136,8 @@ file. If you still have a `config.mk` file in your directory - from ### Building [building]: #building +A default configuration shall use around 3.5 GB of disk space, whereas building a debug configuration may require more than 30 GB. + Dependencies - [build dependencies](README.md#building-from-source) - `gdb` 6.2.0 minimum, 7.1 or later recommended for test builds From 2d266e1d11d08221cab3d11e1bde6571b229470a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 19 Apr 2018 23:47:28 +0200 Subject: [PATCH 3/7] Update stdsimd submodule --- src/stdsimd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdsimd b/src/stdsimd index effdcd0132d17..1ea18a5cb431e 160000 --- a/src/stdsimd +++ b/src/stdsimd @@ -1 +1 @@ -Subproject commit effdcd0132d17b6c4badc67b4b6d3fdf749a2d22 +Subproject commit 1ea18a5cb431e24aa838b652ac305acc5e394d6b From e58629b990ee8ca2dc8fde0703fc7ca2b4b2a809 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 19 Apr 2018 14:51:59 -0700 Subject: [PATCH 4/7] wasm: Increase default stack size to 1MB This commit increases the dfeault stack size allocated to the wasm32-unknown-unknown target to 1MB by default. Currently the default stack size is one wasm page, or 64 kilobytes. This default stack is quite small and has caused a stack overflow or two in the wild by accident. The current "best practice" for fixing this is to pass `-Clink-args='-z stack-size=$bigger'` but that's not great nor always easy to do. A default of 1MB matches more closely with other platforms where it's "pretty big" by default. Note that it was tested and if the users uses `-C link-args` to pass a custom stack size that's still resepected as lld seems to take the first argument, and where rustc is passing it will always be last. --- src/librustc_trans/back/linker.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustc_trans/back/linker.rs b/src/librustc_trans/back/linker.rs index ebcf06d63be26..e001e809ee5f0 100644 --- a/src/librustc_trans/back/linker.rs +++ b/src/librustc_trans/back/linker.rs @@ -960,6 +960,7 @@ impl Linker for WasmLd { fn finalize(&mut self) -> Command { self.cmd.arg("--threads"); + self.cmd.arg("-z").arg("stack-size=1048576"); // FIXME we probably shouldn't pass this but instead pass an explicit // whitelist of symbols we'll allow to be undefined. Unfortunately From b92e6c3de0fcb6ca800a36e394bc4b49826d5f63 Mon Sep 17 00:00:00 2001 From: Johannes Nixdorf Date: Mon, 16 Apr 2018 19:32:19 +0200 Subject: [PATCH 5/7] Disable auto-detection of libxml2 when compiling llvm. --- src/bootstrap/native.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 2c2cf74d9790f..d952cb5bfc4bc 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -149,6 +149,7 @@ impl Step for Llvm { .define("WITH_POLLY", "OFF") .define("LLVM_ENABLE_TERMINFO", "OFF") .define("LLVM_ENABLE_LIBEDIT", "OFF") + .define("LLVM_ENABLE_LIBXML2", "OFF") .define("LLVM_PARALLEL_COMPILE_JOBS", builder.jobs().to_string()) .define("LLVM_TARGET_ARCH", target.split('-').next().unwrap()) .define("LLVM_DEFAULT_TARGET_TRIPLE", target); From ee9a4720eeaf82bb0fa9d1a02325131df51385c7 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Fri, 20 Apr 2018 09:12:59 -0400 Subject: [PATCH 6/7] Fix bad merge in #49991 When I rebased #49991 on `master`, I messed up the merge for this line. I'm reverting this back to the way it was in f15e5c1. --- src/librustc_metadata/encoder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 212de375a3f91..b65e9a715faca 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -930,7 +930,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { } else if let hir::ImplItemKind::Method(ref sig, _) = ast_item.node { let generics = self.tcx.generics_of(def_id); let types = generics.parent_types as usize + generics.types.len(); - let needs_inline = types > 0 || tcx.trans_fn_attrs(def_id).requests_inline() && + let needs_inline = (types > 0 || tcx.trans_fn_attrs(def_id).requests_inline()) && !self.metadata_output_only(); let is_const_fn = sig.constness == hir::Constness::Const; let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir; From 042e1e027974eadc164b875b4a0ab197dd9988cb Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 20 Apr 2018 16:11:05 +0200 Subject: [PATCH 7/7] Fix #50113: must explicitly request file name when using with_file_name. --- src/tools/compiletest/src/runtest.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index c16dbd0272a76..0f4d247633a61 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2880,8 +2880,10 @@ impl<'test> TestCx<'test> { } } - let expected_output_path = self.expected_output_path(kind); - let output_file = self.output_base_name().with_file_name(&expected_output_path); + let expected_output = self.expected_output_path(kind); + // #50113: output is abspath; only want filename component. + let expected_output = expected_output.file_name().expect("output path requires file name"); + let output_file = self.output_base_name().with_file_name(&expected_output); match File::create(&output_file).and_then(|mut f| f.write_all(actual.as_bytes())) { Ok(()) => {} Err(e) => self.fatal(&format!(