summary refs log tree commit diff
path: root/src/test/run-pass
AgeCommit message (Collapse)AuthorLines
2017-03-10Fix #39390 on beta.Jeffrey Seyfried-0/+18
2017-03-09Propagate expected type hints through struct literals.Eduard-Mihai Burtescu-0/+20
2017-03-09trans: don't ICE when trying to create ADT trans-itemsAriel Ben-Yehuda-0/+51
ADTs are translated in-place from rustc_trans::callee, so no trans-items are needed. This fix will be superseded by the shimmir branch, but I prefer not to backport that to beta. Fixes #39823.
2017-03-09Fix const expression macro invocations.Jeffrey Seyfried-0/+24
2017-02-25std: Relax UnwindSafe impl for UniqueAlex Crichton-1/+4
Add the `?Sized` bound as we don't require the type to be sized. Closes #40011
2017-02-25use a more conservative inhabitableness ruleAriel Ben-Yehuda-5/+1
This is a [breaking-change] from 1.15, because this used to compile: ```Rust enum Void {} fn foo(x: &Void) { match x {} } ```
2017-02-25check_match: don't treat privately uninhabited types as uninhabitedAriel Ben-Yehuda-0/+29
Fixes #38972.
2017-02-23fix run-pass test that required `Copy` implNiko Matsakis-0/+2
2017-01-31Auto merge of #39379 - segevfiner:fix-backtraces-on-i686-pc-windows-gnu, ↵bors-5/+0
r=alexcrichton Fix backtraces on i686-pc-windows-gnu by disabling FPO This might have performance implications. But do note that MSVC disables FPO by default nowadays and it's use is limited in exception heavy languages like C++. See discussion in: #39234 Closes: #28218
2017-01-30Merge ty::TyBox into ty::TyAdtVadim Petrochenkov-1/+1
2017-01-29Fix backtraces on i686-pc-windows-gnu by disabling FPOSegev Finer-5/+0
This might have performance implications. But do note that MSVC disables FPO by default nowadays and it's use is limited in exception heavy languages like C++. Closes: #28218
2017-01-28Auto merge of #39234 - segevfiner:fix-backtraces-on-windows-gnu, r=petrochenkovbors-3/+2
Make backtraces work on Windows GNU targets again. This is done by adding a function that can return a filename to pass to backtrace_create_state. The filename is obtained in a safe way by first getting the filename, locking the file so it can't be moved, and then getting the filename again and making sure it's the same. See: https://github.com/rust-lang/rust/pull/37359#issuecomment-260123399 Issue: #33985 Note though that this isn't that pretty... I had to implement a `WideCharToMultiByte` wrapper function to convert to the ANSI code page. This will work better than only allowing ASCII provided that the ANSI code page is set to the user's local language, which is often the case. Also, please make sure that I didn't break the Unix build.
2017-01-28Disable backtrace tests on i686-pc-windows-gnu since it's broken by FPOSegev Finer-0/+5
2017-01-28Auto merge of #39305 - eddyb:synelide, r=nikomatsakisbors-0/+24
Perform lifetime elision (more) syntactically, before type-checking. The *initial* goal of this patch was to remove the (contextual) `&RegionScope` argument passed around `rustc_typeck::astconv` and allow converting arbitrary (syntactic) `hir::Ty` to (semantic) `Ty`. I've tried to closely match the existing behavior while moving the logic to the earlier `resolve_lifetime` pass, and [the crater report](https://gist.github.com/eddyb/4ac5b8516f87c1bfa2de528ed2b7779a) suggests none of the changes broke real code, but I will try to list everything: There are few cases in lifetime elision that could trip users up due to "hidden knowledge": ```rust type StaticStr = &'static str; // hides 'static trait WithLifetime<'a> { type Output; // can hide 'a } // This worked because the type of the first argument contains // 'static, although StaticStr doesn't even have parameters. fn foo(x: StaticStr) -> &str { x } // This worked because the compiler resolved the argument type // to <T as WithLifetime<'a>>::Output which has the hidden 'a. fn bar<'a, T: WithLifetime<'a>>(_: T::Output) -> &str { "baz" } ``` In the two examples above, elision wasn't using lifetimes that were in the source, not even *needed* by paths in the source, but rather *happened* to be part of the semantic representation of the types. To me, this suggests they should have never worked through elision (and they don't with this PR). Next we have an actual rule with a strange result, that is, the return type here elides to `&'x str`: ```rust impl<'a, 'b> Trait for Foo<'a, 'b> { fn method<'x, 'y>(self: &'x Foo<'a, 'b>, _: Bar<'y>) -> &str { &self.name } } ``` All 3 of `'a`, `'b` and `'y` are being ignored, because the `&self` elision rule only cares that the first argument is "`self` by reference". Due implementation considerations (elision running before typeck), I've limited it in this PR to a reference to a primitive/`struct`/`enum`/`union`, but not other types, but I am doing another crater run to assess the impact of limiting it to literally `&self` and `self: &Self` (they're identical in HIR). It's probably ideal to keep an "implicit `Self` for `self`" type around and *only* apply the rule to `&self` itself, but that would result in more bikeshed, and #21400 suggests some people expect otherwise. Another decent option is treating `self: X, ... -> Y` like `X -> Y` (one unique lifetime in `X` used for `Y`). The remaining changes have to do with "object lifetime defaults" (see RFCs [599](https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md) and [1156](https://github.com/rust-lang/rfcs/blob/master/text/1156-adjust-default-object-bounds.md)): ```rust trait Trait {} struct Ref2<'a, 'b, T: 'a+'b>(&'a T, &'b T); // These apply specifically within a (fn) body, // which allows type and lifetime inference: fn main() { // Used to be &'a mut (Trait+'a) - where 'a is one // inference variable - &'a mut (Trait+'b) in this PR. let _: &mut Trait; // Used to be an ambiguity error, but in this PR it's // Ref2<'a, 'b, Trait+'c> (3 inference variables). let _: Ref2<Trait>; } ``` What's happening here is that inference variables are created on the fly by typeck whenever a lifetime has no resolution attached to it - while it would be possible to alter the implementation to reuse inference variables based on decisions made early by `resolve_lifetime`, not doing that is more flexible and works better - it can compile all testcases from #38624 by not ending up with `&'static mut (Trait+'static)`. The ambiguity specifically cannot be an early error, because this is only the "default" (typeck can still pick something better based on the definition of `Trait` and whether it has any lifetime bounds), and having an error at all doesn't help anyone, as we can perfectly infer an appropriate lifetime inside the `fn` body. **TODO**: write tests for the user-visible changes. cc @nikomatsakis @arielb1
2017-01-28rustc: move object default lifetimes to resolve_lifetimes.Eduard-Mihai Burtescu-0/+24
2017-01-27Rollup merge of #39313 - est31:drop_in_place_is_stable, r=GuillaumeGomezAlex Crichton-2/+0
drop_in_place is stable now, don't #![feature] it in the nomicon and a test. It was stable since Rust 1.8. r? @GuillaumeGomez
2017-01-27Auto merge of #39282 - petrochenkov:selfstab, r=nikomatsakisbors-4/+0
Stabilize Self and associated types in struct expressions and patterns Rebase of https://github.com/rust-lang/rust/pull/37734 Closes https://github.com/rust-lang/rust/issues/37544 r? @nikomatsakis
2017-01-26drop_in_place is stable now, don't #![feature] it in the nomicon and a testest31-2/+0
It was stable since Rust 1.8.
2017-01-25Auto merge of #38856 - zackw:process-envs, r=aturonbors-2/+63
Add std::process::Command::envs() `Command::envs()` adds a vector of key-value pairs to the child process environment all at once. Suggested in #38526. This is not fully baked and frankly I'm not sure it even _works_, but I need some help finishing it up, and this is the simplest way to show you what I've got. The problems I know exist and don't know how to solve, from most to least important, are: * [ ] I don't know if the type signature of the new function is correct. * [x] The new test might not be getting run. I didn't see it go by in the output of `x.py test src/libstd --stage 1`. * [x] The tidy check says ``process.rs:402: different `since` than before`` which I don't know what it means. r? @brson
2017-01-25Auto merge of #35712 - oli-obk:exclusive_range_patterns, r=nikomatsakisbors-1/+18
exclusive range patterns adds `..` patterns to the language under a feature gate (`exclusive_range_pattern`). This allows turning ``` rust match i { 0...9 => {}, 10...19 => {}, 20...29 => {}, _ => {} } ``` into ``` rust match i { 0..10 => {}, 10..20 => {}, 20..30 => {}, _ => {} } ```
2017-01-25Stabilize Self and associated types in struct expressions and patternsVadim Petrochenkov-4/+0
2017-01-24Make backtraces work on Windows GNU targets again.Segev Finer-6/+0
This is done by adding a function that can return a filename to pass to backtrace_create_state. The filename is obtained in a safe way by first getting the filename, locking the file so it can't be moved, and then getting the filename again and making sure it's the same. See: https://github.com/rust-lang/rust/pull/37359#issuecomment-260123399 Issue: #33985
2017-01-21Generalize envs() and args() to iterators.Zack Weinberg-1/+4
* Command::envs() now takes anything that is IntoIterator<Item=(K, V)> where both K and V are AsRef<OsStr>. * Since we're not 100% sure that's the right signature, envs() is now marked unstable. (You can use envs() with HashMap<str, str> but not Vec<(str, str)>, for instance.) * Update the test to match. * By analogy, args() now takes any IntoIterator<Item=S>, S: AsRef<OsStr>. This should be uncontroversial.
2017-01-20More test fixes from rollupAlex Crichton-4/+8
2017-01-20Rollup merge of #39197 - michaelwoerister:test-38942, r=alexcrichtonAlex Crichton-0/+26
Add regression test for issue #38942 Closes #38942. Kudos to @pnkfelix and @nagisa, who did all the hard work of creating a reduced test case.
2017-01-20Rollup merge of #39157 - michaelwoerister:debug-lto, r=alexcrichtonAlex Crichton-2/+74
Add regression test for debuginfo + LTO Fixes #25270, which cannot be reproduced with the current nightly version of the compiler anymore (due to various fixes to debuginfo generation in the past). Should we run into the "possible ODR violation" again, the test added by this PR can be extend with the new case. r? @alexcrichton
2017-01-20Rollup merge of #39138 - gralpli:issue-39089, r=nrcAlex Crichton-0/+13
Fix ICE when compiling fn f<T: ?for<'a> Sized>() {} Fixes issue #39089
2017-01-20Rollup merge of #39120 - alexcrichton:emscripten-tests, r=brsonAlex Crichton-0/+12
travis: Get an emscripten builder online This commit adds a new entry to the Travis matrix which will execute emscripten test suites. Along the way it updates a few bits of the test suite to continue passing on emscripten, such as: * Ignoring i128/u128 tests as they're presumably just not working (didn't investigate as to why) * Disabling a few process tests (not working on emscripten) * Ignore some num tests in libstd (#39119) * Fix some warnings when compiling
2017-01-20Rollup merge of #39068 - alexcrichton:more-small-tests, r=brsonAlex Crichton-3/+14
travis: Add i586 linux and i686 musl This commit expands the existing x86_64-musl entry in the Travis matrix to also build/test i586-unknown-linux-gnu and i686-unknown-linux-musl. cc #38531 Closes #35599 Closes #39053
2017-01-19Add regression test for issue #38942Michael Woerister-0/+26
2017-01-19travis: Get an emscripten builder onlineAlex Crichton-0/+12
This commit adds a new entry to the Travis matrix which will execute emscripten test suites. Along the way it updates a few bits of the test suite to continue passing on emscripten, such as: * Ignoring i128/u128 tests as they're presumably just not working (didn't investigate as to why) * Disabling a few process tests (not working on emscripten) * Ignore some num tests in libstd (#39119) * Fix some warnings when compiling
2017-01-19add exclusive range patterns under a feature gateOliver Schneider-1/+18
2017-01-18Add regression test for debuginfo + LTOMichael Woerister-2/+74
2017-01-18Feature gate `&Void`'s uninhabitedness.Andrew Cann-0/+5
References to empty types are only considered empty if feature(never_type) is enabled.
2017-01-17Fix ICE when compiling fn f<T: ?for<'a> Sized>() {}gralpli-0/+13
2017-01-16Fix stage 0 and 1 tests broken because i128 doesn't work in stages less than 2Mark Simulacrum-0/+4
Broken by https://github.com/rust-lang/rust/pull/38992.
2017-01-15travis: Add i586 linux and i686 muslAlex Crichton-3/+14
This commit expands the existing x86_64-musl entry in the Travis matrix to also build/test i586-unknown-linux-gnu and i686-unknown-linux-musl. cc #38531 Closes #39053
2017-01-15Auto merge of #38610 - djzin:master, r=sfacklerbors-3/+3
Implementation of plan in issue #27787 for btree_range Still some ergonomics to be worked on, the ::<str,_> is particularly unsightly
2017-01-14Auto merge of #38992 - nagisa:i128-minvallit, r=eddybbors-0/+14
Fix two const-eval issues related to i128 negation First issue here was the fact that we’d only allow negating integers in i64 range in case the integer was not infered yes. While this is not the direct cause of the issue, its still good to fix it. The real issue here is the code handling specifically the `min_value` literals. While I128_OVERFLOW has the expected value (0x8000_..._0000), match using this value as a pattern is handled incorrectly by the stage1 compiler (it seems to be handled correctly, by the stage2 compiler). So what we do here is extract this pattern into an explicit `==` until the next snapshot. Fixes #38987
2017-01-14fix failing testdjzin-3/+3
2017-01-13Auto merge of #38675 - infinity0:more-jemalloc-fixes, r=alexcrichtonbors-1/+2
More jemalloc fixes - Disable jemalloc on s390x as well (closes #38596) - Disable jemalloc tests on platforms where it is disabled (closes #38612)
2017-01-12Disable jemalloc tests on platforms where it is disabled (closes #38612)Ximin Luo-1/+2
See also #37392
2017-01-12Add mips architectures to conditional-compile testXimin Luo-0/+6
2017-01-11Fix two const-eval issues related to i128 negationSimonas Kazlauskas-0/+14
First issue here was the fact that we’d only allow negating integers in i64 range in case the integer was not infered yes. While this is not the direct cause of the issue, its still good to fix it. The real issue here is the code handling specifically the `min_value` literals. While I128_OVERFLOW has the expected value (0x8000_..._0000), match using this value as a pattern is handled incorrectly by the stage1 compiler (it seems to be handled correctly, by the stage2 compiler). So what we do here is extract this pattern into an explicit `==` until the next snapshot. Fixes #38987
2017-01-11Auto merge of #38989 - arielb1:constant-mir-overflow2, r=eddybbors-0/+7
fix function arguments in constant promotion we can't create the target block until *after* we promote the arguments - otherwise the arguments will be promoted into the target block. oops. Fixes #38985. This is a regression introduced in the beta-nominated #38833, so beta-nominating this one too (sorry @brson). r? @eddyb
2017-01-11fix function arguments in constant promotionAriel Ben-Yehuda-0/+7
we can't create the target block until *after* we promote the arguments - otherwise the arguments will be promoted into the target block. oops. Fixes #38985.
2017-01-10Fixes:Zack Weinberg-7/+5
* give the new feature its own feature tag * correct a lifetime problem in the test * use .output() instead of .spawn() in the test so that output is actually collected * correct the same error in the test whose skeleton I cribbed
2017-01-10Auto merge of #38934 - Manishearth:nodrop, r=eddybbors-0/+63
Remove destructor-related restrictions from unions They don't have drop glue. This doesn't fix the rvalue promotion issues when trying to do things like `static FOO: NoDrop<Bar> = NoDrop {inner: Bar}`. I'm not sure if we should fix that.
2017-01-09Make unions never have needs_dropManish Goregaokar-0/+63
2017-01-09Auto merge of #38866 - alexcrichton:try-wait, r=aturonbors-0/+65
std: Add a nonblocking `Child::try_wait` method This commit adds a new method to the `Child` type in the `std::process` module called `try_wait`. This method is the same as `wait` except that it will not block the calling thread and instead only attempt to collect the exit status. On Unix this means that we call `waitpid` with the `WNOHANG` flag and on Windows it just means that we pass a 0 timeout to `WaitForSingleObject`. Currently it's possible to build this method out of tree, but it's unfortunately tricky to do so. Specifically on Unix you essentially lose ownership of the pid for the process once a call to `waitpid` has succeeded. Although `Child` tracks this state internally to be resilient to multiple calls to `wait` or a `kill` after a successful wait, if the child is waited on externally then the state inside of `Child` is not updated. This means that external implementations of this method must be extra careful to essentially not use a `Child`'s methods after a call to `waitpid` has succeeded (even in a nonblocking fashion). By adding this functionality to the standard library it should help canonicalize these external implementations and ensure they can continue to robustly reuse the `Child` type from the standard library without worrying about pid ownership.