about summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2017-12-01Fixed tidy errorsSunjay Varma-0/+0
2017-12-01Adding feature gateSunjay Varma-0/+17
2017-11-30Added test for immutable unique closure upvar mutation.David Wood-0/+22
2017-11-30make coercions to `!` in unreachable code a hard errorAriel Ben-Yehuda-3/+17
This was added to cover up a lazy extra semicolon in #35849, but does not actually make sense. This is removed as a part of the stabilization of `never_type`.
2017-11-30Implement RFC 2128 (use_nested_groups)Pietro Albini-0/+53
This commit adds support for nested groups inside `use` declarations, such as `use foo::{bar, sub::{baz::Foo, *}};`.
2017-11-30Auto merge of #46041 - zilbuz:issue-44837, r=arielb1bors-16/+39
MIR borrowck: finalize `check_access_permissions()` Fix #44837 (hopefully for good) r? @arielb1
2017-11-29Rollup merge of #46287 - SimonSapin:stable-constness, r=aturonkennytm-30/+2
Stabilize const-calling existing const-fns in std Fixes #46038
2017-11-28ci: Start running wasm32 tests on TravisAlex Crichton-21/+20
This commit allocates a builder to running wasm32 tests on Travis. Not all test suites pass right now so this is starting out with just the run-pass and the libcore test suites. This'll hopefully give us a pretty broad set of coverage for integration in rustc itself as well as a somewhat broad coverage of the llvm backend itself through integration/unit tests.
2017-11-28mir-borrowck: Update testsBasile Desloges-16/+39
2017-11-27Auto merge of #46312 - kennytm:rollup, r=kennytmbors-69/+0
Rollup of 10 pull requests - Successful merges: #45506, #46174, #46231, #46240, #46249, #46258, #46262, #46275, #46282, #46285 - Failed merges:
2017-11-28Rollup merge of #46282 - estebank:impl-trait-cicle-span, r=arielb1kennytm-69/+0
Shorten output of E0391 Use the shorter `def_span` on the impl-Trait cyclic reference errors.
2017-11-27Auto merge of #46022 - matthewjasper:cannot-assign-twice-error, r=arielb1bors-11/+108
Mir Borrowck: Parity with Ast for E0384 (Cannot assign twice to immutable) - Closes #45199 - Don't allow assigning to dropped immutable variables - Show the "first assignment" note on the first assignment that can actually come before the second assignment. - Make "first assignment" notes point to function parameters if needed. - Don't show a "first assignment" note if the first and second assignment have the same span (in a loop). This matches ast borrowck for now, but maybe this we should add "in previous loop iteration" as with some other borrowck errors. (Commit 2) - Use revisions to check mir borrowck for the existing tests for this error. (Commit 3) ~~Still working on a less ad-hoc way to get 'first assignment' notes to show on the correct assignment. Also need to check mutating function arguments.~~ Now using a new dataflow pass.
2017-11-27Auto merge of #44884 - arielb1:pack-safe, r=nikomatsakis,eddybbors-0/+59
Make accesses to fields of packed structs unsafe To handle packed structs with destructors (which you'll think are a rare case, but the `#[repr(packed)] struct Packed<T>(T);` pattern is ever-popular, which requires handling packed structs with destructors to avoid monomorphization-time errors), drops of subfields of packed structs should drop a local move of the field instead of the original one. That's it, I think I'll use a strategy suggested by @Zoxc, where this mir ``` drop(packed_struct.field) ``` is replaced by ``` tmp0 = packed_struct.field; drop tmp0 ``` cc #27060 - this should deal with that issue after codegen of drop glue is updated. The new errors need to be changed to future-compatibility warnings, but I'll rather do a crater run first with them as errors to assess the impact. cc @eddyb Things which still need to be done for this: - [ ] - handle `repr(packed)` structs in `derive` the same way I did in `Span`, and use derive there again - [ ] - implement the "fix packed drops" pass and call it in both the MIR shim and validated MIR pipelines - [ ] - do a crater run - [ ] - convert the errors to compatibility warnings
2017-11-27Update tests involving E0384 for mir-borrowckMatthew Jasper-11/+60
2017-11-27Add initialization info to `MoveData`Matthew Jasper-0/+48
* Used for new dataflow to track if a variable has every been initialized * Used for other dataflows that need to be updated for initializations
2017-11-26Stabilize const-calling existing const-fns in stdSimon Sapin-30/+2
Fixes #46038
2017-11-26Move "auto trait leak" impl-trait cycle dependency test to uiEsteban Küber-69/+0
2017-11-26improve error messagesAriel Ben-Yehuda-28/+0
2017-11-26Update tests for -Zborrowck-mir -> -Zborrowck=mode migrationest31-310/+186
2017-11-26limit packed copy-out to non-generic Copy structsAriel Ben-Yehuda-4/+4
2017-11-26fix #[derive] implementation for repr(packed) structsAriel Ben-Yehuda-0/+28
Fix the derive implementation for repr(packed) structs to move the fields out instead of calling functions on references to each subfield. That's it, `#[derive(PartialEq)]` on a packed struct now does: ```Rust fn eq(&self, other: &Self) { let field_0 = self.0; let other_field_0 = other.0; &field_0 == &other_field_0 } ``` Instead of ```Rust fn eq(&self, other: &Self) { let ref field_0 = self.0; let ref other_field_0 = other.0; &*field_0 == &*other_field_0 } ``` Taking (unaligned) references to each subfield is undefined, unsound and is an error with MIR effectck, so it had to be prevented. This causes a borrowck error when a `repr(packed)` struct has a non-Copy field (and therefore is a [breaking-change]), but I don't see a sound way to avoid that error.
2017-11-26make accessing packed fields a future-compat warningAriel Ben-Yehuda-0/+3
2017-11-26make accesses to fields of packed structs unsafeAriel Ben-Yehuda-0/+56
To handle packed structs with destructors (which you'll think are a rare case, but the `#[repr(packed)] struct Packed<T>(T);` pattern is ever-popular, which requires handling packed structs with destructors to avoid monomorphization-time errors), drops of subfields of packed structs should drop a local move of the field instead of the original one. cc #27060 - this should deal with that issue after codegen of drop glue is updated. The new errors need to be changed to future-compatibility warnings, but I'll rather do a crater run first with them as errors to assess the impact.
2017-11-26Auto merge of #46100 - KiChjang:mass-dead-check, r=nikomatsakisbors-0/+44
Kill the storage for all locals on returning terminators Fixes #45704.
2017-11-26Auto merge of #46033 - sinkuu:const-enum-match-check, r=arielb1bors-0/+44
Do match-check for consts Fixes #43195 (ICE caused by building MIR that contains non-exausitive match)
2017-11-24Kill the storage for all locals on returning terminatorsKeith Yeung-0/+44
2017-11-24Merge cfail and ui tests into ui testsOliver Schneider-16/+1
2017-11-24Auto merge of #45946 - estebank:crate-conflict-diag, r=arielb1bors-16/+8
Use multiline text for crate conflict diagnostics After: ``` error[E0464]: multiple matching crates for `libc` --> /checkout/src/rustc/dlmalloc_shim/../../dlmalloc/src/linux.rs:1:1 | 1 | extern crate libc; | ^^^^^^^^^^^^^^^^^^ | = note: candidates: crate `libc`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-658d35794c10b003.rlib crate `libc`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-f32a17a3111b01aa.rlib ``` Before: ``` error[E0464]: multiple matching crates for `libc` --> /checkout/src/rustc/dlmalloc_shim/../../dlmalloc/src/linux.rs:1:1 | 1 | extern crate libc; | ^^^^^^^^^^^^^^^^^^ | = note: candidates: = note: path: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-658d35794c10b003.rlib = note: crate name: libc = note: path: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-f32a17a3111b01aa.rlib = note: crate name: libc ```
2017-11-24Add testShotaro Yamada-0/+44
2017-11-23Auto merge of #46087 - vramana:fix-46003, r=arielb1bors-2/+13
Fix borrowck compiler errors for upvars contain "spurious" dereferences Fixes #46003
2017-11-23Fix borrowck compiler errors for upvars contain "spurious" dereferencesRamana Venkata-2/+13
Fixes #46003
2017-11-23Auto merge of #46054 - nikomatsakis:nll-master-to-rust-master-1, r=arielb1bors-0/+27
typeck aggregate rvalues in MIR type checker This branch is an attempt to land content by @spastorino and @Nashenas88 that was initially landed on nll-master while we waited for https://github.com/rust-lang/rust/pull/45825 to land. The biggest change it contains is that it extends the MIR type-checker to also type-check MIR aggregate rvalues (at least partially). Specifically, it checks that the operands provided for each field have the right type. It does not yet check that their well-formedness predicates are met. That is https://github.com/rust-lang/rust/issues/45827. It also does not check other kinds of rvalues (that is https://github.com/rust-lang/rust/issues/45959). @spastorino is working on those issues now. r? @arielb1
2017-11-23Auto merge of #46051 - cramertj:in-band-lifetimes, r=nikomatsakisbors-0/+72
Implement in-band lifetime bindings TODO (perhaps in a future PR): Should we ban explicit instantiation of generics with in-band lifetimes, or is it uncontroversial to just append them to the end of the lifetimes list? Fixes #46042, cc #44524. r? @nikomatsakis
2017-11-23Auto merge of #46024 - estebank:no-variant, r=petrochenkovbors-10/+35
Use the proper term when using non-existing variant When using a non-existing variant, function or associated item, refer to the proper term, instead of defaulting to "associated item" in diagnostics. Fix #28972. ``` error[E0599]: no variant named `Quux` found for type `Foo` in the current scope --> file.rs:7:9 | 7 | Foo::Quux(..) =>(), | ^^^^^^^^^^^^^ ```
2017-11-22Use multiline text for crate conflict diagnosticsEsteban Küber-16/+8
2017-11-22Add test to new branchesEsteban Küber-0/+15
2017-11-22Implement in-band lifetime bindingsTaylor Cramer-0/+72
2017-11-22Auto merge of #44781 - QuietMisdreavus:doc-include, r=GuillaumeGomezbors-0/+12
rustdoc: include external files in documentation (RFC 1990) Part of https://github.com/rust-lang/rfcs/pull/1990 (needs work on the error reporting, which i'm deferring to after this initial PR) cc #44732 Also fixes #42760, because the prep work for the error reporting made it easy to fix that at the same time.
2017-11-22Remove attributes and test comments accidentally left behind, add in ↵Paul Daniel Faria-2/+0
span_mirbugs
2017-11-22Fix failing testPaul Daniel Faria-3/+9
2017-11-22Check rvalue aggregates during check_stmt in tycheck, add initial, (not ↵Paul Daniel Faria-0/+23
passing) test
2017-11-22Auto merge of #46040 - zilbuz:mir-misc, r=nikomatsakisbors-12/+12
MIR-borrowck: Some minor fixes - Remove parens when printing dereference (fix #45185) - Change argument type of `autoderef` to `bool` - Change argument type of `field_index` to `Field`
2017-11-21Auto merge of #45879 - nikomatsakis:nll-kill-cyclic-closures, r=arielb1bors-7/+66
move closure kind, signature into `ClosureSubsts` Instead of using side-tables, store the closure-kind and signature in the substitutions themselves. This has two key effects: - It means that the closure's type changes as inference finds out more things, which is very nice. - As a result, it avoids the need for the `freshen_closure_like` code (though we still use it for generators). - It avoids cyclic closures calls. - These were never meant to be supported, precisely because they make a lot of the fancy inference that we do much more complicated. However, due to an oversight, it was previously possible -- if challenging -- to create a setup where a closure *directly* called itself (see e.g. #21410). We have to see what the effect of this change is, though. Needs a crater run. Marking as [WIP] until that has been assessed. r? @arielb1
2017-11-21allow loading external files in documentationQuietMisdreavus-0/+12
Partial implementation of https://github.com/rust-lang/rfcs/pull/1990 (needs error reporting work) cc #44732
2017-11-22Rollup merge of #46103 - ↵kennytm-9/+9
zackmdavis:dead_code_lint_should_say_never_constructed_for_variants, r=arielb1 dead code lint to say "never constructed" for variants As reported in #19140, #44083, and #44565, some users were confused when the dead-code lint reported an enum variant to be "unused" when it was matched on (but not constructed). This wording change makes it clearer that the lint is in fact checking for construction. We continue to say "used" for all other items (it's tempting to say "called" for functions and methods, but this turns out not to be correct: functions can be passed as arguments and the dead-code lint isn't special-casing that or anything). Resolves #19140. r? @pnkfelix
2017-11-21Auto merge of #45771 - petrochenkov:crate, r=nikomatsakisbors-5/+78
Support `::crate` in paths cc https://github.com/rust-lang/rust/issues/45477 Fixes https://github.com/rust-lang/rust/issues/45229
2017-11-21Auto merge of #45701 - cramertj:impl-trait-this-time, r=eddybbors-43/+122
impl Trait Lifetime Handling This PR implements the updated strategy for handling `impl Trait` lifetimes, as described in [RFC 1951](https://github.com/rust-lang/rfcs/blob/master/text/1951-expand-impl-trait.md) (cc #42183). With this PR, the `impl Trait` desugaring works as follows: ```rust fn foo<T, 'a, 'b, 'c>(...) -> impl Foo<'a, 'b> { ... } // desugars to exists type MyFoo<ParentT, 'parent_a, 'parent_b, 'parent_c, 'a, 'b>: Foo<'a, 'b>; fn foo<T, 'a, 'b, 'c>(...) -> MyFoo<T, 'static, 'static, 'static, 'a, 'b> { ... } ``` All of the in-scope (parent) generics are listed as parent generics of the anonymous type, with parent regions being replaced by `'static`. Parent regions referenced in the `impl Trait` return type are duplicated into the anonymous type's generics and mapped appropriately. One case came up that wasn't specified in the RFC: it's possible to write a return type that contains multiple regions, neither of which outlives the other. In that case, it's not clear what the required lifetime of the output type should be, so we generate an error. There's one remaining FIXME in one of the tests: `-> impl Foo<'a, 'b> + 'c` should be able to outlive both `'a` and `'b`, but not `'c`. Currently, it can't outlive any of them. @nikomatsakis and I have discussed this, and there are some complex interactions here if we ever allow `impl<'a, 'b> SomeTrait for AnonType<'a, 'b> { ... }`, so the plan is to hold off on this until we've got a better idea of what the interactions are here. cc #34511. Fixes #44727.
2017-11-21Auto merge of #45039 - QuietMisdreavus:doc-spotlight, ↵bors-0/+14
r=GuillaumeGomez,QuietMisdreavus show in docs whether the return type of a function impls Iterator/Read/Write Closes #25928 This PR makes it so that when rustdoc documents a function, it checks the return type to see whether it implements a handful of specific traits. If so, it will print the impl and any associated types. Rather than doing this via a whitelist within rustdoc, i chose to do this by a new `#[doc]` attribute parameter, so things like `Future` could tap into this if desired. ### Known shortcomings ~~The printing of impls currently uses the `where` class over the whole thing to shrink the font size relative to the function definition itself. Naturally, when the impl has a where clause of its own, it gets shrunken even further:~~ (This is no longer a problem because the design changed and rendered this concern moot.) The lookup currently just looks at the top-level type, not looking inside things like Result or Option, which renders the spotlights on Read/Write a little less useful: <details><summary>`File::{open, create}` don't have spotlight info (pic of old design)</summary> ![image](https://user-images.githubusercontent.com/5217170/31209495-e59d027e-a950-11e7-9998-ceefceb71c07.png) </details> All three of the initially spotlighted traits are generically implemented on `&mut` references. Rustdoc currently treats a `&mut T` reference-to-a-generic as an impl on the reference primitive itself. `&mut Self` counts as a generic in the eyes of rustdoc. All this combines to create this lovely scene on `Iterator::by_ref`: <details><summary>`Iterator::by_ref` spotlights Iterator, Read, and Write (pic of old design)</summary> ![image](https://user-images.githubusercontent.com/5217170/31209554-50b271ca-a951-11e7-928b-4f83416c8681.png) </details>
2017-11-21Report special messages for path segment keywords in wrong positionsVadim Petrochenkov-10/+9
2017-11-21Support `::crate` in pathsVadim Petrochenkov-2/+76