summary refs log tree commit diff
path: root/src/test/ui/nll
AgeCommit message (Collapse)AuthorLines
2019-03-16Handle 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-16Include 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-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.
2019-01-13Rollup merge of #57102 - davidtwco:issue-57100, r=nikomatsakisMazdak Farrokhzad-0/+100
NLL: Add union justifications to conflicting borrows. Fixes #57100. This PR adds justifications to error messages for conflicting borrows of union fields. Where previously an error message would say ``cannot borrow `u.b` as mutable..``, it now says ``cannot borrow `u` (via `u.b`) as mutable..``. r? @pnkfelix
2019-01-13Implement basic input validation for built-in attributesVadim Petrochenkov-2/+1
2019-01-07Auto merge of #57304 - davidtwco:issue-57280, r=nikomatsakisbors-0/+43
NLL: Fix bug in associated constant type annotations. Fixes #57280. This PR reverses the variance used when relating types from the type annotation of an associated constant - this matches the behaviour of the lexical borrow checker and fixes a bug whereby matching a `&'a str` against a `&'static str` would produce an error. r? @nikomatsakis
2019-01-05Rollup merge of #57249 - frewsxcv:frewsxcv-second-edition, r=KodrAuskennytm-2/+2
Fix broken links to second edition TRPL. Fixes https://github.com/rust-lang/rust/issues/57104. Remove `second-edition/` from TRPL hyperlinks.
2019-01-04Improve diagnostic labels and add note.David Wood-2/+6
This commit improves diagnostic labels to mention which field a borrow overlaps with and adds a note explaining that the fields overlap.
2019-01-04Make conflicting borrow description more robust.David Wood-0/+96
This commit improves the logic for place descriptions in conflicting borrow errors so that borrows of union fields have better messages even when the unions are embedded in other unions or structs.
2019-01-03Fix bug in associated constant type annotations.David Wood-0/+43
This commit reverses the variance used when relating types from the type annotation of an associated constant - this matches the behaviour of the lexical borrow checker and fixes a bug whereby matching a `&'a str` against a `&'static str` would produce an error.
2019-01-02Wf-check the output type of a function in MIR-typeckMatthew Jasper-0/+38
2019-01-01Fix broken links to second edition TRPL.Corey Farwell-2/+2
Fixes https://github.com/rust-lang/rust/issues/57104.
2018-12-30Guarantee `rustc_dump_user_substs` error order.David Wood-8/+8
This commit buffers the errors output by the `rustc_dump_user_substs` attribute so that they can be output in order of span and would therefore be consistent.
2018-12-30Support user type annotations in `ref` bindings.David Wood-0/+19
This commit adds support for user type annotations in variables declared using `ref` bindings. When a variable declared using a `ref` binding, then the `LocalDecl` has the type `&T` where the `&` was introduced by the `ref` binding but the canonicalized type annotation has only a `T` since the reference is implicit with the `ref` binding. Therefore, to support type annotations, the canonicalized type annotation either needs wrapped in a reference, or the `LocalDecl` type must have a wrapped reference removed for comparison. It is easier to remove the outer reference from the `LocalDecl` for the purpose of comparison, so that is the approach this commit takes.
2018-12-30Refactor `UserTypeAnnotation`.David Wood-11/+11
This commit refactors the `UserTypeAnnotation` type to be referred to by an index within `UserTypeProjection`. `UserTypeAnnotation` is instead kept in an `IndexVec` within the `Mir` struct. Further, instead of `UserTypeAnnotation` containing canonicalized types, it now contains normal types and the entire `UserTypeAnnotation` is canonicalized. To support this, the type was moved from the `rustc::mir` module to `rustc::ty` module.
2018-12-29add non-copy note to stderrcsmoe-8/+8
2018-12-27retrieve ty info from place_tycsmoe-2/+2
describe index with _
2018-12-25Remove licensesMark Rousskov-1889/+412
2018-12-25Auto merge of #57088 - euclio:non-camel-case-early-lint, r=estebankbors-18/+18
make non_camel_case_types an early lint This allows us to catch these kinds of style violations much earlier, as evidenced by the large number of tests that had to be updated for this change.
2018-12-25Auto merge of #56962 - nivkner:fixme_fixup4, r=pnkfelixbors-12/+6
address some FIXME whose associated issues were marked as closed part of #44366
2018-12-24make non_camel_case_types an early lintAndy Russell-18/+18
2018-12-22Update migrate warning wording.David Wood-3/+2
This commit modifies the wording of the warning for backwards-incompatible changes in migrate mode. The warning messages are changed to be lowercase and not include line-breaks in order to be consistent with other compiler diagnostics.
2018-12-20Auto merge of #56649 - davidtwco:issue-46589, r=pnkfelixbors-31/+57
MIR borrowck doesn't accept the example of iterating and updating a mutable reference Fixes #46589. r? @pnkfelix or @nikomatsakis
2018-12-19FIXME(45827) remove comment since errors are reportedNiv Kaminer-12/+6