about summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2017-11-03auto trait future compatibility lintleonardo.yvens-0/+36
2017-11-03Add tests for `auto trait`, fix parsing bugleonardo.yvens-0/+32
Now we can do the well formedness checks in the parser, yay!
2017-11-03[Syntax Breaking] Rename DefaultImpl to AutoImplleonardo.yvens-6/+6
DefaultImpl is a highly confusing name for what we now call auto impls, as in `impl Send for ..`. The name auto impl is not formally decided but for sanity anything is better than `DefaultImpl` which refers neither to `default impl` nor to `impl Default`.
2017-11-02fallback to provided signature in the event of a type errorNiko Matsakis-4/+4
This prevents regressions on some annoying cases.
2017-11-02new rules for merging expected/supplied types in closure signaturesNiko Matsakis-0/+322
Also, fix numbering in mir-opt tests. We are now anonymizing more consistently, I think, and hence some of the `TyAnon` indices shifted.
2017-11-02Auto merge of #45409 - tamird:suggest-match-default-bindings, r=nikomatsakisbors-11/+16
typeck: suggest use of match_default_bindings feature Fixes #45383. Updates #42640. r? @nikomatsakis cc @tschottdorf This needs a UI test, but thought I'd get some early feedback.
2017-11-02rustc: add item name to deprecated lint warningKevin Butler-222/+291
2017-11-02add TerminatorKind::FalseEdges and use it in matchesMikhail Modin-0/+42
2017-11-01Auto merge of #45538 - nikomatsakis:nll-liveness, r=pnkfelixbors-0/+194
enable non-lexical lifetimes in the MIR borrow checker This PR, joint work with @spastorino, fills out the NLL infrastructure and integrates it with the borrow checker. **Don't get too excited:** it includes still a number of hacks (the subtyping code is particularly hacky). However, it *does* kinda' work. =) The final commit demonstrates this by including a test that -- with both the AST borrowck and MIR borrowck -- reports an error by default. But if you pass `-Znll`, you only get an error from the AST borrowck, demonstrating that the integration succeeds: ``` struct MyStruct { field: String } fn main() { let mut my_struct = MyStruct { field: format!("Hello") }; let value = &my_struct.field; if value.is_empty() { my_struct.field.push_str("Hello, world!"); //~^ ERROR cannot borrow (Ast) } } ```
2017-10-31WIP patch `compile-fail/nll/region-ends-after-if-condition.rs`Niko Matsakis-2/+16
2017-10-31connect MIR borrowck with NLLNiko Matsakis-0/+180
2017-10-31rustc_typeck: use subtyping on the LHS of binops.Eduard-Mihai Burtescu-1/+1
2017-10-30typeck: suggest use of match_default_bindings featureTamir Duberstein-11/+16
Fixes #45383. Updates #42640.
2017-10-29Add several lints into `unused` lint groupVadim Petrochenkov-4/+4
Remove a couple of obsolete lints
2017-10-28Auto merge of #45489 - oli-obk:json_diagnostics, r=petrochenkovbors-1/+1
Fix a quadradic duplication in json for multi-suggestions r? @petrochenkov
2017-10-28Auto merge of #44295 - plietar:extern-types, r=arielb1bors-0/+108
Implement RFC 1861: Extern types A few notes : - Type parameters are not supported. This was an unresolved question from the RFC. It is not clear how useful this feature is, and how variance should be treated. This can be added in a future PR. - `size_of_val` / `align_of_val` can be called with extern types, and respectively return 0 and 1. This differs from the RFC, which specified that they should panic, but after discussion with @eddyb on IRC this seems like a better solution. If/when a `DynSized` trait is added, this will be disallowed statically. - Auto traits are not implemented by default, since the contents of extern types is unknown. This means extern types are `!Sync`, `!Send` and `!Freeze`. This seems like the correct behaviour to me. Manual `unsafe impl Sync for Foo` is still possible. - This PR allows extern type to be used as the tail of a struct, as described by the RFC : ```rust extern { type OpaqueTail; } #[repr(C)] struct FfiStruct { data: u8, more_data: u32, tail: OpaqueTail, } ``` However this is undesirable, as the alignment of `tail` is unknown (the current PR assumes an alignment of 1). Unfortunately we can't prevent it in the general case as the tail could be a type parameter : ```rust #[repr(C)] struct FfiStruct<T: ?Sized> { data: u8, more_data: u32, tail: T, } ``` Adding a `DynSized` trait would solve this as well, by requiring tail fields to be bound by it. - Despite being unsized, pointers to extern types are thin and can be casted from/to integers. However it is not possible to write a `null<T>() -> *const T` function which works with extern types, as I've explained here : https://github.com/rust-lang/rust/issues/43467#issuecomment-321678621 - Trait objects cannot be built from extern types. I intend to support it eventually, although how this interacts with `DynSized`/`size_of_val` is still unclear. - The definition of `c_void` is unmodified
2017-10-28Auto merge of #45503 - thombles:tk/i44339-v5, r=petrochenkovbors-3/+1
Improve diagnostics when list of tokens has incorrect separators Make `parse_seq_to_before_tokens` more resilient to error conditions. Where possible it is better if it can consume up to the final bracket before returning. This change improves the diagnostics in a couple of situations: ``` struct S(pub () ()); // omitted separator use std::{foo. bar}; // used a similar but wrong separator ``` Fixes #44339 r? @petrochenkov
2017-10-27Implement RFC 1861: Extern typesPaul Lietar-0/+108
2017-10-26Auto merge of #45519 - michaelwoerister:dedup-errors, r=arielb1bors-137/+45
Don't emit the same compiler diagnostic twice. This PR makes the compiler filter out diagnostic messages that have already been emitted during the same compilation session.
2017-10-25Reword to avoid using either re-assignment or reassignment in errorsCarol (Nichols || Goulding)-18/+18
2017-10-25Update compile-fail tests for error message deduplication.Michael Woerister-137/+45
2017-10-25Compiletest should parse suggestions from the spansOliver Schneider-1/+1
2017-10-25Update tests for less noisy error messagesThomas Karpiniec-3/+1
2017-10-22`crate` shorthand visibility modifierZack M. Davis-1/+29
With regrets, this breaks rustfmt and rls. This is in the matter of #45388.
2017-10-22Auto merge of #45442 - matthewjasper:const-dynamic-capture-error, r=petrochenkovbors-0/+19
Cleanly error for non-const variable in associated const Not sure if wrapping the whole `visit::walk_impl_item` call is correct. Closes #44239
2017-10-20Auto merge of #45359 - arielb1:escaping-borrow, r=eddybbors-1/+6
Fix a few bugs in drop generation This fixes a few bugs in drop generation, one of which causes spurious MIR borrowck errors. Fixes #44832. r? @eddyb
2017-10-19Cleanly error for non-const expression in associated constmatthewjasper-0/+19
2017-10-20Rollup merge of #45352 - alexcrichton:emscripten-tests, r=nikomatsakiskennytm-1/+1
test: Update Emscripten failures/passing All tests should now have annotation for *why* they're ignored on emscripten. A few tests no longer need such an annotation as well! Closes #41299
2017-10-19Auto merge of #45232 - zackmdavis:moar_lint_suggestions, r=estebankbors-4/+3
code suggestions for non-shorthand field pattern, no-mangle lints continuing in the spirit of #44942 ![moar_lint_suggestions](https://user-images.githubusercontent.com/1076988/31485011-3b20cc80-aee7-11e7-993d-81267ab77732.png) r? @estebank
2017-10-18run EndRegion when unwinding otherwise-empty scopesAriel Ben-Yehuda-1/+6
Improves #44832 borrowck-overloaded-index-move-index.rs - fixed borrowck-multiple-captures.rs - still ICE borrowck-issue-2657-1.rs - fixed borrowck-loan-blocks-move.rs - fixed borrowck-move-from-subpath-of-borrowed-path.rs - fixed borrowck-mut-borrow-linear-errors.rs - still ICE borrowck-no-cycle-in-exchange-heap.rs - fixed borrowck-unary-move.rs - fixed borrowck-loan-blocks-move-cc.rs - fixed borrowck-vec-pattern-element-loan.rs - still broken
2017-10-17test: Update Emscripten failures/passingAlex Crichton-1/+1
All tests should now have annotation for *why* they're ignored on emscripten. A few tests no longer need such an annotation as well! Closes #41299
2017-10-16add error to the correct line in unit testtoidiu-3/+2
2017-10-16add a test casetoidiu-0/+24
dont duplicate error codes choose unlikely error code specify error pattern in test
2017-10-16code suggestions for no-mangle lintsZack M. Davis-4/+3
At reviewer's suggestion, we remove the function/static name from the main lint message. While we're correspondingly adjusting the expectations of a compile-fail test, we remove an obsolete FIXME comment, another quantum of progress towards resolving the fabulous metabug #44366.
2017-10-15Auto merge of #45123 - goffrie:fix-method-unit-call, r=oli-obkbors-38/+0
Provide the full span of method calls to `check_argument_types` ... so that it includes the span of the passed arguments, not just the name of the called method. Fixes #44760.
2017-10-15Auto merge of #45200 - mikhail-m1:match-with-false-edges, r=nikomatsakisbors-0/+25
MIR-borrowck: add false edges to match arms basic fix for https://github.com/rust-lang/rust/issues/45043, should be modified with #45184
2017-10-14Implement `dyn Trait` syntaxVadim Petrochenkov-0/+46
2017-10-13Pass the full span for method callsGeoffry Song-38/+0
2017-10-13Rollup merge of #45133 - GuillaumeGomez:usize-index-msg, r=dtolnaykennytm-0/+15
usize index message for vec
2017-10-13Auto merge of #45025 - ↵bors-5/+137
pnkfelix:mir-borrowck-moves-of-supporting-prefixes-invalidate-uses-too, r=arielb1 MIR-borrowck: moves of prefixes invalidate uses too I overlooked the fact that when we check if a path is moved, we need to check for interference between the (shallow) prefixes and the use in question. ~~Long term, we may want to revise how this computation is done. For example, it might be better to represent the set of invalidated prefixes in the dataflow computation (the `maybe_uninitialized` dataflow), and thus avoid one of the loops in the code here.~~ * Update: I was wrong in my original recollection of the dataflow code, which actually does the right thing, in terms of precisely tracking substructure initialization and movement. Fix #44833 ---- Update: The initial version of this PR's description (and the code as well) erroneously focused on supporting prefixes. ~~But the two main cases of interest are: 1. the *shallow* prefixes, and 2. the deref-free prefix built off a local (if the lvalue is indeed built off a local)~~ Update 2: The main cases of interest are in fact: 1. the nearest prefix with a MovePath, and 2. the suffixes.
2017-10-12Auto merge of #44985 - zilbuz:issue-44974, r=pnkfelixbors-9/+339
MIR borrowck: print lvalues in error messages in the same way that the AST borrowck Fix #44974 - Print fields with `.name` rather than `.<num>` - Autoderef values if followed by a field or an index - Output `[..]` when borrowing inside a slice
2017-10-11Added `revisions: ast mir` template to tests that this PR sync'ed ast+mir ↵Felix S. Klock II-5/+28
borrowcks. (There are other tests that this PR also improves, but were not completely synchronized. I chose to wait until later to pull those into the `revisions: ast mir` testing pattern; later being either when they *are* synchronized, or in some PR where we migrate all borrowck tests, regardless of whether MIR-borrowck is "finished" for them or not.)
2017-10-11Test case illustrating some variants of the issue pointed out by ariel.Felix S. Klock II-0/+60
Expanded to cover partial-initialization ideas.
2017-10-11Test against accesses to uninitialized fields.Felix S. Klock II-0/+49
2017-10-11Auto merge of #44888 - tirr-c:binder-hr-region, r=arielb1bors-6/+6
Refactor fmt::Display and fmt::Debug impls in ppaux Also fixes #44887. There was a problem that unnamed late-bound regions are *always* named `'r` while they are displayed using `std::fmt::Display`. --- ```rust fn main() { f(|_: (), _: ()| {}); } fn f<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} ``` Before (incorrectly shadows lifetime, `for<'r>` omitted for the second argument): ``` error[E0631]: type mismatch in closure arguments --> test.rs:2:5 | 2 | f(|_: (), _: ()| {}); | ^ ----------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), fn(&'r ())) -> _` | = note: required by `f` ``` After: ``` error[E0631]: type mismatch in closure arguments --> test.rs:2:5 | 2 | f(|_: (), _: ()| {}); | ^ ----------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _` | = note: required by `f` ``` r? @nikomatsakis
2017-10-11MIR-borrowck: add false edges to match armsYour Name-0/+25
2017-10-09incr.comp.: Move macro-export test case to src/test/incremental.Michael Woerister-23/+0
2017-10-09usize index message for vecGuillaume Gomez-0/+15
2017-10-08Auto merge of #45016 - pnkfelix:mir-borrowck-gather-and-signal-move-errors, ↵bors-13/+60
r=nikomatsakis MIR-borrowck: gather and signal any move errors When building up the `MoveData` structure for a given MIR, also accumulate any erroneous actions, and then report all of those errors when the construction is complete. This PR adds a host of move-related error constructor methods to `trait BorrowckErrors`. I think I got the notes right; but we should plan to audit all of the notes before turning MIR-borrowck on by default. Fix #44830
2017-10-08Fix testsWonwoo Choi-6/+6