about summary refs log tree commit diff
path: root/src/test/ui/nll
AgeCommit message (Collapse)AuthorLines
2018-08-05Closes #52413: Provide structured suggestion instead of labelPramod Bisht-3/+3
2018-08-05Use span of the closure args in free region errorsMatthew Jasper-4/+5
2018-08-05Auto merge of #52959 - matthewjasper:closure-spans, r=pnkfelixbors-20/+686
[NLL] Use smaller spans for errors involving closure captures Closes #51170 Closes #46599 Error messages involving closures now point to the captured variable/closure args. r? @pnkfelix
2018-08-05Auto merge of #52991 - nikomatsakis:nll-escaping-into-return, r=pnkfelixbors-16/+31
avoid computing liveness for locals that escape into statics Fixes #52713 I poked at this on the plane and I think it's working -- but I want to do a bit more investigation and double check. The idea is to identify those local variables where the entire value will "escape" into the return -- for them, we don't need to compute liveness, since we know that the outlives relations from the return type will force those regions to be equal to free regions. This should help with html5ever in particular. - [x] test performance - [x] verify correctness - [x] add comments r? @pnkfelix cc @lqd
2018-08-03Update tests for new spans for nll errors involving closuresMatthew Jasper-20/+20
2018-08-03Tests for closure spansMatthew Jasper-0/+666
2018-08-03Auto merge of #52973 - davidtwco:issue-52663-lifetimes-not-included-in-span, ↵bors-1/+44
r=pnkfelix NLL mentions lifetimes that are not included in printed span(s). Part of #52663. r? @pnkfelix
2018-08-03update error messages -- in some cases maybe we should investigateNiko Matsakis-16/+31
2018-08-02Explicitly label any named lifetimes mentioned in error messages.David Wood-1/+44
2018-08-01Rollup merge of #52834 - matthewjasper:allow-zst-conflicts, r=pnkfelixPietro Albini-0/+23
[NLL] Allow conflicting borrows of promoted length zero arrays This is currently overkill as there's no way to create two conflicting borrows of any promoted. It is possible that the following code might not fail due to const eval in the future (@oli-obk?). In which case either the array marked needs to not be promoted, or to be checked for conflicts ```rust static mut A: () = { let mut y = None; let z; let mut done_y = false; loop { let x = &mut [1]; // < this array if done_y { z = x; break; } y = Some(x); done_y = true; } some_const_fn(y, z); // some_const_fn expects that y to not alias z. }; ``` r? @pnkfelix @nikomatsakis closes #52671 cc #51823
2018-08-01Rollup merge of #52907 - ↵Pietro Albini-9/+20
pnkfelix:issue-52877-original-source-should-precede-suggestions, r=petrochenkov NLL: On "cannot move out of type" error, print original before rewrite NLL: On "cannot move out of type" error, print original source before rewrite. * Arguably this change is sometimes injecting noise into the output (namely in the cases where the suggested rewrite is inline with the suggestion and we end up highlighting the original source code). I would not be opposed to something more aggressive/dynamic, like revising the suggestion code to automatically print the original source when necessary (e.g. when the error does not have a span that includes the span of the suggestion). * Also, as another note on this change: The doc comment for `Diagnostic::span_suggestion` says: ```rust /// The message /// /// * should not end in any punctuation (a `:` is added automatically) /// * should not be a question /// * should not contain any parts like "the following", "as shown" ``` * but the `:` is *not* added when the emitted line appears out-of-line relative to the suggestion. I find that to be an unfortunate UI experience. ---- As a drive-by fix, also changed code to combine multiple suggestions for a pattern into a single multipart suggestion (which vastly improves user experience IMO). ---- Includes the updates to expected NLL diagnostics. Fix #52877
2018-08-01Rollup merge of #52904 - pnkfelix:issue-51167-sort-by-span, r=petrochenkovPietro Albini-254/+254
NLL: sort diagnostics by span Sorting the output diagnostics by span is a long planned revision to the NLL diagnostics that we hope will yield a less surprising user experience in some case. Once we got them buffered, it was trivial to implement. (The hard part is skimming the resulting changes to the diagnostics to make sure nothing broke... Note that I largely rubber-stamped the `#[rustc_regions]` output change.) Fix #51167
2018-08-01Rollup merge of #52878 - mikhail-m1:master, r=kennytmPietro Albini-1/+1
Fix wrong issue number in the test name I made a mistake in previous PR #52620, second issue number was wrong, changing from #52133 to #52113 r? @kennytm
2018-08-01Rollup merge of #52810 - matthewjasper:more-immutablity, r=pnkfelixPietro Albini-0/+9
[NLL] Don't make "fake" match variables mutable These variables can't be mutated by the user, but since they have names the unused-mut lint thinks that it should check them.
2018-07-31Allow borrow conflicts for promoted length 0 arraysMatthew Jasper-0/+23
2018-07-31NLL: On "cannot move out of type" error, print original source before rewrite.Felix S. Klock II-9/+20
* Arguably this change is sometimes injecting noise into the output (namely in the cases where the suggested rewrite is inline with the suggestion and we end up highlighting the original source code). I would not be opposed to something more aggressive/dynamic, like revising the suggestion code to automatically print the original source when necessary (e.g. when the error does not have a span that includes the span of the suggestion). * Also, as another note on this change: The doc comment for `Diagnostic::span_suggestion` says: /// The message /// /// * should not end in any punctuation (a `:` is added automatically) /// * should not be a question /// * should not contain any parts like "the following", "as shown" but the `:` is *not* added when the emitted line appears out-of-line relative to the suggestion. I find that to be an unfortunate UI experience. ---- As a drive-by fix, also changed code to combine multiple suggestions for a pattern into a single multipart suggestion (which vastly improves user experience IMO). ---- Includes the updates to expected NLL diagnostics.
2018-07-31Blindly update the `#[rustc_region]` tests which got touched by the NLL ↵Felix S. Klock II-254/+254
diagnostic change.
2018-07-30Fix wrong issue number in the test nameMikhail Modin-1/+1
2018-07-29Auto merge of #52620 - mikhail-m1:51351, r=nikomatsakisbors-46/+139
fix simple case of issue #51351 and #52133 r? @nikomatsakis
2018-07-29fix issues #51351 and #52133Mikhail Modin-46/+139
2018-07-28Don't make "fake" match variables mutableMatthew Jasper-0/+9
2018-07-28Auto merge of #52678 - matthewjasper:better-spans, r=nikomatsakisbors-12/+184
[NLL] Use better spans in some errors * Use the span of the discriminant and patterns for "fake" statements created to properly check matches. I plan to special case these soon, but this felt like a good first step * Use the span of the statement, rather than the initialization, when reporting move errors for `let x = ...`, which avoids giving an unhelpful suggestion to use `&{ }`. r? @nikomatsakis cc @pnkfelix
2018-07-27Region inference error messages no longer start with 'free region'David Wood-2/+2
2018-07-27Improved mechanism for naming regions in non-annotated types.David Wood-10/+10
2018-07-27Change label from closure to function where appropriate.David Wood-15/+15
2018-07-27Update affected tests.David Wood-14/+14
2018-07-26Use better spans for cannot-move errorsMatthew Jasper-0/+175
2018-07-26Use better spans for dummy accesses used in matchesMatthew Jasper-12/+9
2018-07-26Auto merge of #52735 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-9/+9
Rollup of 16 pull requests Successful merges: - #52558 (Add tests for ICEs which no longer repro) - #52610 (Clarify what a task is) - #52617 (Don't match on region kinds when reporting NLL errors) - #52635 (Fix #[linkage] propagation though generic functions) - #52647 (Suggest to take and ignore args while closure args count mismatching) - #52649 (Point spans to inner elements of format strings) - #52654 (Format linker args in a way that works for gcc and ld) - #52667 (update the stdsimd submodule) - #52674 (Impl Executor for Box<E: Executor>) - #52690 (ARM: expose `rclass` and `dsp` target features) - #52692 (Improve readability in a few sorts) - #52695 (Hide some lints which are not quite right the way they are reported to the user) - #52718 (State default capacity for BufReader/BufWriter) - #52721 (std::ops::Try impl for std::task::Poll) - #52723 (rustc: Register crates under their real names) - #52734 (sparc ABI issue - structure returning from function is returned in 64bit registers (with tests)) Failed merges: - #52678 ([NLL] Use better spans in some errors) r? @ghost
2018-07-26move mir_check_* to ui tests, add adjusted referencesNiko Matsakis-0/+188
2018-07-26fix reference fileNiko Matsakis-1/+1
2018-07-25Nit: improve comment in hr-fn-aau-eq-abu.rsNiko Matsakis-10/+10
2018-07-25improve heuristics for what makes an interesting constraintNiko Matsakis-15/+15
2018-07-25add regression test for #48071Niko Matsakis-0/+38
Fixes #48071
2018-07-25introduce new subtypingNiko Matsakis-0/+108
2018-07-25remove unnecessary `blame_span` from `report_region_errors`Niko Matsakis-14/+24
2018-07-23Don't match on region kinds when reporting NLL errorsMatthew Jasper-9/+9
With NLL region kinds are always ReVar
2018-07-22Auto merge of #52564 - pnkfelix:issue-52126-lhs-of-assign-op-is-invariant, ↵bors-1/+1
r=eddyb LHS of assign op is invariant This addresses a bug injected by #45435. That PR changed the way we type-check `LHS <op> RHS` to coerce the LHS to the expected supertype in much the same way that we coerce the RHS. The problem is that when we have a case of `LHS <op>= RHS`, we do not want to coerce to a supertype; we need the type to remain invariant. Otherwise we risk leaking a value with short-lifetimes into a expression context that needs to satisfy a long lifetime. Fix #52126
2018-07-22Fallback to general error handling in ICE cases.David Wood-10/+17
2018-07-21Auto merge of #51959 - tmandry:make-implied-outlives-query, r=nikomatsakisbors-0/+37
Turn implied_outlives_bounds into a query Right now all this does is remove the error reporting in `implied_outlives_bounds`, which seems to work. Farming out full tests to Travis. For #51649. That issue is deferred so not sure what's next. r? @nikomatsakis
2018-07-21add regression test for #52078Niko Matsakis-0/+37
Fixes #52078
2018-07-20Update tests for new NLL mutability errorsMatthew Jasper-1/+232
2018-07-20For some reason, on my linux box, using `-Zverbose` here is causing a linker ↵Felix S. Klock II-1/+1
failure. Rather than try to work out what was happening, I just removed the flag because I see no reason for it to be on this test.
2018-07-13Auto merge of #52242 - ashtneoi:suggest-ref-mut, r=pnkfelixbors-0/+28
NLL: Suggest `ref mut` and `&mut self` Fixes #51244. Supersedes #51249, I think. Under the old lexical lifetimes, the compiler provided helpful suggestions about adding `mut` when you tried to mutate a variable bound as `&self` or (explicit) `ref`. NLL doesn't have those suggestions yet. This pull request adds them. I didn't bother making the help text exactly the same as without NLL, but I can if that's important. (Originally this was supposed to be part of #51612, but I got bogged down trying to fit everything in one PR.)
2018-07-12Bless tests and update ERRORashtneoi-5/+6
2018-07-12span_suggestioncsmoe-0/+27
2018-07-13compute region values using SCCs not iterative flowNiko Matsakis-15/+15
The strategy is this: - we compute SCCs once all outlives constraints are known - we allocate a set of values **per region** for storing liveness - we allocate a set of values **per SCC** for storing the final values - when we add a liveness constraint to the region R, we also add it to the final value of the SCC to which R belongs - then we can apply the constraints by just walking the DAG for the SCCs and union'ing the children (which have their liveness constraints within) There are a few intermediate refactorings that I really ought to have broken out into their own commits: - reverse the constraint graph so that `R1: R2` means `R1 -> R2` and not `R2 -> R1`. This fits better with the SCC computation and new style of inference (`->` now means "take value from" and not "push value into") - this does affect some of the UI tests, since they traverse the graph, but mostly the artificial ones and they don't necessarily seem worse - put some things (constraint set, etc) into `Rc`. This lets us root them to permit mutation and iteration. It also guarantees they don't change, which is critical to the correctness of the algorithm. - Generalize various helpers that previously operated only on points to work on any sort of region element.
2018-07-06Rollup merge of #52067 - csmoe:issue-51167, r=nikomatsakisMark Rousskov-12/+12
Visit the mir basic blocks in reverse-postfix order cc #51167 r? @nikomatsakis
2018-07-06Auto merge of #52021 - nikomatsakis:nll-region-errors, r=estebankbors-81/+109
refactor and cleanup region errors for NLL This is a WIP commit. It simplifies some of the code from https://github.com/rust-lang/rust/pull/51536 and extends a few more steps towards the errors that @davidtwco and I were shooting for. These are intended as a replacement for the general "unable to infer lifetime" messages -- one that is actually actionable. We're certainly not there yet, but the overall shape hopefully gets a bit clearer. I'm thinking about trying to open up an internals thread to sketch out the overall plan and perhaps discuss how to get the wording right, which special cases to handle, etc. r? @estebank cc @davidtwco
2018-07-05update testcsmoe-12/+12