about summary refs log tree commit diff
path: root/src/test/run-pass
AgeCommit message (Collapse)AuthorLines
2018-01-30Ignore run-pass/sse2 when using system LLVMJosh Stone-1/+1
This is a test of `target_feature`, which needs a rust-specific patch to LLVM to add `MCSubtargetInfo::getFeatureTable()`.
2018-01-30Force locals to be live after they are borrowed for immovable generators. ↵John Kåre Alsaker-0/+28
Fixes #47736
2018-01-30Rollup merge of #47853 - rust-lang:increase-nested-groups-test-coverage, ↵kennytm-0/+7
r=nikomatsakis Increase test coverage of use_nested_groups r? @nikomatsakis
2018-01-30Rollup merge of #47718 - malbarbo:env-home-dir, r=nikomatsakiskennytm-1/+4
Make run-pass/env-home-dir.rs test more robust Remove the assumption that home_dir always returns Some. This allows the test to be executed with [cross](https://github.com/japaric/cross).
2018-01-29Fix ref-to-ptr coercions not working with NLL in certain casesAaron Hill-0/+26
Implicit coercions from references to pointers were lowered to slightly different Mir than explicit casts (e.g. 'foo as *mut T'). This resulted in certain uses of self-referential structs compiling correctly when an explicit cast was used, but not when the implicit coercion was used. To fix this, this commit adds an outer 'Use' expr when applying a raw-ptr-borrow adjustment. This makes the lowered Mir for coercions identical to that of explicit coercions, allowing the original code to compile regardless of how the raw ptr cast occurs. Fixes #47722
2018-01-29Auto merge of #47837 - eddyb:going-places, r=nikomatsakisbors-6/+6
Replace "lvalue" terminology with "place". See #46425 for the previous PR (which only changed MIR-related code). r? @nikomatsakis
2018-01-29move comment right onto the line in questionNiko Matsakis-3/+3
2018-01-29Make run-pass/env-home-dir.rs test more robustMarco A L Barbosa-1/+4
Remove the assumption that home_dir always returns Some This allows the test to be executed with [cross](https://github.com/japaric/cross).
2018-01-29Increase test coverage of use_nested_groupsPietro Albini-0/+7
2018-01-29tests: replace "lvalue" terminology with "place".Eduard-Mihai Burtescu-6/+6
2018-01-28Auto merge of #47794 - etaoins:fix-ice-on-const-eval-of-union-field, r=eddybbors-0/+45
Fix ICE on const eval of union field 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 r? @eddyb
2018-01-28Auto merge of #47746 - varkor:never-type-ice, r=nikomatsakisbors-0/+46
Fix never-type rvalue ICE This fixes #43061. r? @nikomatsakis A small post-mortem as a follow-up to our investigations in https://github.com/rust-lang/rust/pull/47291: The problem as I understand it is that when `NeverToAny` coercions are made, the expression/statement that is coerced may be enclosed in a block. In our case, the statement `x;` was being transformed to something like: `NeverToAny( {x;} )`. Then, `NeverToAny` is transformed into an expression: https://github.com/rust-lang/rust/blob/000fbbc9b8f88adc6a417f1caef41161f104250f/src/librustc_mir/build/expr/into.rs#L52-L59 Which ends up calling `ast_block_stmts` on the block `{x;}`, which triggers this condition: https://github.com/rust-lang/rust/blob/000fbbc9b8f88adc6a417f1caef41161f104250f/src/librustc_mir/build/block.rs#L141-L147 In our case, there is no return expression, so `push_assign_unit` is called. But the block has already been recorded as _diverging_, meaning the result of the block will be assigned to a location of type `!`, rather than `()`. This causes the MIR error. I'm assuming the `NeverToAny` coercion code is doing what it's supposed to (there don't seem to be any other problems), so fixing the issue simply consists of checking that the destination for the return value actually _is_ supposed to be a unit. (If no return value is given, the only other possible type for the return value is `!`, which can just be ignored, as it will be unreachable anyway.) I checked the other cases of `push_assign_unit`, and it didn't look like they could be affected by the divergence issue (blocks are kind of special-cased in this regard as far as I can tell), so this should be sufficient to fix the issue.
2018-01-27Be more explicit about how and why we need fallback in targets of castsleonardo.yvens-0/+16
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-26Auto merge of #47748 - alexcrichton:rollup, r=alexcrichtonbors-31/+342
Rollup of 19 pull requests - Successful merges: #47415, #47437, #47439, #47453, #47460, #47502, #47529, #47600, #47607, #47618, #47626, #47656, #47668, #47696, #47701, #47705, #47710, #47711, #47719 - Failed merges: #47455, #47521
2018-01-26Ignore a test on emscriptenAlex Crichton-0/+2
2018-01-26add regression testNiko Matsakis-0/+162
Fixes #47139
2018-01-26Add clarifying comment regarding the trailing type of a blockvarkor-1/+1
2018-01-26Fix a test case on WindowsAlex Crichton-0/+5
2018-01-26Merge branch 'mlsm' of https://github.com/dotdash/rust into rollupAlex Crichton-0/+66
2018-01-26Merge branch 'android-run-pass' of https://github.com/malbarbo/rust into rollupAlex Crichton-24/+5
2018-01-26Merge branch 'simd-always-mem' of https://github.com/alexcrichton/rust into ↵Alex Crichton-0/+181
rollup
2018-01-26Shorten another test path for MSVCAlex Crichton-2/+2
2018-01-26Auto merge of #47252 - Zoxc:backtrace-win, r=alexcrichtonbors-13/+3
Print inlined functions on Windows Split from https://github.com/rust-lang/rust/pull/45637 r? @alexcrichton
2018-01-26Upgrade LLVM to incorporate a fix for #47364Björn Steinbrink-0/+66
Fixes #47364
2018-01-25Ignore an i128 test on emscriptenAlex Crichton-0/+2
2018-01-26Print inlined functions on WindowsJohn Kåre Alsaker-13/+3
2018-01-25Merge branch 'configure-lto' of https://github.com/alexcrichton/rust into rollupAlex Crichton-1/+35
2018-01-25Rollup merge of #47719 - malbarbo:run-pass-arch-powerpc, r=alexcrichtonAlex Crichton-0/+3
Add powerpc to run-pass/conditional-compile-arch.rs
2018-01-25Rollup merge of #47705 - pietroalbini:fix-47673, r=petrochenkovAlex Crichton-0/+16
Fix ICE when use trees have multiple empty nested groups The issue was caused by an oversight of mine in the original use_nested_groups PR, where different paths were resolved with the same `NodeId` in some cases (such as in `use {{}, {}};`). Fixes #47673 r? @petrochenkov
2018-01-25Make 3 run-pass tests works on android (aarch64 and x86)Marco A L Barbosa-24/+5
2018-01-25rustc: SIMD types use pointers in Rust's ABIAlex Crichton-0/+181
This commit changes the ABI of SIMD types in the "Rust" ABI to unconditionally be passed via pointers instead of being passed as immediates. This should fix a longstanding issue, #44367, where SIMD-using programs ended up showing very odd behavior at runtime because the ABI between functions was mismatched. As a bit of a recap, this is sort of an LLVM bug and sort of an LLVM feature (today's behavior). LLVM will generate code for a function solely looking at the function it's generating, including calls to other functions. Let's then say you've got something that looks like: ```llvm define void @foo() { ; no target features enabled call void @bar(<i64 x 4> zeroinitializer) ret void } define void @bar(<i64 x 4>) #0 { ; enables the AVX feature ... } ``` LLVM will codegen the call to `bar` *without* using AVX registers becauase `foo` doesn't have access to these registers. Instead it's generated with emulation that uses two 128-bit registers. The `bar` function, on the other hand, will expect its argument in an AVX register (as it has AVX enabled). This means we've got a codegen problem! Comments on #44367 have some more contexutal information but the crux of the issue is that if we want SIMD to work in general we'll need to ensure that whenever a function calls another they ABI of the arguments being passed is in agreement. One possible solution to this would be to insert "shim functions" where whenever a `target_feature` mismatch is detected the compiler inserts a shim function where you pass arguments via memory to the shim and then the shim loads the values and calls the target function (where the shim and the target have the same target features enabled). This unfortunately is quite nontrivial to implement in rustc today (especially when accounting for function pointers and such). This commit takes a different solution, *always* passing SIMD arguments through memory instead of passing as immediates. This strategy solves the problem at the LLVM layer because the ABI between two functions never uses SIMD registers. This also shouldn't be a hit to performance because SIMD performance is thought to often rely on inlining anyway, where a `call` instruction, even if using SIMD registers, would be disastrous to performance regardless. LLVM should then be more than capable of fixing all our memory usage to use registers instead after enough inlining has been performed. Note that there's a few caveats to this commit though: * The "platform intrinsic" ABI is omitted from "always pass via memory". This ABI is used to define intrinsics like `simd_shuffle4` where LLVM and rustc need to have the arguments as an immediate. * Additionally this commit does *not* fix the `extern` ("C") ABI. This means that the bug in #44367 can still happen when using non-Rust-ABI functions. My hope is that before stabilization we can ban and/or warn about SIMD types in these functions (as AFAIK there's not much motivation to belong there anyway), but I'll leave that for a later commit and if this is merged I'll file a follow-up issue. All in all this... Closes #44367
2018-01-25Rollup merge of #47439 - eddyb:issue-45662, r=nagisaAlex Crichton-4/+4
rustc_trans: ignore trailing padding larger than 8 bytes. Fixes #45662 by ignoring a missing second register component, as it could be entirely padding.
2018-01-25Rollup merge of #47437 - eddyb:issue-38763, r=nagisaAlex Crichton-0/+21
rustc_trans: take into account primitives larger than 8 bytes. Fixes #38763 by marking all "eightbytes" covered by a primitive appropriately, not just the first.
2018-01-25Fix never-type rvalue ICEvarkor-0/+46
2018-01-25Rollup merge of #47609 - ritiek:test-mutating-references, r=nikomatsakisGuillaume Gomez-6/+6
NLL test for mutating &mut references As mentioned in #46361. cc @nikomatsakis?
2018-01-25Auto merge of #47374 - topecongiro:issue-47096, r=nikomatsakisbors-0/+24
Simplify irrefutable slice patterns Closes #47096.
2018-01-25Auto merge of #47006 - bitshifter:stabilize-repr-align, r=eddybbors-4/+0
Stabilized `#[repr(align(x))]` attribute (RFC 1358) Stabilzed `#[repr(align(x))]` with attr_literal syntax as proposed by @eddyb https://github.com/rust-lang/rust/issues/33626#issuecomment-348467804
2018-01-24Add powerpc to run-pass/conditional-compile-arch.rsMarco A L Barbosa-0/+3
2018-01-24Fix ICE when use trees have multiple empty nested groupsPietro Albini-0/+16
2018-01-23Auto merge of #45337 - Zoxc:gen-static, r=nikomatsakisbors-0/+141
Immovable generators This adds support for immovable generators which allow you to borrow local values inside generator across suspension points. These are declared using a `static` keyword: ```rust let mut generator = static || { let local = &Vec::new(); yield; local.push(0i8); }; generator.resume(); // ERROR moving the generator after it has resumed would invalidate the interior reference // drop(generator); ``` Region inference is no longer affected by the types stored in generators so the regions inside should be similar to other code (and unaffected by the presence of `yield` expressions). The borrow checker is extended to pick up the slack so interior references still result in errors for movable generators. This fixes #44197, #45259 and #45093. This PR depends on [PR #44917 (immovable types)](https://github.com/rust-lang/rust/pull/44917), I suggest potential reviewers ignore the first commit as it adds immovable types.
2018-01-23rustc: Add `-C lto=val` optionAlex Crichton-1/+35
This commit primarily adds the ability to control what kind of LTO happens when rustc performs LTO, namely allowing values to be specified to the `-C lto` option, such as `-C lto=thin` and `-C lto=fat`. (where "fat" is the previous kind of LTO, throw everything in one giant module) Along the way this also refactors a number of fields which store information about whether LTO/ThinLTO are enabled to unify them all into one field through which everything is dispatched, hopefully removing a number of special cases throughout. This is intended to help mitigate #47409 but will require a backport as well, and this would unfortunately need to be an otherwise insta-stable option.
2018-01-23Remove similar test that does not run the resultritiek-35/+1
2018-01-23Make immovable generators unsafeJohn Kåre Alsaker-6/+8
2018-01-23Adds support for immovable generators. Move checking of invalid borrows ↵John Kåre Alsaker-0/+139
across suspension points to borrowck. Fixes #44197, #45259 and #45093.
2018-01-23Stabilized `#[repr(align(x))]` attribute (RFC 1358)Cameron Hart-4/+0
2018-01-22Add dynamic-drop test to nll tests alsoSantiago Pastorino-0/+3
2018-01-22Auto merge of #47353 - nikomatsakis:nll-issue-47189, r=pnkfelix+nmatsakisbors-0/+3
renumber regions in generators This fixes #47189, but I think we still have to double check various things around how to treat generators in MIR type check + borrow check (e.g., what borrows should be invalidated by a `Suspend`? What consistency properties should type check be enforcing anyway around the "interior" type?) Also fixes #47587 thanks to @spastorino's commit. r? @pnkfelix
2018-01-21Auto merge of #47001 - arielb1:private-match, r=nikomatsakisbors-0/+28
check_match: fix handling of privately uninhabited types the match-checking code used to use TyErr for signaling "unknown, inhabited" types for a long time. It had been switched to using the exact type in #38069, to handle uninhabited types. However, in #39980, we discovered that we still needed the "unknown inhabited" logic, but I used `()` instead of `TyErr` to handle that. Revert to using `TyErr` to fix that problem. Fixes #46964. r? @nikomatsakis