summary refs log tree commit diff
path: root/tests/ui/inference
AgeCommit message (Collapse)AuthorLines
2024-03-10Ignore tests w/ current/next revisions from compare-mode=next-solverMichael Goulet-0/+1
2024-03-03Move testsCaio-0/+55
2024-02-29renaming test casesyukang-9/+9
2024-02-29Suggest removing superfluous semicolos when statements used as expressionsyukang-0/+205
2024-02-22Overhaul the handling of errors at the top-level.Nicholas Nethercote-2/+0
Currently `emit_stashed_diagnostic` is called from four(!) different places: `print_error_count`, `DiagCtxtInner::drop`, `abort_if_errors`, and `compile_status`. And `flush_delayed` is called from two different places: `DiagCtxtInner::drop` and `Queries`. This is pretty gross! Each one should really be called from a single place, but there's a bunch of entanglements. This commit cleans up this mess. Specifically, it: - Removes all the existing calls to `emit_stashed_diagnostic`, and adds a single new call in `finish_diagnostics`. - Removes the early `flush_delayed` call in `codegen_and_build_linker`, replacing it with a simple early return if delayed bugs are present. - Changes `DiagCtxtInner::drop` and `DiagCtxtInner::flush_delayed` so they both assert that the stashed diagnostics are empty (i.e. processed beforehand). - Changes `interface::run_compiler` so that any errors emitted during `finish_diagnostics` (i.e. late-emitted stashed diagnostics) are counted and cannot be overlooked. This requires adding `ErrorGuaranteed` return values to several functions. - Removes the `stashed_err_count` call in `analysis`. This is possible now that we don't have to worry about calling `flush_delayed` early from `codegen_and_build_linker` when stashed diagnostics are pending. - Changes the `span_bug` case in `handle_tuple_field_pattern_match` to a `delayed_span_bug`, because it now can be reached due to the removal of the `stashed_err_count` call in `analysis`. - Slightly changes the expected output of three tests. If no errors are emitted but there are delayed bugs, the error count is no longer printed. This is because delayed bugs are now always printed after the error count is printed (or not printed, if the error count is zero). There is a lot going on in this commit. It's hard to break into smaller pieces because the existing code is very tangled. It took me a long time and a lot of effort to understand how the different pieces interact, and I think the new code is a lot simpler and easier to understand.
2024-02-19Drive-by `DUMMY_SP` -> `Span` and fmt changesEsteban Küber-1/+12
Noticed these while doing something else. There's no practical change, but it's preferable to use `DUMMY_SP` as little as possible, particularly when we have perfectlly useful `Span`s available.
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-43/+43
2024-02-14Auto merge of #120847 - oli-obk:track_errors9, r=compiler-errorsbors-3/+16
Continue compilation after check_mod_type_wf errors The ICEs fixed here were probably reachable through const eval gymnastics before, but now they are easily reachable without that, too. The new errors are often bugfixes, where useful errors were missing, because they were reported after the early abort. In other cases sometimes they are just duplication of already emitted errors, which won't be user-visible due to deduplication. fixes https://github.com/rust-lang/rust/issues/120860
2024-02-14Continue compilation after check_mod_type_wf errorsOli Scherer-3/+16
2024-02-13Move testsCaio-0/+53
2024-01-31Remove a has_errors check that only hides errors after unrelated items have ↵Oli Scherer-2/+8
errored.
2024-01-24Deduplicate more sized errors on call exprsEsteban Küber-5/+5
Change the implicit `Sized` `Obligation` `Span` for call expressions to include the whole expression. This aids the existing deduplication machinery to reduce the number of errors caused by a single unsized expression.
2024-01-19use implied bounds compat mode in MIR borrowcklcnr-7/+12
2024-01-17Don't use compat versions of implied bounds in ImpliedOutlivesBounds queryJack Huey-1/+15
2024-01-13Bless testsGeorge-lewis-0/+1
Update tests
2024-01-02Adjust compiler tests for unused_tuple_struct_fields -> dead_codeJake Goulding-1/+1
2023-12-14update use of feature flagslcnr-1/+1
2023-12-08Support bare unit structs in destructuring assignmentsMichael Goulet-5/+1
2023-11-24Show number in error message even for one errorNilstrieb-30/+30
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-10-20Avoid a `track_errors` by bubbling up most errors from `check_well_formed`Oli Scherer-18/+5
2023-10-18Tweak wording of type errors involving type paramsEsteban Küber-1/+1
Fix #78206.
2023-10-15Suggest adding `return` if the type of unused semi return value can coerce ↵yukang-0/+159
to the fn return type
2023-10-06Fix windows test that has different stderr outputEsteban Küber-1/+2
2023-10-04Reorder fullfillment errors to keep more interesting ones firstEsteban Küber-56/+29
In `report_fullfillment_errors` push back `T: Sized`, `T: WellFormed` and coercion errors to the end of the list. The pre-existing deduplication logic eliminates redundant errors better that way, keeping the resulting output with fewer errors than before, while also having more detail.
2023-10-04Show more information when multiple `impl` applyEsteban Küber-2/+103
2023-08-28Tweak output of `to_pretty_impl_header` involving only anon lifetimesEsteban Küber-15/+15
Do not print `impl<> Foo for &Bar`.
2023-08-26More accurately point at argumentsEsteban Küber-7/+7
2023-08-16Fix suggestion for attempting to define a string with single quotesbeetrees-1/+14
2023-08-01Don't select infer -> dyn TraitMichael Goulet-1/+3
2023-07-16stop mentioning number of applicate implementationslcnr-1/+1
2023-07-16self type param infer, avoid ICElcnr-0/+21
2023-07-11Rollup merge of #113567 - chenyukang:yukang-fix-113354-while-let, r=cjgillotJubilee-0/+22
While let suggestion will work for closure body Fixes #113354
2023-07-11While let suggestion will work for closureyukang-0/+22
2023-07-08Don't suggest `impl Trait` in path position许杰友 Jieyou Xu (Joe)-0/+26
2023-06-08Point at correct exprs for assert_eq type mismatchMichael Goulet-6/+7
2023-05-09Rollup merge of #111021 - c410-f3r:dqewdas, r=petrochenkovMatthias Krüger-0/+23
Move some tests r? ``@petrochenkov``
2023-05-08Move testsCaio-0/+23
2023-05-08Tweak borrow suggestionMichael Goulet-8/+12
2023-04-26Rollup merge of #110825 - notriddle:notriddle/issue-70082, r=compiler-errorsMatthias Krüger-0/+27
diagnostics: add test case for already-solved issue Fixes #70082
2023-04-25diagnostics: add test case for already-solved issueMichael Howell-0/+27
Fixes #70082
2023-04-19Suggest deref on comparison binop RHS even if type is not CopyMichael Goulet-1/+23
2023-04-07update tests/uiickk-1/+1
2023-04-07Rollup merge of #109957 - fmease:fix-109905, r=petrochenkovMatthias Krüger-4/+48
diagnostics: account for self type when looking for source of unsolved type variable Fixes #109905. When searching for the source of an unsolved infer var inside of a list of generic args, we look through the `tcx.generics_of(…).own_substs(…)` which *skips* the self type if present. However, the computed `argument_index` is later[^1] used to index into `tcx.generics_of(…).params` which may still contain the self type. In such case, we are off by one when indexing into the parameters. From now on, we account for this immediately after calling `own_substs` which keeps things local. This also fixes the wrong output in the preexisting UI test `inference/need_type_info/concrete-impl.rs` which was overlooked. It used to claim that the *type of type parameter `Self`* couldn't be inferred in `<Struct as Ambiguous<_>>::method()` which of course isn't true: `Self` equals `Struct` here, `A` couldn't be inferred. `@rustbot` label A-diagnostics [^1]: https://github.com/rust-lang/rust/blob/f98a2718141593fbb8dbad10acc537786d748156/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs#L471
2023-04-05account for self type when looking for source of unsolved ty varLeón Orell Valerian Liehr-4/+48
2023-04-05Add regression test for #80409Yuki Okushi-0/+36
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-03-25fix type suggestions in match armsLukas Markeffsky-1/+32
2023-02-22diagnostics: update test cases to refer to assoc fn with `self` as methodMichael Howell-12/+12
2023-02-12Suggest the correct array length on mismatchclubby789-0/+33
2023-02-10Rollup merge of #107789 - jieyouxu:issue-107745, r=lcnrMatthias Krüger-0/+30
Avoid exposing type parameters and implementation details sourced from macro expansions Fixes #107745. ~~I would like to **request some guidance** for this issue, because I don't think this is a good fix (a band-aid at best).~~ ### The Problem The code ```rust fn main() { println!("{:?}", []); } ``` gets desugared into (`rustc +nightly --edition=2018 issue-107745.rs -Z unpretty=hir`): ```rust #[prelude_import] use std::prelude::rust_2018::*; #[macro_use] extern crate std; fn main() { { ::std::io::_print(<#[lang = "format_arguments"]>::new_v1(&["", "\n"], &[<#[lang = "format_argument"]>::new_debug(&[])])); }; } ``` so the diagnostics code tries to be as specific and helpful as possible, and I think it finds that `[]` needs a type parameter and so does `new_debug`. But since `[]` doesn't have an origin for the type parameter definition, it points to `new_debug` instead and leaks the internal implementation detail since all `[]` has is an type inference variable. ### ~~The Bad Fix~~ ~~This PR currently tries to fix the problem by bypassing the generated function `<#[lang = "format_argument"]>::new_debug` to avoid its generic parameter (I think it is auto-generated from the argument `[_; 0]`?) from getting collected as an `InsertableGenericArg`. This is problematic because it also prevents the help from getting displayed.~~ ~~I think this fix is not ideal and hard-codes the format generated code pattern, but I can't think of a better fix. I have tried asking on Zulip but no responses there yet.~~
2023-02-09Introduce `ReError`Esteban Küber-110/+15
CC #69314