about summary refs log tree commit diff
path: root/src/test/ui/nll
AgeCommit message (Collapse)AuthorLines
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
2018-12-17Kill borrows from a projection after assignment.David Wood-47/+7
This commit extends previous work to kill borrows from a local after assignment into that local to kill borrows from a projection after assignment into a prefix of that place.
2018-12-13Make determining the discriminant a normal Shallow readMatthew Jasper-5/+29
Enum layout optimizations mean that the discriminant of an enum may not be stored in a tag disjoint from the rest of the fields of the enum. Stop borrow checking as though they are.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-12-07Fix ICE in region naming.David Wood-0/+79
This commit puts a fix in place for the ICE in region naming code so that it doesn't break the compiler. However, this results in the diagnostic being poorer as the borrow explanation that was causing the ICE is not being added - this should be fixed as a follow-up.
2018-12-06Add test for #46589.David Wood-0/+66
This commit adds the test for writing into a projection of a local to confirm there are no remaining borrows.
2018-12-05Rollup merge of #56372 - wildarch:issue-55314-second-borrow-ref, r=davidtwcoPietro Albini-2/+2
Refer to the second borrow as the "second borrow" in E0501.rs Fixes #55314. r? @davidtwco
2018-12-04Auto merge of #56486 - matthewjasper:propagate-all-closure-bounds, r=pnkfelixbors-0/+42
Propagate all closure requirements to the caller Closes #56477 This should be backported to 1.32 if it doesn't make the cut. r? @pnkfelix cc @nikomatsakis
2018-12-04Update testsOliver Scherer-49/+79
2018-12-03Propagate all closure requirements to the callerMatthew Jasper-0/+42
2018-11-30Refer to the second borrow as the "second borrow".Daan de Graaf-2/+2
2018-11-26Put all existential ty vars in the `ROOT` universescalexm-1/+1
2018-11-25Auto merge of #55921 - scalexm:placeholders, r=nikomatsakisbors-2/+2
Add placeholder types Fixes #48696 (handle universes in canonicalization of type inference vars), and fixes #55098.
2018-11-25Auto merge of #55959 - matthewjasper:remove-end-region, r=nikomatsakisbors-4/+4
Cleanup from lexical MIR borrowck removal Lexical MIR borrowck was removed months ago now, and `EndRegion`s are no longer used for MIRI verification. * Remove `rustc::mir::StatementKind::EndRegion` and the `-Zemit_end_regions` flag * Use `RegionVid` instead of `Region` in BorrowSet * Rewrite drop generation to create fewer goto terminators. r? @nikomatsakis
2018-11-24Fix NLL ui testscalexm-2/+2
2018-11-19Rollup merge of #56043 - nikomatsakis:issue-55756-via-outlives, r=eddybPietro Albini-0/+37
remove "approx env bounds" if we already know from trait Alternative to https://github.com/rust-lang/rust/pull/55988 that fixes #55756 -- smaller fix that I cannot see having (correctness) repercussions beyond the test at hand, and hence better for backporting. (Famous last words, I know.) r? @eddyb
2018-11-18remove "approx env bounds" if we already know from traitNiko Matsakis-0/+37
2018-11-18Remove mir::StatementKind::EndRegionMatthew Jasper-4/+4
Since lexical MIR borrow check is gone, and validation no longer uses these, they can be removed.
2018-11-15Rollup merge of #55781 - ↵Pietro Albini-0/+63
pnkfelix:issue-54382-more-precise-spans-for-temps-and-their-drops, r=davidtwco More precise spans for temps and their drops This PR has two main enhancements: 1. when possible during code generation for a statement (like `expr();`), pass along the span of a statement, and then attribute the drops of temporaries from that statement to the statement's end-point (which will be the semicolon if it is a statement that is terminating by a semicolon). 2. when evaluating a block expression into a MIR temp, use the span of the block's tail expression (rather than the span of whole block including its statements and curly-braces) for the span of the temp. Each of these individually increases the precision of our diagnostic output; together they combine to make a much clearer picture about the control flow through the spans. Fix #54382
2018-11-13Fix ui testsscalexm-6/+6
2018-11-11Auto merge of #55657 - davidtwco:issue-55651, r=pnkfelixbors-0/+38
NLL Diagnostic Review 3: Unions not reinitialized after assignment into field Fixes #55651, #55652. This PR makes two changes: First, it updates the dataflow builder to add an init for the place containing a union if there is an assignment into the field of that union. Second, it stops a "use of uninitialized" error occuring when there is an assignment into the field of an uninitialized union that was previously initialized. Making this assignment would re-initialize the union, as tested in `src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr`. The check for previous initialization ensures that we do not start supporting partial initialization yet (cc #21232, #54499, #54986). This PR also fixes #55652 which was marked as requiring investigation as the changes in this PR add an error that was previously missing (and mentioned in the review comments) and confirms that the error that was present is correct and a result of earlier partial initialization changes in NLL. r? @pnkfelix (due to earlier work with partial initialization) cc @nikomatsakis
2018-11-11Rollup merge of #55822 - davidtwco:issue-55394, r=pnkfelixPietro Albini-0/+37
ICE with #![feature(nll)] and elided lifetimes Fixes #55394. This commit fixes an ICE and determines the correct return span in cases with a method implemented on a struct with an an elided lifetime. r? @pnkfelix
2018-11-09Fix ICE and find correct return span.David Wood-0/+37
This commit fixes an ICE and determines the correct return span in cases with a method implemented on a struct with an an elided lifetime.
2018-11-08Revise the temp creation for blocks in `stmt_expr` to setup `BlockTailInfo`.Felix S. Klock II-0/+2
2018-11-08Regression test for issue #54382Felix S. Klock II-0/+61
(I opted to rely on compare-mode=nll rather than opt into `#![feature(nll)]`, mostly to make it easy to observe the interesting differences between the AST-borrwock diagnostic and the NLL one.)
2018-11-07Ignore never-initialized locals for `unused_mut`.David Wood-0/+26
This commit filters out locals that have never been initialized for consideration in the `unused_mut` lint. This is intended to detect when the statement that would have initialized the local was removed as unreachable code. In these cases, we would not want to lint. This is the same behaviour as the AST borrow checker. This is achieved by taking advantage of an existing pass over the MIR for the `unused_mut` lint and creating a set of those locals that were never initialized.
2018-11-05Add run-pass test for reinitialized unions.David Wood-0/+38
This commit adds a run-pass test for the subset of `src/test/ui/borrowck/borrowck-union-move-assign.rs` that is intended to pass as the union is reinitialized.
2018-11-02Auto merge of #55305 - nikomatsakis:universes-refactor-3, r=scalexmbors-5/+5
universes refactor 3 Some more refactorings from my universe branch. These are getting a bit more "invasive" -- they start to plumb the universe information through the canonicalization process. As of yet though I don't **believe** this branch changes our behavior in any notable way, though I'm marking the branch as `WIP` to give myself a chance to verify this. r? @scalexm
2018-10-29Don't emit cannot move errors twice in migrate modeMatthew Jasper-85/+1
2018-10-27allow canonicalized regions to carry universe and track max-universeNiko Matsakis-5/+5
But.. we don't really use it for anything right now.