summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2016-02-23Revert "Auto merge of #30533 - nikomatsakis:fulfillment-tree, r=aturon"Niko Matsakis-150/+46
This reverts commit c14b615534ebcd5667f594c86d18eebff6afc7cb, reversing changes made to dda25f2221cc7dd68ed28254665dc7d25e2648ed. This caused a regression in compiler performance and backporting the fix to beta was deemed too risky and too challenging, since it is non-trivial and builds on prior commits in various ways. Conflicts: src/librustc/middle/traits/fulfill.rs src/librustc_data_structures/lib.rs
2016-02-18regression tests for issue #30438.Felix S. Klock II-0/+97
Fix #30438.
2016-02-05thorough follow-set testsAlex Burka-0/+312
2016-01-19Auto merge of #30845 - nagisa:mir-extern-calls, r=dotdashbors-0/+42
Supersedes https://github.com/rust-lang/rust/pull/30517 Fixes https://github.com/rust-lang/rust/issues/29575 cc @luqmana r? @nikomatsakis
2016-01-19[MIR] Implement extern call supportSimonas Kazlauskas-0/+42
2016-01-18Auto merge of #30956 - KiChjang:move-tests-to-libcollectionstest, r=blussbors-0/+41
Encountered while I was trying to work on #28518. Please let me know whether this is a correct move.
2016-01-18Auto merge of #30953 - KalitaAlexey:17823-get-rid-of-duplicate-error, r=nrcbors-109/+1
2016-01-18simplify E0308 message for primitive typeskalita.alexey-109/+1
2016-01-17Expand the macro in variance-btree-invariant-types.rs to make compiletest ↵Jonathan S-36/+43
recognize that it should error
2016-01-17Fix and test variance of BTreeMap and its companion structs.Jonathan S-0/+56
2016-01-17Move zst test from libcollections to src/testKeith Yeung-0/+41
2016-01-17Rollup merge of #30943 - alexcrichton:stabilize-1.7, r=aturonManish Goregaokar-6/+11
This commit stabilizes and deprecates the FCP (final comment period) APIs for the upcoming 1.7 beta release. The specific APIs which changed were: Stabilized * `Path::strip_prefix` (renamed from `relative_from`) * `path::StripPrefixError` (new error type returned from `strip_prefix`) * `Ipv4Addr::is_loopback` * `Ipv4Addr::is_private` * `Ipv4Addr::is_link_local` * `Ipv4Addr::is_multicast` * `Ipv4Addr::is_broadcast` * `Ipv4Addr::is_documentation` * `Ipv6Addr::is_unspecified` * `Ipv6Addr::is_loopback` * `Ipv6Addr::is_unique_local` * `Ipv6Addr::is_multicast` * `Vec::as_slice` * `Vec::as_mut_slice` * `String::as_str` * `String::as_mut_str` * `<[T]>::clone_from_slice` - the `usize` return value is removed * `<[T]>::sort_by_key` * `i32::checked_rem` (and other signed types) * `i32::checked_neg` (and other signed types) * `i32::checked_shl` (and other signed types) * `i32::checked_shr` (and other signed types) * `i32::saturating_mul` (and other signed types) * `i32::overflowing_add` (and other signed types) * `i32::overflowing_sub` (and other signed types) * `i32::overflowing_mul` (and other signed types) * `i32::overflowing_div` (and other signed types) * `i32::overflowing_rem` (and other signed types) * `i32::overflowing_neg` (and other signed types) * `i32::overflowing_shl` (and other signed types) * `i32::overflowing_shr` (and other signed types) * `u32::checked_rem` (and other unsigned types) * `u32::checked_shl` (and other unsigned types) * `u32::saturating_mul` (and other unsigned types) * `u32::overflowing_add` (and other unsigned types) * `u32::overflowing_sub` (and other unsigned types) * `u32::overflowing_mul` (and other unsigned types) * `u32::overflowing_div` (and other unsigned types) * `u32::overflowing_rem` (and other unsigned types) * `u32::overflowing_neg` (and other unsigned types) * `u32::overflowing_shl` (and other unsigned types) * `u32::overflowing_shr` (and other unsigned types) * `ffi::IntoStringError` * `CString::into_string` * `CString::into_bytes` * `CString::into_bytes_with_nul` * `From<CString> for Vec<u8>` * `From<CString> for Vec<u8>` * `IntoStringError::into_cstring` * `IntoStringError::utf8_error` * `Error for IntoStringError` Deprecated * `Path::relative_from` - renamed to `strip_prefix` * `Path::prefix` - use `components().next()` instead * `os::unix::fs` constants - moved to the `libc` crate * `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize * `IntoCow` - conflicts with `Into` and may come back later * `i32::{BITS, BYTES}` (and other integers) - not pulling their weight * `DebugTuple::formatter` - will be removed * `sync::Semaphore` - not used enough and confused with system semaphores Closes #23284 cc #27709 (still lots more methods though) Closes #27712 Closes #27722 Closes #27728 Closes #27735 Closes #27729 Closes #27755 Closes #27782 Closes #27798
2016-01-17Rollup merge of #30938 - dotdash:zst_void, r=eddybManish Goregaokar-0/+40
The only way to get a value for a zero-sized type is `undef`, so there's really no point in actually having a return type other than void for such types. Also, while the comment in return_type_is_void mentioned something about aiding C ABI support, @eddyb correctly pointed out on IRC that there is no such thing as a zero-sized type in C. And even with clang, which allows empty structs, those get translated as void return types as well. Fixes #28766
2016-01-16Auto merge of #30567 - steffengy:master, r=alexcrichtonbors-0/+51
Add support to use functions exported using vectorcall. This essentially only allows to pass a new LLVM calling convention from rust to LLVM. ```rust extern "vectorcall" fn abc(param: c_void); ``` references ---- http://llvm.org/docs/doxygen/html/CallingConv_8h_source.html https://msdn.microsoft.com/en-us/library/dn375768.aspx
2016-01-16std: Stabilize APIs for the 1.7 releaseAlex Crichton-6/+11
This commit stabilizes and deprecates the FCP (final comment period) APIs for the upcoming 1.7 beta release. The specific APIs which changed were: Stabilized * `Path::strip_prefix` (renamed from `relative_from`) * `path::StripPrefixError` (new error type returned from `strip_prefix`) * `Ipv4Addr::is_loopback` * `Ipv4Addr::is_private` * `Ipv4Addr::is_link_local` * `Ipv4Addr::is_multicast` * `Ipv4Addr::is_broadcast` * `Ipv4Addr::is_documentation` * `Ipv6Addr::is_unspecified` * `Ipv6Addr::is_loopback` * `Ipv6Addr::is_unique_local` * `Ipv6Addr::is_multicast` * `Vec::as_slice` * `Vec::as_mut_slice` * `String::as_str` * `String::as_mut_str` * `<[T]>::clone_from_slice` - the `usize` return value is removed * `<[T]>::sort_by_key` * `i32::checked_rem` (and other signed types) * `i32::checked_neg` (and other signed types) * `i32::checked_shl` (and other signed types) * `i32::checked_shr` (and other signed types) * `i32::saturating_mul` (and other signed types) * `i32::overflowing_add` (and other signed types) * `i32::overflowing_sub` (and other signed types) * `i32::overflowing_mul` (and other signed types) * `i32::overflowing_div` (and other signed types) * `i32::overflowing_rem` (and other signed types) * `i32::overflowing_neg` (and other signed types) * `i32::overflowing_shl` (and other signed types) * `i32::overflowing_shr` (and other signed types) * `u32::checked_rem` (and other unsigned types) * `u32::checked_neg` (and other unsigned types) * `u32::checked_shl` (and other unsigned types) * `u32::saturating_mul` (and other unsigned types) * `u32::overflowing_add` (and other unsigned types) * `u32::overflowing_sub` (and other unsigned types) * `u32::overflowing_mul` (and other unsigned types) * `u32::overflowing_div` (and other unsigned types) * `u32::overflowing_rem` (and other unsigned types) * `u32::overflowing_neg` (and other unsigned types) * `u32::overflowing_shl` (and other unsigned types) * `u32::overflowing_shr` (and other unsigned types) * `ffi::IntoStringError` * `CString::into_string` * `CString::into_bytes` * `CString::into_bytes_with_nul` * `From<CString> for Vec<u8>` * `From<CString> for Vec<u8>` * `IntoStringError::into_cstring` * `IntoStringError::utf8_error` * `Error for IntoStringError` Deprecated * `Path::relative_from` - renamed to `strip_prefix` * `Path::prefix` - use `components().next()` instead * `os::unix::fs` constants - moved to the `libc` crate * `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize * `IntoCow` - conflicts with `Into` and may come back later * `i32::{BITS, BYTES}` (and other integers) - not pulling their weight * `DebugTuple::formatter` - will be removed * `sync::Semaphore` - not used enough and confused with system semaphores Closes #23284 cc #27709 (still lots more methods though) Closes #27712 Closes #27722 Closes #27728 Closes #27735 Closes #27729 Closes #27755 Closes #27782 Closes #27798
2016-01-16Auto merge of #30533 - nikomatsakis:fulfillment-tree, r=aturonbors-46/+150
This PR introduces an `ObligationForest` data structure that the fulfillment context can use to track what's going on, instead of the current flat vector. This enables a number of improvements: 1. transactional support, at least for pushing new obligations 2. remove the "errors will be reported" hack -- instead, we only add types to the global cache once their entire subtree has been proven safe. Before, we never knew when this point was reached because we didn't track the subtree. - this in turn allows us to limit coinductive reasoning to structural traits, which sidesteps #29859 3. keeping the backtrace should allow for an improved error message, where we give the user full context - we can also remove chained obligation causes This PR is not 100% complete. In particular: - [x] Currently, types that embed themselves like `struct Foo { f: Foo }` give an overflow when evaluating whether `Foo: Sized`. This is not a very user-friendly error message, and this is a common beginner error. I plan to special-case this scenario, I think. - [x] I should do some perf. measurements. (Update: 2% regression.) - [x] More tests targeting #29859 - [ ] The transactional support is not fully integrated, though that should be easy enough. - [ ] The error messages are not taking advantage of the backtrace. I'd certainly like to do 1 through 3 before landing, but 4 and 5 could come as separate PRs. r? @aturon // good way to learn more about this part of the trait system f? @arielb1 // already knows this part of the trait system :)
2016-01-16Add regression tests for #29859. However #29859 is not fully fixed.Niko Matsakis-0/+84
2016-01-16Implement a hacky version of the DAG support we ultimately want, leavingNiko Matsakis-3/+2
a FIXME for later.
2016-01-16Detect cycles and specialize error reporting for Sized. It is importantNiko Matsakis-44/+65
to get the `Sized` error usable, since that hits new users frequently. Further work is needed for the error reporting for non-Sized cycle cases; those currently just fallback to the old path. Also adjust tests.
2016-01-16Auto merge of #30930 - oli-obk:fix/30887, r=arielb1bors-7/+90
this makes sure the checks run before typeck (which might use the constant or const function to calculate an array length) and gives prettier error messages in case of for loops and such (since they aren't expanded yet). fixes #30887 r? @pnkfelix
2016-01-16Auto merge of #30896 - petrochenkov:vkindmeta, r=alexcrichtonbors-30/+188
Also add tests for use of empty structs in cross-crate scenarios Some tests are commented out, they depend on fixes from https://github.com/rust-lang/rust/pull/30882
2016-01-15Auto merge of #30878 - brson:raw-pointer-derive, r=brsonbors-0/+110
This adds back the raw_pointer_derive lint as a 'removed' lint, so that its removal does not cause errors (#30346) but warnings. In the process I discovered regressions in the code for renamed and removed lints, which didn't appear to have any tests. The addition of a second lint pass (ast vs. hir) meant that attributes were being inspected twice, renamed and removed warnings printed twice. I restructured the code so these tests are only done once and added tests. Unfortunately it makes the patch more complicated for the needed beta backport. r? @nikomatsakis
2016-01-15Auto merge of #30446 - michaelwu:associated-const-type-params-pt1, ↵bors-8/+168
r=nikomatsakis This provides limited support for using associated consts on type parameters. It generally works on things that can be figured out at trans time. This doesn't work for array lengths or match arms. I have another patch to make it work in const expressions. CC @eddyb @nikomatsakis
2016-01-15Auto merge of #30890 - nagisa:mir-tuple-adts, r=nikomatsakisbors-3/+98
This PR changes translation of tuple-like ADTs from being calls to being proper aggregates. This change is done in hope to make code generation better. Namely, now we can avoid: 1. Call overhead; 2. Generating landingpads in presence of cleanups (we know for sure constructing ADTs can’t panic); 3. And probably much more, gaining better MIR introspectablilty. Along with that a few serious deficiencies with translation of ADTs and switches have been fixed as well (commits 2 and 3). r? @nikomatsakis cc @tsion
2016-01-15Add some tests for non-trivial ADTsSimonas Kazlauskas-3/+98
These tests test building and matching some non-trivial ADT configurations such as C-like enums and packed structs.
2016-01-15Auto merge of #30773 - fhahn:test-fix, r=alexcrichtonbors-11/+13
In my PR for #21659 I accidentally used `// | help` as test annotation. This PR updates it to `//~| help`. I also found and updated 2 other tests with the same issue.
2016-01-15Translate zero-sized return types as voidBjörn Steinbrink-0/+40
The only way to get a value for a zero-sized type is `undef`, so there's really no point in actually having a return type other than void for such types. Also, while the comment in return_type_is_void mentioned something about aiding C ABI support, @eddyb correctly pointed out on IRC that there is no such thing as a zero-sized type in C. And even with clang, which allows empty structs, those get translated as void return types as well. Fixes #28766
2016-01-15Preserve struct/variant kinds in metadataVadim Petrochenkov-30/+188
Add tests for use of empty structs in cross-crate scenarios
2016-01-15move const block checks before lowering stepOliver Schneider-7/+90
this makes sure the checks run before typeck (which might use the constant or const function to calculate an array length) and gives prettier error messages in case of for loops and such (since they aren't expanded yet).
2016-01-15Rollup merge of #30787 - nikomatsakis:future-incompatible-lint, r=brsonManish Goregaokar-1/+43
There is now more structure to the report, so that you can specify e.g. an RFC/PR/issue number and other explanatory details. Example message: ``` type-parameter-invalid-lint.rs:14:8: 14:9 error: defaults for type parameters are only allowed on type definitions, like `struct` or `enum` type-parameter-invalid-lint.rs:14 fn avg<T=i32>(_: T) {} ^ type-parameter-invalid-lint.rs:14:8: 14:9 warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! type-parameter-invalid-lint.rs:14:8: 14:9 note: for more information, see PR 30742 <https://github.com/rust-lang/rust/pull/30724> type-parameter-invalid-lint.rs:11:9: 11:28 note: lint level defined here type-parameter-invalid-lint.rs:11 #![deny(future_incompatible)] ^~~~~~~~~~~~~~~~~~~ error: aborting due to previous error ``` r? @brson I would really like feedback also on the specific messages! Fixes #30746
2016-01-15Rollup merge of #30776 - antonblanchard:powerpc64_merge, r=alexcrichtonManish Goregaokar-17/+15
This adds support for big endian and little endian PowerPC64. make check runs clean apart from one big endian backtrace issue.
2016-01-15Auto merge of #30763 - gchp:issue/30033, r=nagisabors-6/+66
This is achieved by adding the scan_back method. This method looks back through the source_text of the StringReader until it finds the target char, returning it's offset in the source. We use this method to find the offset of the opening single quote, and use that offset as the start of the error. Given this code: ```rust fn main() { let _ = 'abcd'; } ``` The compiler would give a message like: ``` error: character literal may only contain one codepoint: '; let _ = 'abcd'; ^~ ``` With this change, the message now displays: ``` error: character literal may only contain one codepoint: 'abcd'; let _ = 'abcd'; ^~~~~~~ ``` Fixes #30033
2016-01-15Address reviewer commentsNick Cameron-4/+5
[breaking-change] `OptLevel` variants are no longer `pub use`ed by rust::session::config. If you are using these variants, you must change your code to prefix the variant name with `OptLevel`.
2016-01-14Support generic associated constsMichael Wu-8/+168
2016-01-14rustc: Fix bugs in renamed and removed lints and re-add raw_pointer_deriveBrian Anderson-0/+110
cc #30346
2016-01-15Add a testNick Cameron-2/+24
And fix bustage in make check
2016-01-14Display better snippet for invalid char literalGreg Chapple-6/+66
Given this code: fn main() { let _ = 'abcd'; } The compiler would give a message like: error: character literal may only contain one codepoint: '; let _ = 'abcd'; ^~ With this change, the message now displays: error: character literal may only contain one codepoint: 'abcd' let _ = 'abcd' ^~~~~~ Fixes #30033
2016-01-14Auto merge of #30848 - nagisa:mir-no-store-zsts, r=nikomatsakisbors-0/+27
Fixes #30831 r? @nikomatsakis
2016-01-14Rollup merge of #30823 - pnkfelix:put-back-alloca-zeroing-for-issue-30530, ↵Manish Goregaokar-0/+213
r=dotdash Put back alloca zeroing for issues #29092, #30018, #30530; inject zeroing for #30822. ---- Background context: `fn alloca_zeroed` was removed in PR #22969, so we haven't been "zero'ing" (\*) the alloca's since at least that point, but the logic behind that PR seems sound, so its not entirely obvious how *long* the underlying bug has actually been present. In other words, I have not yet done a survey to see when the new `alloc_ty` and `lvalue_scratch_datum` calls were introduced that should have had "zero'ing" the alloca's. ---- I first fixed #30018, then decided to do a survey of `alloc_ty` calls to see if they needed similar treatment, which quickly led to a rediscovery of #30530. While making the regression test for the latter, I discovered #30822, which is a slightly different bug (in terms of where the "zero'ing" needs to go), but still relevant. I haven't finished the aforementioned survey of `fn alloc_ty` calls, but I decided I wanted to get this up for review in its current state (namely to see if my attempt to force developers to include a justification for passing `Uninit` can possibly fly, or if I should abandon that path of action). ---- (*): I am putting quotation marks around "zero'ing" because we no longer use zero as our "dropped" marker value. Fix #29092 Fix #30018 Fix #30530 Fix #30822
2016-01-13Auto merge of #30813 - fhahn:fix-ice-semicolon-in-lifetime, r=nrcbors-0/+19
This PR fixes an ICE due to an DiagnosticsBuilder not being canceld or emitted. Ideally it would use `Handler::cancel`, but I did not manage to get a `&mut` reference to the diagnostics handler.
2016-01-13Auto merge of #30509 - michaelsproul:string-box-error, r=alexcrichtonbors-0/+20
Closes #30156.
2016-01-13s/HARD ERROR/hard error/ -- perhaps the warning is enoughNiko Matsakis-43/+43
2016-01-13Unit/regression tests for issues #29092, #30018, #30530, #30822.Felix S. Klock II-0/+213
Note that the test for #30822 is folded into the test for #30530 (but the file name mentions only 30530).
2016-01-13Simplify some uses of cfg in test casesAnton Blanchard-26/+9
While adding PowerPC64 support it was noticed that some testcases should just use target_pointer_width, and others should select between x86 and !x86.
2016-01-13Add powerpc64 and powerpc64le supportAnton Blanchard-7/+22
This adds support for big endian and little endian PowerPC64. make check runs clean apart from one big endian backtrace issue.
2016-01-13Add an impl for Box<Error> from &str.Michael Sproul-0/+2
2016-01-12test: add a basic test for the vectorcall calling conventionSteffen-0/+32
2016-01-12[MIR] Avoid some code generation for stores of ZSTSimonas Kazlauskas-0/+27
Fixes #30831
2016-01-12Fix test cases accordinglyNiko Matsakis-1/+43
2016-01-11add feature gate "abi_vectorcall" for the vectorcall calling conventionSteffen-0/+19