Skip to content

Commit c2a2cb9

Browse files
committed
Auto merge of #62424 - Centril:rollup-hry6eak, r=Centril
Rollup of 8 pull requests Successful merges: - #60260 (Add support for UWP targets) - #62151 (Update linked OpenSSL version) - #62245 (Miri engine: support extra function (pointer) values) - #62257 (forward read_c_str method from Memory to Alloc) - #62264 (Fix perf regression from Miri Machine trait changes) - #62296 (request at least ptr-size alignment from posix_memalign) - #62329 (Remove support for 1-token lookahead from the lexer) - #62377 (Add test for ICE #62375) Failed merges: r? @ghost
2 parents 481068a + a5ab8b2 commit c2a2cb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1039
-501
lines changed

Cargo.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1835,7 +1835,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
18351835

18361836
[[package]]
18371837
name = "openssl-src"
1838-
version = "111.1.0+1.1.1a"
1838+
version = "111.3.0+1.1.1c"
18391839
source = "registry+https://github.com/rust-lang/crates.io-index"
18401840
dependencies = [
18411841
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1848,7 +1848,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
18481848
dependencies = [
18491849
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
18501850
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
1851-
"openssl-src 111.1.0+1.1.1a (registry+https://github.com/rust-lang/crates.io-index)",
1851+
"openssl-src 111.3.0+1.1.1c (registry+https://github.com/rust-lang/crates.io-index)",
18521852
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
18531853
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
18541854
"vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -4384,7 +4384,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
43844384
"checksum opener 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "998c59e83d9474c01127a96e023b7a04bb061dd286bf8bb939d31dc8d31a7448"
43854385
"checksum openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ec7bd7ca4cce6dbdc77e7c1230682740d307d1218a87fb0349a571272be749f9"
43864386
"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
4387-
"checksum openssl-src 111.1.0+1.1.1a (registry+https://github.com/rust-lang/crates.io-index)" = "26bb632127731bf4ac49bf86a5dde12d2ca0918c2234fc39d79d4da2ccbc6da7"
4387+
"checksum openssl-src 111.3.0+1.1.1c (registry+https://github.com/rust-lang/crates.io-index)" = "53ed5f31d294bdf5f7a4ba0a206c2754b0f60e9a63b7e3076babc5317873c797"
43884388
"checksum openssl-sys 0.9.43 (registry+https://github.com/rust-lang/crates.io-index)" = "33c86834957dd5b915623e94f2f4ab2c70dd8f6b70679824155d5ae21dbd495d"
43894389
"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"
43904390
"checksum ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd20eec3dbe4376829cb7d80ae6ac45e0a766831dca50202ff2d40db46a8a024"

src/bootstrap/compile.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ impl Step for StartupObjects {
326326
fn run(self, builder: &Builder<'_>) {
327327
let for_compiler = self.compiler;
328328
let target = self.target;
329-
if !target.contains("pc-windows-gnu") {
329+
if !target.contains("windows-gnu") {
330330
return
331331
}
332332

@@ -1130,6 +1130,7 @@ pub fn run_cargo(builder: &Builder<'_>,
11301130
// Skip files like executables
11311131
if !filename.ends_with(".rlib") &&
11321132
!filename.ends_with(".lib") &&
1133+
!filename.ends_with(".a") &&
11331134
!is_dylib(&filename) &&
11341135
!(is_check && filename.ends_with(".rmeta")) {
11351136
continue;

src/liballoc/tests/heap.rs

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::alloc::{Global, Alloc, Layout, System};
22

3-
/// Issue #45955.
3+
/// Issue #45955 and #62251.
44
#[test]
55
fn alloc_system_overaligned_request() {
66
check_overalign_requests(System)
@@ -12,21 +12,23 @@ fn std_heap_overaligned_request() {
1212
}
1313

1414
fn check_overalign_requests<T: Alloc>(mut allocator: T) {
15-
let size = 8;
16-
let align = 16; // greater than size
17-
let iterations = 100;
18-
unsafe {
19-
let pointers: Vec<_> = (0..iterations).map(|_| {
20-
allocator.alloc(Layout::from_size_align(size, align).unwrap()).unwrap()
21-
}).collect();
22-
for &ptr in &pointers {
23-
assert_eq!((ptr.as_ptr() as usize) % align, 0,
24-
"Got a pointer less aligned than requested")
25-
}
15+
for &align in &[4, 8, 16, 32] { // less than and bigger than `MIN_ALIGN`
16+
for &size in &[align/2, align-1] { // size less than alignment
17+
let iterations = 128;
18+
unsafe {
19+
let pointers: Vec<_> = (0..iterations).map(|_| {
20+
allocator.alloc(Layout::from_size_align(size, align).unwrap()).unwrap()
21+
}).collect();
22+
for &ptr in &pointers {
23+
assert_eq!((ptr.as_ptr() as usize) % align, 0,
24+
"Got a pointer less aligned than requested")
25+
}
2626

27-
// Clean up
28-
for &ptr in &pointers {
29-
allocator.dealloc(ptr, Layout::from_size_align(size, align).unwrap())
27+
// Clean up
28+
for &ptr in &pointers {
29+
allocator.dealloc(ptr, Layout::from_size_align(size, align).unwrap())
30+
}
31+
}
3032
}
3133
}
3234
}

src/librustc_codegen_ssa/back/linker.rs

+20
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,26 @@ impl<'a> Linker for GccLinker<'a> {
368368
}
369369
} else {
370370
self.cmd.arg("-shared");
371+
if self.sess.target.target.options.is_like_windows {
372+
// The output filename already contains `dll_suffix` so
373+
// the resulting import library will have a name in the
374+
// form of libfoo.dll.a
375+
let implib_name = out_filename
376+
.file_name()
377+
.and_then(|file| file.to_str())
378+
.map(|file| format!("{}{}{}",
379+
self.sess.target.target.options.staticlib_prefix,
380+
file,
381+
self.sess.target.target.options.staticlib_suffix));
382+
if let Some(implib_name) = implib_name {
383+
let implib = out_filename
384+
.parent()
385+
.map(|dir| dir.join(&implib_name));
386+
if let Some(implib) = implib {
387+
self.linker_arg(&format!("--out-implib,{}", (*implib).to_str().unwrap()));
388+
}
389+
}
390+
}
371391
}
372392
}
373393

src/librustc_mir/const_eval.rs

+16-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc::hir::def::DefKind;
1111
use rustc::hir::def_id::DefId;
1212
use rustc::mir::interpret::{ConstEvalErr, ErrorHandled, ScalarMaybeUndef};
1313
use rustc::mir;
14-
use rustc::ty::{self, TyCtxt, query::TyCtxtAt};
14+
use rustc::ty::{self, TyCtxt};
1515
use rustc::ty::layout::{self, LayoutOf, VariantIdx};
1616
use rustc::ty::subst::Subst;
1717
use rustc::traits::Reveal;
@@ -23,7 +23,7 @@ use crate::interpret::{self,
2323
PlaceTy, MPlaceTy, OpTy, ImmTy, Immediate, Scalar,
2424
RawConst, ConstValue,
2525
InterpResult, InterpErrorInfo, InterpError, GlobalId, InterpCx, StackPopCleanup,
26-
Allocation, AllocId, MemoryKind, Memory,
26+
Allocation, AllocId, MemoryKind,
2727
snapshot, RefTracking, intern_const_alloc_recursive,
2828
};
2929

@@ -316,6 +316,7 @@ impl interpret::MayLeak for ! {
316316
impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir, 'tcx> {
317317
type MemoryKinds = !;
318318
type PointerTag = ();
319+
type ExtraFnVal = !;
319320

320321
type FrameExtra = ();
321322
type MemoryExtra = ();
@@ -370,6 +371,16 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
370371
}))
371372
}
372373

374+
fn call_extra_fn(
375+
_ecx: &mut InterpCx<'mir, 'tcx, Self>,
376+
fn_val: !,
377+
_args: &[OpTy<'tcx>],
378+
_dest: Option<PlaceTy<'tcx>>,
379+
_ret: Option<mir::BasicBlock>,
380+
) -> InterpResult<'tcx> {
381+
match fn_val {}
382+
}
383+
373384
fn call_intrinsic(
374385
ecx: &mut InterpCx<'mir, 'tcx, Self>,
375386
instance: ty::Instance<'tcx>,
@@ -398,27 +409,27 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
398409
}
399410

400411
fn find_foreign_static(
412+
_tcx: TyCtxt<'tcx>,
401413
_def_id: DefId,
402-
_tcx: TyCtxtAt<'tcx>,
403414
) -> InterpResult<'tcx, Cow<'tcx, Allocation<Self::PointerTag>>> {
404415
err!(ReadForeignStatic)
405416
}
406417

407418
#[inline(always)]
408419
fn tag_allocation<'b>(
420+
_memory_extra: &(),
409421
_id: AllocId,
410422
alloc: Cow<'b, Allocation>,
411423
_kind: Option<MemoryKind<!>>,
412-
_memory: &Memory<'mir, 'tcx, Self>,
413424
) -> (Cow<'b, Allocation<Self::PointerTag>>, Self::PointerTag) {
414425
// We do not use a tag so we can just cheaply forward the allocation
415426
(alloc, ())
416427
}
417428

418429
#[inline(always)]
419430
fn tag_static_base_pointer(
431+
_memory_extra: &(),
420432
_id: AllocId,
421-
_memory: &Memory<'mir, 'tcx, Self>,
422433
) -> Self::PointerTag {
423434
()
424435
}

src/librustc_mir/interpret/cast.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc::mir::interpret::{
1111
};
1212
use rustc::mir::CastKind;
1313

14-
use super::{InterpCx, Machine, PlaceTy, OpTy, Immediate};
14+
use super::{InterpCx, Machine, PlaceTy, OpTy, Immediate, FnVal};
1515

1616
impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
1717
fn type_is_fat_ptr(&self, ty: Ty<'tcx>) -> bool {
@@ -86,7 +86,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
8686
def_id,
8787
substs,
8888
).ok_or_else(|| InterpError::TooGeneric.into());
89-
let fn_ptr = self.memory.create_fn_alloc(instance?);
89+
let fn_ptr = self.memory.create_fn_alloc(FnVal::Instance(instance?));
9090
self.write_scalar(Scalar::Ptr(fn_ptr.into()), dest)?;
9191
}
9292
_ => bug!("reify fn pointer on {:?}", src.layout.ty),
@@ -115,7 +115,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
115115
substs,
116116
ty::ClosureKind::FnOnce,
117117
);
118-
let fn_ptr = self.memory.create_fn_alloc(instance);
118+
let fn_ptr = self.memory.create_fn_alloc(FnVal::Instance(instance));
119119
let val = Immediate::Scalar(Scalar::Ptr(fn_ptr.into()).into());
120120
self.write_immediate(val, dest)?;
121121
}

src/librustc_mir/interpret/eval_context.rs

+38-36
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,23 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
222222
&mut self.memory
223223
}
224224

