about summary refs log tree commit diff
path: root/src/test/ui/structs
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-1699/+0
2022-12-10Introduce `with_forced_trimmed_paths`Esteban Küber-1/+1
2022-12-07Rollup merge of #105267 - compiler-errors:issue-104613, r=oli-obkMatthias Krüger-0/+21
Don't ICE in ExprUseVisitor on FRU for non-existent struct Fixes #104613 Fixes #105202
2022-12-04Don't ICE in ExprUseVisitor on FRU for non-existent structMichael Goulet-0/+21
2022-12-01While parsing enum variant, the error message always disappearYiming Lei-0/+2
Because the error message that emit out is from main error of parser The information of enum variant disappears while parsing enum variant with error We only check the syntax of expecting token, i.e, in case #103869 It will error it without telling the message that this error is from pasring enum variant. Propagate the sub-error from parsing enum variant to the main error of parser by chaining it with map_err Check the sub-error before emitting the main error of parser and attach it. Fix #103869
2022-11-18Add a detailed note for missing comma in FRU syntax typoMichael Goulet-19/+65
2022-09-28fix a ui testTakayuki Maeda-3/+5
2022-09-28improve errors for incomplete functions in struct definitionsTakayuki Maeda-0/+18
2022-09-27add a label to struct/enum/union ident nameTakayuki Maeda-0/+9
2022-09-25Auto merge of #100865 - compiler-errors:parent-substs-still, r=cjgillotbors-11/+23
Don't drop parent substs when we have no generic parameters in `create_substs_for_ast_path` This bug is being shadowed by an explicit check for `generics.params.is_empty()` in the only parent caller that could trigger it (`create_substs_for_associated_item`). I triggered it on another branch where I'm messing around with astconv stuff. Also, the second commit simplifies `create_substs_for_associated_item`. Removing that explicit check I mentioned above^ and also the special case call to `Astconv::prohibit_generics` causes the UI test `src/test/ui/structs/struct-path-associated-type.stderr` to change, but I think that it's clearer now. The suggestion to remove the generics is actually useful.
2022-08-22Simplify create_substs_for_associated_itemMichael Goulet-11/+23
2022-08-09Extend comma suggestion to cases where fields arent missingMichael Goulet-11/+60
2022-06-19Be more specific for what lifetimes are not allowed onMichael Goulet-5/+5
2022-06-16diagnostics: fix trailing spaceklensy-3/+3
2022-06-02review commentsEsteban Küber-2/+2
2022-06-01Make output more specificEsteban Küber-15/+25
2022-06-01Fix typoEsteban Küber-2/+2
2022-06-01More accurately handle suggestionsEsteban Küber-12/+14
* Confirm the path segment being modified is an `enum` * Check whether type has type param before suggesting changing `Self` * Wording changes * Add clarifying comments * Suggest removing args from `Self` if the type doesn't have type params
2022-06-01Provide more context when denying invalid type paramsEsteban Küber-0/+32
2022-04-05Suggest derivable trait on E0277ohno418-0/+4
2022-03-28Remove duplicated and unused test filesCaio-0/+56
2022-03-28Auto merge of #95396 - ↵bors-0/+122
TaKO8Ki:suggest-replacing-field-when-using-the-same-type, r=compiler-errors Suggest replacing a field when using the same type closes #89166
2022-03-28suggest replacing field when using the same typeTakayuki Maeda-0/+122
2022-03-27diagnostics: suggest missing comma in bad FRU syntaxMichael Howell-0/+56
Fixes #51103
2022-03-27Point (again) to more expressions with their type, even if not fully resolvedEsteban Kuber-0/+6
2021-12-14Make TyS::is_suggestable more structualMichael Goulet-6/+0
2021-11-20Point at source of trait bound obligations in more placesEsteban Kuber-3/+3
Be more thorough in using `ItemObligation` and `BindingObligation` when evaluating obligations so that we can point at trait bounds that introduced unfulfilled obligations. We no longer incorrectly point at unrelated trait bounds (`substs-ppaux.verbose.stderr`). In particular, we now point at trait bounds on method calls. We no longer point at "obvious" obligation sources (we no longer have a note pointing at `Trait` saying "required by a bound in `Trait`", like in `associated-types-no-suitable-supertrait*`). Address part of #89418.
2021-11-14Move some tests to more reasonable directoriesCaio-0/+38
2021-08-11Modify structured suggestion outputEsteban Küber-6/+6
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-07-19Various diagnostics clean ups/tweaksEsteban Küber-3/+6
* Always point at macros, including derive macros * Point at non-local items that introduce a trait requirement * On private associated item, point at definition
2021-05-11improve diagnosts for GATsb-naber-8/+8
2021-05-07Also take unions and enums into accountLeSeulArtichaut-5/+42
2021-05-07Add basic testLeSeulArtichaut-0/+25
2021-04-03Remove redundant `ignore-tidy-linelength` annotationsSimon Jakobi-17/+15
This is step 2 towards fixing #77548. In the codegen and codegen-units test suites, the `//` comment markers were kept in order not to affect any source locations. This is because these tests cannot be automatically `--bless`ed.
2021-03-15More precise spans for HIR pathsVadim Petrochenkov-2/+2
2021-03-14Rollup merge of #82789 - csmoe:issue-82772, r=estebankYuki Okushi-5/+7
Get with field index from pattern slice instead of directly indexing Closes #82772 r? ``@estebank`` https://github.com/rust-lang/rust/pull/82789#issuecomment-796921977 > ``@estebank`` So the real cause is we only generate single pattern for Box here https://github.com/csmoe/rust/blob/615b03aeaa8ce9819de7828740ab3cd7def4fa76/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs#L1130-L1132 But in the replacing function, it tries to index on the 1-length pattern slice with field 1, thus out of bounds. https://github.com/csmoe/rust/blob/615b03aeaa8ce9819de7828740ab3cd7def4fa76/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs#L1346
2021-03-12fix: check before index into generated patternscsmoe-17/+3
2021-03-12add ui testcase for issue 82772csmoe-8/+24
2021-03-05Update tests names to start with `issue-`Henry Boisdequin-1/+1
See @JohnTitor's [comment](https://github.com/rust-lang/rust/pull/82720#discussion_r586488083) @rustbot label +C-cleanup
2021-02-25Rollup merge of #82220 - henryboisdequin:fixes-80853, r=varkorDylan DPC-0/+20
fix the false 'defined here' messages Closes #80853. Take this code: ```rust struct S; fn repro_ref(thing: S) { thing(); } ``` Previously, the error message would be this: ``` error[E0618]: expected function, found `S` --> src/lib.rs:4:5 | 3 | fn repro_ref(thing: S) { | ----- `S` defined here 4 | thing(); | ^^^^^-- | | | call expression requires function error: aborting due to previous error ``` This is incorrect as `S` is not defined in the function arguments, `thing` is defined there. With this change, the following is emitted: ``` error[E0618]: expected function, found `S` --> $DIR/80853.rs:4:5 | LL | fn repro_ref(thing: S) { | ----- is of type `S` LL | thing(); | ^^^^^-- | | | call expression requires function | = note: local variable `S` is not a function error: aborting due to previous error ``` As you can see, this error message points out that `thing` is of type `S` and later in a note, that `S` is not a function. This change does seem like a downside for some error messages. Take this example: ``` LL | struct Empty2; | -------------- is of type `Empty2` ``` As you can see, the error message shows that the definition of `Empty2` is of type `Empty2`. Although this isn't wrong, it would be more helpful if it would say something like this (which was there previously): ``` LL | struct Empty2; | -------------- `Empty2` defined here ``` If there is a better way of doing this, where the `Empty2` example would stay the same as without this change, please inform me. **Update: This is now fixed** CC `@camelid`
2021-02-25add helpful error notes and fix the false 'defined here' messagesHenry Boisdequin-0/+20
2021-02-23Rollup merge of #81235 - reese:rw-tuple-diagnostics, r=estebankDylan DPC-0/+40
Improve suggestion for tuple struct pattern matching errors. Closes #80174 This change allows numbers to be parsed as field names when pattern matching on structs, which allows us to provide better error messages when tuple structs are matched using a struct pattern. r? ``@estebank``
2021-02-20Fix suggestion span and move suggestions into new subwindow.Reese Williams-6/+12
2021-02-14Clarify error message and remove pretty printing in help suggestions.Reese Williams-4/+8
2021-01-26Tweak suggestion for missing field in patternsEsteban Küber-2/+2
Account for parser recovered struct and tuple patterns to avoid invalid suggestion. Follow up to #81103.
2021-01-20Improve suggestion for tuple struct pattern matching errors.Reese Williams-0/+30
Currently, when a user uses a struct pattern to pattern match on a tuple struct, the errors we emit generally suggest adding fields using their field names, which are numbers. However, numbers are not valid identifiers, so the suggestions, which use the shorthand notation, are not valid syntax. This commit changes those errors to suggest using the actual tuple struct pattern syntax instead, which is a more actionable suggestion.
2021-01-10Rework diagnostics for wrong number of generic argsPatryk Wychowaniec-19/+37
2020-11-06Fixing Spelling Typosankushduacodes-2/+2
2020-09-11Provide suggestion for missing fields in patternsEsteban Küber-0/+18
2020-09-02pretty: trim paths of unique symbolsDan Aloni-5/+5
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.