about summary refs log tree commit diff
path: root/tests/ui/const-generics
AgeCommit message (Collapse)AuthorLines
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
2024-11-19Introduce `min_generic_const_args` and directly represent pathsNoah Lev-0/+28
Co-authored-by: Boxy UwU <rust@boxyuwu.dev> Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2024-11-12Handle infer vars in anon consts on stableBoxy-0/+52
2024-11-12Auto merge of #132943 - matthiaskrgr:rollup-164l3ej, r=matthiaskrgrbors-129/+80
Rollup of 8 pull requests Successful merges: - #132651 (Remove attributes from generics in built-in derive macros) - #132668 (Feature gate yield expressions not in 2024) - #132771 (test(configure): cover `parse_args` in `src/bootstrap/configure.py`) - #132895 (Generalize `NonNull::from_raw_parts` per ACP362) - #132914 (Update grammar in std::cell docs.) - #132927 (Consolidate type system const evaluation under `traits::evaluate_const`) - #132935 (Make sure to ignore elided lifetimes when pointing at args for fulfillment errors) - #132941 (Subtree update of `rust-analyzer`) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-12Consolidate type system const evaluation under `traits::evaluate_const`Boxy-129/+80
mew
2024-11-05Check for both `StmtKind::MacCall` and `ExprKind::MacCall`Boxy-0/+425
2024-11-03Yeet effects featureMichael Goulet-8/+7
2024-11-02On long E0277 primary span label, move it to a `help`Esteban Küber-1/+2
Long span labels don't read well.
2024-11-02Add trait diff highlighting logic and use it in E0277Esteban Küber-8/+16
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-10-29Remove detail from label/note that is already available in other noteEsteban Küber-10/+10
Remove the "which is required by `{root_obligation}`" post-script in "the trait `X` is not implemented for `Y`" explanation in E0277. This information is already conveyed in the notes explaining requirements, making it redundant while making the text (particularly in labels) harder to read. ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ``` vs the prior ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ```
2024-10-26Deny calls to non-`#[const_trait]` methods in MIR constckDeadbeef-21/+21
2024-10-24Implement const effect predicate in new solverMichael Goulet-18/+0
2024-10-21Rollup merge of #131697 - ShE3py:rt-arg-lifetimes, r=AmanieuJubilee-1/+1
`rt::Argument`: elide lifetimes `@rustbot` label +C-cleanup
2024-10-15stabilize `-Znext-solver=coherence`lcnr-20/+19
2024-10-14`rt::Argument`: elide lifetimesLieselotte-1/+1
2024-10-11Don't assume traits used as type are trait objsVulnBandit-73/+28
2024-10-10Rollup merge of #131475 - fmease:compiler-mv-obj-safe-dyn-compat-2, r=jieyouxuMatthias Krüger-14/+14
Compiler & its UI tests: Rename remaining occurrences of "object safe" to "dyn compatible" Follow-up to #130826. Part of #130852. 1. 1st commit: Fix stupid oversights. Should've been part of #130826. 2. 2nd commit: Rename the unstable feature `object_safe_for_dispatch` to `dyn_compatible_for_dispatch`. Might not be worth the churn, you decide. 3. 3rd commit: Apply the renaming to all UI tests (contents and paths).
2024-10-10UI tests: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-14/+14
2024-10-04Bless ui tests.Camille GILLOT-8/+8
2024-10-01Auto merge of #126839 - obeis:mpmc, r=Amanieubors-1/+1
Add multi-producer, multi-consumer channel (mpmc) Closes #125712 Tracking issue: #126840 r? m-ou-se