Skip to content

Commit 8940af3

Browse files
committed
Auto merge of #56352 - alexcrichton:beta-next, r=alexcrichton
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
2 parents 42053f9 + 9023e94 commit 8940af3

File tree

11 files changed

+105
-21
lines changed

11 files changed

+105
-21
lines changed

src/Cargo.lock

+13-10
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ version = "0.1.0"
180180

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

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

1416+
[[package]]
1417+
name = "packed_simd"
1418+
version = "0.3.1"
1419+
source = "registry+https://github.com/rust-lang/crates.io-index"
1420+
dependencies = [
1421+
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
1422+
]
1423+
14161424
[[package]]
14171425
name = "panic_abort"
14181426
version = "0.0.0"
@@ -2520,7 +2528,7 @@ version = "1.0.0"
25202528
dependencies = [
25212529
"assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
25222530
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
2523-
"bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
2531+
"bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
25242532
"cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
25252533
"derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
25262534
"diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2650,11 +2658,6 @@ name = "shlex"
26502658
version = "0.1.1"
26512659
source = "registry+https://github.com/rust-lang/crates.io-index"
26522660

2653-
[[package]]
2654-
name = "simd"
2655-
version = "0.2.3"
2656-
source = "registry+https://github.com/rust-lang/crates.io-index"
2657-
26582661
[[package]]
26592662
name = "siphasher"
26602663
version = "0.2.2"
@@ -3207,7 +3210,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
32073210
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
32083211
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
32093212
"checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32"
3210-
"checksum bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f861d9ce359f56dbcb6e0c2a1cb84e52ad732cadb57b806adeb3c7668caccbd8"
3213+
"checksum bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b92204551573580e078dc80017f36a213eb77a0450e4ddd8cfa0f3f2d1f0178f"
32113214
"checksum byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "74c0b906e9446b0a2e4f760cdb3fa4b2c48cdc6db8766a845c54b6ff063fd2e9"
32123215
"checksum bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010"
32133216
"checksum cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d8dfe3adeb30f7938e6c1dd5327f29235d8ada3e898aeb08c343005ec2915a2"
@@ -3323,6 +3326,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
33233326
"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"
33243327
"checksum ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd20eec3dbe4376829cb7d80ae6ac45e0a766831dca50202ff2d40db46a8a024"
33253328
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
3329+
"checksum packed_simd 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25d36de864f7218ec5633572a800109bbe5a1cc8d9d95a967f3daf93ea7e6ddc"
33263330
"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5"
33273331
"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa"
33283332
"checksum parking_lot_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06a2b6aae052309c2fd2161ef58f5067bc17bb758377a0de9d4b279d603fdd8a"
@@ -3396,7 +3400,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
33963400
"checksum serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "bb47a3d5c84320222f66d7db21157c4a7407755de41798f9b4c1c40593397b1a"
33973401
"checksum shell-escape 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "170a13e64f2a51b77a45702ba77287f5c6829375b04a69cf2222acd17d0cfab9"
33983402
"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
3399-
"checksum simd 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0048b17eb9577ac545c61d85c3559b41dfb4cbea41c9bd9ca6a4f73ff05fda84"
34003403
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
34013404
"checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d"
34023405
"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7"

src/librustc_codegen_llvm/mir/operand.rs

+15-5
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,21 @@ impl OperandValue<'ll> {
294294
bx.store_with_flags(val, dest.llval, dest.align, flags);
295295
}
296296
OperandValue::Pair(a, b) => {
297-
for (i, &x) in [a, b].iter().enumerate() {
298-
let llptr = bx.struct_gep(dest.llval, i as u64);
299-
let val = base::from_immediate(bx, x);
300-
bx.store_with_flags(val, llptr, dest.align, flags);
301-
}
297+
let (a_scalar, b_scalar) = match dest.layout.abi {
298+
layout::Abi::ScalarPair(ref a, ref b) => (a, b),
299+
_ => bug!("store_with_flags: invalid ScalarPair layout: {:#?}", dest.layout)
300+
};
301+
let b_offset = a_scalar.value.size(bx.cx).abi_align(b_scalar.value.align(bx.cx));
302+
303+
let llptr = bx.struct_gep(dest.llval, 0);
304+
let val = base::from_immediate(bx, a);
305+
let align = dest.align;
306+
bx.store_with_flags(val, llptr, align, flags);
307+
308+
let llptr = bx.struct_gep(dest.llval, 1);
309+
let val = base::from_immediate(bx, b);
310+
let align = dest.align.restrict_for_offset(b_offset);
311+
bx.store_with_flags(val, llptr, align, flags);
302312
}
303313
}
304314
}

