Skip to content
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

Rollup of 31 pull requests #59207

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
6da206b
Add back in MSVC version check for LLVM
alexcrichton Mar 1, 2019
02b0085
appveyor: Use VS2017 for all our images
alexcrichton Nov 13, 2018
e969de8
Fix "Auto-hide item methods documentation" setting
GuillaumeGomez Mar 2, 2019
1a19c46
fs::copy() unix: set file mode early
haraldh Mar 4, 2019
2b49ec0
Move alloc::prelude::* to alloc::prelude::v1, make alloc a subset of std
SimonSapin Mar 5, 2019
1243859
core: ensure VaList passes improper_ctypes lint
dlrobertson Mar 5, 2019
5d1022a
Rename the feature gate for alloc::prelude
SimonSapin Mar 5, 2019
72958ac
std: Spin for a global malloc lock on wasm32
alexcrichton Mar 1, 2019
710988a
MIPS: add r6 support
wzssyqa Mar 5, 2019
5cf5832
fs::copy() set file mode early
haraldh Feb 28, 2019
67eabc6
SGX target: Expose thread id function in os module
Mar 5, 2019
876258b
Default to integrated `rust-lld` linker for UEFI targets
phil-opp Mar 6, 2019
3477939
[CI] Update binutils for powerpc64 and powerpc64le
cuviper Mar 7, 2019
c843fe7
Wrap a long configure line
cuviper Mar 7, 2019
ec91f26
Fix SGX implementations of read/write_vectored.
sfackler Mar 8, 2019
ab8e1d2
Always call read/write from default vectored io methods
sfackler Mar 8, 2019
94a6936
Track embedded-book in the toolstate
kennytm Mar 9, 2019
a4ea084
Avoid some common false positives in intra doc link checking
Manishearth Mar 9, 2019
3a83cb2
Fix ICE in MIR pretty printing
dlrobertson Mar 9, 2019
135b686
Update src/tools/publish_toolstate.py
jamesmunns Mar 10, 2019
d6f5100
Fix tidy
kennytm Mar 10, 2019
4888b1f
we can now skip should_panic tests with the libtest harness
RalfJung Mar 10, 2019
52d9fa8
enabled too many tests
RalfJung Mar 10, 2019
8629fd3
Improvements to comments in libstd, libcore, liballoc.
alexreg Feb 9, 2019
e25df32
consistent naming for duration_float methods and additional f32 methods
newpavlov Mar 11, 2019
35c19c5
move MAX_NANOS_F64/32 to methods
newpavlov Mar 11, 2019
d4b2071
Resolved nits raised in review.
alexreg Mar 11, 2019
02f26e3
Add peer_addr function to UdpSocket
LinusU Mar 11, 2019
980871a
fix tests
newpavlov Mar 11, 2019
197efb0
fix test
newpavlov Mar 11, 2019
78b248d
fix typo
newpavlov Mar 12, 2019
df2dce3
Mark UdpSocket peer_addr unstable w/ tracking issue
LinusU Mar 12, 2019
54bf8e0
Document UdpSocket peer_addr NotConnected error
LinusU Mar 12, 2019
5074489
Unregress using scalar unions in constants.
oli-obk Mar 12, 2019
79695ea
Add test for UdpSocket peer_addr
LinusU Mar 12, 2019
ca32fe4
Fix test names regarding ip version
LinusU Mar 12, 2019
df05fbf
rustc: fix ICE when trait alias has bare Self
seanmonstar Mar 11, 2019
795d307
Suggest return lifetime when there's only one named lifetime
estebank Mar 12, 2019
f923476
review comments
estebank Mar 12, 2019
adbd0a6
Make std time tests more robust for platform differences
Mar 12, 2019
0ea9b58
Suggest adding lifetime to struct field
estebank Mar 13, 2019
266ca31
Stabilize Range*::contains.
smmalis37 Mar 13, 2019
9d938f6
Add test for #55809.
davidtwco Mar 13, 2019
311025e
Fix generic argument lookup for Self
Mar 7, 2019
c37dab7
Revert "Don't generate minification variable if minification disabled"
Manishearth Mar 13, 2019
5abd6d9
add suggestions to invalid macro item error
euclio Mar 11, 2019
88d43a0
Don't run test launching `echo` since that doesn't exist on Windows
Zoxc Mar 14, 2019
41cdf07
Run RustdocUi earlier
Zoxc Mar 14, 2019
ab19e58
Use try blocks in rustc_codegen_ssa
taiki-e Mar 14, 2019
d1fcd86
Update sources.rs
lukaslueg Mar 14, 2019
fa8fd3d
Add support for comma-separated option lists
tmandry Mar 14, 2019
7c59ce9
Add `-Z allow_features=...` flag
tmandry Mar 13, 2019
ad8e2b1
Rollup merge of #58803 - haraldh:fs_copy_fix, r=alexcrichton
kennytm Mar 15, 2019
2bb8c9b
Rollup merge of #58854 - alexcrichton:update-windows, r=Mark-Simulacrum
kennytm Mar 15, 2019
d0a4fac
Rollup merge of #58855 - alexcrichton:wasm-multithreaded-alloc, r=fit…
kennytm Mar 15, 2019
b3c597f
Rollup merge of #58873 - GuillaumeGomez:fix-auto-hide-method-doc, r=Q…
kennytm Mar 15, 2019
237d769
Rollup merge of #58933 - SimonSapin:alloc-prelude-v1, r=Amanieu
kennytm Mar 15, 2019
3d305f9
Rollup merge of #58938 - dlrobertson:fix_58280, r=joshtriplett
kennytm Mar 15, 2019
b072116
Rollup merge of #58941 - wzssyqa:master, r=alexcrichton
kennytm Mar 15, 2019
e0f7f9a
Rollup merge of #58949 - jethrogb:jb/sgx-thread-id, r=joshtriplett
kennytm Mar 15, 2019
4b4707e
Rollup merge of #58976 - phil-opp:patch-2, r=alexcrichton
kennytm Mar 15, 2019
6a0e3cd
Rollup merge of #58986 - cuviper:ppc64-binutils, r=alexcrichton
kennytm Mar 15, 2019
d3893c7
Rollup merge of #59009 - sfackler:fix-sgx-vectors, r=alexcrichton
kennytm Mar 15, 2019
05ad8ba
Rollup merge of #59025 - aoikonomopoulos:issue-57924, r=varkor
kennytm Mar 15, 2019
b0cc65b
Rollup merge of #59036 - dlrobertson:fix_59021, r=estebank
kennytm Mar 15, 2019
5b78001
Rollup merge of #59037 - Manishearth:intra-doc-false, r=QuietMisdreavus
kennytm Mar 15, 2019
cdc2f47
Rollup merge of #59038 - kennytm:track-embedded-book, r=oli-obk
kennytm Mar 15, 2019
3463053
Rollup merge of #59072 - RalfJung:miri-alloc-tests, r=kennytm
kennytm Mar 15, 2019
8a55a86
Rollup merge of #59079 - euclio:macro-semi, r=estebank
kennytm Mar 15, 2019
7267bce
Rollup merge of #59082 - alexreg:cosmetic-2-doc-comments, r=Centril
kennytm Mar 15, 2019
348ee6d
Rollup merge of #59102 - newpavlov:duration_float, r=alexcrichton
kennytm Mar 15, 2019
3672ef7
Rollup merge of #59106 - LinusU:udp-peer-addr, r=kennytm
kennytm Mar 15, 2019
3086e1d
Rollup merge of #59118 - seanmonstar:alias-where-self-ice, r=alexreg
kennytm Mar 15, 2019
7f70db6
Rollup merge of #59139 - oli-obk:unions_are_a_good_thing, r=RalfJung
kennytm Mar 15, 2019
d93e460
Rollup merge of #59146 - estebank:suggest-return-lt, r=varkor
kennytm Mar 15, 2019
ea3c111
Rollup merge of #59147 - jethrogb:jb/time-tests, r=sfackler
kennytm Mar 15, 2019
2a20230
Rollup merge of #59152 - smmalis37:range_contains, r=SimonSapin
kennytm Mar 15, 2019
5c680ee
Rollup merge of #59156 - davidtwco:issue-55809, r=nikomatsakis
kennytm Mar 15, 2019
14ba4d5
Rollup merge of #59158 - Manishearth:fix-minification, r=GuillaumeGomez
kennytm Mar 15, 2019
076be4d
Rollup merge of #59169 - tmandry:allow-features-flag, r=cramertj
kennytm Mar 15, 2019
6d865eb
Rollup merge of #59175 - Zoxc:fix-process-test, r=alexcrichton
kennytm Mar 15, 2019
a2f345e
Rollup merge of #59180 - taiki-e:try_blocks, r=scottmcm
kennytm Mar 15, 2019
f8257ab
Rollup merge of #59185 - lukaslueg:patch-2, r=cramertj
kennytm Mar 15, 2019
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
26 changes: 13 additions & 13 deletions src/librustc_mir/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ pub(crate) fn eval_promoted<'a, 'mir, 'tcx>(
fn mplace_to_const<'tcx>(
ecx: &CompileTimeEvalContext<'_, '_, 'tcx>,
mplace: MPlaceTy<'tcx>,
) -> EvalResult<'tcx, ty::Const<'tcx>> {
) -> ty::Const<'tcx> {
let MemPlace { ptr, align, meta } = *mplace;
// extract alloc-offset pair
assert!(meta.is_none());
let ptr = ptr.to_ptr()?;
let alloc = ecx.memory.get(ptr.alloc_id)?;
let ptr = ptr.to_ptr().unwrap();
let alloc = ecx.memory.get(ptr.alloc_id).unwrap();
assert!(alloc.align >= align);
assert!(alloc.bytes.len() as u64 - ptr.offset.bytes() >= mplace.layout.size.bytes());
let mut alloc = alloc.clone();
Expand All @@ -79,16 +79,16 @@ fn mplace_to_const<'tcx>(
// interned this? I thought that is the entire point of that `FinishStatic` stuff?
let alloc = ecx.tcx.intern_const_alloc(alloc);
let val = ConstValue::ByRef(ptr, alloc);
Ok(ty::Const { val, ty: mplace.layout.ty })
ty::Const { val, ty: mplace.layout.ty }
}

