about summary refs log tree commit diff
path: root/src/test/run-pass/union
AgeCommit message (Collapse)AuthorLines
2019-07-27tests: Move run-pass tests with naming conflicts to uiVadim Petrochenkov-111/+0
2019-07-27tests: Move run-pass tests without naming conflicts to uiVadim Petrochenkov-839/+0
2019-05-18Make clear that status quo ≠ guaranteePeter Todd-2/+3
2019-05-07Add non-non-zero test to union-nonzero testPeter Todd-0/+8
2019-05-07Document purpose of union-nonzero testPeter Todd-0/+12
2019-05-06Test interaction of unions with non-zero/niche-filling optimizationPeter Todd-0/+30
Notably this nails down part of the behavior that MaybeUninit assumes, e.g. that a Option<MaybeUninit<&u8>> does not take advantage of non-zero optimization, and thus is a safe construct.
2018-12-25Remove licensesMark Rousskov-200/+0
2018-12-21Stabilize #[repr(packed(N))]Taylor Cramer-1/+0
2018-09-29Merge branch 'master' into dropMichael Bradshaw-0/+1100
2018-09-26Add `#![allow(..)]` as necessary to get re-migrated run-pass tests compiling ↵Felix S. Klock II-0/+13
with clean stderr again. Most were added mechanically.
2018-09-26Migrate `src/test/ui/run-pass/*` back to `src/test/run-pass/`.Felix S. Klock II-0/+1089
Fix #54047
2018-09-06Migrated remaining `src/test/run-pass/` subdirectories to ↵Felix S. Klock II-1043/+0
`src/test/ui/run-pass/`.
2018-06-03Deduplicate and fix a testOliver Schneider-3/+11
2018-05-17Rename trans to codegen everywhere.Irina Popa-0/+0
2018-05-09use fmt::Result where applicableAndre Bogus-1/+1
2018-04-11Implementation of `#[repr(packed(n))]` RFC 1399.Cameron Hart-19/+93
2018-01-27Expand union test to include different typesRyan Cumming-7/+26
2018-01-27Fix ICE on const eval of union fieldRyan Cumming-0/+26
MIR's `Const::get_field()` attempts to retrieve the value for a given field in a constant. In the case of a union constant it was falling through to a generic `const_get_elt` based on the field index. As union fields don't have an index this caused an ICE in `llvm_field_index`. Fix by simply returning the current value when accessing any field in a union. This works because all union fields start at byte offset 0. The added test uses `const_fn` it ensure the field is extracted using MIR's const evaluation. The crash is reproducible without it, however. Fixes #47788
2018-01-23Stabilized `#[repr(align(x))]` attribute (RFC 1358)Cameron Hart-2/+0
2017-11-19std: Add a new wasm32-unknown-unknown targetAlex Crichton-0/+2
This commit adds a new target to the compiler: wasm32-unknown-unknown. This target is a reimagining of what it looks like to generate WebAssembly code from Rust. Instead of using Emscripten which can bring with it a weighty runtime this instead is a target which uses only the LLVM backend for WebAssembly and a "custom linker" for now which will hopefully one day be direct calls to lld. Notable features of this target include: * There is zero runtime footprint. The target assumes nothing exists other than the wasm32 instruction set. * There is zero toolchain footprint beyond adding the target. No custom linker is needed, rustc contains everything. * Very small wasm modules can be generated directly from Rust code using this target. * Most of the standard library is stubbed out to return an error, but anything related to allocation works (aka `HashMap`, `Vec`, etc). * Naturally, any `#[no_std]` crate should be 100% compatible with this new target. This target is currently somewhat janky due to how linking works. The "linking" is currently unconditional whole program LTO (aka LLVM is being used as a linker). Naturally that means compiling programs is pretty slow! Eventually though this target should have a linker. This target is also intended to be quite experimental. I'm hoping that this can act as a catalyst for further experimentation in Rust with WebAssembly. Breaking changes are very likely to land to this target, so it's not recommended to rely on it in any critical capacity yet. We'll let you know when it's "production ready". --- Currently testing-wise this target is looking pretty good but isn't complete. I've got almost the entire `run-pass` test suite working with this target (lots of tests ignored, but many passing as well). The `core` test suite is still getting LLVM bugs fixed to get that working and will take some time. Relatively simple programs all seem to work though! --- It's worth nothing that you may not immediately see the "smallest possible wasm module" for the input you feed to rustc. For various reasons it's very difficult to get rid of the final "bloat" in vanilla rustc (again, a real linker should fix all this). For now what you'll have to do is: cargo install --git https://github.com/alexcrichton/wasm-gc wasm-gc foo.wasm bar.wasm And then `bar.wasm` should be the smallest we can get it! --- In any case for now I'd love feedback on this, particularly on the various integration points if you've got better ideas of how to approach them!
2017-09-09Stabilize drop_types_in_const.Eduard-Mihai Burtescu-3/+9
2017-08-22Fix little-endian assumptions in run-pass/union/union-basicJosh Stone-6/+2
2017-08-03Recognize SPARC in more tests where architecture matters.Danek Duvall-0/+1
2017-07-17Support repr alignment on unions.Cameron Hart-0/+72
2017-05-27Stabilize unions with `Copy` fields and no destructorVadim Petrochenkov-20/+0
2017-04-20Remove float_extrasJosh Stone-5/+3
[unstable, deprecated since 1.11.0]
2017-01-09Make unions never have needs_dropManish Goregaokar-0/+63
2016-12-01Fix rust_test_helpers linkage.Vadim Chugunov-1/+1
2016-10-20Tweak path parsing logicVadim Petrochenkov-0/+6
2016-10-18Fix some pretty printing testsVadim Petrochenkov-2/+0
2016-09-15Rollup merge of #36384 - petrochenkov:derclone, r=alexcrichtonManish Goregaokar-7/+20
Improve shallow `Clone` deriving `Copy` unions now support `#[derive(Clone)]`. Less code is generated for `#[derive(Clone, Copy)]`. + Unions now support `#[derive(Eq)]`. Less code is generated for `#[derive(Eq)]`. --- Example of code reduction: ``` enum E { A { a: u8, b: u16 }, B { c: [u8; 100] }, } ``` Before: ``` fn clone(&self) -> E { match (&*self,) { (&E::A { a: ref __self_0, b: ref __self_1 },) => { ::std::clone::assert_receiver_is_clone(&(*__self_0)); ::std::clone::assert_receiver_is_clone(&(*__self_1)); *self } (&E::B { c: ref __self_0 },) => { ::std::clone::assert_receiver_is_clone(&(*__self_0)); *self } } } ``` After: ``` fn clone(&self) -> E { { let _: ::std::clone::AssertParamIsClone<u8>; let _: ::std::clone::AssertParamIsClone<u16>; let _: ::std::clone::AssertParamIsClone<[u8; 100]>; *self } } ``` All the matches are removed, bound assertions are more lightweight. `let _: Checker<CheckMe>;`, unlike `checker(&check_me);`, doesn't have to be translated by rustc_trans and then inlined by LLVM, it doesn't even exist in MIR, this means faster compilation. --- Union impls are generated like this: ``` union U { a: u8, b: u16, c: [u8; 100], } ``` ``` fn clone(&self) -> U { { let _: ::std::clone::AssertParamIsCopy<Self>; *self } } ``` Fixes https://github.com/rust-lang/rust/issues/36043 cc @durka r? @alexcrichton
2016-09-10Improve `Eq` derivingVadim Petrochenkov-1/+12
2016-09-10Improve shallow `Clone` derivingVadim Petrochenkov-7/+9
2016-09-09Add s390x supportUlrich Weigand-0/+3
This adds support for building the Rust compiler and standard library for s390x-linux, allowing a full cross-bootstrap sequence to complete. This includes: - Makefile/configure changes to allow native s390x builds - Full Rust compiler support for the s390x C ABI (only the non-vector ABI is supported at this point) - Port of the standard library to s390x - Update the liblibc submodule to a version including s390x support - Testsuite fixes to allow clean "make check" on s390x Caveats: - Resets base cpu to "z10" to bring support in sync with the default behaviour of other compilers on the platforms. (Usually, upstream supports all older processors; a distribution build may then chose to require a more recent base version.) (Also, using zEC12 causes failures in the valgrind tests since valgrind doesn't fully support this CPU yet.) - z13 vector ABI is not yet supported. To ensure compatible code generation, the -vector feature is passed to LLVM. Note that this means that even when compiling for z13, no vector instructions will be used. In the future, support for the vector ABI should be added (this will require common code support for different ABIs that need different data_layout strings on the same platform). - Two test cases are (temporarily) ignored on s390x to allow passing the test suite. The underlying issues still need to be fixed: * debuginfo/simd.rs fails because of incorrect debug information. This seems to be a LLVM bug (also seen with C code). * run-pass/union/union-basic.rs simply seems to be incorrect for all big-endian platforms. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-03Fix type encoding/decoding for unionsVadim Petrochenkov-45/+33
Fix union debuginfo test on lldb
2016-09-03Address comments and add requested testsVadim Petrochenkov-0/+792