summary refs log tree commit diff
path: root/src/test/ui/span
AgeCommit message (Collapse)AuthorLines
2018-09-16Auto merge of #54157 - euclio:structured-suggestion, r=estebankbors-7/+7
use structured suggestion for "missing mut" label Fixes #54133 for both NLL and non-NLL. r? @estebank I'm not super happy with the existing wording here, since it's now a suggestion. I wonder if the message would work better as something like "help: make binding mutable: `mut foo`"? Also, are the `HELP` and `SUGGESTION` comments necessary?
2018-09-14Auto merge of #54088 - matthewjasper:use-reason-in-dlle-errors, r=pnkfelixbors-0/+13
[NLL] Suggest let binding Closes #49821 Also adds an alternative to `explain_why_borrow_contains_point` that allows changing error messages based on the reason that will be given. This will also be useful for #51026, #51169 and maybe further changes to does not live long enough messages.
2018-09-12use structured suggestion for "missing mut" labelAndy Russell-7/+7
Fixes #54133.
2018-09-10Feature gate non-builtin attributes in inner attribute positionVadim Petrochenkov-3/+14
2018-09-09Suggest a let binding to extend temporary lifetimes with NLLMatthew Jasper-0/+13
2018-08-28Auto merge of #53493 - matthewjasper:hair-spans, r=nikomatsakisbors-11/+6
Use smaller span for adjustments on block expressions When returning a mutable reference don't use the entire body of the function as the span for the adjustments at the end. The error [in this case](https://github.com/rust-lang/rust/compare/master...matthewjasper:hair-spans?expand=1#diff-ecef8b1f15622fb48a803c9b61605c78) is worse, but neither error message is really what we want. I have some ideas on how to get a better error message that will have to wait for a future PR.
2018-08-27Also use smaller spans for unsize adjustmentsMatthew Jasper-11/+6
2018-08-20resolve: Consolidate error reporting for resolved macros in `fn ↵Vadim Petrochenkov-4/+4
resolve_macro_to_def`
2018-08-14Label definition of captured variables in errors.David Wood-0/+3
2018-08-06Auto merge of #52332 - ↵bors-6/+6
zackmdavis:dead_code_lint_should_say_2_electric_boogaloo, r=pnkfelix dead-code lint: say "constructed" for structs Respectively. This is a sequel to November 2017's #46103 / 1a9dc2e9. It had been reported (more than once—at least #19140, #44083, and #44565) that the "never used" language was confusing for enum variants that were "used" as match patterns, so the wording was changed to say never "constructed" specifically for enum variants. More recently, the same issue was raised for structs (#52325). It seems consistent to say "constructed" here, too, for the same reasons. ~~While we're here, we can also use more specific word "called" for unused functions and methods. (We declined to do this in #46103, but the rationale given in the commit message doesn't actually make sense.)~~ This resolves #52325.
2018-08-03Update tests for new spans for nll errors involving closuresMatthew Jasper-24/+22
2018-08-03Auto merge of #52948 - davidtwco:issue-52633-later-loop-iteration, r=pnkfelixbors-5/+5
NLL: Better Diagnostic When "Later" means "A Future Loop Iteration" Part of #52663. r? @pnkfelix
2018-08-01minor fallout from the change.Felix S. Klock II-2/+0
(Presumably the place that borrow_check ends up reporting for the error about is no longer the root `Local` itself, and thus the note diagnostic here stops firing.)
2018-08-01Errors are more specific in cases where borrows are used in future ↵David Wood-5/+5
iterations of loops.
2018-08-01Rollup merge of #52904 - pnkfelix:issue-51167-sort-by-span, r=petrochenkovPietro Albini-55/+55
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-07-31Update the `.nll.stderr` files under new sorted-by-span scheme.Felix S. Klock II-55/+55
2018-07-30Include lifetime in mutability suggestion in NLL messagesEsteban Küber-5/+5
2018-07-26Use better spans for dummy accesses used in matchesMatthew Jasper-5/+5
2018-07-26Rollup merge of #52617 - matthewjasper:remove-unused-code, r=nikomatsakisMark Rousskov-51/+51
Don't match on region kinds when reporting NLL errors First half (by number of tests affected) of the changes to "does not live long enough". Now that lexical MIR borrowck is gone, region kinds are always ReVar, so matching on them to change errors does nothing. Changes "borrowed value only lives until here" to "`x` is dropped here while still borrowed". r? @pnkfelix cc @nikomatsakis
2018-07-24Rollup merge of #52605 - estebank:str-plus-eq, r=oli-obkkennytm-6/+2
Do not suggest using `to_owned()` on `&str += &str` - Don't provide incorrect suggestion for `&str += &str` (fix #52410) - On `&str + String` suggest `&str.to_owned() + &String` as a single suggestion
2018-07-23Don't match on region kinds when reporting NLL errorsMatthew Jasper-51/+51
With NLL region kinds are always ReVar
2018-07-23Match errors using the callsite of macro expansionsFederico Poli-2/+5
2018-07-22Rollup merge of #52507 - estebank:infer-type, r=nikomatsakiskennytm-3/+3
Reword when `_` couldn't be inferred r? @nikomatsakis
2018-07-21Do not suggest using `to_owned()` on `&str += &str`Esteban Küber-6/+2
2018-07-21dead-code lint: say "constructed" for structsZack M. Davis-6/+6
This is a sequel to November 2017's #46103 / 1a9dc2e9. It had been reported (more than once—at least #19140, #44083, and #44565) that the "never used" language was confusing for enum variants that were "used" as match patterns, so the wording was changed to say never "constructed" specifically for enum variants. More recently, the same issue was raised for structs (#52325). It seems consistent to say "constructed" here, too, for the same reasons. We considered using more specific word "called" for unused functions and methods (while we declined to do this in #46103, the rationale given in the commit message doesn't actually make sense), but it turns out that Cargo's test suite expects the "never used" message, and maybe we don't care enough even to make a Cargo PR over such a petty and subjective wording change. This resolves #52325.
2018-07-21Add specific message when moving from upvars in a non-FnOnce closureMatthew Jasper-2/+2
2018-07-20Update tests for new NLL mutability errorsMatthew Jasper-21/+21
2018-07-20Reword when `_` couldn't be inferredEsteban Küber-3/+3
2018-07-06Rollup merge of #52067 - csmoe:issue-51167, r=nikomatsakisMark Rousskov-28/+28
Visit the mir basic blocks in reverse-postfix order cc #51167 r? @nikomatsakis
2018-07-05update testcsmoe-28/+28
2018-07-01Make causal tracking lazySantiago Pastorino-22/+6
2018-06-23add `dyn` to display of dynamic (trait) type namesZack M. Davis-1/+1
The `dyn Trait` syntax was stabilized in 199ee327. Resolves #49277.
2018-06-19Suggest that values are dropped in the opposite order they are definedSantiago Pastorino-0/+36
2018-06-19NLL: Updates to diagnostic output in `test/ui`.Felix S. Klock II-18/+59
2018-05-29Fix typoEsteban Küber-1/+1
2018-05-28Add primary span labelEsteban Küber-3/+4
2018-05-28Only suggest assoc fn when sure about the typeEsteban Küber-6/+2
2018-05-27Use suggestion for assoc fn called like methodEsteban Küber-8/+11
When encountering an unexisting method for a given trait where an associated function has the same name, suggest using the appropriate syntax, instead of using `help` text. When only one candidate is found, do not call it "candidate #1", just call it "the candidate".
2018-05-25rust-lang/rust#51025: improve test robustness so that they work under NLL too.Felix S. Klock II-110/+233
2018-05-13Improve eager type resolution error messageleonardo.yvens-0/+52
This PR improves the span of eager resolution type errors referring to indexing and field access to use the base span rather than the whole expression. Also a note "Type must be known at this point." is added to where we at some point in the past emitted the "type must be known at this context" error, so that early failures can be differentiated and will hopefully be less surprising. Fixes #50692 (or at least does the best we can for the moment) r? @estebank
2018-05-10Fix tuple struct field spansEsteban Küber-1/+1
2018-04-28stabilize `#[must_use]` for functions and must-use operatorsZack M. Davis-40/+1
This is in the matter of RFC 1940 and tracking issue #43302.
2018-04-18Workaround rust-lang/rust#49998 by opting into experimental `-Z ↵Felix S. Klock II-9/+12
nll-subminimal-causes` flag This commit only applies the flag to the one test case, ui/span/dropck_vec_cycle_checked.rs, that absolutely needs it. Without the flag, that test takes an unknown amount of time (greater than 1 minute) to compile. But its possible that other tests would also benefit from the flag, and we may want to make it the default (after evaluating its impact on other tests). In terms of its known impact on other tests, I have only evaluated the ui tests, and the *only* ui test I have found that the flag impacts (running under NLL mode, of course), is src/test/ui/nll/issue-31567.rs In particular: ``` % ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/nll/issue-31567.rs error[E0597]: `*v.0` does not live long enough --> ../src/test/ui/nll/issue-31567.rs:22:26 | 22 | let s_inner: &'a S = &*v.0; //~ ERROR `*v.0` does not live long enough | ^^^^^ borrowed value does not live long enough 23 | &s_inner.0 24 | } | - borrowed value only lives until here | note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:1... --> ../src/test/ui/nll/issue-31567.rs:21:1 | 21 | fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0597`. % ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/nll/issue-31567.rs -Z nll-subminimal-causes error[E0597]: `*v.0` does not live long enough --> ../src/test/ui/nll/issue-31567.rs:22:26 | 22 | let s_inner: &'a S = &*v.0; //~ ERROR `*v.0` does not live long enough | ^^^^^ borrowed value does not live long enough 23 | &s_inner.0 24 | } | - | | | borrowed value only lives until here | borrow later used here, when `v` is dropped error: aborting due to previous error For more information about this error, try `rustc --explain E0597`. % ```
2018-04-18Update the previously checkpointed (but unused by bors) tests to reflect ↵Felix S. Klock II-14/+60
current reality.
2018-04-13Rename must-compile-successfully into compile-passGuillaume Gomez-2/+2
2018-04-11Checkpoint the current status of NLL on `ui` tests via compare-mode=nll.Felix S. Klock II-0/+923
2018-04-11Workaround rust-lang/rust#49855 by forcing rustc_error in any mode, ↵Felix S. Klock II-16/+16
including NLL. NOTE: I was careful to make each change in a manner that preserves the existing diagnostic output (usually by ensuring that no lines were added or removed). This means that the resulting source files are not as nice to read as they were at the start. But we will have to review these cases by hand anyway as follow-up work, so cleanup could reasonably happen then (or not at all).
2018-03-25Rollup merge of #49299 - SimonSapin:ubiquity, r=nikomatsakiskennytm-5/+8
Stabilize the copy_closures and clone_closures features In addition to the `Fn*` family of traits, closures now implement `Copy` (and similarly `Clone`) if all of the captures do. Tracking issue: https://github.com/rust-lang/rust/issues/44490
2018-03-23Stabilize the copy_closures and clone_closures featuresSimon Sapin-5/+8
In addition to the `Fn*` family of traits, closures now implement `Copy` (and similarly `Clone`) if all of the captures do.
2018-03-16Update testsJohn Kåre Alsaker-1/+4