Skip to content

Rollup of 7 pull requests #50119

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

Merged
merged 14 commits into from
Apr 20, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/transform/qualify_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -964,15 +964,15 @@ 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 \
compiler via `const fn`"))
} else {
(format!("calls in {}s are limited \
to constant functions, \
struct and enum constructors",
tuple structs and tuple variants",
self.mode),
None)
};
Expand Down
1 change: 1 addition & 0 deletions src/librustc_trans/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/stdsimd
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-43105.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
9 changes: 6 additions & 3 deletions src/test/compile-fail/issue32829.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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 = {
Expand All @@ -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
}
};
Expand All @@ -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
}
};
Expand All @@ -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
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/const-fn-error.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
21 changes: 21 additions & 0 deletions src/test/ui/mir_check_nonconst.rs
Original file line number Diff line number Diff line change
@@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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() {}
9 changes: 9 additions & 0 deletions src/test/ui/mir_check_nonconst.stderr
Original file line number Diff line number Diff line change
@@ -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`.
6 changes: 4 additions & 2 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down