src/librustc_codegen_llvm/mir/place.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,21 @@ impl PlaceRef<'ll, 'tcx> {
150150
});
151151
OperandValue::Immediate(base::to_immediate(bx, llval, self.layout))
152152
} else if let layout::Abi::ScalarPair(ref a, ref b) = self.layout.abi {
153-
let load = |i, scalar: &layout::Scalar| {
153+
let b_offset = a.value.size(bx.cx).abi_align(b.value.align(bx.cx));
154+
let load = |i, scalar: &layout::Scalar, align| {
154155
let llptr = bx.struct_gep(self.llval, i as u64);
155-
let load = bx.load(llptr, self.align);
156+
let load = bx.load(llptr, align);
156157
scalar_load_metadata(load, scalar);
157158
if scalar.is_bool() {
158159
bx.trunc(load, Type::i1(bx.cx))
159160
} else {
160161
load
161162
}
162163
};
163-
OperandValue::Pair(load(0, a), load(1, b))
164+
OperandValue::Pair(
165+
load(0, a, self.align),
166+
load(1, b, self.align.restrict_for_offset(b_offset)),
167+
)
164168
} else {
165169
OperandValue::Ref(self.llval, None, self.align)
166170
};

src/librustc_resolve/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3952,7 +3952,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
39523952

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

src/librustc_resolve/resolve_imports.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
173173
}
174174
ModuleOrUniformRoot::ExternPrelude => {
175175
assert!(!restricted_shadowing);
176-
return if let Some(binding) = self.extern_prelude_get(ident, !record_used) {
176+
return if ns != TypeNS {
177+
Err((Determined, Weak::No))
178+
} else if let Some(binding) = self.extern_prelude_get(ident, !record_used) {
177179
Ok(binding)
178180
} else if !self.graph_root.unresolved_invocations.borrow().is_empty() {
179181
// Macro-expanded `extern crate` items can add names to extern prelude.

src/test/codegen/issue-56267-2.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// compile-flags: -C no-prepopulate-passes
2+
3+
#![crate_type="rlib"]
4+
5+
#[allow(dead_code)]
6+
pub struct Foo<T> {
7+
foo: u64,
8+
bar: T,
9+
}
10+
11+
// The load from bar.1 should have alignment 4. Not checking
12+
// other loads here, as the alignment will be platform-dependent.
13+
14+
// CHECK: %{{.+}} = load i32, i32* %{{.+}}, align 4
15+
#[no_mangle]
16+
pub fn test(x: Foo<(i32, i32)>) -> (i32, i32) {
17+
x.bar
18+
}

src/test/codegen/issue-56267.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// compile-flags: -C no-prepopulate-passes
2+
3+
#![crate_type="rlib"]
4+
5+
#[allow(dead_code)]
6+
pub struct Foo<T> {
7+
foo: u64,
8+
bar: T,
9+
}
10+
11+
// The store writing to bar.1 should have alignment 4. Not checking
12+
// other stores here, as the alignment will be platform-dependent.
13+
14+
// CHECK: store i32 [[TMP1:%.+]], i32* [[TMP2:%.+]], align 4
15+
#[no_mangle]
16+
pub fn test(x: (i32, i32)) -> Foo<(i32, i32)> {
17+
Foo { foo: 0, bar: x }
18+
}

src/test/ui/imports/issue-56263.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// compile-pass
2+
// edition:2018
3+
4+
use ::std;
5+
6+
fn main() {
7+
let std = 10;
8+
}

src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs

+11
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,14 @@
99
// except according to those terms.
1010

1111
pub fn foo() {}
12+
13+
#[macro_export]
14+
macro_rules! macro_2015 {
15+
() => {
16+
use edition_lint_paths as other_name;
17+
use edition_lint_paths::foo as other_foo;
18+
fn check_macro_2015() {
19+
::edition_lint_paths::foo();
20+
}
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// compile-pass
2+
// edition:2018
3+
// compile-flags:--extern edition_lint_paths
4+
// aux-build:edition-lint-paths.rs
5+
6+
#![deny(absolute_paths_not_starting_with_crate)]
7+
8+
edition_lint_paths::macro_2015!(); // OK
9+
10+
fn main() {}

src/tools/rustfmt

0 commit comments

Comments
 (0)