about summary refs log tree commit diff
path: root/tests/ui/inference
AgeCommit message (Collapse)AuthorLines
2024-07-05Use verbose style for argument removal suggestionEsteban Küber-4/+6
2024-06-19Const generic parameters aren't bounds, even if we end up erroring because ↵Oli Scherer-2/+2
of the bound that binds the parameter's type
2024-06-19Taint infcx when reporting errorsOli Scherer-3/+8
2024-06-17Use subtyping instead of equality, since method resolution also uses subtypingOli Scherer-4/+4
2024-05-29Partially implement `ConstArgHasType`Boxy-1/+1
2024-05-28Don't suggest turning non-char-literal exprs of ty `char` into string literalsLeón Orell Valerian Liehr-0/+57
2024-05-23Handle `ReVar` in `note_and_explain_region`.Nicholas Nethercote-0/+21
PR #124918 made this path abort. The added test, from fuzzing, identified that it is reachable.
2024-05-20Move 100 entries from tests/ui into subdirsJubilee Young-0/+45
- Move super-fast-paren-parsing test into ui/parser - Move stmt_expr_attrs test into ui/feature-gates - Move macro tests into ui/macros - Move global_asm tests into ui/asm - Move env tests into ui/process - Move xcrate tests into ui/cross-crate - Move unop tests into ui/unop - Move backtrace tests into ui/backtrace - Move check-static tests into ui/statics - Move expr tests into ui/expr - Move optimization fuel tests into ui/fuel - Move ffi attribute tests into ui/ffi-attrs - Move suggestion tests into ui/suggestions - Move main tests into ui/fn-main - Move lint tests into ui/lint - Move repr tests into ui/repr - Move intrinsics tests into ui/intrinsics - Move tool lint tests into ui/tool-attributes - Move return tests into ui/return - Move pattern tests into ui/patttern - Move range tests into ui/range - Move foreign-fn tests into ui/foreign - Move orphan-check tests into ui/coherence - Move inference tests into ui/inference - Reduce ROOT_ENTRY_LIMIT
2024-04-25Check closure args and returns are WFMichael Goulet-22/+36
2024-04-20Print note with closure signature on type mismatchDaniel Sedlak-0/+29
2024-04-16Don't proceed into parent bodies when collecting stmts for possible return ↵Michael Goulet-0/+39
suggestion
2024-04-11Remove `From` impls for unstable types that break inferenceTrevor Gross-0/+9
Adding additional `From` implementations that fit `f32::from(<unaffixed float>)` broke inference. Remove these for now. Fixes: <https://github.com/rust-lang/rust/issues/123824>
2024-04-11Rollup merge of #123703 - estebank:diag-changes-2, r=NadrierilLeón Orell Valerian Liehr-8/+8
Use `fn` ptr signature instead of `{closure@..}` in infer error When suggesting a type on inference error, do not use `{closure@..}`. Instead, replace with an appropriate `fn` ptr. On the error message, use `short_ty_string` and write long types to disk. ``` error[E0284]: type annotations needed for `Select<{closure@lib.rs:2782:13}, _, Expression<'_>, _>` --> crates/lang/src/parser.rs:41:13 | 41 | let lit = select! { | ^^^ 42 | Token::Int(i) = e => Expression::new(Expr::Lit(ast::Lit::Int(i.parse().unwrap())), e.span()), | ---- type must be known at this point | = note: the full type name has been written to '/home/gh-estebank/iowo/target/debug/deps/lang-e2d6e25819442273.long-type-4587393693885174369.txt' = note: cannot satisfy `<_ as chumsky::input::Input<'_>>::Span == SimpleSpan` help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified | 41 | let lit: Select<for<'a, 'b> fn(tokens::Token<'_>, &'a mut MapExtra<'_, 'b, _, _>) -> Option<Expression<'_>>, _, Expression<'_>, _> = select! { | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ``` instead of ``` error[E0284]: type annotations needed for `Select<{closure@/home/gh-estebank/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chumsky-1.0.0-alpha.6/src/lib.rs:2782:13: 2782:28}, _, Expression<'_>, _>` --> crates/lang/src/parser.rs:41:13 | 41 | let lit = select! { | ^^^ 42 | Token::Int(i) = e => Expression::new(Expr::Lit(ast::Lit::Int(i.parse().unwrap())), e.span()), | ---- type must be known at this point | = note: cannot satisfy `<_ as chumsky::input::Input<'_>>::Span == SimpleSpan` help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified | 41 | let lit: Select<{closure@/home/gh-estebank/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chumsky-1.0.0-alpha.6/src/lib.rs:2782:13: 2782:28}, _, Expression<'_>, _> = select! { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ``` Address #123630 (test missing).
2024-04-10Use `fn` ptr signature instead of `{closure@..}` in infer errorEsteban Küber-8/+8
When suggesting a type on inference error, do not use `{closure@..}`. Instead, replace with an appropriate `fn` ptr. On the error message, use `short_ty_string` and write long types to disk. ``` error[E0284]: type annotations needed for `Select<{closure@lib.rs:2782:13}, _, Expression<'_>, _>` --> crates/lang/src/parser.rs:41:13 | 41 | let lit = select! { | ^^^ 42 | Token::Int(i) = e => Expression::new(Expr::Lit(ast::Lit::Int(i.parse().unwrap())), e.span()), | ---- type must be known at this point | = note: the full type name has been written to '/home/gh-estebank/iowo/target/debug/deps/lang-e2d6e25819442273.long-type-4587393693885174369.txt' = note: cannot satisfy `<_ as chumsky::input::Input<'_>>::Span == SimpleSpan` help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified | 41 | let lit: Select<for<'a, 'b> fn(tokens::Token<'_>, &'a mut MapExtra<'_, 'b, _, _>) -> Option<Expression<'_>>, _, Expression<'_>, _> = select! { | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ``` instead of ``` error[E0284]: type annotations needed for `Select<{closure@/home/gh-estebank/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chumsky-1.0.0-alpha.6/src/lib.rs:2782:13: 2782:28}, _, Expression<'_>, _>` --> crates/lang/src/parser.rs:41:13 | 41 | let lit = select! { | ^^^ 42 | Token::Int(i) = e => Expression::new(Expr::Lit(ast::Lit::Int(i.parse().unwrap())), e.span()), | ---- type must be known at this point | = note: cannot satisfy `<_ as chumsky::input::Input<'_>>::Span == SimpleSpan` help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified | 41 | let lit: Select<{closure@/home/gh-estebank/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chumsky-1.0.0-alpha.6/src/lib.rs:2782:13: 2782:28}, _, Expression<'_>, _> = select! { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ``` Fix #123630.
2024-04-08Scrape extraneous regions from ↵Oli Scherer-1/+1
instantiate_nll_query_response_and_region_obligations
2024-03-24Rollup merge of #122217 - estebank:issue-119685, r=fmeaseMatthias Krüger-6/+6
Handle str literals written with `'` lexed as lifetime Given `'hello world'` and `'1 str', provide a structured suggestion for a valid string literal: ``` error[E0762]: unterminated character literal --> $DIR/lex-bad-str-literal-as-char-3.rs:2:26 | LL | println!('hello world'); | ^^^^ | help: if you meant to write a `str` literal, use double quotes | LL | println!("hello world"); | ~ ~ ``` ``` error[E0762]: unterminated character literal --> $DIR/lex-bad-str-literal-as-char-1.rs:2:20 | LL | println!('1 + 1'); | ^^^^ | help: if you meant to write a `str` literal, use double quotes | LL | println!("1 + 1"); | ~ ~ ``` Fix #119685.
2024-03-22Rollup merge of #122844 - matthiaskrgr:just_one_more_test_mom, r=compiler-errorsMatthias Krüger-0/+35
add test for ice "cannot relate region: LUB(ReErased, ReError)" Fixes #109178
2024-03-21add test for ice "cannot relate region: LUB(ReErased, ReError)"Matthias Krüger-0/+35
Fixes #109178
2024-03-21add test for https://github.com/rust-lang/rust/issues/122098 ICE: index out ↵Matthias Krüger-0/+97
of bounds, snapshot_vec.rs Fixes #122098
2024-03-20make `type_flags(ReError) & HAS_ERROR`Ali MJ Al-Nasrawy-16/+3
2024-03-18Provide structured suggestion for `#![feature(foo)]`Esteban Küber-6/+25
``` error: `S2<'_>` is forbidden as the type of a const generic parameter --> $DIR/lifetime-in-const-param.rs:5:23 | LL | struct S<'a, const N: S2>(&'a ()); | ^^ | = note: the only supported types are integers, `bool` and `char` help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types | LL + #![feature(adt_const_params)] | ``` Fix #55941.
2024-03-17review comment: `str` -> string in messagesEsteban Küber-4/+4
2024-03-17Use shorter span for existing `'` -> `"` structured suggestionEsteban Küber-2/+2
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