mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
ae88766286
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). |
||
---|---|---|
.. | ||
auxiliary | ||
need_type_info | ||
ambiguous_type_parameter.rs | ||
ambiguous_type_parameter.stderr | ||
array-len-mismatch.rs | ||
array-len-mismatch.stderr | ||
cannot-infer-async.rs | ||
cannot-infer-async.stderr | ||
cannot-infer-closure-circular.rs | ||
cannot-infer-closure-circular.stderr | ||
cannot-infer-closure.rs | ||
cannot-infer-closure.stderr | ||
cannot-infer-partial-try-return.rs | ||
cannot-infer-partial-try-return.stderr | ||
char-as-str-multi.rs | ||
char-as-str-multi.stderr | ||
char-as-str-single.fixed | ||
char-as-str-single.rs | ||
char-as-str-single.stderr | ||
deref-suggestion.rs | ||
deref-suggestion.stderr | ||
erase-type-params-in-label.rs | ||
erase-type-params-in-label.stderr | ||
ice-cannot-relate-region-109178.rs | ||
ice-cannot-relate-region-109178.stderr | ||
ice-ifer-var-leaked-out-of-rollback-122098.rs | ||
ice-ifer-var-leaked-out-of-rollback-122098.stderr | ||
infer-binary-operand-behind-reference.rs | ||
inference_unstable_featured.rs | ||
inference_unstable_featured.stderr | ||
inference_unstable_forced.rs | ||
inference_unstable_forced.stderr | ||
inference_unstable.rs | ||
inference_unstable.stderr | ||
inference-variable-behind-raw-pointer.rs | ||
inference-variable-behind-raw-pointer.stderr | ||
issue-3743.rs | ||
issue-12028.rs | ||
issue-12028.stderr | ||
issue-28935.rs | ||
issue-36053.rs | ||
issue-70082.rs | ||
issue-70082.stderr | ||
issue-70703.rs | ||
issue-71309.rs | ||
issue-71309.stderr | ||
issue-71584.rs | ||
issue-71584.stderr | ||
issue-71732.rs | ||
issue-71732.stderr | ||
issue-72616.rs | ||
issue-72616.stderr | ||
issue-72690.rs | ||
issue-72690.stderr | ||
issue-80409.no-compat.stderr | ||
issue-80409.rs | ||
issue-80816.rs | ||
issue-80816.stderr | ||
issue-81522.rs | ||
issue-83606.rs | ||
issue-83606.stderr | ||
issue-86094-suggest-add-return-to-coerce-ret-ty.rs | ||
issue-86094-suggest-add-return-to-coerce-ret-ty.stderr | ||
issue-86162-1.rs | ||
issue-86162-1.stderr | ||
issue-86162-2.rs | ||
issue-86162-2.stderr | ||
issue-103587.rs | ||
issue-103587.stderr | ||
issue-104649.rs | ||
issue-104649.stderr | ||
issue-107090.rs | ||
issue-107090.stderr | ||
issue-113354.fixed | ||
issue-113354.rs | ||
issue-113354.stderr | ||
lub-glb-with-unbound-infer-var.rs | ||
multiple-impl-apply.rs | ||
multiple-impl-apply.stderr | ||
newlambdas-ret-infer2.rs | ||
newlambdas-ret-infer.rs | ||
question-mark-type-infer.rs | ||
question-mark-type-infer.stderr | ||
range-type-infer.rs | ||
simple-infer.rs | ||
stmts-as-exp-105431.rs | ||
stmts-as-exp-105431.stderr | ||
str-as-char.fixed | ||
str-as-char.rs | ||
str-as-char.stderr | ||
tutorial-suffix-inference-test.rs | ||
tutorial-suffix-inference-test.stderr | ||
type-infer-generalize-ty-var.rs |