about summary refs log tree commit diff
path: root/tests/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2025-01-28Properly check that array length is valid type during built-in unsizing in indexMichael Goulet-0/+41
2025-01-23Handle parenthesised infer argsBoxy-0/+12
2025-01-23Bless and add testsBoxy-9/+7
2025-01-22Auto merge of #135896 - matthiaskrgr:rollup-g6rv7za, r=matthiaskrgrbors-1/+1
Rollup of 9 pull requests Successful merges: - #132983 (Edit dangling pointers ) - #135409 (Fix ICE-133117: multiple never-pattern arm doesn't have false_edge_start_block) - #135557 (Point at invalid utf-8 span on user's source code) - #135596 (Properly note when query stack is being cut off) - #135794 (Detect missing fields with default values and suggest `..`) - #135814 (ci: use ghcr buildkit image) - #135826 (Misc. `rustc_resolve` cleanups) - #135837 (Remove test panic from File::open) - #135856 (Library: Finalize dyn compatibility renaming) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-22Rollup merge of #135596 - compiler-errors:stack, r=oli-obkMatthias Krüger-1/+1
Properly note when query stack is being cut off cc #70953 also, i'm not certain whether we should even limit this at all. i don't see the problem with printing the full query stack, apparently it was limited b/c we used to ICE? but we're already printing the full stack to disk since #108714. r? oli-obk
2025-01-22Refactor dyn-compatibility error and suggestionsTaylor Cramer-37/+44
This CL makes a number of small changes to dyn compatibility errors: - "object safety" has been renamed to "dyn-compatibility" throughout - "Convert to enum" suggestions are no longer generated when there exists a type-generic impl of the trait or an impl for `dyn OtherTrait` - Several error messages are reorganized for user readability Additionally, the dyn compatibility error creation code has been split out into functions. cc #132713 cc #133267
2025-01-21Auto merge of #133830 - compiler-errors:span-key, r=lcnrbors-4/+4
Rework dyn trait lowering to stop being so intertwined with trait alias expansion This PR reworks the trait object lowering code to stop handling trait aliases so funky, and removes the `TraitAliasExpander` in favor of a much simpler design. This refactoring is important for making the code that I'm writing in https://github.com/rust-lang/rust/pull/133397 understandable and easy to maintain, so the diagnostics regressions are IMO inevitable. In the old trait object lowering code, we used to be a bit sloppy with the lists of traits in their unexpanded and expanded forms. This PR largely rewrites this logic to expand the trait aliases *once* and handle them more responsibly throughout afterwards. Please review this with whitespace disabled. r? lcnr
2025-01-18Revert "Rollup merge of #134371 - scottmcm:fix-134352, r=oli-obk"Rémy Rakic-23/+0
This reverts commit 7c301ecdf5e806b7aa3c44e4a185049fabbc4381, reversing changes made to dffaad83327454430129802f240121f8c7866208.
2025-01-16Properly note when query stack is being cut offMichael Goulet-1/+1
2025-01-15Rework trait expansion to happen once explicitlyMichael Goulet-4/+4
2025-01-14Make sure we can produce ConstArgHasWrongType errors for valtree constsMichael Goulet-0/+107
2025-01-13Rollup merge of #135390 - ranger-ross:readd-test-122638, r=BoxyUwUJacob Pratt-0/+78
Re-added regression test for #122638 Re-adds the test for #122638 :smile: fixes #122638 r? `@BoxyUwU` (please let me know if this can be improved. I am still fairly new to using compiletest)
2025-01-12re-added regression test for #122638Ross Sullivan-0/+78
2025-01-11Remove a bunch of diagnostic stashing that doesn't do anythingMichael Goulet-5/+22
2025-01-09Always take the `Ok` path in `lit_to_const` and produce error constants insteadOli Scherer-48/+91
2025-01-06Add derived causes for host effect predicatesMichael Goulet-0/+18
2025-01-03Rollup merge of #135044 - compiler-errors:better-infer-suggestions-in-const, ↵Matthias Krüger-24/+46
r=oli-obk Improve infer (`_`) suggestions in `const`s and `static`s Fixes https://github.com/rust-lang/rust/issues/135010. This PR does a few things to (imo) greatly improve the error message when users write something like `static FOO: [i32; _] = [1, 2, 3]`. Firstly, it adapts the recovery code for when we encounter `_` in a const/static to work a bit more like `fn foo() -> _`, and removes the somewhat redundant query `diagnostic_only_typeck`. Secondly, it changes the lowering for `[T; _]` to always lower under the `feature(generic_arg_infer)` logic to `ConstArgKind::Infer`. We still issue the feature error, so it's not doing anything *observable* on the good path, but it does mean that we no longer erroneously interpret `[T; _]`'s array length as a `_` **wildcard expression** (à la destructuring assignment, like `(_, y) = expr`). Lastly it makes the suggestions verbose and fixes (well, suppresses) a bug with stashing and suggestions. r? oli-obk
2025-01-02Make suggestion verbose and tweak error messageMichael Goulet-26/+40
2025-01-02More refined spans for placeholder error in const/staticMichael Goulet-24/+26
2025-01-02Remove diagnostic_only_typeck and fix placeholder suggestion for const/staticMichael Goulet-2/+8
2025-01-01Try to write the panic message with a single `write_all` callJohn Kåre Alsaker-0/+1
2024-12-27Remove the `-test` suffix from normalize directivesZalathar-4/+4
2024-12-27Simplify or delete normalize directives that don't care about bit-widthZalathar-17/+16
2024-12-23Note def descr in NonConstFunctionCallMichael Goulet-3/+3
2024-12-18add testslcnr-0/+33
2024-12-17add testslcnr-0/+23
2024-12-15Check for array lengths that aren't actually `usize`Scott McMurray-0/+23
2024-12-12Filter empty lines, comments and delimiters from previous to last multiline ↵Esteban Küber-1/+0
span rendering
2024-12-12Tweak multispan renderingEsteban Küber-7/+2
Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments.
2024-12-10Rollup merge of #134010 - RalfJung:promoted-type-error-ice, r=oli-obkLeón Orell Valerian Liehr-14/+0
fix ICE on type error in promoted Fixes https://github.com/rust-lang/rust/issues/133968 Ensure that when we turn a type error into a "this promoted failed to evaluate" error, we do record this as something that may happen even in "infallible" promoteds.
2024-12-09fix ICE on type error in promotedRalf Jung-14/+0
2024-12-07Use trait name instead of full constraint in suggestion messageEsteban Küber-2/+2
``` help: consider restricting type parameter `T` with traits `Copy` and `Trait` | LL | fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) { | ++++++++++++++ ``` ``` help: consider restricting type parameter `V` with trait `Copy` | LL | fn index<'a, K, V: std::marker::Copy>(map: &'a HashMap<K, V>, k: K) -> &'a V { | +++++++++++++++++++ ```
2024-12-07reword trait bound suggestion message to include the boundsEsteban Küber-2/+2
2024-12-06Remove polymorphizationBen Kimock-46/+0
2024-12-04Add comment to testBoxy-1/+2
2024-12-03Rollup merge of #133779 - BoxyUwU:array_const_arg_infer_hir_id, ↵Matthias Krüger-0/+12
r=compiler-errors Use correct `hir_id` for array const arg infers Fixes #133771 `self.next_id()` results in the `DefId` for the const argument, created from the hack introduced by #133468, having no `HirId` associated with it. This then results in an ICE in metadata encoding. Fixing this then results in *another* ICE where `encode_defs` was not skipping encoding `type_of` and other queries for `DefId`s when they correspond to a `ConstArgKind::Infer` node. This only reproduces with a library crate as metadata is not encoded for binaries, and apparently we had 0 tests for `generic_arg_infer` for array lengths in a library crate so this was not caught :< cc #133589 `@voidc` r? `@compiler-errors` `@lcnr`
2024-12-03Use correct `hir_id` for array const arg infersBoxy-0/+12
2024-12-02Rollup merge of #133704 - RalfJung:promoted-size-overflow-ice, r=compiler-errorsGuillaume Gomez-0/+14
fix ICE when promoted has layout size overflow Turns out there is no reason to distinguish `tainted_by_errors` and `can_be_spurious` here, we can just track whether we allow this even in "infallible" constants. Fixes https://github.com/rust-lang/rust/issues/125476
2024-12-02Move `Const::{from_anon_const,try_from_lit}` to hir_ty_loweringNoah Lev-4/+21
These operations are much more about lowering the HIR than about `Const`s themselves. They fit better in hir_ty_lowering with `lower_const_arg` (formerly `Const::from_const_arg`) and the rest. To accomplish this, `const_evaluatable_predicates_of` had to be changed to not use `from_anon_const` anymore. Instead of visiting the HIR and lowering anon consts on the fly, it now visits the `rustc_middle::ty` data structures instead and directly looks for `UnevaluatedConst`s. This approach was proposed in: https://github.com/rust-lang/rust/pull/131081#discussion_r1821189257
2024-12-01fix ICE when promoted has layout size overflowRalf Jung-0/+14
2024-11-30Make compare_impl_item into a queryMichael Goulet-4/+4
2024-11-28add testslcnr-36/+352
2024-11-27Rollup merge of #133518 - compiler-errors:structurally-resolve-never, r=lcnrMatthias Krüger-35/+44
Structurally resolve before checking `!` in HIR typeck Some more missing structural resolves in HIR typeck :> r? lcnr
2024-11-27Bless tests due to extra error reporting due to normalizing types that are ↵Michael Goulet-35/+44
not WF It's okay though b/c these are duplicated diagnostics.
2024-11-26Rollup merge of #133471 - lcnr:uwu-gamer, r=BoxyUwUMichael Goulet-0/+64
gce: fix typing_mode mismatch Fixes #133271 r? `@BoxyUwU`
2024-11-26Rollup merge of #133394 - compiler-errors:dyn-more-errors, r=lcnrMichael Goulet-76/+3
Bail on more errors in dyn ty lowering If we have more than one principal trait, or if we have a principal trait with errors in it, then bail with `TyKind::Error` rather than attempting lowering. Lowering a dyn trait with more than one principal just arbitrarily chooses the first one and drops the subsequent ones, and lowering a dyn trait path with errors in it is just kinda useless. This suppresses unnecessary errors which I think is net-good, but also is important to make sure that we don't end up leaking `{type error}` in https://github.com/rust-lang/rust/issues/133388 error messaging :) r? types
2024-11-25fix gce typing_mode mismatchlcnr-0/+64
2024-11-24Simplify array length mismatch error reportingMichael Goulet-9/+4
2024-11-23Dont create trait object if it has errors in itMichael Goulet-76/+3
2024-11-21Stop being so bail-y in candidate assemblyMichael Goulet-23/+38