summary refs log tree commit diff
path: root/tests/ui/const-generics/defaults
AgeCommit message (Collapse)AuthorLines
2025-03-12Disentangle ForwardGenericParamBan and ConstParamTy ribsMichael Goulet-15/+15
2025-02-14fallout :skull_emoji:lcnr-12/+12
2024-11-02Add trait diff highlighting logic and use it in E0277Esteban Küber-6/+12
When a trait is not implemented for a type, but there *is* an `impl` for another type or different trait params, we format the output to use highlighting in the same way that E0308 does for types. The logic accounts for 3 cases: - When both the type and trait in the expected predicate and the candidate are different - When only the types are different - When only the trait generic params are different For each case, we use slightly different formatting and wording.
2024-08-10Differentiate between methods and associated functionsEsteban Küber-10/+10
Accurately refer to assoc fn without receiver as assoc fn instead of methods. Add `AssocItem::descr` method to centralize where we call methods and associated functions.
2024-08-03Revert "Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pnkfelix"Michael Goulet-1/+0
This reverts commit 13314df21b0bb0cdd02c6760581d1b9f1052fa7e, reversing changes made to 6e534c73c35f569492ed5fb5f349075d58ed8b7e.
2024-06-19Const generic parameters aren't bounds, even if we end up erroring because ↵Oli Scherer-6/+6
of the bound that binds the parameter's type
2024-06-19Taint infcx when reporting errorsOli Scherer-6/+35
2024-06-05Detect pub structs never constructed and unused associated constants in traitsr0cky-0/+1
2024-05-29Partially implement `ConstArgHasType`Boxy-2/+4
2024-04-10Use `fn` ptr signature instead of `{closure@..}` in infer errorEsteban Küber-2/+2
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-03-21Provide structured suggestion for unconstrained generic constantEsteban Küber-2/+8
``` error: unconstrained generic constant --> $DIR/const-argument-if-length.rs:18:10 | LL | pad: [u8; is_zst::<T>()], | ^^^^^^^^^^^^^^^^^^^ | help: try adding a `where` bound | LL | pub struct AtLeastByte<T: ?Sized> where [(); is_zst::<T>()]: { | ++++++++++++++++++++++++++ ``` Detect when the constant expression isn't `usize` and suggest casting: ``` error: unconstrained generic constant --> f300.rs:6:10 | 6 | bb::<{!N}>(); | ^^^^ -Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs:3539:36 | help: try adding a `where` bound | 5 | fn b<const N: bool>() where [(); {!N} as usize]: { | ++++++++++++++++++++++++++ ``` Fix #122395.
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-22/+22
2024-01-31Remove a has_errors check that only hides errors after unrelated items have ↵Oli Scherer-3/+15
errored.
2023-12-14update use of feature flagslcnr-1/+1
2023-11-30generic_const_exprs: suggest to add the feature, not use itRalf Jung-2/+2
2023-11-24Show number in error message even for one errorNilstrieb-8/+8
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-10-23Update `since` stability attributes in testsDavid Tolnay-3/+3
2023-07-04implement `ConstEvaluatable` goals in new solverlcnr-1/+13
we don't yet handle `generic_const_exprs`, someone else can do that :3
2023-05-12Note base types of coercionMichael Goulet-2/+2
2023-04-07update tests/uiickk-1/+1
2023-02-21Specify what 'this' actually isMichael Goulet-1/+1
2023-01-30Modify primary span label for E0308Esteban Küber-5/+5
The previous output was unintuitive to users.
2023-01-11Move /src/test to /testsAlbert Larsan-0/+982