Skip to content

Commit 3cc1e39

Browse files
committed
Auto merge of #41427 - alexcrichton:beta-next, r=alexcrichton
[beta] Final backports to beta Backport of: * #40863 * #41085 * #41354 * #41378
2 parents e64b987 + e7eda62 commit 3cc1e39

File tree

11 files changed

+96
-22
lines changed

11 files changed

+96
-22
lines changed

src/bootstrap/lib.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ struct Crate {
181181
///
182182
/// These entries currently correspond to the various output directories of the
183183
/// build system, with each mod generating output in a different directory.
184-
#[derive(Clone, Copy)]
184+
#[derive(Clone, Copy, PartialEq)]
185185
pub enum Mode {
186186
/// This cargo is going to build the standard library, placing output in the
187187
/// "stageN-std" directory.
@@ -461,8 +461,6 @@ impl Build {
461461
.env("RUSTC", self.out.join("bootstrap/debug/rustc"))
462462
.env("RUSTC_REAL", self.compiler_path(compiler))
463463
.env("RUSTC_STAGE", stage.to_string())
464-
.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string())
465-
.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string())
466464
.env("RUSTC_CODEGEN_UNITS",
467465
self.config.rust_codegen_units.to_string())
468466
.env("RUSTC_DEBUG_ASSERTIONS",
@@ -474,6 +472,13 @@ impl Build {
474472
.env("RUSTDOC_REAL", self.rustdoc(compiler))
475473
.env("RUSTC_FLAGS", self.rustc_flags(target).join(" "));
476474

475+
// Tools don't get debuginfo right now, e.g. cargo and rls don't get
476+
// compiled with debuginfo.
477+
if mode != Mode::Tool {
478+
cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string())
479+
.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string());
480+
}
481+
477482
// Enable usage of unstable features
478483
cargo.env("RUSTC_BOOTSTRAP", "1");
479484
self.add_rust_test_threads(&mut cargo);

src/librustc_driver/driver.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1357,10 +1357,9 @@ pub fn build_output_filenames(input: &Input,
13571357
.values()
13581358
.filter(|a| a.is_none())
13591359
.count();
1360-
let ofile = if unnamed_output_types > 1 &&
1361-
sess.opts.output_types.contains_key(&OutputType::Exe) {
1362-
sess.warn("ignoring specified output filename for 'link' output because multiple \
1363-
outputs were requested");
1360+
let ofile = if unnamed_output_types > 1 {
1361+
sess.warn("due to multiple output types requested, the explicitly specified \
1362+
output file name will be adapted for each output type");
13641363
None
13651364
} else {
13661365
Some(out_file.clone())

src/librustc_trans/cabi_x86_64.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,7 @@ pub fn compute_abi_info(ccx: &CrateContext, fty: &mut FnType) {
375375
let in_mem = cls.is_pass_byval() ||
376376
int_regs < needed_int ||
377377
sse_regs < needed_sse;
378-
if in_mem {
379-
// `byval` parameter thus one less integer register available
380-
int_regs -= 1;
381-
} else {
378+
if !in_mem {
382379
// split into sized chunks passed individually
383380
int_regs -= needed_int;
384381
sse_regs -= needed_sse;

src/librustc_typeck/check/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3801,7 +3801,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
38013801
element_ty
38023802
}
38033803
None => {
3804-
self.check_expr_has_type(&idx, self.tcx.types.err);
38053804
let mut err = self.type_error_struct(
38063805
expr.span,
38073806
|actual| {

src/librustc_typeck/check/op.rs

+11-10
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
184184
// particularly for things like `String + &String`.
185185
let rhs_ty_var = self.next_ty_var(TypeVariableOrigin::MiscVariable(rhs_expr.span));
186186

187-
let return_ty = match self.lookup_op_method(expr, lhs_ty, vec![rhs_ty_var],
188-
Symbol::intern(name), trait_def_id,
189-
lhs_expr) {
187+
let return_ty = self.lookup_op_method(expr, lhs_ty, vec![rhs_ty_var],
188+
Symbol::intern(name), trait_def_id,
189+
lhs_expr);
190+
191+
// see `NB` above
192+
let rhs_ty = self.check_expr_coercable_to_type(rhs_expr, rhs_ty_var);
193+
194+
let return_ty = match return_ty {
190195
Ok(return_ty) => return_ty,
191196
Err(()) => {
192197
// error types are considered "builtin"
@@ -209,7 +214,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
209214

210215
if let TypeVariants::TyRef(_, ref ty_mut) = lhs_ty.sty {
211216
if !self.infcx.type_moves_by_default(ty_mut.ty, lhs_expr.span) &&
212-
self.lookup_op_method(expr, ty_mut.ty, vec![rhs_ty_var],
217+
self.lookup_op_method(expr, ty_mut.ty, vec![rhs_ty],
213218
Symbol::intern(name), trait_def_id,
214219
lhs_expr).is_ok() {
215220
err.note(
@@ -240,7 +245,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
240245
if let Some(missing_trait) = missing_trait {
241246
if missing_trait == "std::ops::Add" &&
242247
self.check_str_addition(expr, lhs_expr, lhs_ty,
243-
rhs_expr, rhs_ty_var, &mut err) {
248+
rhs_expr, rhs_ty, &mut err) {
244249
// This has nothing here because it means we did string
245250
// concatenation (e.g. "Hello " + "World!"). This means
246251
// we don't want the note in the else clause to be emitted
@@ -257,9 +262,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
257262
}
258263
};
259264

260-
// see `NB` above
261-
self.check_expr_coercable_to_type(rhs_expr, rhs_ty_var);
262-
263265
(rhs_ty_var, return_ty)
264266
}
265267

@@ -268,12 +270,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
268270
lhs_expr: &'gcx hir::Expr,
269271
lhs_ty: Ty<'tcx>,
270272
rhs_expr: &'gcx hir::Expr,
271-
rhs_ty_var: Ty<'tcx>,
273+
rhs_ty: Ty<'tcx>,
272274
mut err: &mut errors::DiagnosticBuilder) -> bool {
273275
// If this function returns true it means a note was printed, so we don't need
274276
// to print the normal "implementation of `std::ops::Add` might be missing" note
275277
let mut is_string_addition = false;
276-
let rhs_ty = self.check_expr_coercable_to_type(rhs_expr, rhs_ty_var);
277278
if let TyRef(_, l_ty) = lhs_ty.sty {
278279
if let TyRef(_, r_ty) = rhs_ty.sty {
279280
if l_ty.ty.sty == TyStr && r_ty.ty.sty == TyStr {

src/test/compile-fail/issue-40610.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn f(_: &[f32]) {}
12+
13+
fn main() {
14+
() + f(&[1.0]);
15+
//~^ ERROR binary operation `+` cannot be applied to type `()`
16+
}

src/test/compile-fail/issue-40861.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn f(_: &[f32]) {}
12+
13+
fn main() {
14+
()[f(&[1.0])];
15+
//~^ ERROR cannot index a value of type `()`
16+
}

src/test/run-make/extern-fn-struct-passing-abi/test.c

+15
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,21 @@ void byval_rect_with_float(int32_t a, int32_t b, float c, int32_t d,
132132
assert(s.d == 556);
133133
}
134134

135+
// System V x86_64 ABI:
136+
// a, b, d, e, f should be byval pointer (on the stack)
137+
// g passed via register (fixes #41375)
138+
//
139+
// Win64 ABI:
140+
// a, b, d, e, f, g should be byval pointer
141+
void byval_rect_with_many_huge(struct Huge a, struct Huge b, struct Huge c,
142+
struct Huge d, struct Huge e, struct Huge f,
143+
struct Rect g) {
144+
assert(g.a == 123);
145+
assert(g.b == 456);
146+
assert(g.c == 789);
147+
assert(g.d == 420);
148+
}
149+
135150
// System V x86_64 & Win64 ABI:
136151
// a, b should be in registers
137152
// s should be split across 2 integer registers

src/test/run-make/extern-fn-struct-passing-abi/test.rs

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ extern {
5757

5858
fn byval_rect_with_float(a: i32, b: i32, c: f32, d: i32, e: i32, f: i32, s: Rect);
5959

60+
fn byval_rect_with_many_huge(a: Huge, b: Huge, c: Huge, d: Huge, e: Huge, f: Huge, g: Rect);
61+
6062
fn split_rect(a: i32, b: i32, s: Rect);
6163

6264
fn split_rect_floats(a: f32, b: f32, s: FloatRect);
@@ -85,6 +87,12 @@ fn main() {
8587
byval_many_rect(1, 2, 3, 4, 5, 6, s);
8688
byval_rect_floats(1., 2., 3., 4., 5., 6., 7., s, u);
8789
byval_rect_with_float(1, 2, 3.0, 4, 5, 6, s);
90+
byval_rect_with_many_huge(v, v, v, v, v, v, Rect {
91+
a: 123,
92+
b: 456,
93+
c: 789,
94+
d: 420
95+
});
8896
split_rect(1, 2, s);
8997
split_rect_floats(1., 2., u);
9098
split_rect_with_floats(1, 2, 3.0, 4, 5.0, 6, s);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-include ../tools.mk
2+
3+
all:
4+
$(RUSTC) foo.rs --emit=asm,llvm-ir -o $(TMPDIR)/out 2>&1
5+
rm $(TMPDIR)/out.ll $(TMPDIR)/out.s
6+
$(RUSTC) foo.rs --emit=asm,llvm-ir -o $(TMPDIR)/out2.ext 2>&1
7+
rm $(TMPDIR)/out2.ll $(TMPDIR)/out2.s
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {}

0 commit comments

Comments
 (0)