about summary refs log tree commit diff
path: root/tests/ui/const-generics/defaults
AgeCommit message (Collapse)AuthorLines
2025-08-22On E0277, point at type that doesn't implement boundEsteban Küber-1/+6
When encountering an unmet trait bound, point at local type that doesn't implement the trait: ``` error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied --> $DIR/issue-64855.rs:9:19 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; | ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `Foo` is not implemented for `Bar<T>` --> $DIR/issue-64855.rs:9:1 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; | ^^^^^^^^^^^^^^^^^ ```
2025-08-06Fortify generic param default checksLeón Orell Valerian Liehr-2/+2
2025-07-28expand: Micro-optimize prelude injectionVadim Petrochenkov-2/+2
Use `splice` to avoid shifting the other items twice. Put `extern crate std;` first so it's already resolved when we resolve `::std::prelude::rust_20XX`.
2025-07-07Add `ty_span` queryOli Scherer-0/+8
2025-06-12Rollup merge of #142157 - Enselic:trivial-anon-const-use-cases, ↵Matthias Krüger-1/+1
r=compiler-errors rustc_resolve: Improve `resolve_const_param_in_non_trivial_anon_const` wording In some contexts, const expressions are OK. Add a `here` to the error message to clarify this. Closes rust-lang/rust#79429 which has 15 x 👍
2025-06-07const-eval error: always say in which item the error occurredRalf Jung-3/+3
also adjust the wording a little so that we don't say "the error occurred here" for two different spans
2025-06-07rustc_resolve: Improve `resolve_const_param_in_non_trivial_anon_const` wordingMartin Nordholts-1/+1
In some contexts, const expressions are OK. Add a `here` to the error message to clarify this.
2025-06-02Clarify why we are talking about a failed const eval at a random placeOli Scherer-3/+3
2025-06-02Use the informative error as the main const eval error messageOli Scherer-8/+8
2025-04-30compiletest: Make diagnostic kind mandatory on line annotationsVadim Petrochenkov-10/+12
2025-04-24check types of const param defaultlcnr-0/+38
2025-04-16Explicitly annotate edition for `unpretty=expanded` and `unpretty=hir` testsLukas Wirth-0/+2
These emit prelude imports which means they are always edition dependent
2025-04-07compiletest: Stricter parsing for diagnostic kindsVadim Petrochenkov-5/+5
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