summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2017-10-06Merge remote-tracking branch 'origin/beta' into beta-nextAlex Crichton-13/+33
2017-10-06Revert "Cleanup some remains of `hr_lifetime_in_assoc_type` compatibility lint"Niko Matsakis-0/+2
This reverts commit 80cf3f99f4a3377fd9b544d18017ef29b8713dfd.
2017-09-29WIP: don't suggest placing `use` statements into expanded codeOliver Schneider-5/+5
2017-09-29Add test for broken suggestionOliver Schneider-9/+29
2017-08-26Auto merge of #44098 - frewsxcv:rollup, r=frewsxcvbors-6/+7
Rollup of 7 pull requests - Successful merges: #43776, #43966, #43979, #44072, #44086, #44090, #44091 - Failed merges:
2017-08-26Rollup merge of #43776 - zackmdavis:feature_gate_fn_must_use, r=alexcrichtonCorey Farwell-6/+7
feature-gate #[must_use] for functions as `fn_must_use` @eddyb I [was](https://github.com/rust-lang/rust/pull/43728#issuecomment-320854120) [dithering](https://github.com/rust-lang/rust/pull/43728#issuecomment-320856407) on this, but [your comment](https://github.com/rust-lang/rust/issues/43302#issuecomment-321174989) makes it sound like we do want a feature gate for this? Please advise. r? @eddyb
2017-08-26Auto merge of #44081 - est31:master, r=eddybbors-0/+52
Fix a byte/char confusion issue in the error emitter Fixes #44078. Fixes #44023. The start_col member is given in chars, while the code previously assumed it was given in bytes. The more basic issue #44080 doesn't get fixed.
2017-08-25Fix a byte/char confusion issue in the error emitterest31-0/+52
Fixes #44078. Fixes #44023. The start_col member is given in chars, while the code previously assumed it was given in bytes. The more basic issue #44080 doesn't get fixed.
2017-08-25Auto merge of #43700 - gaurikholkar:struct_lifetimes, r=nikomatsakisbors-53/+306
Adding E0623 for structs This is a fix to #43275 The error message is ``` +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:12 + | +14 | fn foo(mut x: Vec<Ref>, y: Ref) { + | --- --- these structs are declared with different lifetimes... +15 | x.push(y); + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error ``` r? @nikomatsakis
2017-08-23minor fixgaurikholkar-1/+1
2017-08-23code review fixesgaurikholkar-66/+6
2017-08-22hard feature-gate for #[must_use] on functionsZack M. Davis-6/+7
We'll actually want a new "soft" warning-only gate to maintain backwards-compatibility, but it's cleaner to start out with the established, well-understood gate before implementing the alternative warn-only behavior in a later commit. This is in the matter of #43302.
2017-08-22Fix fallout in tests.Jeffrey Seyfried-44/+38
2017-08-22Auto merge of #43854 - estebank:missing-cond, r=nikomatsakisbors-0/+39
Point out missing if conditional On a case where an else conditional is missing, point this out instead of the token immediately after the (incorrect) else block: ``` error: missing condition for `if` statemementt push fork -f --> $DIR/issue-13483.rs:16:5 | 13 | } else if { | ^ expected if condition here ``` instead of ``` error: expected `{`, found `else` --> ../../src/test/ui/issue-13483.rs:14:7 | 14 | } else { | ^^^^ ``` Fix #13483.
2017-08-21Auto merge of #43929 - oli-obk:use_placement, r=nrcbors-17/+82
Improve placement of `use` suggestions r? @nrc cc @estebank @Mark-Simulacrum fixes #42835 fixes #42548 fixes #43769
2017-08-19Auto merge of #43933 - topecongiro:bad-span-for-attributes, r=petrochenkovbors-2/+2
Fix bad span for attributes Closes #42641.
2017-08-18Auto merge of #43901 - GuillaumeGomez:unsized-union-field, r=petrochenkovbors-0/+58
udpdate error message for unsized union field Fixes #36312.
2017-08-18Handle structs, unions and enums unsized field/variant separatelyGuillaume Gomez-2/+31
2017-08-17Verify that an `if` condition block returns a valueEsteban Küber-4/+19
2017-08-17Check for `else` keyword on missing `if` conditionEsteban Küber-13/+1
2017-08-17Point out missing if conditionalEsteban Küber-0/+36
On a case where an else conditional is missing, point this out instead of the token immediately after the (incorrect) else block: ``` error: missing condition for `if` statemementt push fork -f --> $DIR/issue-13483.rs:16:5 | 13 | } else if { | ^ expected if condition here ``` instead of ``` error: expected `{`, found `else` --> ../../src/test/ui/issue-13483.rs:14:7 | 14 | } else { | ^^^^ ```
2017-08-17Improve placement of `use` suggestionsOliver Schneider-17/+82
2017-08-17Update ui testsSeiichi Uchida-2/+2
2017-08-17Adding E0623 for structsgaurikholkar-53/+366
2017-08-16Auto merge of #43864 - GuillaumeGomez:static-method-invalid-use, r=eddybbors-0/+4
Add help for static method invalid use Fixes #30391.
2017-08-16Stabilize rvalue promotion to 'static.Eduard-Mihai Burtescu-38/+47
2017-08-16Auto merge of #43850 - GuillaumeGomez:unused-variable-lint, r=arielb1bors-0/+1
Add a note to unused variables Fixes #26720.
2017-08-16Add a note to unused variablesGuillaume Gomez-0/+1
2017-08-16udpdate error message for unsized union fieldGuillaume Gomez-0/+29
2017-08-14Add help for static method invalid useGuillaume Gomez-0/+4
2017-08-11Don't trigger unused_result on functions returning empty enumsOwen Sanchez-0/+7
2017-08-11Fix unused_result lint triggering when a function returns `()` or `!`Owen Sanchez-0/+26
Add a test for this case
2017-08-10Auto merge of #43720 - pornel:staticconst, r=petrochenkovbors-0/+27
Hint correct extern constant syntax Error message for `extern "C" { const …}` is terse, and the right syntax is hard to guess given unfortunate difference between meaning of `static` in C and Rust. I've added a hint for the right syntax.
2017-08-10Reword error hintKornel-1/+1
2017-08-10Auto merge of #43522 - alexcrichton:rewrite-lints, r=michaelwoeristerbors-72/+127
rustc: Rearchitect lints to be emitted more eagerly In preparation for incremental compilation this commit refactors the lint handling infrastructure in the compiler to be more "eager" and overall more incremental-friendly. Many passes of the compiler can emit lints at various points but before this commit all lints were buffered in a table to be emitted at the very end of compilation. This commit changes these lints to be emitted immediately during compilation using pre-calculated lint level-related data structures. Linting today is split into two phases, one set of "early" lints run on the `syntax::ast` and a "late" set of lints run on the HIR. This commit moves the "early" lints to running as late as possible in compilation, just before HIR lowering. This notably means that we're catching resolve-related lints just before HIR lowering. The early linting remains a pass very similar to how it was before, maintaining context of the current lint level as it walks the tree. Post-HIR, however, linting is structured as a method on the `TyCtxt` which transitively executes a query to calculate lint levels. Each request to lint on a `TyCtxt` will query the entire crate's 'lint level data structure' and then go from there about whether the lint should be emitted or not. The query depends on the entire HIR crate but should be very quick to calculate (just a quick walk of the HIR) and the red-green system should notice that the lint level data structure rarely changes, and should hopefully preserve incrementality. Overall this resulted in a pretty big change to the test suite now that lints are emitted much earlier in compilation (on-demand vs only at the end). This in turn necessitated the addition of many `#![allow(warnings)]` directives throughout the compile-fail test suite and a number of updates to the UI test suite. Closes https://github.com/rust-lang/rust/issues/42511
2017-08-10Auto merge of #43737 - GuillaumeGomez:duplicate-method, r=eddybbors-0/+42
Improve error message when duplicate names for type and trait method Fixes #43626.
2017-08-10Better diagnostics and recovery for `const` in extern blocksVadim Petrochenkov-0/+27
2017-08-09Auto merge of #43484 - estebank:point-to-return, r=arielb1bors-0/+23
Point at return type always when type mismatch against it Before this, the diagnostic errors would only point at the return type when changing it would be a possible solution to a type error. Add a label to the return type without a suggestion to change in order to make the source of the expected type obvious. Follow up to #42850, fixes #25133, fixes #41897.
2017-08-09Readd backticks around ()Esteban Küber-4/+4
2017-08-09rustc: Rearchitect lints to be emitted more eagerlyAlex Crichton-72/+127
In preparation for incremental compilation this commit refactors the lint handling infrastructure in the compiler to be more "eager" and overall more incremental-friendly. Many passes of the compiler can emit lints at various points but before this commit all lints were buffered in a table to be emitted at the very end of compilation. This commit changes these lints to be emitted immediately during compilation using pre-calculated lint level-related data structures. Linting today is split into two phases, one set of "early" lints run on the `syntax::ast` and a "late" set of lints run on the HIR. This commit moves the "early" lints to running as late as possible in compilation, just before HIR lowering. This notably means that we're catching resolve-related lints just before HIR lowering. The early linting remains a pass very similar to how it was before, maintaining context of the current lint level as it walks the tree. Post-HIR, however, linting is structured as a method on the `TyCtxt` which transitively executes a query to calculate lint levels. Each request to lint on a `TyCtxt` will query the entire crate's 'lint level data structure' and then go from there about whether the lint should be emitted or not. The query depends on the entire HIR crate but should be very quick to calculate (just a quick walk of the HIR) and the red-green system should notice that the lint level data structure rarely changes, and should hopefully preserve incrementality. Overall this resulted in a pretty big change to the test suite now that lints are emitted much earlier in compilation (on-demand vs only at the end). This in turn necessitated the addition of many `#![allow(warnings)]` directives throughout the compile-fail test suite and a number of updates to the UI test suite.
2017-08-08Only refer to return type when it matchesEsteban Küber-7/+4
2017-08-08Improve error message when duplicate names for type and trait methodGuillaume Gomez-0/+42
2017-08-08#[must_use] for functions (RFC 1940)Zack M. Davis-0/+47
The return value of a function annotated with `must_use`, must be used. This is in the matter of #43302.
2017-08-06Handle type aliases as wellGuillaume Gomez-1/+16
2017-08-06Fix union unused fields checkGuillaume Gomez-5/+17
2017-08-06Improve union unused field detectionGuillaume Gomez-12/+16
2017-08-05Don't warn on unused field on unionGuillaume Gomez-0/+43
2017-08-04Auto merge of #43600 - scalexm:issue-35976, r=nikomatsakisbors-0/+42
Add a more precise error message for issue #35976 When trying to perform static dispatch on something which derefs to a trait object, and the target trait is not in scope, we had confusing error messages if the target method had a `Self: Sized` bound. We add a more precise error message in this case: "consider using trait ...". Fixes #35976. r? @nikomatsakis
2017-08-04Auto merge of #43442 - ↵bors-0/+75
zackmdavis:note_available_field_names_if_levenshtein_fails, r=nikomatsakis field does not exist error: note fields if Levenshtein suggestion fails When trying to access or initialize a nonexistent field, if we can't infer what field was meant (by virtue of the purported field in the source being a small Levenshtein distance away from an actual field, suggestive of a typo), issue a note listing all the available fields. To reduce terminal clutter, we don't issue the note when we have a `find_best_match_for_name` Levenshtein suggestion: the suggestion is probably right. The third argument of the call to `find_best_match_for_name` is changed to `None`, accepting the default maximum Levenshtein distance of one-third of the identifier supplied for correction. The previous value of `Some(name.len())` was overzealous, inappropriately very Levenshtein-distant suggestions when the attempted field access could not plausibly be a mere typo. For example, if a struct has fields `mule` and `phone`, but I type `.donkey`, I'd rather the error have a note listing that the available fields are, in fact, `mule` and `phone` (which is the behavior induced by this patch) rather than the error asking "did you mean `phone`?" (which is the behavior on master). The "only find fits with at least one matching letter" comment was accurate when it was first introduced in 09d992471 (January 2015), but is a vicious lie in its present context before a call to `find_best_match_for_name` and must be destroyed (replacing every letter is within a Levenshtein distance of name.len()). The present author claims that this suffices to resolve #42599.
2017-08-03Tweak error messagescalexm-0/+42