225+
#[inline(always)]
226+
pub fn force_ptr(
227+
&self,
228+
scalar: Scalar<M::PointerTag>,
229+
) -> InterpResult<'tcx, Pointer<M::PointerTag>> {
230+
self.memory.force_ptr(scalar)
231+
}
232+
233+
#[inline(always)]
234+
pub fn force_bits(
235+
&self,
236+
scalar: Scalar<M::PointerTag>,
237+
size: Size
238+
) -> InterpResult<'tcx, u128> {
239+
self.memory.force_bits(scalar, size)
240+
}
241+
225242
#[inline(always)]
226243
pub fn tag_static_base_pointer(&self, ptr: Pointer) -> Pointer<M::PointerTag> {
227244
self.memory.tag_static_base_pointer(ptr)
@@ -253,6 +270,27 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
253270
self.frame().body
254271
}
255272

273+
#[inline(always)]
274+
pub fn sign_extend(&self, value: u128, ty: TyLayout<'_>) -> u128 {
275+
assert!(ty.abi.is_signed());
276+
sign_extend(value, ty.size)
277+
}
278+
279+
#[inline(always)]
280+
pub fn truncate(&self, value: u128, ty: TyLayout<'_>) -> u128 {
281+
truncate(value, ty.size)
282+
}
283+
284+
#[inline]
285+
pub fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
286+
ty.is_sized(self.tcx, self.param_env)
287+
}
288+
289+
#[inline]
290+
pub fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
291+
ty.is_freeze(*self.tcx, self.param_env, DUMMY_SP)
292+
}
293+
256294
pub(super) fn subst_and_normalize_erasing_regions<T: TypeFoldable<'tcx>>(
257295
&self,
258296
substs: T,
@@ -288,14 +326,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
288326
).ok_or_else(|| InterpError::TooGeneric.into())
289327
}
290328

