about summary refs log tree commit diff
path: root/src/test/ui/span
AgeCommit message (Collapse)AuthorLines
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.
2019-08-03Move special treatment of `derive(Copy, PartialEq, Eq)` from expansion ↵Vadim Petrochenkov-1/+28
infrastructure to elsewhere
2019-07-24Rollup merge of #62772 - estebank:trait-bound, r=matthewjasperMazdak Farrokhzad-3/+5
Suggest trait bound on type parameter when it is unconstrained Given ``` trait Foo { fn method(&self) {} } fn call_method<T>(x: &T) { x.method() } ``` suggest constraining `T` with `Foo`. Fix #21673, fix #41030.
2019-07-19Auto merge of #62684 - petrochenkov:scopevisit, r=davidtwcobors-23/+6
resolve: Improve candidate search for unresolved macro suggestions Use same scope visiting machinery for both collecting suggestion candidates and actually resolving the names. The PR is better read in per-commit fashion with whitespace changes ignored (the first commit in particular moves some code around). This should be the last pre-requisite for https://github.com/rust-lang/rust/pull/62086. r? @davidtwco
2019-07-18Suggest trait bound on type parameter when it is unconstrainedEsteban Küber-3/+5
Given ``` mented on Jan 26, 2015 • trait Foo { fn method(&self) {} } fn call_method<T>(x: &T) { x.method() } ``` suggest constraining `T` with `Foo`.
2019-07-18Rollup merge of #62764 - ↵Mark Rousskov-5/+5
fakenine:normalize_use_of_backticks_compiler_messages_p7, r=alexreg normalize use of backticks in compiler messages for librustc/lint https://github.com/rust-lang/rust/issues/60532
2019-07-18resolve: Use `feature(custom_attribute)` fallback only if the feature is enabledVadim Petrochenkov-23/+6
Normally `#![feature(...)]` shouldn't change behavior, but custom attributes in particular are in the process of retirement, and we should not produce a message telling to enable them. It also helps with unifying diagnostics for unresolved macros.
2019-07-17normalize use of backticks in compiler messages for librustc/lintSamy Kacimi-5/+5
https://github.com/rust-lang/rust/issues/60532
2019-07-16Update the help message on error for self typeLimira-1/+1
2019-07-11Remove feature gate `dropck_parametricity` completelyLzu Tao-11/+8
Therefore we also remove `#[unsafe_destructor_blind_to_params]` attribute completly.
2019-07-11Replace unsafe_destructor_blind_to_params with may_dangleLzu Tao-5/+5
2019-07-09normalize use of backticks in compiler messages for libsyntax/feature_gateSamy Kacimi-4/+4
https://github.com/rust-lang/rust/issues/60532
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-3/+3
2019-06-03Update tests for changes to cannot move errorsMatthew Jasper-3/+3
2019-06-03Auto merge of #61331 - estebank:fn-arg-parse-recovery, r=varkorbors-0/+20
Recover gracefully from argument with missing type or param name
2019-06-01review comment: tweak wordingEsteban Küber-3/+3
2019-05-31Tweak wordingEsteban Küber-1/+1
2019-05-31Alternative wording for inference failureEsteban Küber-3/+3
2019-05-31Add more detail to type inference errorEsteban Küber-2/+2
When encountering code where type inference fails, add more actionable information: ``` fn main() { let foo = Vec::new(); } ``` ``` error[E0282]: type annotations needed for `std::vec::Vec<_>` --> $DIR/vector-no-ann.rs:2:16 | LL | let foo = Vec::new(); | --- ^^^^^^^^ cannot infer type for `T` | | | consider giving `foo` the type `std::vec::Vec<_>` with the type parameter `T` specified ``` We still need to modify type printing to optionally accept a `TypeVariableTable` in order to properly print `std::vec::Vec<T>`. CC #25633.
2019-05-30Recover gracefully from argument with missing type or param nameEsteban Küber-0/+20
2019-05-29Update ui test suite to use dynmemoryruins-22/+22
2019-05-17Account for &String + StringEsteban Küber-2/+2
2019-05-16review commentsEsteban Küber-10/+10
2019-05-16Fix binop spanEsteban Küber-12/+9
2019-05-16Handle more string addition cases with appropriate suggestionsEsteban Küber-2/+161
2019-04-23Update ui testsvarkor-9/+9
2019-04-23Remove unnecessary ignore-tidy-linelengthvarkor-4/+0
2019-04-22Remove double trailing newlinesvarkor-2/+0
2019-04-22update tests for migrate mode by defaultMatthew Jasper-1725/+533
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-13/+10
2019-04-11Reword tracking issue noteEsteban Küber-4/+4
2019-04-10Tweak unstable diagnostic outputEsteban Küber-4/+8
2019-04-05Fix expectations on some ui tests involving FnOnce.Masaki Hara-4/+4
2019-03-29Rollup merge of #59473 - estebank:borrow-sugg-inside-macro, r=davidtwcoMazdak Farrokhzad-4/+1
Do not emit incorrect borrow suggestion involving macros and fix overlapping multiline spans Fix #58298.
2019-03-29Rollup merge of #59467 - hgallagher1993:local_branch, r=estebankMazdak Farrokhzad-6/+15
Better diagnostic for binary operation on BoxedValues Fixes #59458
2019-03-28Add check for when left and right overlap and change span for explanation to ↵hgallagher1993-4/+3
point at operator
2019-03-27Do not suggest borrowing when the span comes from a macroEsteban Küber-4/+1
2019-03-27Better diagnostic for binary operation on BoxedValueshgallagher1993-6/+16
2019-03-25When moving out of a for loop head, suggest borrowing it in nll modeEsteban Küber-1/+0
2019-03-11Update NLL testsVadim Petrochenkov-37/+37
2019-03-11Update testsVadim Petrochenkov-113/+113