summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2022-01-19Only check for errors in predicate when skipping impl assemblyAaron Hill-8/+9
Prior to PR #91205, checking for errors in the overall obligation would check checking the `ParamEnv`, due to an incorrect `super_visit_with` impl. With this bug fixed, we will now bail out of impl candidate assembly if the `ParamEnv` contains any error types. In practice, this appears to be overly conservative - when an error occurs early in compilation, we end up giving up early for some predicates that we could have successfully evaluated without overflow. By only checking for errors in the predicate itself, we avoid causing additional spurious 'type annotations needed' errors after a 'real' error has already occurred. With this PR, the diagnostic changes caused by PR #91205 are reverted.
2021-11-26Auto merge of #91205 - Aaron1011:visit_param_env, r=lcnrbors-9/+8
Visit `param_env` field in Obligation's `TypeFoldable` impl This oversight appears to have gone unnoticed for a long time without causing issues, but it should still be fixed.
2021-11-26Auto merge of #85102 - estebank:point-at-assignment, r=oli-obkbors-61/+67
Diagnostic tweaks * On type mismatch caused by assignment, point at the source of the expectation * Hide redundant errors * Suggest `while let` when `let` is missing in some cases
2021-11-25Visit `param_env` field in Obligation's `TypeFoldable` implAaron Hill-9/+8
This oversight appears to have gone unnoticed for a long time without causing issues, but it should still be fixed.
2021-11-25On type mismatch caused by assignment, point at assigneeEsteban Küber-61/+67
* Do not emit unnecessary E0308 after E0070 * Show fewer errors on `while let` missing `let` * Hide redundant E0308 on `while let` missing `let` * Point at binding definition when possible on invalid assignment * do not point at closure twice * do not suggest `if let` for literals in lhs * account for parameter types
2021-11-23Fix printing unit return ty, don't elaborate FnOnce unless we see itMichael Goulet-4/+4
2021-11-23Update test outputsMichael Goulet-4/+4
2021-11-21Simplify for loop desugarCameron Steffen-14/+3
2021-11-21Auto merge of #91104 - matthiaskrgr:rollup-duk33o1, r=matthiaskrgrbors-0/+4
Rollup of 4 pull requests Successful merges: - #91008 (Adds IEEE 754-2019 minimun and maximum functions for f32/f64) - #91070 (Make `LLVMRustGetOrInsertGlobal` always return a `GlobalVariable`) - #91097 (Add spaces in opaque `impl Trait` with more than one trait) - #91098 (Don't suggest certain fixups (`.field`, `.await`, etc) when reporting errors while matching on arrays ) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-11-20Use same_type_modulo_infer in more placesMichael Goulet-0/+4
2021-11-20Move tests for missing trait bounds to their own directoryEsteban Kuber-95/+0
2021-11-20Suggest constraining `fn` type params when appropriateEsteban Kuber-2/+39
2021-11-20Do not mention associated items when they introduce an obligationEsteban Kuber-181/+0
2021-11-20Point at bounds when comparing impl items to traitEsteban Kuber-11/+7
2021-11-20Point at source of trait bound obligations in more placesEsteban Kuber-63/+126
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-20Rollup merge of #90575 - m-ou-se:compatible-variant-improvements, r=estebankMatthias Krüger-2/+2
Improve suggestions for compatible variants on type mismatch. Fixes #90553. Before: ![image](https://user-images.githubusercontent.com/783247/140385675-6ff41090-eca2-41bc-b161-99c5dabfec61.png) After: ![image](https://user-images.githubusercontent.com/783247/140385748-20cf26b5-ea96-4e56-8af2-5fe1ab16fd3b.png) r? `````@estebank`````
2021-11-16Update tests.Mara Bos-2/+2
2021-11-14Improve diagnostics when a static lifetime is expectedLucas Kent-4/+16
2021-11-10no overlap errors after failing the orphan checklcnr-22/+11
2021-11-09Auto merge of #87337 - jyn514:lint-error, r=oli-obk,flip1995bors-1/+10
Don't abort compilation after giving a lint error The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors. Closes https://github.com/rust-lang/rust/issues/82761. This is a WIP because I have a feeling it will exit with 0 even if there were lint errors; I don't have a computer that can build rustc locally at the moment.
2021-11-08Auto merge of #89488 - c410-f3r:testsssssss, r=petrochenkovbors-3788/+0
Move some tests to more reasonable directories - 8 cc #73494 r? `@petrochenkov`
2021-11-08Don't abort compilation after giving a lint errorJoshua Nelson-1/+10
The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors.
2021-11-06Move some tests to more reasonable directoriesCaio-3788/+0
2021-11-06Auto merge of #88441 - jackh726:closure_norm, r=nikomatsakisbors-50/+0
Normalize obligations for closure confirmation Based on #90017 Fixes #74261 Fixes #71955 Fixes #88459 r? `@nikomatsakis`
2021-10-31Rollup merge of #89839 - jkugelman:must-use-mem-ptr-functions, r=joshtriplettMatthias Krüger-0/+1
Add #[must_use] to mem/ptr functions There's a lot of low-level / unsafe stuff here. Are there legit use cases for ignoring any of these return values? * No regressions in `./x.py test --stage 1 library/std src/tools/clippy`. * One regression in `./x.py test --stage 1 src/test/ui`. Fixed. * I am unable to run `./x.py doc` on my machine so I'll need to wait for the CI to verify doctests pass. I eyeballed all the adjacent tests and they all look okay. Parent issue: #89692 r? ```@joshtriplett```
2021-10-30Add #[must_use] to mem/ptr functionsJohn Kugelman-0/+1
2021-10-25fix(rustc_typeck): report function argument errors on matching typeMichael Howell-4/+8
Fixes #90101
2021-10-24Always sort suggestions before emitting themEsteban Kuber-4/+4
2021-10-24Point at overlapping impls when type annotations are neededEsteban Kuber-22/+228
2021-10-22Update the minimum external LLVM to 11Josh Stone-1/+0
2021-10-20Rollup merge of #90025 - JohnTitor:revert-86011, r=estebankYuki Okushi-16/+6
Revert #86011 to fix an incorrect bound check This reverts commit 36a1076d24697621a3bb67ef654b4eb79647aa54, reversing changes made to e1e9319d93aea755c444c8f8ff863b0936d7a4b6. Fixes #89935 r? ``@estebank``
2021-10-19Rollup merge of #89956 - JohnTitor:suggest-case-insensitive-match-names, ↵Matthias Krüger-1/+4
r=estebank Suggest a case insensitive match name regardless of levenshtein distance Fixes #86170 Currently, `find_best_match_for_name` only returns a case insensitive match name depending on a Levenshtein distance. It's a bit unfortunate that that hides some suggestions for typos like `Bar` -> `BAR`. That idea is from https://github.com/rust-lang/rust/pull/46347#discussion_r153701834, but I think it still makes some sense to show a candidate when we find a case insensitive match name as it's more like a typo. Skipped the `candidate != lookup` check because the current (i.e, `levenshtein_match`) returns the exact same `Symbol` anyway but it doesn't seem to confuse anything on UI tests. r? ``@estebank``
2021-10-19Revert "Rollup merge of #86011 - tlyu:correct-sized-bound-spans, r=estebank"Yuki Okushi-16/+6
This reverts commit 36a1076d24697621a3bb67ef654b4eb79647aa54, reversing changes made to e1e9319d93aea755c444c8f8ff863b0936d7a4b6.
2021-10-18Normalize obligations for closure confirmationjackh726-50/+0
2021-10-17Suggest a case insensitive match name regardless of levenshtein distanceYuki Okushi-1/+4
2021-10-16Auto merge of #89860 - camsteffen:macro-semi, r=petrochenkovbors-26/+26
Remove trailing semicolon from macro call span Macro call site spans are now less surprising/more consistent since they no longer contain a semicolon after the macro call. The downside is that we need to do a little guesswork to get the semicolon in diagnostics. But this should not be noticeable since it is rare for the semicolon to not immediately follow the macro call.
2021-10-15Bless testsCameron Steffen-26/+26
2021-10-15Rollup merge of #86011 - tlyu:correct-sized-bound-spans, r=estebankMatthias Krüger-6/+16
move implicit `Sized` predicate to end of list In `Bounds::predicates()`, move the implicit `Sized` predicate to the end of the generated list. This means that if there is an explicit `Sized` bound, it will be checked first, and any resulting diagnostics will have a more useful span. Fixes #85998, at least partially. ~~Based on #85979, but only the last 2 commits are new for this pull request.~~ (edit: rebased) A full fix would need to deal with where-clauses, and that seems difficult. Basically, predicates are being collected in multiple stages, and there are two places where implicit `Sized` predicates can be inserted: once for generic parameters, and once for where-clauses. I think this insertion is happening too early, and we should actually do it only at points where we collect all of the relevant trait bounds for a type parameter. I could use some help interpreting the changes to the stderr output. It looks like reordering the predicates changed some diagnostics that don't obviously have anything to do with `Sized` bounds. Possibly some error reporting code is making assumptions about ordering of predicates? The diagnostics for src/test/ui/derives/derives-span-Hash-*.rs seem to have improved, no longer pointing at the type parameter identifier, but src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs became less verbose for some reason. I also ran into an instance of #84970 while working on this, but I kind of expected that could happen, because I'm reordering predicates. I can open a separate issue on that if it would be helpful. ``@estebank`` this seems likely to conflict (slightly?) with your work on #85947; how would you like to resolve that?
2021-10-13Remove textual span from diagnostic stringOli Scherer-32/+32
2021-10-10Auto merge of #89633 - rhysd:issue-65230, r=petrochenkovbors-2/+31
Show detailed expected/found types in error message when trait paths are the same Fixes #65230. ### Issue solved by this PR ```rust trait T { type U; fn f(&self) -> Self::U; } struct X<'a>(&'a mut i32); impl<'a> T for X<'a> { type U = &'a i32; fn f(&self) -> Self::U { self.0 } } fn main() {} ``` Compiler generates the following note: ``` note: ...so that the types are compatible --> test.rs:10:28 | 10 | fn f(&self) -> Self::U { | ____________________________^ 11 | | self.0 12 | | } | |_____^ = note: expected `T` found `T` ``` This note is not useful since the expected type and the found type are the same. ### How this PR solve the issue When the expected type and the found type are exactly the same in string representation, the note falls back to the detailed string representation of trait ref: ``` note: ...so that the types are compatible --> test.rs:10:28 | 10 | fn f(&self) -> Self::U { | ____________________________^ 11 | | self.0 12 | | } | |_____^ = note: expected `<X<'a> as T>` found `<X<'_> as T>` ``` So that a user can notice what was different between the expected one and the found one.
2021-10-10Use E0308 instead of E0495 for checking the error message improvementrhysd-47/+19
because previous test does not cause the expected error message when `-Z borrowck=mir`.
2021-10-08update ui test expectationsTaylor Yu-6/+16
2021-10-09Show detailed expected/found types in error message when trait paths are the ↵rhysd-2/+59
same
2021-10-08testsb-naber-4/+2
2021-10-06Rollup merge of #89528 - FabianWolff:issue-89497, r=jackh726Manish Goregaokar-2/+3
Fix suggestion to borrow when casting from pointer to reference Fixes #89497.
2021-10-06Rollup merge of #89501 - Aaron1011:escaping-name-regions, r=davidtwcoManish Goregaokar-4/+22
Note specific regions involved in 'borrowed data escapes' error Fixes #67007 Currently, a 'borrowed data escapes' error does not mention the specific lifetime involved (except indirectly through a suggestion about adding a lifetime bound). We now explain the specific lifetime relationship that failed to hold, which improves otherwise vague error messages.
2021-10-05Consider unfulfilled obligations in binop errorsEsteban Kuber-6/+44
When encountering a binop where the types would have been accepted, if all the predicates had been fulfilled, include information about the predicates and suggest appropriate `#[derive]`s if possible. Point at trait(s) that needs to be `impl`emented.
2021-10-05Note specific regions involved in 'borrowed data escapes' errorAaron Hill-4/+22
Fixes #67007 Currently, a 'borrowed data escapes' error does not mention the specific lifetime involved (except indirectly through a suggestion about adding a lifetime bound). We now explain the specific lifetime relationship that failed to hold, which improves otherwise vague error messages.
2021-10-04Rollup merge of #89504 - Aaron1011:rpit-nll-static, r=nikomatsakisManish Goregaokar-12/+0
Don't suggest replacing region with 'static in NLL Fixes #73159 This is similar to #69350 - if the user didn't initially write out a 'static lifetime, adding 'static in response to a lifetime error is usually the wrong thing to do.
2021-10-04Rollup merge of #89483 - hkmatsumoto:patch-diagnostics-2, r=estebankJubilee-2/+2
Practice diagnostic message convention Detected by #89455. r? ```@estebank```