about summary refs log tree commit diff
path: root/tests/ui/specialization/min_specialization
AgeCommit message (Collapse)AuthorLines
2025-06-30Unconditionally run `check_item_type` on all itemsOli Scherer-6/+6
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-0/+2
2025-01-06Normalize each signature input/output in typeck_with_fallback with its own spanMichael Goulet-6/+3
2024-12-15Auto merge of #134258 - bjorn3:no_public_specialization, r=petrochenkovbors-4/+14
Remove support for specializing ToString outside the standard library This is the only trait specializable outside of the standard library. Before stabilizing specialization we will probably want to remove support for this. It was originally made specializable to allow a more efficient ToString in libproc_macro back when this way the only way to get any data out of a TokenStream. We now support getting individual tokens, so proc macros no longer need to call it as often.
2024-12-13Update testbjorn3-4/+14
2024-12-12Tweak multispan renderingEsteban Küber-4/+1
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-07Mention type parameter in more cases and don't suggest ~const bound already ↵Esteban Küber-4/+4
there
2024-12-07Use trait name instead of full constraint in suggestion messageEsteban Küber-4/+4
``` 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-4/+4
2024-11-22Simplify fulfill_implicationMichael Goulet-10/+2
2024-10-29Remove detail from label/note that is already available in other noteEsteban Küber-4/+4
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-09-12Re-enable `ConstArgKind::Path` lowering by defaultNoah Lev-12/+3
...and remove the `const_arg_path` feature gate as a result. It was only a stopgap measure to fix the regression that the new lowering introduced (which should now be fixed by this PR).
2024-08-19Retroactively feature gate `ConstArgKind::Path`Boxy-3/+12
2024-07-16Add `ConstArgKind::Path` and make `ConstArg` its own HIR nodeNoah Lev-12/+3
This is a very large commit since a lot needs to be changed in order to make the tests pass. The salient changes are: - `ConstArgKind` gets a new `Path` variant, and all const params are now represented using it. Non-param paths still use `ConstArgKind::Anon` to prevent this change from getting too large, but they will soon use the `Path` variant too. - `ConstArg` gets a distinct `hir_id` field and its own variant in `hir::Node`. This affected many parts of the compiler that expected the parent of an `AnonConst` to be the containing context (e.g., an array repeat expression). They have been changed to check the "grandparent" where necessary. - Some `ast::AnonConst`s now have their `DefId`s created in rustc_ast_lowering rather than `DefCollector`. This is because in some cases they will end up becoming a `ConstArgKind::Path` instead, which has no `DefId`. We have to solve this in a hacky way where we guess whether the `AnonConst` could end up as a path const since we can't know for sure until after name resolution (`N` could refer to a free const or a nullary struct). If it has no chance as being a const param, then we create a `DefId` in `DefCollector` -- otherwise we decide during ast_lowering. This will have to be updated once all path consts use `ConstArgKind::Path`. - We explicitly use `ConstArgHasType` for array lengths, rather than implicitly relying on anon const type feeding -- this is due to the addition of `ConstArgKind::Path`. - Some tests have their outputs changed, but the changes are for the most part minor (including removing duplicate or almost-duplicate errors). One test now ICEs, but it is for an incomplete, unstable feature and is now tracked at #127009.
2024-05-29Partially implement `ConstArgHasType`Boxy-29/+10
2024-05-24Fail relating constants of different typesOli Scherer-10/+29
2024-04-04Specialization already rejects defining opaque typesOli Scherer-0/+71
2024-03-24add test for ICE: min_specialization: Ok(['?0, Const { ty: usize, kind: ↵Matthias Krüger-0/+36
Leaf(0x0000000000000000) }]) is not fully resolved #113045 Fixes https://github.com/rust-lang/rust/issues/113045
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-10/+10
2024-02-14Continue compilation after check_mod_type_wf errorsOli Scherer-4/+32
2024-02-10Allow restricted trait impls in macros with `min_specialization`Zalathar-0/+25
Implementing traits marked with `#[rustc_specialization_trait]` normally requires (min-)specialization to be enabled for the enclosing crate. With this change, that permission can also be granted by an `allow_internal_unstable` attribute on the macro that generates the impl.
2024-01-30Provide more context on derived obligation error primary labelEsteban Küber-3/+3
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-23Remove track_errors entirelyOli Scherer-21/+2
2024-01-22Make generic const type mismatches not hide trait impls from the trait solverOli Scherer-4/+20
2024-01-02Reorder `check_item_type` diagnostics so they occur next to the ↵Oli Scherer-4/+4
corresponding `check_well_formed` diagnostics
2023-11-24Show number in error message even for one errorNilstrieb-12/+12
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-10-25Work around the fact that `check_mod_type_wf` may spuriously return ↵Oli Scherer-1/+14
`ErrorGuaranteed`, even if that error is only emitted by `check_modwitem_types`
2023-06-28Adjust inner span of implicit self ref argumentMichael Goulet-2/+2
2023-05-05Report nicer lifetime errors for specializationMatthew Jasper-0/+77
Add an obligation cause for these error so that the error points to the implementations that caused the error.
2023-05-05Normalize consistently for specializationsMatthew Jasper-0/+82
2023-05-05Disallow (min) specialization imps with no itemsMatthew Jasper-0/+28
Such implementations are usually mistakes and are not used in the compiler or standard library (after this commit) so forbid them with `min_specialization`.
2023-03-23Note type mismatch on ConstArgHasTypeMichael Goulet-1/+1
2023-03-19Delay overlap errors if errors are involvedMichael Goulet-7/+10
2023-03-19Constrain const vars to error if const types are mismatchedMichael Goulet-4/+4
2023-03-09Use param's real type in try_eval_lit_or_paramMichael Goulet-0/+23
2023-01-12Point at HIR types when impl trait ref doesn't normalizeMichael Goulet-2/+2
2023-01-11Move /src/test to /testsAlbert Larsan-0/+546