about summary refs log tree commit diff
path: root/src/test/ui/nll
AgeCommit message (Collapse)AuthorLines
2019-04-22Remove double trailing newlinesvarkor-5/+0
2019-04-22update tests for migrate mode by defaultMatthew Jasper-493/+169
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-30/+19
2019-04-14Rollup merge of #59708 - matthewjasper:double-closure-unused-mut, r=pnkfelixMazdak Farrokhzad-8/+11
Mark variables captured by reference as mutable correctly Closes #59620 r? @pnkfelix
2019-04-07Auto merge of #58739 - matthewjasper:more-restrictive-tpb, r=pnkfelixbors-123/+0
More restrictive 2 phase borrows - take 2 Signal lint diagnostic `mutable_borrow_reservation_conflict` when borrow-check finds a 2-phase borrow's reservation overlapping with a shared borrow. (pnkfelix updated description) cc #56254 , #59159 blocks PR #59114 r? @pnkfelix cc @RalfJung @nikomatsakis
2019-04-05Include trailing comma in multiline Debug representationDavid Tolnay-84/+84
This commit changes the behavior of Formatter::debug_struct, debug_tuple, debug_list, debug_set, and debug_map to render trailing commas in {:#?} mode, which is the dominant style in modern Rust code. Before: Language { name: "Rust", trailing_commas: false } After: Language { name: "Rust", trailing_commas: true, }
2019-04-04Mark variables captured by reference as mutable correctlyMatthew Jasper-8/+11
2019-04-04Update tests for restrictive two-phase borrowsMatthew Jasper-123/+0
2019-03-31Suggest using anonymous lifetime in `impl Trait` return without hacksEsteban Küber-4/+4
Fallback to `static_impl_trait` for nice error message by peeking at the return type and the lifetime type. Point at the return type instead of the return expr/stmt in NLL mode.
2019-03-19Rollup merge of #57729 - ↵Mazdak Farrokhzad-0/+99
pnkfelix:issue-55748-pat-types-are-constraints-on-bindings-too, r=nikomatsakis extra testing of how NLL handles wildcard type `_` test that wildcard type `_` is not duplicated by `type Foo<X> = (X, X);` and potentially instantiated at different types when used in type ascriptions in let bindings. (NLL's handling of this for the type ascription *expression form* is currently broken, or at least differs from what AST-borrowck does. I'll file a separate bug about that. Its not something critical to address since that expression is guarded by `#![feature(type_ascription)]`.) cc #55748
2019-03-17Updated UI test output to remove test annotations for revisionsMathias Blikstad-7/+7
2019-03-15rustc: always rely on '_ to be not printed by ty::Region itself.Eduard-Mihai Burtescu-7/+7
2019-03-13test that wildcard type `_` is not duplicated by `type Foo<X> = (X, X);` and ↵Felix S. Klock II-0/+99
potentially instantiated at different types. (Updated to reflect changes in diagnostic output and compiletest infrastructure.)
2019-03-13Rollup merge of #59083 - kyren:master, r=varkorMazdak Farrokhzad-29/+9
Fix #54822 and associated faulty tests Type checking associated constants can require trait bounds, but an empty parameter environment was provided to the trait solver. Providing an appropriate parameter environment seems to fix #54822 and also make one of the cases in src/test/ui/nll/trait-associated-constant.rs that should compile successfully do so. It also (slightly) improves the error message in src/test/ui/associated-const/associated-const-generic-obligations.rs
2019-03-12Rename test struct names to something more sensiblekyren-8/+8
2019-03-11Update NLL testsVadim Petrochenkov-15/+15
2019-03-11Update testsVadim Petrochenkov-282/+282
2019-03-10Fix #54822 and associated faulty testskyren-21/+1
Type checking associated constants can require trait bounds, but an empty parameter environment was provided to the trait solver. Providing an appropriate parameter environment seems to fix #54822 and also make one of the cases in src/test/ui/nll/trait-associated-constant.rs that should compile successfully do so. It also (slightly) improves the error message in src/test/ui/associated-const/associated-const-generic-obligations.rs
2019-03-03Auto merge of #58673 - matthewjasper:typeck-ptr-coercions, r=pnkfelixbors-0/+221
[NLL] Type check operations with pointer types It seems these were forgotten about. Moving to `Rvalue::AddressOf` simplifies the coercions from references, but I want this to be fixed as soon as possible. r? @pnkfelix
2019-03-01Handle type annotations in promoted MIR correctlyMatthew Jasper-0/+29
Type annotations are shared between the MIR of a function and the promoted constants for that function, so keep them in the type checker when we check the promoted MIR.
2019-03-01Include bounds from promoted constants in NLLMatthew Jasper-3/+78
Previously, a promoted that contains a function item wouldn't have the function items bounds propagated to the main function body.
2019-02-25Auto merge of #57609 - matthewjasper:more-restrictive-match, r=pnkfelixbors-90/+146
Use normal mutable borrows in matches `ref mut` borrows are currently two-phase with NLL enabled. This changes them to be proper mutable borrows. To accommodate this, first the position of fake borrows is changed: ```text [ 1. Pre-match ] | [ (old create fake borrows) ] [ 2. Discriminant testing -- check discriminants ] <-+ | | | (once a specific arm is chosen) | | | [ (old read fake borrows) ] | [ 3. Create "guard bindings" for arm ] | [ (create fake borrows) ] | | | [ 4. Execute guard code ] | [ (read fake borrows) ] --(guard is false)-----------+ | | (guard results in true) | [ 5. Create real bindings and execute arm ] | [ Exit match ] ``` The following additional changes are made to accommodate `ref mut` bindings: * We no longer create fake `Shared` borrows. These borrows are no longer needed for soundness, just to avoid some arguably strange cases. * `Shallow` borrows no longer conflict with existing borrows, avoiding conflicting access between the guard borrow access and the `ref mut` borrow. There is some further clean up done in this PR: * Avoid the "later used here" note for Shallow borrows (since it's not relevant with the message provided) * Make any use of a two-phase borrow activate it. * Simplify the cleanup_post_borrowck passes into a single pass. cc #56254 r? @nikomatsakis
2019-02-24Type check pointer comparisonsMatthew Jasper-0/+95
2019-02-23Type check coercions to pointer typesMatthew Jasper-0/+126
2019-02-23Rollup merge of #58353 - matthewjasper:typeck-pattern-constants, r=arielb1Mazdak Farrokhzad-20/+58
Check the Self-type of inherent associated constants r? @arielb1
2019-02-23Rollup merge of #58199 - clintfred:partial-move-err-msg, r=estebankMazdak Farrokhzad-1/+1
Add better error message for partial move closes #56657 r? @davidtwco
2019-02-21Use normal mutable borrows in MIR match loweringMatthew Jasper-78/+41
2019-02-21Improve error message and add tests for borrowck match handlingMatthew Jasper-32/+125
2019-02-20Fix erroneous loop diagnostic in nllSantiago Pastorino-0/+65
This commit fixes the logic of detecting when a use happen in a later iteration of where a borrow was defined Fixes #53773
2019-02-18re-blessing error output: ./x.py test src/test/ui --stage 1 --blessClint Frederickson-14/+14
2019-02-14Rollup merge of #58371 - davidtwco:issue-58299, r=arielb1Mazdak Farrokhzad-0/+50
Check user type annotations for range patterns. Fixes #58299. This PR builds on the fix from #58161 (which fixed miscompilation caused by the introduction of `AscribeUserType` patterns for associated constants) to start checking these patterns are well-formed for ranges (previous fix just ignored them so that miscompilation wouldn't occur). r? @arielb1
2019-02-13Check the self-type of inherent associated constantsMatthew Jasper-20/+58
2019-02-13Propagate region constraints more precisely from closuresMatthew Jasper-0/+40
2019-02-12Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnikbors-1/+1
Cosmetic improvements to doc comments This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-12Check user type annotations for range patterns.David Wood-0/+50
This commit builds on the fix from #58161 (which fixed miscompilation caused by the introduction of `AscribeUserType` patterns for associated constants) to start checking these patterns are well-formed for ranges (previous fix just ignored them so that miscompilation wouldn't occur).
2019-02-12Auto merge of #58180 - davidtwco:issue-58053, r=estebankbors-0/+34
Fix span for closure return type when annotated. Fixes #58053. This PR adjusts the span used to label closure return types so that if the user specifies the return type, i.e. `|_| -> X {}` instead of `|_| {}`, we correctly highlight all of it and not just the last character. r? @pnkfelix
2019-02-10tests: doc commentsAlexander Regueiro-1/+1
2019-02-06Lower constant patterns with ascribed types.David Wood-0/+39
This commit fixes a bug introduced by #55937 which started checking user type annotations for associated type patterns. Where lowering a associated constant expression would previously return a `PatternKind::Constant`, it now returns a `PatternKind::AscribeUserType` with a `PatternKind::Constant` inside, this commit unwraps that to access the constant pattern inside and behaves as before.
2019-02-06error output updated by ./x.py test --stage 1 src/test/ui --incremental --blessClint Frederickson-15/+15
2019-02-05Fix span for closure return type when annotated.David Wood-0/+34
This commit adjusts the span used to label closure return types so that if the user specifies the return type, i.e. `|_| -> X {}` instead of `|_| {}`, we correctly highlight all of it and not just the last character.
2019-01-30Pass correct arguments to places_conflictMatthew Jasper-0/+36
The borrow place *must* be a place that we track borrows for, otherwise we will likely ICE.
2019-01-27Change generator trait to use pinningWim Looman-6/+6
2019-01-25Auto merge of #57714 - matthewjasper:wellformed-unreachable, r=pnkfelixbors-2/+297
[NLL] Clean up handling of type annotations * Renames (Canonical)?UserTypeAnnotation -> (Canonical)?UserType so that the name CanonicalUserTypeAnnotation is free. * Keep the inferred type associated to user type annotations in the MIR, so that it can be compared against the annotated type, even when the annotated expression gets removed from the MIR. (#54943) * Use the inferred type to allow infallible handling of user type projections (#57531) * Uses revisions for the tests in #56993 * Check the types of `Unevaluated` constants with no annotations (#46702) * Some drive-by cleanup Closes #46702 Closes #54943 Closes #57531 Closes #57731 cc #56993 leaving this open to track the underlying issue: we are not running tests with full NLL enabled on CI at the moment r? @nikomatsakis
2019-01-24When using value after move, point at span of localEsteban Küber-40/+44
When trying to use a value after move, instead of using a note, point at the local declaration that has a type that doesn't implement `Copy` trait.
2019-01-19Don't ignore `_` in type casts and ascriptionsMatthew Jasper-0/+78
2019-01-19Type check unnanotated constant items with NLLMatthew Jasper-0/+79
2019-01-19Handle lifetime annotations in unreachable codeMatthew Jasper-2/+140
We equate the type in the annotation with the inferred type first so that we have a fully inferred type to perform the well-formedness check on.
2019-01-17fix compat-mode ui testMark Mansi-1/+1
2019-01-17Update testsMark Mansi-91/+86
2019-01-16Auto merge of #57321 - petrochenkov:atokens, r=nikomatsakisbors-2/+1
Implement basic input validation for built-in attributes Correct top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is enforced for built-in attributes, built-in attributes must also fit into the "meta-item" syntax (aka the "classic attribute syntax"). For some subset of attributes (found by crater run), errors are lowered to deprecation warnings. NOTE: This PR previously included https://github.com/rust-lang/rust/pull/57367 as well.