Skip to content

Commit

Permalink
Auto merge of #56352 - alexcrichton:beta-next, r=alexcrichton
Browse files Browse the repository at this point in the history
Rollup beta backports

* #56264
* #56300
* #56322
* #56329

Neither #56300 nor #56329 applied cleanly, but I think I've gotten it working with @nikic's [help](#56300 (comment)) (thanks!)

Closes #56311
Closes #56263
  • Loading branch information
bors committed Nov 30, 2018
2 parents 42053f9 + 9023e94 commit 8940af3
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 21 deletions.
23 changes: 13 additions & 10 deletions src/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ version = "0.1.0"

[[package]]
name = "bytecount"
version = "0.3.2"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"simd 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"packed_simd 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
Expand Down Expand Up @@ -1413,6 +1413,14 @@ dependencies = [
"stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "packed_simd"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "panic_abort"
version = "0.0.0"
Expand Down Expand Up @@ -2520,7 +2528,7 @@ version = "1.0.0"
dependencies = [
"assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -2650,11 +2658,6 @@ name = "shlex"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "simd"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "siphasher"
version = "0.2.2"
Expand Down Expand Up @@ -3207,7 +3210,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
"checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32"
"checksum bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f861d9ce359f56dbcb6e0c2a1cb84e52ad732cadb57b806adeb3c7668caccbd8"
"checksum bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b92204551573580e078dc80017f36a213eb77a0450e4ddd8cfa0f3f2d1f0178f"
"checksum byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "74c0b906e9446b0a2e4f760cdb3fa4b2c48cdc6db8766a845c54b6ff063fd2e9"
"checksum bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010"
"checksum cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d8dfe3adeb30f7938e6c1dd5327f29235d8ada3e898aeb08c343005ec2915a2"
Expand Down Expand Up @@ -3323,6 +3326,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"
"checksum ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd20eec3dbe4376829cb7d80ae6ac45e0a766831dca50202ff2d40db46a8a024"
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
"checksum packed_simd 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25d36de864f7218ec5633572a800109bbe5a1cc8d9d95a967f3daf93ea7e6ddc"
"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5"
"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa"
"checksum parking_lot_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06a2b6aae052309c2fd2161ef58f5067bc17bb758377a0de9d4b279d603fdd8a"
Expand Down Expand Up @@ -3396,7 +3400,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "bb47a3d5c84320222f66d7db21157c4a7407755de41798f9b4c1c40593397b1a"
"checksum shell-escape 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "170a13e64f2a51b77a45702ba77287f5c6829375b04a69cf2222acd17d0cfab9"
"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
"checksum simd 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0048b17eb9577ac545c61d85c3559b41dfb4cbea41c9bd9ca6a4f73ff05fda84"
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
"checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d"
"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7"
Expand Down
20 changes: 15 additions & 5 deletions src/librustc_codegen_llvm/mir/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,21 @@ impl OperandValue<'ll> {
bx.store_with_flags(val, dest.llval, dest.align, flags);
}
OperandValue::Pair(a, b) => {
for (i, &x) in [a, b].iter().enumerate() {
let llptr = bx.struct_gep(dest.llval, i as u64);
let val = base::from_immediate(bx, x);
bx.store_with_flags(val, llptr, dest.align, flags);
}
let (a_scalar, b_scalar) = match dest.layout.abi {
layout::Abi::ScalarPair(ref a, ref b) => (a, b),
_ => bug!("store_with_flags: invalid ScalarPair layout: {:#?}", dest.layout)
};
let b_offset = a_scalar.value.size(bx.cx).abi_align(b_scalar.value.align(bx.cx));

let llptr = bx.struct_gep(dest.llval, 0);
let val = base::from_immediate(bx, a);
let align = dest.align;
bx.store_with_flags(val, llptr, align, flags);

let llptr = bx.struct_gep(dest.llval, 1);
let val = base::from_immediate(bx, b);
let align = dest.align.restrict_for_offset(b_offset);
bx.store_with_flags(val, llptr, align, flags);
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/librustc_codegen_llvm/mir/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,21 @@ impl PlaceRef<'ll, 'tcx> {
});
OperandValue::Immediate(base::to_immediate(bx, llval, self.layout))
} else if let layout::Abi::ScalarPair(ref a, ref b) = self.layout.abi {
let load = |i, scalar: &layout::Scalar| {
let b_offset = a.value.size(bx.cx).abi_align(b.value.align(bx.cx));
let load = |i, scalar: &layout::Scalar, align| {
let llptr = bx.struct_gep(self.llval, i as u64);
let load = bx.load(llptr, self.align);
let load = bx.load(llptr, align);
scalar_load_metadata(load, scalar);
if scalar.is_bool() {
bx.trunc(load, Type::i1(bx.cx))
} else {
load
}
};
OperandValue::Pair(load(0, a), load(1, b))
OperandValue::Pair(
load(0, a, self.align),
load(1, b, self.align.restrict_for_offset(b_offset)),
)
} else {
OperandValue::Ref(self.llval, None, self.align)
};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3952,7 +3952,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {

let first_name = match path.get(0) {
// In the 2018 edition this lint is a hard error, so nothing to do
Some(seg) if seg.ident.span.rust_2015() => seg.ident.name,
Some(seg) if seg.ident.span.rust_2015() && self.session.rust_2015() => seg.ident.name,
_ => return,
};

Expand Down
4 changes: 3 additions & 1 deletion src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
}
ModuleOrUniformRoot::ExternPrelude => {
assert!(!restricted_shadowing);
return if let Some(binding) = self.extern_prelude_get(ident, !record_used) {
return if ns != TypeNS {
Err((Determined, Weak::No))
} else if let Some(binding) = self.extern_prelude_get(ident, !record_used) {
Ok(binding)
} else if !self.graph_root.unresolved_invocations.borrow().is_empty() {
// Macro-expanded `extern crate` items can add names to extern prelude.
Expand Down
18 changes: 18 additions & 0 deletions src/test/codegen/issue-56267-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// compile-flags: -C no-prepopulate-passes

#![crate_type="rlib"]

#[allow(dead_code)]
pub struct Foo<T> {
foo: u64,
bar: T,
}

// The load from bar.1 should have alignment 4. Not checking
// other loads here, as the alignment will be platform-dependent.

// CHECK: %{{.+}} = load i32, i32* %{{.+}}, align 4
#[no_mangle]
pub fn test(x: Foo<(i32, i32)>) -> (i32, i32) {
x.bar
}
18 changes: 18 additions & 0 deletions src/test/codegen/issue-56267.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// compile-flags: -C no-prepopulate-passes

#![crate_type="rlib"]

#[allow(dead_code)]
pub struct Foo<T> {
foo: u64,
bar: T,
}

// The store writing to bar.1 should have alignment 4. Not checking
// other stores here, as the alignment will be platform-dependent.

// CHECK: store i32 [[TMP1:%.+]], i32* [[TMP2:%.+]], align 4
#[no_mangle]
pub fn test(x: (i32, i32)) -> Foo<(i32, i32)> {
Foo { foo: 0, bar: x }
}
8 changes: 8 additions & 0 deletions src/test/ui/imports/issue-56263.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// compile-pass
// edition:2018

use ::std;

fn main() {
let std = 10;
}
11 changes: 11 additions & 0 deletions src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@
// except according to those terms.

pub fn foo() {}

#[macro_export]
macro_rules! macro_2015 {
() => {
use edition_lint_paths as other_name;
use edition_lint_paths::foo as other_foo;
fn check_macro_2015() {
::edition_lint_paths::foo();
}
}
}
10 changes: 10 additions & 0 deletions src/test/ui/rust-2018/edition-lint-paths-2018.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// compile-pass
// edition:2018
// compile-flags:--extern edition_lint_paths
// aux-build:edition-lint-paths.rs

#![deny(absolute_paths_not_starting_with_crate)]

edition_lint_paths::macro_2015!(); // OK

fn main() {}
2 changes: 1 addition & 1 deletion src/tools/rustfmt

0 comments on commit 8940af3

Please sign in to comment.