about summary refs log tree commit diff
path: root/src/test/ui/nll
AgeCommit message (Collapse)AuthorLines
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.
2018-10-27Test for cast causing static promotion failure.David Wood-0/+21
This commit adds a test that ensures that a cast in a static doesn't stop const promotion within the static.
2018-10-26Add test for normalization during field-lookup on patterns with ascribed types.Felix S. Klock II-14/+50
As a drive-by, also added test analogous to existing static_to_a_to_static_through_tuple, but now apply to a struct instead of a tuple.
2018-10-26regression test for ICE I encountered in my patch.Felix S. Klock II-0/+31
2018-10-26Add the actual chain of projections to `UserTypeProjection`.Felix S. Klock II-17/+46
Update the existing NLL `patterns.rs` test accordingly. includes changes addressing review feedback: * Added example to docs for `UserTypeProjections` illustrating how we build up multiple projections when descending into a pattern with type ascriptions. * Adapted niko's suggested docs for `UserTypeProjection`. * Factored out `projection_ty` from more general `projection_ty_core` (as a drive-by, made its callback an `FnMut`, as I discovered later that I need that). * Add note to docs that `PlaceTy.field_ty(..)` does not normalize its result. * Normalize as we project out `field_ty`.
2018-10-25Auto merge of #54490 - wesleywiser:rewrite_it_in_mir, r=oli-obkbors-5/+18
Rewrite the `UnconditionalRecursion` lint to use MIR Part of #51002 r? @eddyb
2018-10-25Auto merge of #55347 - pietroalbini:rollup, r=pietroalbinibors-2/+2
Rollup of 22 pull requests Successful merges: - #53507 (Add doc for impl From for Waker) - #53931 (Gradually expanding libstd's keyword documentation) - #54965 (update tcp stream documentation) - #54977 (Accept `Option<Box<$t:ty>>` in macro argument) - #55138 (in which unused-parens suggestions heed what the user actually wrote) - #55173 (Suggest appropriate syntax on missing lifetime specifier in return type) - #55200 (Documents `From` implementations for `Stdio`) - #55245 (submodules: update clippy from 5afdf8b7 to b1d03437) - #55247 (Clarified code example in char primitive doc) - #55251 (Fix a typo in the documentation of RangeInclusive) - #55253 (only issue "variant of the expected type" suggestion for enums) - #55254 (Correct trailing ellipsis in name_from_pat) - #55269 (fix typos in various places) - #55282 (Remove redundant clone) - #55285 (Do some copy editing on the release notes) - #55291 (Update stdsimd submodule) - #55296 (Set RUST_BACKTRACE=0 for rustdoc-ui/failed-doctest-output.rs) - #55306 (Regression test for #54478.) - #55328 (Fix doc for new copysign functions) - #55340 (Operands no longer appear in places) - #55345 (Remove is_null) - #55348 (Update RELEASES.md after destabilization of non_modrs_mods) Failed merges: r? @ghost
2018-10-25Rollup merge of #55269 - matthiaskrgr:typos_oct, r=zackmdavisPietro Albini-2/+2
fix typos in various places
2018-10-24port the relate-types code from NLL type-check into a type-opNiko Matsakis-0/+48
Add regression tests for #55219 and #55241 Also another test where a duplicate-like error appears to have been suppressed; I'm not 100% sure why this output changes, though I could imagine that some duplicate suppression is enabled by this PR.
2018-10-23Auto merge of #55229 - nikomatsakis:issue-54692-closure-signatures, ↵bors-31/+152
r=MatthewJasper enforce user annotations in closure signatures Not *quite* ready yet but I'm opening anyway. Still have to finish running tests locally. Fixes #54692 Fixes #54124 r? @matthewjasper
2018-10-23check the self type is well-formedNiko Matsakis-0/+37
This fixes `issue-28848.rs` -- it also handles another case that the AST region checker gets wrong (`wf-self-type.rs`). I don't actually think that this is the *right way* to be enforcing this constraint -- I think we should probably do it more generally, perhaps by editing `predicates_of` for the impl itself. The chalk-style implied bounds setup ought to fix this.
2018-10-23fix typos in various placesMatthias Krüger-2/+2
2018-10-23Auto merge of #54778 - scottmcm:stabilize-ihle, r=pnkfelixbors-2/+1
Stabilize impl_header_lifetime_elision in 2015 ~~This is currently blocked on https://github.com/rust-lang/rust/issues/54902; it should be good after that~~ It's already stable in 2018; this finishes the stabilization. FCP completed (https://github.com/rust-lang/rust/issues/15872#issuecomment-417953153), proposal (https://github.com/rust-lang/rust/issues/15872#issuecomment-412759783). Tracking issue: https://github.com/rust-lang/rust/issues/15872 Usage examples (from libcore): https://github.com/rust-lang/rust/pull/54687
2018-10-22stop reporting "unsatisfied lifetime bounds" errors after the firstNiko Matsakis-87/+13
In particular, after the first for a given region variable. This suppresses a lot of duplicate errors.
2018-10-22flesh out closure-substs testNiko Matsakis-8/+66
2018-10-22add regression test for #54124Niko Matsakis-0/+29
Fixes #54124
2018-10-22start enforcing closure typesNiko Matsakis-0/+71
2018-10-21Use new region infer errors for explaining borrowsMatthew Jasper-591/+418
This gives at least some explanation for why a borrow is expected to last for a certain free region. Also: * Reports E0373: "closure may outlive the current function" with NLL. * Special cases the case of returning a reference to (or value referencing) a local variable or temporary (E0515). * Special case assigning a reference to a local variable in a closure to a captured variable.
2018-10-20Give an error number for "borrowed data escapes outside of closure"Matthew Jasper-4/+7
2018-10-20Prefer type annotations and returns in free region errorsMatthew Jasper-1/+1
2018-10-19Stabilize impl_header_lifetime_elision in 2015Scott McMurray-2/+1
It's already stable in 2018; this finishes the stabilization.
2018-10-19normalize the self-type that we extract from implNiko Matsakis-0/+25
2018-10-19add a test that we enforce '`static` errors post normalizationNiko Matsakis-0/+26
2018-10-19create type ascription for any castNiko Matsakis-0/+13
Also, avoid shadowing of the `ty` variable by giving the `cast_ty` and `var_ty` variables different names. We want to get the user-provided type from `cast_ty.hir_id`.
2018-10-19Wrap cast expressions inside of ValueTypeAscriptionKeith Yeung-0/+17
2018-10-19normalize and prove predicatesNiko Matsakis-0/+26
Also include a test that was not working previously.
2018-10-19normalize after substitutionNiko Matsakis-0/+34
2018-10-19propagate user-type annotation for constants in expressionsNiko Matsakis-0/+77
2018-10-17Auto merge of #55134 - davidtwco:issue-55118, r=pnkfelixbors-13/+100
NLL: change compare-mode=nll to use borrowck=migrate Fixes #55118. This PR is split into two parts: The first commit is a minor change that fixes a flaw in the existing `borrowck=migrate` implementation whereby a lint that was promoted to an error in the AST borrow checker would result in the same lint from the NLL borrow checker being downgraded to a warning in migrate mode. This PR fixes this by ensuring lints are exempt from buffering in the NLL borrow checker. The second commit updates `compiletest` to make the NLL compare mode use `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The third commit shows all the test output changes that result from this. r? @pnkfelix
2018-10-17Auto merge of #54941 - pnkfelix:issue-21232-reject-partial-reinit, ↵bors-2/+613
r=nikomatsakis reject partial init and reinit of uninitialized data Reject partial initialization of uninitialized structured types (i.e. structs and tuples) and also reject partial *reinitialization* of such types. Fix #54986 Fix #54499 cc #21232
2018-10-17Some new tests I added.Felix S. Klock II-0/+611
2018-10-17Update output for borrowck=migrate compare mode.David Wood-13/+100
This commit updates the test output for the updated NLL compare mode that uses `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The previous commit changes `compiletest` and this commit only updates `.nll.stderr` files.
2018-10-16add ~ERROR annotationsNiko Matsakis-0/+12
2018-10-16updates to expected output for other ui tests.Felix S. Klock II-2/+2
2018-10-15update testsNiko Matsakis-5/+178
2018-10-12Auto merge of #54942 - matthewjasper:wf-type-annotations, r=nikomatsakisbors-4/+4
[NLL] Check user types are well-formed Also contains a change of span for AscribeUserType. I'm not quite sure if this was what @nikomatsakis was thinking. Closes #54620 r? @nikomatsakis
2018-10-11Auto merge of #54848 - davidtwco:issue-52663-trait-object, r=nikomatsakisbors-0/+40
Better Diagnostic for Trait Object Capture Part of #52663. This commit enhances `LaterUseKind` detection to identify when a borrow is captured by a trait object which helps explain why there is a borrow error. r? @nikomatsakis cc @pnkfelix
2018-10-10Auto merge of #54802 - davidtwco:issue-53040, r=pnkfelixbors-0/+29
[nll] better error message when returning refs to upvars Fixes #53040. r? @nikomatsakis
2018-10-10Use the span of the user type for `AscribeUserType`Matthew Jasper-4/+4
Also change the order of the fake read for let and the AscribeUserType, so that we use the better span and message from the fake read in errors.
2018-10-09Improve message for closure returning a closure.David Wood-1/+1
Now when a `FnMut` closure is returning a closure that contains a reference to a captured variable, we provide an error that makes it more clear what is happening.
2018-10-09Improve errors for `FnMut` closures.David Wood-0/+29
This commit improves the errors for `FnMut` closures where a reference to a captured variable is escaping.
2018-10-09Auto merge of #54757 - nikomatsakis:nll-issue-54573-user-annot, r=pnkfelixbors-0/+192
user annotations in patterns Fixes https://github.com/rust-lang/rust/issues/54573 r? @pnkfelix
2018-10-09Auto merge of #54798 - matthewjasper:free-region-closure-errors, r=nikomatsakisbors-75/+54
[NLL] Improve closure region bound errors Previously, we would report free region errors that originate from closure with the span of the closure and a "closure body requires ..." message. This is now updated to use a reason and span from inside the closure.
2018-10-08add pattern type ascriptions for tuple/brace structs/enumsNiko Matsakis-0/+192
2018-10-07Update logic to search for casts.David Wood-0/+40
This commit updates the captured trait object search logic to look for unsized casts to boxed types rather than for functions that returned trait objects.