fn op_to_const<'tcx>(
ecx: &CompileTimeEvalContext<'_, '_, 'tcx>,
op: OpTy<'tcx>,
) -> EvalResult<'tcx, ty::Const<'tcx>> {
// We do not normalize just any data. Only scalar layout and slices.
) -> ty::Const<'tcx> {
// We do not normalize just any data. Only non-union scalars and slices.
let normalize = match op.layout.abi {
layout::Abi::Scalar(..) => true,
layout::Abi::Scalar(..) => op.layout.ty.ty_adt_def().map_or(true, |adt| !adt.is_union()),
layout::Abi::ScalarPair(..) => op.layout.ty.is_slice(),
_ => false,
};
Expand All @@ -100,11 +100,11 @@ fn op_to_const<'tcx>(
let val = match normalized_op {
Ok(mplace) => return mplace_to_const(ecx, mplace),
Err(Immediate::Scalar(x)) =>
ConstValue::Scalar(x.not_undef()?),
ConstValue::Scalar(x.not_undef().unwrap()),
Err(Immediate::ScalarPair(a, b)) =>
ConstValue::Slice(a.not_undef()?, b.to_usize(ecx)?),
ConstValue::Slice(a.not_undef().unwrap(), b.to_usize(ecx).unwrap()),
};
Ok(ty::Const { val, ty: op.layout.ty })
ty::Const { val, ty: op.layout.ty }
}

fn eval_body_and_ecx<'a, 'mir, 'tcx>(
Expand Down Expand Up @@ -488,7 +488,7 @@ pub fn const_field<'a, 'tcx>(
let field = ecx.operand_field(down, field.index() as u64).unwrap();
// and finally move back to the const world, always normalizing because
// this is not called for statics.
op_to_const(&ecx, field).unwrap()
op_to_const(&ecx, field)
}

// this function uses `unwrap` copiously, because an already validated constant must have valid
Expand Down Expand Up @@ -534,9 +534,9 @@ fn validate_and_turn_into_const<'a, 'tcx>(
// Now that we validated, turn this into a proper constant.
let def_id = cid.instance.def.def_id();
if tcx.is_static(def_id).is_some() || cid.promoted.is_some() {
mplace_to_const(&ecx, mplace)
Ok(mplace_to_const(&ecx, mplace))
} else {
op_to_const(&ecx, mplace.into())
Ok(op_to_const(&ecx, mplace.into()))
}
})();

Expand Down
11 changes: 11 additions & 0 deletions src/test/ui/consts/union_constant.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// compile-pass

union Uninit {
_never_use: *const u8,
uninit: (),
}

const UNINIT: Uninit = Uninit { uninit: () };

fn main() {}