about summary refs log tree commit diff
path: root/src/test/ui/span
AgeCommit message (Collapse)AuthorLines
2020-02-06rustc: rename -Zexternal-macro-backtrace to -Zmacro-backtrace.Eduard-Mihai Burtescu-3/+3
2020-02-02Rollup merge of #68764 - Centril:self-semantic, r=petrochenkovMazdak Farrokhzad-0/+8
parser: syntactically allow `self` in all `fn` contexts Part of https://github.com/rust-lang/rust/pull/68728. `self` parameters are now *syntactically* allowed as the first parameter irrespective of item context (and in function pointers). Instead, semantic validation (`ast_validation`) is used. r? @petrochenkov
2020-02-02parser: address review comments re. `self`.Mazdak Farrokhzad-0/+8
2020-02-02Do not suggest duplicate boundsYuki Okushi-9/+4
2020-01-24Normalise notes with the/isvarkor-5/+5
2020-01-11Rollup merge of #68014 - estebank:unify-e0599, r=cramertjYuki Okushi-5/+5
Unify output of "variant not found" errors Fix #49566.
2020-01-09Update testsVadim Petrochenkov-1/+28
2020-01-08Unify output of "variant not found" errorsEsteban Küber-5/+5
2019-12-24Fix suggestion span for typo in associated type nameEsteban Küber-2/+2
2019-12-24Fix case in `associated-type-projection-from-multiple-supertraits.rs`Esteban Küber-1/+1
This still doesn't handle the case entirely correctly, requiring a more targeted approach with a better suggestion, but at least now the suggested syntax makes *some* sense.
2019-12-20Rollup merge of #67285 - ohadravid:indicate-origin-of-where-type-parameter, ↵Mazdak Farrokhzad-1/+1
r=estebank Indicate origin of where type parameter for uninferred types Based on #65951 (which is not merge yet), fixes #67277. This PR improves a little the diagnostic for code like: ``` async fn foo() { bar().await; } async fn bar<T>() -> () {} ``` by showing: ``` error[E0698]: type inside `async fn` body must be known in this context --> unresolved_type_param.rs:9:5 | 9 | bar().await; | ^^^ cannot infer type for type parameter `T` declared on the function `bar` | ... ``` (The ``` declared on the function `bar` ``` part is new) A small side note: `Vec` and `slice` seem to resist this change, because querying `item_name()` panics, and `get_opt_name()` returns `None`. r? @estebank
2019-12-20Rollup merge of #67127 - estebank:disambiguate-suggestion, r=varkorMazdak Farrokhzad-10/+40
Use structured suggestion for disambiguating method calls Fix #65635.
2019-12-19Rollup merge of #67406 - ohadravid:suggest-assoc-type, r=estebankMazdak Farrokhzad-1/+1
Suggest associated type when the specified one cannot be found Fixes #67386, so code like this: ``` use std::ops::Deref; fn homura<T: Deref<Trget = i32>>(_: T) {} fn main() {} ``` results in: ``` error[E0220]: associated type `Trget` not found for `std::ops::Deref` --> type-binding.rs:6:20 | 6 | fn homura<T: Deref<Trget = i32>>(_: T) {} | ^^^^^^^^^^^ help: there is an associated type with a similar name: `Target` error: aborting due to previous error ``` (The `help` is new) I used an `all_candidates: impl Fn() -> Iterator<...>` instead of `collect`ing to avoid the cost of allocating the Vec when no errors are found, at the expense of a little added complexity. r? @estebank
2019-12-19Rollup merge of #67189 - LeSeulArtichaut:binop-wording, r=estebankMazdak Farrokhzad-26/+26
Unify binop wording Closes #60497 r? @estebank
2019-12-18Suggest associated type when the specified one cannot be foundOhad Ravid-1/+1
2019-12-14Indicate origin of where type parameter for uninferred typesOhad Ravid-1/+1
2019-12-12Update testsLeSeulArtichaut-13/+13
2019-12-12Update UI test expectationsLeSeulArtichaut-13/+13
2019-12-11Use structured suggestion for disambiguating method callsEsteban Küber-10/+40
Fix #65635.
2019-12-11Add more context for type parametersEsteban Küber-2/+2
2019-12-10Use the appropriate number of type arguments in suggestionEsteban Küber-1/+1
2019-12-10Point at method call when type annotations are neededEsteban Küber-7/+9
2019-12-06derive: avoid parse_in_attrMazdak Farrokhzad-8/+1
2019-11-21Point at type in `let` assignment on type errorsEsteban Küber-6/+11
2019-11-18Surround types with backticks in type errorsEsteban Küber-6/+6
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-18/+2
2019-11-18review comments: tweak prefix stringsEsteban Küber-2/+2
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-16/+16
2019-11-11Evaluate borrow and struct expressions in `into`Matthew Jasper-2/+2
This fixes some ordering problems around assignment expressions.
2019-11-09Remove `#[feature(custom_attribute)]`Vadim Petrochenkov-2/+4
2019-11-08Rollup merge of #66007 - estebank:remove-here, r=CentrilMazdak Farrokhzad-3/+3
Remove "here" from "expected one of X here"
2019-11-07Rollup merge of #66087 - tmiasko:ui-mode, r=CentrilMazdak Farrokhzad-1/+1
Update some build-pass ui tests to use check-pass where applicable Helps with issue https://github.com/rust-lang/rust/issues/62277.
2019-11-06Remove "here" from "expected one of X here"Esteban Küber-3/+3
2019-11-06Suggest missing item from `trait` in `impl`Esteban Küber-4/+4
2019-11-06Auto merge of #65830 - Quantumplation:master, r=davidtwco,estebankbors-17/+12
Use ident.span instead of def_span in dead-code pass Hello! First time contributor! :) This should fix #58729. According to @estebank in the duplicate #63064, def_span scans forward on the line until it finds a {, and if it can't find one, falls back to the span for the whole item. This was apparently written before the identifier span was explicitly tracked on each node. This means that if an unused function signature spans multiple lines, the entire function (potentially hundreds of lines) gets flagged as dead code. This could, for example, cause IDEs to add error squiggly's to the whole function. By using the span from the ident instead, we narrow the scope of this in most cases. In a wider sense, it's probably safe to use ident.span instead of def_span in most locations throughout the whole code base, but since this is my first contribution, I kept it small. Some interesting points that came up while I was working on this: - I reorganized the tests a bit to bring some of the dead code ones all into the same location - A few tests were for things unrelated to dead code (like the path-lookahead for parens), so I added #![allow(dead_code)] and cleaned up the stderr file to reduce noise in the future - The same fix doesn't apply to const and static declarations. I tried adding these cases to the match expression, but that created a much wider change to tests and error messages, so I left it off until I could get some code review to validate the approach.
2019-11-05Detect if item.span is in a macro, and fall backPi Lanningham-2/+5
If item.span is part of a macro invocation, this has several downstream implications. To name two that were found while working on this: - The dead-code error gets annotated with a "in this macro invocation" - Some errors get canceled if they refer to remote crates Ideally, we should annotate item.ident.span with the same macro info, but this is a larger change (see: #66095), so for now we just fall back to the old behavior if this item was generated by a macro. I use span.macro_backtrace().len() to detect if it's part of a macro, because that (among other things) is what is used by the code which adds the "in this macro invocation" annotations mentioned above.
2019-11-04Use check-pass in ui tests where appropriateTomasz Miąsko-1/+1
2019-10-30Update ui testsGuillaume Gomez-0/+1
2019-10-26Use ident instead of def_span in dead-code passPi Lanningham-22/+14
According to @estebank, def_span scans forward on the line until it finds a {, and if it can't find one, fallse back to the span for the whole item. This was apparently written before the identifier span was explicitly tracked on each node. This means that if an unused function signature spans multiple lines, the entire function (potentially hundreds of lines) gets flagged as dead code. This could, for example, cause IDEs to add error squiggly's to the whole function. By using the span from the ident instead, we narrow the scope of this in most cases. In a wider sense, it's probably safe to use ident.span instead of def_span in most locations throughout the whole code base, but since this is my first contribution, I kept it small. Some interesting points that came up while I was working on this: - I reorganized the tests a bit to bring some of the dead code ones all into the same location - A few tests were for things unrelated to dead code (like the path-lookahead for parens), so I added #![allow(dead_code)] and cleaned up the stderr file to reduce noise in the future - The same fix doesn't apply to const and static declarations. I tried adding these cases to the match expression, but that created a much wider change to tests and error messages, so I left it off until I could get some code review to validate the approach.
2019-10-24Increase spacing for suggestions in diagnosticsEsteban Küber-0/+15
Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages.
2019-10-02syntax: improve parameter without type suggestionsDavid Wood-0/+6
This commit improves the suggestions provided when function parameters do not have types: - A new suggestion is added for arbitrary self types, which suggests adding `self: ` before the type. - Existing suggestions are now provided when a `<` is found where a `:` was expected (previously only `,` and `)` or trait items), this gives suggestions in the case where the unnamed parameter type is generic in a free function. - The suggestion that a type name be provided (e.g. `fn foo(HashMap<u32>)` -> `fn foo(HashMap: TypeName<u32>)`) will no longer occur when a `<` was found instead of `:`. - The ident will not be used for recovery when a `<` was found instead of `:`. Signed-off-by: David Wood <david@davidtw.co>
2019-10-01Rollup merge of #64933 - sam09:master, r=estebankMazdak Farrokhzad-1/+1
Fixes #64919. Suggest fix based on operator precendence. Fixes https://github.com/rust-lang/rust/issues/64919
2019-10-01Change to use exprPrecedence instead of exprKind.Sam Radhakrishnan-1/+1
2019-09-30update testsGuillaume Gomez-0/+1
2019-09-02Refer to "`self` type" instead of "receiver type"Esteban Küber-3/+4
2019-08-31Use span label instead of note for cause in E0631Esteban Küber-6/+3
2019-08-26Rollup merge of #63693 - Centril:polish-parse-or-pats, r=estebankMazdak Farrokhzad-6/+6
Fully implement or-pattern parsing Builds upon the initial parsing in https://github.com/rust-lang/rust/pull/61708 to fully implement or-pattern (`p | q`) parsing as specified in [the grammar section of RFC 2535](https://github.com/rust-lang/rfcs/blob/master/text/2535-or-patterns.md#grammar). Noteworthy: - We allow or-patterns in `[p | q, ...]`. - We allow or-patterns in `let` statements and `for` expressions including with leading `|`. - We improve recovery for `p || q` (+ tests for that in `multiple-pattern-typo.rs`). - We improve recovery for `| p | q` in inner patterns (tests in `or-patterns-syntactic-fail.rs`). - We rigorously test or-pattern parsing (in `or-patterns-syntactic-{pass,fail}.rs`). - We harden the feature gating tests. - We do **_not_** change `ast.rs`. That is, `ExprKind::Let.0` and `Arm.pats` still accept `Vec<P<Pat>>`. I was starting work on that but it would be cleaner to do this in a separate PR so this one has a narrower scope. cc @dlrobertson cc the tracking issue https://github.com/rust-lang/rust/issues/54883. r? @estebank
2019-08-25Point at method call on missing annotation errorEsteban Küber-2/+16
Make it clearer where the type name that couldn't be infered comes from.
2019-08-25parser: gracefully handle `fn foo(A | B: type)`.Mazdak Farrokhzad-6/+6
2019-08-10resolve: Move late resolution into a separate visitorVadim Petrochenkov-8/+6
Move `Resolver` fields specific to late resolution to the new visitor. The `current_module` field from `Resolver` is replaced with two `current_module`s in `LateResolutionVisitor` and `BuildReducedGraphVisitor`. Outside of those visitors `current_module` is replaced by passing `parent_scope` to more functions and using the parent module from it. Visibility resolution no longer have access to later resolution methods and has to use early resolution, so its diagnostics in case of errors regress slightly.