about summary refs log tree commit diff
path: root/tests/ui/const-generics/adt_const_params
AgeCommit message (Collapse)AuthorLines
2025-09-24Improve the pretty print of UnstableFeature clausetiif-3/+3
2025-09-15Fix the testcases to not use UnsizedConstParamTytiif-246/+150
2025-08-26Rollup merge of #145481 - mu001999-contrib:fix/closure-sugg, r=SparrowLiiGuillaume Gomez-2/+3
Add parentheses for closure when suggesting calling closure Fixes rust-lang/rust#145404
2025-08-22On E0277, point at type that doesn't implement boundEsteban Küber-6/+36
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-16Add parentheses for closure when suggesting calling closureMu001999-2/+3
2025-04-30compiletest: Make diagnostic kind mandatory on line annotationsVadim Petrochenkov-2/+2
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-6/+6
2025-03-15Rollup merge of #138283 - compiler-errors:enforce-const-param, r=BoxyUwUMatthias Krüger-0/+30
Enforce type of const param correctly in MIR typeck Properly intercepts and then annotates the type for a `ConstKind::Param` in the MIR. This code should probably be cleaned up, it's kinda spaghetti, but no better structure really occurred to me when writing this case. We could probably gate this behind the feature gate or add a fast path when the args have no free regions if perf is bad. r? `@BoxyUwU`
2025-03-14Do not suggest using `-Zmacro-backtrace` for builtin macrosEsteban Küber-25/+0
For macros that are implemented on the compiler, we do *not* mention the `-Zmacro-backtrace` flag. This includes `derive`s and standard macros.
2025-03-14Check type of const param correctly in MIR typeckMichael Goulet-0/+30
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-4/+6
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2025-01-26Compiler: Finalize dyn compatibility renamingLeón Orell Valerian Liehr-2/+2
2025-01-22Refactor dyn-compatibility error and suggestionsTaylor Cramer-8/+10
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-15Rework trait expansion to happen once explicitlyMichael Goulet-4/+4
2024-11-12Consolidate type system const evaluation under `traits::evaluate_const`Boxy-0/+80
mew
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-10-29Remove detail from label/note that is already available in other noteEsteban Küber-6/+6
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-10UI tests: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-2/+2
2024-09-29fix(hir_analysis/wfcheck): don't leak {type error}Barrett Ray-9/+9
avoid `{type error}` being leaked in user-facing messages, particularly when using the `adt_const_params` feature
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-2/+2
2024-08-27safe transmute: Rename `BikeshedIntrinsicFrom` to `TransmuteFrom`Jack Wrenn-4/+4
As our implementation of MCP411 nears completion and we begin to solicit testing, it's no longer reasonable to expect testers to type or remember `BikeshedIntrinsicFrom`. The name degrades the ease-of-reading of documentation, and the overall experience of using compiler safe transmute. Tentatively, we'll instead adopt `TransmuteFrom`. This name seems to be the one most likely to be stabilized, after discussion on Zulip [1]. We may want to revisit the ordering of `Src` and `Dst` before stabilization, at which point we'd likely consider `TransmuteInto` or `Transmute`. [1] https://rust-lang.zulipchat.com/#narrow/stream/216762-project-safe-transmute/topic/What.20should.20.60BikeshedIntrinsicFrom.60.20be.20named.3F
2024-08-16Special-case alias ty in `try_from_lit`Jaic1-0/+18
2024-08-05WF-check struct field types at construction siteNoah Lev-0/+188
Rustc of course already WF-checked the field types at the definition site, but for error tainting of consts to work properly, there needs to be an error emitted at the use site. Previously, with no use-site error, we proceeded with CTFE and ran into ICEs since we are running code with type errors. Emitting use-site errors also brings struct-like constructors more in line with fn-like constructors since they already emit use-site errors for WF issues.
2024-07-22Revert suggestion verbosity changeEsteban Küber-7/+3
2024-07-22On generic and lifetime removal suggestion, do not leave behind stray `,`Esteban Küber-1/+1
2024-07-22Change suggestion message wordingEsteban Küber-1/+1
2024-07-22Use verbose suggestion for "wrong # of generics"Esteban Küber-3/+7
2024-07-17Split part of `adt_const_params` into `unsized_const_params`Boxy-195/+446
2024-07-02Add testBoxy-0/+69
2024-06-05Bless tests and handle tests/crashesBoxy-18/+1
2024-06-03Mark all missing generic args as errorsOli Scherer-18/+2
2024-05-29Partially implement `ConstArgHasType`Boxy-0/+74
2024-04-28add test for const generic ty's with lifetimes cause opaque types to ICEMatthias Krüger-0/+29
Fixes https://github.com/rust-lang/rust/issues/111911
2024-04-28add test for Inconsistent rustc_transmute::is_transmutable(...) result, got YesMatthias Krüger-0/+71
Fixes https://github.com/rust-lang/rust/issues/110969
2024-04-19add test for #83993Matthias Krüger-0/+47
Fixes #83993
2024-03-18Provide structured suggestion for `#![feature(foo)]`Esteban Küber-18/+36
``` 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-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-1/+1
2024-01-30Provide more context on derived obligation error primary labelEsteban Küber-4/+4
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote: ``` error[E0277]: the trait bound `i32: Bar` is not satisfied --> f100.rs:6:6 | 6 | <i32 as Foo>::foo(); | ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo` | help: this trait has no implementations, consider adding one --> f100.rs:2:1 | 2 | trait Bar {} | ^^^^^^^^^ note: required for `i32` to implement `Foo` --> f100.rs:3:14 | 3 | impl<T: Bar> Foo for T {} | --- ^^^ ^ | | | unsatisfied trait bound introduced here ``` Fix #40120.
2024-01-24remove StructuralEq traitRalf Jung-31/+8
2023-11-24Show number in error message even for one errorNilstrieb-1/+1
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-09-28make adt_const_params feature suggestion more consistent with others and ↵asquared31415-0/+124
only suggest it when the type can probably work
2023-09-24ConstParamTy: require EqRalf Jung-3/+34
2023-09-21adjust how closure/generator types and rvalues are printedRalf Jung-3/+3
2023-06-01Implement custom diagnostic for ConstParamTyMichael Goulet-2/+41
2023-06-01Impl ConstParamTy for tuples, make PartialStructuralEq a supertrait tooMichael Goulet-3/+18
2023-05-16Add derive for `core::marker::ConstParamTy`Nilstrieb-2/+82
This makes it easier to implement it for a type, just like `Copy`.
2023-04-27--bless `ConstParamTy` ui testsMaybe Waffle-3/+3
2023-04-27Add `ConstParamTy` testsMaybe Waffle-0/+198
2023-04-27Add a test for `[NotParam; 0]: ConstParamTy` (not holding)Maybe Waffle-0/+28
2023-04-27Add `!StructuralEq` test for `ConstParamTy`Maybe Waffle-0/+29