summary refs log tree commit diff
path: root/src/test/run-pass
AgeCommit message (Collapse)AuthorLines
2016-11-03add #32791 test caseNiko Matsakis-0/+81
2016-10-22[beta] trans: pad const structs to aligned sizeTim Neumann-0/+25
2016-10-19Deprecate `Reflect`Nick Cameron-4/+1
[tracking issue](https://github.com/rust-lang/rust/issues/27749)
2016-10-19Stabilise attributes on statements.Nick Cameron-5/+1
Note that attributes on expressions are still unstable and are behind the `stmt_expr_attributes` flag. cc [Tracking issue](https://github.com/rust-lang/rust/issues/15701)
2016-10-19Stabilise `?`Nick Cameron-12/+1
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-10-19Add regression test.Jeffrey Seyfried-0/+25
2016-10-18normalize types every time HR regions are erasedAriel Ben-Yehuda-0/+25
Associated type normalization is inhibited by higher-ranked regions. Therefore, every time we erase them, we must re-normalize. I was meaning to introduce this change some time ago, but we used to erase regions in generic context, which broke this terribly (because you can't always normalize in a generic context). That seems to be gone now. Ensure this by having a `erase_late_bound_regions_and_normalize` function. Fixes #37109 (the missing call was in mir::block).
2016-10-18Some tests to check that lifetime parametric fn's do not trip up LLVM.Felix S. Klock II-0/+54
2016-10-11force `i1` booleans to `i8` when comparingNiko Matsakis-0/+24
Work around LLVM bug. cc #36856
2016-10-11stop having identity casts be lexprsAriel Ben-Yehuda-0/+35
that made no sense (see test), and was incompatible with borrowck. Fixes #36936.
2016-10-11loosen assertion against proj in collectorNiko Matsakis-0/+34
The collector was asserting a total absence of projections, but some projections are expected, even in trans: in particular, projections containing higher-ranked regions, which we don't currently normalize.
2016-09-25Haiku: add workaround for missing F_DUPFD_CLOEXECNiels Sascha Reedijk-0/+1
The src/libstd/sys/unix/net.rs file depends on it. It is missing from Haiku. This workaround should actually 'fix' the problem, but it turns out the fds-are-cloexec.rs test hangs. I do not know how related these two issues are, but it warrants further investigation. The test is ignored on this platform for now. * Hand rebased from Niels original work on 1.9.0
2016-09-24Rollup merge of #36566 - frewsxcv:9837, r=nikomatsakisGuillaume Gomez-0/+20
Add regression test for #9837. Fixes https://github.com/rust-lang/rust/issues/9837
2016-09-21Auto merge of #36551 - eddyb:meta-games, r=nikomatsakisbors-2/+5
Refactor away RBML from rustc_metadata. RBML and `ty{en,de}code` have had their long-overdue purge. Summary of changes: * Metadata is now a tree encoded in post-order and with relative backward references pointing to children nodes. With auto-deriving and type safety, this makes maintenance and adding new information to metadata painless and bug-free by default. It's also more compact and cache-friendly (cache misses should be proportional to the depth of the node being accessed, not the number of siblings as in EBML/RBML). * Metadata sizes have been reduced, for `libcore` it went down 16% (`8.38MB` -> `7.05MB`) and for `libstd` 14% (`3.53MB` -> `3.03MB`), while encoding more or less the same information * Specialization is used in the bundled `libserialize` (crates.io `rustc_serialize` remains unaffected) to customize the encoding (and more importantly, decoding) of various types, most notably those interned in the `TyCtxt`. Some of this abuses a soundness hole pending a fix (cc @aturon), but when that fix arrives, we'll move to macros 1.1 `#[derive]` and custom `TyCtxt`-aware serialization traits. * Enumerating children of modules from other crates is now orthogonal to describing those items via `Def` - this is a step towards bridging crate-local HIR and cross-crate metadata * `CrateNum` has been moved to `rustc` and both it and `NodeId` are now newtypes instead of `u32` aliases, for specializing their decoding. This is `[syntax-breaking]` (cc @Manishearth ). cc @rust-lang/compiler
2016-09-21Auto merge of #36496 - pnkfelix:workaround-issue-34427, r=eddybbors-0/+26
Workaround #34427 by using memset of 0 on ARM to set the discriminant. Workaround #34427 by using memset of 0 on ARM to set the discriminant.
2016-09-21add assert_ne and debug_assert_ne macrosAshley Williams-0/+35
2016-09-20rustc: allow less and handle fn pointers in the type hashing algorithm.Eduard Burtescu-0/+4
2016-09-20rustc: don't recurse through nested items in decoded HIR fragments.Eduard Burtescu-2/+1
2016-09-20Workaround #34427 by using memset of 0 on ARM to set the discriminant.Felix S. Klock II-0/+26
2016-09-18Add regression test for #9837.Corey Farwell-0/+20
Fixes https://github.com/rust-lang/rust/issues/9837
2016-09-18Auto merge of #36555 - jseyfried:issue_36540, r=eddybbors-0/+19
Visit and fold macro invocations in the same order Fixes #36540. r? @nrc
2016-09-17Add regression test.Jeffrey Seyfried-0/+19
2016-09-17Auto merge of #36508 - nagisa:llvm-backport, r=eddybbors-0/+40
Up the LLVM Fixes #36474 The relevant patch to rust-llvm is at https://github.com/rust-lang/llvm/pull/51 r? @alexcrichton
2016-09-17Up the LLVMSimonas Kazlauskas-0/+40
Fixes #36474
2016-09-17Auto merge of #36490 - bluss:zip-slightly-despecialized-edition, r=alexcrichtonbors-0/+17
Remove data structure specialization for .zip() iterator Go back on half the specialization, the part that changed the Zip struct's fields themselves depending on the types of the iterators. Previous PR: #33090 This means that the Zip iterator will always carry two usize fields, which are sometimes unused. If a whole for loop using a .zip() iterator is inlined, these are simply removed and have no effect. The same improvement for Zip of for example slice iterators remain, and they still optimize well. However, like when the specialization of zip was merged, the compiler is still very sensistive to the exact context. For example this code only autovectorizes if the function is used, not if the code in zip_sum_i32 is inserted inline where it was called: ```rust fn zip_sum_i32(xs: &[i32], ys: &[i32]) -> i32 { let mut s = 0; for (&x, &y) in xs.iter().zip(ys) { s += x * y; } s } fn zipdot_i32_default_zip(b: &mut test::Bencher) { let xs = vec![1; 1024]; let ys = vec![1; 1024]; b.iter(|| { zip_sum_i32(&xs, &ys) }) } ``` Include a test that checks that `Zip<T, U>` is covariant w.r.t. T and U. Fixes #35727
2016-09-16Auto merge of #36482 - jseyfried:dont_load_unconfigured_noninline_modules, r=nrcbors-0/+3
Avoid loading and parsing unconfigured non-inline modules. For example, `#[cfg(any())] mod foo;` will always compile after this PR, even if `foo.rs` and `foo/mod.rs` do not exist or do not contain valid Rust. Fixes #36478 and fixes #27873. r? @nrc
2016-09-16Auto merge of #36468 - michaelwoerister:collect-vtable-drop-glue, r=eddybbors-0/+22
trans: Let the collector find drop-glue for all vtables, not just VTableImpl. This fixes #36260. So far, the collector has only recorded drop-glue for insertion into a vtable if the vtable was for an impl. But there's actually no reason why it shouldn't do just the same for closure vtables, afaict. r? @eddyb cc @rust-lang/compiler
2016-09-16fix dynamic drop for unionsAriel Ben-Yehuda-1/+24
Moving out of a union is now treated like moving out of its parent type. Fixes #36246
2016-09-15Auto merge of #36491 - Manishearth:rollup, r=Manishearthbors-7/+99
Rollup of 9 pull requests - Successful merges: #36384, #36405, #36425, #36429, #36438, #36454, #36459, #36461, #36463 - Failed merges: #36444
2016-09-15Rollup merge of #36461 - nikomatsakis:issue-36053, r=arielb1Manish Goregaokar-0/+32
clear obligations-added flag with nested fulfillcx This flag is a debugging measure designed to detect cases where we start a snapshot, create type variables, register obligations involving those type variables in the fulfillment cx, and then have to unroll the snapshot, leaving "dangling type variables" behind. HOWEVER, in some cases the flag is wrong. In particular, we sometimes create a "mini-fulfilment-cx" in which we enroll obligations. As long as this fulfillment cx is fully drained before we return, this is not a problem, as there won't be any escaping obligations in the main cx. So we add a fn to save/restore the flag. Fixes #36053. r? @arielb1
2016-09-15Rollup merge of #36459 - nikomatsakis:issue-35546, r=eddybManish Goregaokar-0/+28
invoke drop glue with a ptr to (data, meta) This is done by creating a little space on the stack. Hokey, but it's the simplest fix I can see, and I am in "kill regressions" mode right now. Fixes #35546 r? @eddyb
2016-09-15Rollup merge of #36425 - michaelwoerister:stable-projection-bounds, r=eddybManish Goregaokar-0/+19
Fix indeterminism in ty::TraitObject representation. Make sure that projection bounds in `ty::TraitObject` are sorted in a way that is stable across compilation sessions and crate boundaries. This PR + moves `DefPathHashes` up into `librustc` so it can be used there to create a stable sort key for `DefId`s, + changes `PolyExistentialProjection::sort_key()` to take advantage of the above, + and removes the unused `PolyProjectionPredicate::sort_key()` and `ProjectionTy::sort_key()` methods. Fixes #36155
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-15Remove data structure specialization for .zip() iteratorUlrik Sverdrup-0/+17
Go back on half the specialization, the part that changed the Zip struct's fields themselves depending on the types of the iterators. This means that the Zip iterator will always carry two usize fields, which are unused. If a whole for loop using a .zip() iterator is inlined, these are simply removed and have no effect. The same improvement for Zip of for example slice iterators remain, and they still optimize well. However, like when the specialization of zip was merged, the compiler is still very sensistive to the exact context. For example this code only autovectorizes if the function is used, not if the code in zip_sum_i32 is inserted inline it was called: ``` fn zip_sum_i32(xs: &[i32], ys: &[i32]) -> i32 { let mut s = 0; for (&x, &y) in xs.iter().zip(ys) { s += x * y; } s } fn zipdot_i32_default_zip(b: &mut test::Bencher) { let xs = vec![1; 1024]; let ys = vec![1; 1024]; b.iter(|| { zip_sum_i32(&xs, &ys) }) } ``` Include a test that checks that Zip<T, U> is covariant w.r.t. T and U.
2016-09-15Auto merge of #36372 - sfackler:sum-prod-overflow, r=alexcrichtonbors-0/+58
Inherit overflow checks for sum and product We have previously documented the fact that these will panic on overflow, but I think this behavior is what people actually want/expect. `#[rustc_inherit_overflow_checks]` didn't exist when we discussed these for stabilization. r? @alexcrichton Closes #35807
2016-09-15Add regression test.Jeffrey Seyfried-0/+3
2016-09-14clear obligations-added flag with nested fulfillcxNiko Matsakis-0/+32
This flag is a debugging measure designed to detect cases where we start a snapshot, create type variables, register obligations involving those type variables in the fulfillment cx, and then have to unroll the snapshot, leaving "dangling type variables" behind. HOWEVER, in some cases the flag is wrong. In particular, we sometimes create a "mini-fulfilment-cx" in which we enroll obligations. As long as this fulfillment cx is fully drained before we return, this is not a problem, as there won't be any escaping obligations in the main cx. So we add a fn to save/restore the flag.
2016-09-13trans: Let the collector find drop-glue for all vtables, not just VTableImpl.Michael Woerister-0/+22
2016-09-13add missing testNiko Matsakis-0/+28
2016-09-13TypeIdHasher: Let projections be hashed implicitly by the visitor.Michael Woerister-0/+19
2016-09-13Auto merge of #36264 - matklad:zeroing-cstring, r=alexcrichtonbors-0/+49
Zero first byte of CString on drop Hi! This is one more attempt to ameliorate `CString::new("...").unwrap().as_ptr()` problem (related RFC: https://github.com/rust-lang/rfcs/pull/1642). One of the biggest problems with this code is that it may actually work in practice, so the idea of this PR is to proactively break such invalid code. Looks like writing a `null` byte at the start of the CString should do the trick, and I think is an affordable cost: zeroing a single byte in `Drop` should be cheap enough compared to actual memory deallocation which would follow. I would actually prefer to do something like ```Rust impl Drop for CString { fn drop(&mut self) { let pattern = b"CTHULHU FHTAGN "; let bytes = self.inner[..self.inner.len() - 1]; for (d, s) in bytes.iter_mut().zip(pattern.iter().cycle()) { *d = *s; } } } ``` because Cthulhu error should be much easier to google, but unfortunately this would be too expensive in release builds, and we can't implement things `cfg(debug_assertions)` conditionally in stdlib. Not sure if the whole idea or my implementation (I've used ~~`transmute`~~ `mem::unitialized` to workaround move out of Drop thing) makes sense :)
2016-09-12Auto merge of #36406 - arielb1:constant-padding, r=eddybbors-0/+25
use `adt::trans_const` when translating constant closures and tuples The previous way dropped padding on the floor. Fixes #36401 r? @eddyb
2016-09-12use `adt::trans_const` when translating constant closures and tuplesAriel Ben-Yehuda-0/+25
Fixes #36401
2016-09-11Auto merge of #36369 - uweigand:s390x, r=alexcrichtonbors-0/+6
Add s390x support 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-10Auto merge of #36351 - pnkfelix:fix-36278-size-miscalc, r=eddybbors-0/+28
When sizing DST, don't double-count nested struct prefixes. When computing size of `struct P<T>(Q<T>)`, don't double-count prefix added by `Q` Fix #36278. Fix #36294.
2016-09-10Improve `Eq` derivingVadim Petrochenkov-1/+12
2016-09-10Inherit overflow checks for sum and productSteven Fackler-0/+58
2016-09-10Improve shallow `Clone` derivingVadim Petrochenkov-7/+9
2016-09-09Auto merge of #36332 - llogiq:static_consts_feature, r=nikomatsakisbors-81/+1
add static_in_const feature gate also updates tests and deletes the spurious .bk files I inadvertently added last time. r? @nikomatsakis
2016-09-09Add s390x supportUlrich Weigand-0/+6
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>