about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2017-12-15Auto merge of #46706 - sunjay:gat-lifetimes, r=nikomatsakisbors-33/+88
Lifetime Resolution for Generic Associated Types Tracking Issue: https://github.com/rust-lang/rust/issues/44265 r? @nikomatsakis This PR implements lifetime resolution for generic associated types. :tada: ## Remaining Work Before Merge I'm going to go do these things in the next day or so. Please let me know if you spot anything in my changes until then. - [x] If I'm not mistaken, at least some tests should pass now. I need to go through the tests and re-enable the ones that should work by removing the appropriate `~ ERROR` comments
2017-12-15Auto merge of #46653 - estebank:str-as-ch, r=petrochenkovbors-2/+28
When attempting to write str with single quote suggest double quotes Fix #26101.
2017-12-14When attempting to write str with single quote suggest double quotesEsteban Küber-2/+28
2017-12-15Auto merge of #46537 - pnkfelix:two-phase-borrows, r=arielb1bors-0/+294
[MIR-borrowck] Two phase borrows This adds limited support for two-phase borrows as described in http://smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/ The support is off by default; you opt into it via the flag `-Z two-phase-borrows` I have written "*limited* support" above because there are simple variants of the simple `v.push(v.len())` example that one would think should work but currently do not, such as the one documented in the test compile-fail/borrowck/two-phase-reservation-sharing-interference-2.rs (To be clear, that test is not describing something that is unsound. It is just providing an explicit example of a limitation in the implementation given in this PR. I have ideas on how to fix, but I want to land the work that is in this PR first, so that I can stop repeatedly rebasing this branch.)
2017-12-15Auto merge of #46641 - petrochenkov:nohelp2, r=nikomatsakisbors-1975/+6701
Move compile-fail tests with NOTE/HELP annotations to UI Remove NOTE/HELP annotations from UI tests cc https://github.com/rust-lang/rust/issues/44844 @oli-obk @est31 r? @nikomatsakis
2017-12-14Review feedback: Added test with control flow merge of two borrows "before ↵Felix S. Klock II-0/+27
activation" In reality the currently generated MIR has at least one of the activations in a copy that occurs before the merge. But still, good to have a test, in anticipation of that potentially changing...
2017-12-14Auto merge of #45047 - durka:trait-alias, r=petrochenkovbors-0/+108
trait alias infrastructure This will be an implementation of trait aliases (RFC 1733, #41517). Progress so far: - [x] Feature gate - [x] Add to parser - [x] `where` clauses - [x] prohibit LHS type parameter bounds via AST validation https://github.com/rust-lang/rust/pull/45047#discussion_r143575575 - [x] Add to AST and HIR - [x] make a separate PathSource for trait alias contexts https://github.com/rust-lang/rust/pull/45047#discussion_r143353932 - [x] Stub out enough of typeck and resolve to just barely not ICE Postponed: - [ ] Actually implement the alias part - [ ] #21903 - [ ] #24010 I need some pointers on where to start with that last one. The test currently does this: ``` error[E0283]: type annotations required: cannot resolve `_: CD` --> src/test/run-pass/trait-alias.rs:34:16 | 34 | let both = foo(); | ^^^ | = note: required by `foo` ```
2017-12-14Fix rebaseVadim Petrochenkov-67/+103
Update docs for custom normalization of test output
2017-12-14Support regexes in custom normalization in UI testsVadim Petrochenkov-34/+42
2017-12-14Do the same things for fulldeps testsVadim Petrochenkov-6/+126
2017-12-14Remove NOTE/HELP annotations from UI testsVadim Petrochenkov-2814/+1756
2017-12-14Move compile-fail tests with NOTE/HELP annotations to UIVadim Petrochenkov-7/+5821
2017-12-14Remove NOTE/HELP annotations from error index testsVadim Petrochenkov-216/+22
2017-12-14error for impl trait aliasAlex Burka-1/+3
2017-12-14feature gate trait aliasesAlex Burka-14/+18
2017-12-14error on any use of trait aliasAlex Burka-6/+46
2017-12-14add trait aliases to ASTAlex Burka-0/+62
2017-12-14Auto merge of #45002 - oli-obk:miri, r=eddybbors-2/+13
Validate miri against the HIR const evaluator r? @eddyb cc @alexcrichton @arielb1 @RalfJung The interesting parts are the last few functions in `librustc_const_eval/eval.rs` * We warn if miri produces an error while HIR const eval does not. * We warn if miri produces a value that does not match the value produced by HIR const eval * if miri succeeds and HIR const eval fails, nothing is emitted, but we still return the HIR error * if both error, nothing is emitted and the HIR const eval error is returned So there are no actual changes, except that miri is forced to produce the same values as the old const eval. * This does **not** touch the const evaluator in trans at all. That will come in a future PR. * This does **not** cause any code to compile that didn't compile before. That will also come in the future It would be great if someone could start a crater run if travis passes
2017-12-14Auto merge of #46335 - oli-obk:cleanups, r=jseyfriedbors-10/+10
Use PathBuf instead of String where applicable r? @jseyfried
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-10/+10
2017-12-14Auto merge of #46633 - estebank:arg-mismatch, r=arielb1bors-63/+87
Point at whole method call instead of args To avoid confusion in cases where the code is ```rust fn foo() {} / foo( | bar() | ^^^ current diagnostics point here for arg count mismatch | ); |_^ new diagnostic span points here ``` as this leads to confusion making people think that the diagnostic is talking about `bar`'s arg count, not `foo`'s. Point at `fn`s definition on arg mismatch, just like we do for closures. Re #42855, Fix #45633.
2017-12-14Auto merge of #46605 - estebank:macro-backtrace-spans, r=pnkfelixbors-10/+95
Use spans for -Z external-macro-backtrace ``` % rustc ui/type-check/cannot_infer_local_or_vec.rs -Z external-macro-backtrace error[E0282]: type annotations needed --> <vec macros>:3:1 | 1 | / ( $ elem : expr ; $ n : expr ) => ( 2 | | $ crate :: vec :: from_elem ( $ elem , $ n ) ) ; ( $ ( $ x : expr ) , * ) => ( 3 | | < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ) ) ; ( $ ( $ x : expr , ) * ) | | ^^^^^^^^^^^^^^^^^^^^^ | | | | | cannot infer type for `T` 4 | | => ( vec ! [ $ ( $ x ) , * ] ) | |______________________________- in this expansion of `vec!` | ::: ui/type-check/cannot_infer_local_or_vec.rs | 12 | let x = vec![]; | - ------ in this macro invocation | | | consider giving `x` a type error: aborting due to previous error ```
2017-12-14Auto merge of #46582 - nikomatsakis:nll-master-to-rust-master-4, r=arielb1bors-81/+399
make MIR type checker handle a number of other cases The existing type checker was primarily used to verify types, but was skipping over a number of details. For example, it was not checking that the predicates on functions were satisfied and so forth. This meant that the NLL region checker was not getting a lot of the constraints it needed. This PR closes those gaps. It also includes a bit of refactoring for the way that we store region values, encapsulating the bit matrix over into its own module and improving the data structures in use. This is mostly work by @spastorino being ported over from nll-master. r? @arielb1 or @pnkfelix
2017-12-13Added test to make sure that undeclared lifetimes are in fact detectedSunjay Varma-0/+63
2017-12-13Added test to make sure we can refer to the declared traits of a generic ↵Sunjay Varma-5/+18
associated type
2017-12-13Auto merge of #46708 - pnkfelix:fix-issue-46112, r=arielb1bors-0/+47
Fix visible_parent_map to choose globally minimal paths Fix #46112: visible_parent_map construction needs a BFS over whole crate forest to get globally minimal paths. (There are other latent bugs that were e.g. causing this test case to have weirdness like `<unnamed>` in the diagnostic output. Those bugs are not fixed here, since they are issues long-standing in the stable channel.)
2017-12-13Updating tests to remove all "undeclared lifetime" errors (since those ↵Sunjay Varma-33/+12
should no longer occur)
2017-12-13Check activation points as the place where mutable borrows become relevant.Felix S. Klock II-11/+72
Since we are now checking activation points, I removed one of the checks at the reservation point. (You can see the effect this had on two-phase-reservation-sharing-interference-2.rs) Also, since we now have checks at both the reservation point and the activation point, we sometimes would observe duplicate errors (since either one independently interferes with another mutable borrow). To deal with this, I used a similar strategy to one used as discussed on issue #45360: keep a set of errors reported (in this case for reservations), and then avoid doing the checks for the corresponding activations. (This does mean that some errors could get masked, namely for conflicting borrows that start after the reservation but still conflict with the activation, which is unchecked when there was an error for the reservation. But this seems like a reasonable price to pay.)
2017-12-13two-phase-reservation-sharing-interference.rs variant that is perhaps more ↵Felix S. Klock II-0/+38
surprising.
2017-12-13test describing a currently unsupported corner case.Felix S. Klock II-0/+46
2017-12-13tests transcribed from nikos blog post.Felix S. Klock II-0/+101
2017-12-13the minimal test for two-phase borrows: the core example from niko's blog ↵Felix S. Klock II-0/+21
post on it.
2017-12-13Move error checks out of span for easier to follow `.stderr`Esteban Küber-15/+6
2017-12-13correct comment in testNiko Matsakis-1/+1
2017-12-13refactor region value bitmatrixNiko Matsakis-4/+4
2017-12-13fix closure tests now that MIR typeck works properlyNiko Matsakis-79/+142
These tests had FIXMEs for errors that were not previously being reported.
2017-12-13Auto merge of #46550 - jseyfried:cleanup_builtin_hygiene, r=nrcbors-7/+7
macros: hygienize use of `core`/`std` in builtin macros Today, if a builtin macro wants to access an item from `core` or `std` (depending `#![no_std]`), it generates `::core::path::to::item` or `::std::path::to::item` respectively (c.f. `fn std_path()` in `libsyntax/ext/base.rs`). This PR refactors the builtin macros to instead always emit `$crate::path::to::item` here. That is, the def site of builtin macros is taken to be in `extern crate core;` or `extern crate std;`. Since builtin macros are macros 1.0 (i.e. mostly unhygienic), changing the def site can only effect the resolution of `$crate`. r? @nrc
2017-12-13normalize fn sig as part of reificationNiko Matsakis-0/+38
2017-12-13Mir typeck Cast for Unsize valueSantiago Pastorino-0/+24
2017-12-13Mir typeck Cast for ClosureFnPtr valueSantiago Pastorino-0/+22
2017-12-13Mir typeck Cast for UnsafeFnPtr valueSantiago Pastorino-0/+24
2017-12-13Mir typeck Cast for ReifyFnPtr valueSantiago Pastorino-0/+52
2017-12-13Check functions predicatesSantiago Pastorino-0/+28
2017-12-13Check Aggregate predicatesSantiago Pastorino-0/+28
2017-12-13Check Repeat RvalueSantiago Pastorino-0/+39
2017-12-13Auto merge of #46419 - jseyfried:all_imports_in_metadata, r=nrcbors-0/+59
Record all imports (`use`, `extern crate`) in the crate metadata This PR adds non-`pub` `use` and `extern crate` imports in the crate metadata since hygienic macros invoked in other crates may use them. We already include all other non-`pub` items in the crate metadata. This improves import suggestions in some cases. Fixes #42337. r? @nrc
2017-12-12Regression test for issue #46112.Felix S. Klock II-0/+47
2017-12-13Auto merge of #46616 - cramertj:impl-trait-elision, r=nikomatsakisbors-1/+25
Implement impl Trait lifetime elision Fixes #43396. There's one weird ICE in the interaction with argument-position `impl Trait`. I'm still debugging it-- I've left a test for it commented out with a FIXME. Also included a FIXME to ensure that `impl Trait` traits are caught under the lint in https://github.com/rust-lang/rust/issues/45992. r? @nikomatsakis
2017-12-13Auto merge of #46613 - petrochenkov:absext, r=nikomatsakisbors-0/+164
Resolve absolute paths as extern under a feature flag cc https://github.com/rust-lang/rust/issues/44660 r? @nikomatsakis
2017-12-12Auto merge of #46570 - AgustinCB:issue-46553, r=oli-obkbors-2/+32
Ignore `unsopported constant expr` error Fixes #46553