291-
pub fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
292-
ty.is_sized(self.tcx, self.param_env)
293-
}
294-
295-
pub fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
296-
ty.is_freeze(*self.tcx, self.param_env, DUMMY_SP)
297-
}
298-
299329
pub fn load_mir(
300330
&self,
301331
instance: ty::InstanceDef<'tcx>,
@@ -766,32 +796,4 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
766796
trace!("generate stacktrace: {:#?}, {:?}", frames, explicit_span);
767797
frames
768798
}
769-
770-
#[inline(always)]
771-
pub fn sign_extend(&self, value: u128, ty: TyLayout<'_>) -> u128 {
772-
assert!(ty.abi.is_signed());
773-
sign_extend(value, ty.size)
774-
}
775-
776-
#[inline(always)]
777-
pub fn truncate(&self, value: u128, ty: TyLayout<'_>) -> u128 {
778-
truncate(value, ty.size)
779-
}
780-
781-
#[inline(always)]
782-
pub fn force_ptr(
783-
&self,
784-
scalar: Scalar<M::PointerTag>,
785-
) -> InterpResult<'tcx, Pointer<M::PointerTag>> {
786-
self.memory.force_ptr(scalar)
787-
}
788-
789-
#[inline(always)]
790-
pub fn force_bits(
791-
&self,
792-
scalar: Scalar<M::PointerTag>,
793-
size: Size
794-
) -> InterpResult<'tcx, u128> {
795-
self.memory.force_bits(scalar, size)
796-
}
797799
}

0 commit comments

Comments
 (0)