about summary refs log tree commit diff
path: root/tests/ui/generic-const-items
AgeCommit message (Collapse)AuthorLines
2025-01-29Rollup merge of #136168 - fmease:gci-fix-mono, r=compiler-errorsLeón Orell Valerian Liehr-0/+40
GCI: Don't try to eval / collect mono items inside overly generic free const items Fixes #136156. Thanks for the pointers, errs! There's one (preexisting) thing of note (maybe?). There's a difference between `const _: () = panic!();` and `const _<'a>: () = panic!();`: The former is a pre-mono error, the latter is a post-mono error. For comparison, both `fn _f() { const { panic!() } }` and `fn _f<'a: 'a>() { const { panic!() } }` are post-mono errors. cc `@oli-obk` r? compiler-errors or reassign
2025-01-28GCI: Don't try to collect mono items inside overly generic free const itemsLeón Orell Valerian Liehr-0/+40
2025-01-27Remove all dead files inside tests/ui/León Orell Valerian Liehr-13/+0
2025-01-06improve diagnostics for const eval query overflowMartin Zacho-4/+14
2025-01-02Remove diagnostic_only_typeck and fix placeholder suggestion for const/staticMichael Goulet-16/+3
2024-11-03Yeet effects featureMichael Goulet-1/+1
2024-11-02Add trait diff highlighting logic and use it in E0277Esteban Küber-2/+4
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-09-29fix(hir_analysis/wfcheck): don't leak {type error}Barrett Ray-19/+20
avoid `{type error}` being leaked in user-facing messages, particularly when using the `adt_const_params` feature
2024-07-17Split part of `adt_const_params` into `unsized_const_params`Boxy-0/+4
2024-06-30Migrate tests to use `-Znext-solver`Deadbeef-1/+1
2024-05-24Handle trait/impl GAC mismatches when inferring missing/placeholder typesLeón Orell Valerian Liehr-5/+25
2024-05-24Properly deal with missing/placeholder types inside GACsLeón Orell Valerian Liehr-0/+49
2024-04-13Check regions earlier when comparing impl with trait item defLeón Orell Valerian Liehr-17/+29
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-04-07add test for assertion failed: !value.has_infer() #115806Matthias Krüger-0/+33
Fixes https://github.com/rust-lang/rust/issues/115806
2024-03-26Auto merge of #121387 - oli-obk:eager_const_failures_regression, r=lcnrbors-0/+14
Avoid some unnecessary query invocations. Specifically this inlines `const_eval_poly` and avoids computing the generic params, the param env, normalizing the param env and erasing lifetimes on everything. should fix the perf regression from https://github.com/rust-lang/rust/pull/121087
2024-03-25Rollup merge of #122988 - matthiaskrgr:icetests, r=petrochenkovMatthias Krüger-0/+35
add even more tests! Fixes https://github.com/rust-lang/rust/issues/109869 Fixes https://github.com/rust-lang/rust/issues/110453 Fixes https://github.com/rust-lang/rust/issues/109020 Fixes https://github.com/rust-lang/rust/issues/108580 Fixes https://github.com/rust-lang/rust/issues/108220 Fixes https://github.com/rust-lang/rust/issues/113045 Fixes https://github.com/rust-lang/rust/issues/113133 Fixes https://github.com/rust-lang/rust/issues/114464 Fixes https://github.com/rust-lang/rust/issues/116599 Fixes https://github.com/rust-lang/rust/issues/119731
2024-03-24add test for ICE with associated_const_equality #108220Matthias Krüger-0/+35
Fixes #108220
2024-03-21Provide structured suggestion for unconstrained generic constantEsteban Küber-10/+45
``` 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-03-19Avoid computing generic params or a param env for free const itemsOli Scherer-0/+14
2024-03-18Provide structured suggestion for `#![feature(foo)]`Esteban Küber-1/+4
``` 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-11Rollup merge of #119385 - fmease:assoc-const-eq-fixes-2, r=oli-obk,cjgillotJubilee-1/+10
Fix type resolution of associated const equality bounds (take 2) Instead of trying to re-resolve the type of assoc const bindings inside the `type_of` query impl in an incomplete manner, transfer the already (correctly) resolved type from `add_predicates_for_ast_type_binding` to `type_of`/`anon_type_of` through query feeding. --- Together with #118668 (merged) and #121258, this supersedes #118360. Fixes #118040. r? ``@ghost``
2024-02-19Always evaluate free constants and statics, even if previous errors occurredOli Scherer-3/+12
2024-02-18Propagate the resolved type of assoc const bindings via query feedingLeón Orell Valerian Liehr-1/+10
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-9/+9
2024-01-31Remove a has_errors check that does not prevent follow up error noiseOli Scherer-1/+1
2024-01-13Bless testsGeorge-lewis-0/+8
Update tests
2024-01-09Avoid silencing relevant follow-up errorsOli Scherer-1/+14
2023-12-27Introduce `const Trait` (always-const trait bounds)León Orell Valerian Liehr-17/+13
2023-12-19bless ui testsDeadbeef-0/+1
2023-11-24Show number in error message even for one errorNilstrieb-7/+7
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-12Deny more `~const` trait boundsLeón Orell Valerian Liehr-5/+5
2023-10-04Reorder fullfillment errors to keep more interesting ones firstEsteban Küber-1/+1
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-02Point out the actual mismatch errorMichael Goulet-0/+2
2023-09-28make adt_const_params feature suggestion more consistent with others and ↵asquared31415-1/+1
only suggest it when the type can probably work
2023-08-25Walk through full path in point_at_path_if_possibleMichael Goulet-2/+2
2023-08-12Don't crash when reporting nice region errors for generic const itemsLeón Orell Valerian Liehr-0/+29
2023-08-02Remove constness from `TraitPredicate`Deadbeef-1/+13
2023-07-28Add UI tests for generic const itemsLeón Orell Valerian Liehr-0/+813