about summary refs log tree commit diff
path: root/tests/ui/specialization
AgeCommit message (Collapse)AuthorLines
2025-01-27Remove all dead files inside tests/ui/León Orell Valerian Liehr-72/+0
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-10Tweak wording of non-const traits used as const boundsEsteban Küber-6/+21
Use verbose suggestions and add additional labels/notes. Add more test cases for stable/nightly and feature enabled/disabled.
2024-12-07Mention type parameter in more cases and don't suggest ~const bound already ↵Esteban Küber-5/+5
there
2024-12-07Use trait name instead of full constraint in suggestion messageEsteban Küber-7/+7
``` 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-7/+7
2024-11-22Rollup merge of #132090 - compiler-errors:baily, r=lcnrMichael Goulet-13/+2
Stop being so bail-y in candidate assembly A conceptual follow-up to #132084. We gotta stop bailing so much when there are errors; it's both unnecessary, leads to weird knock-on errors, and it's messing up the vibes lol
2024-11-22Simplify fulfill_implicationMichael Goulet-10/+2
2024-11-21Stop being so bail-y in candidate assemblyMichael Goulet-13/+2
2024-11-03Gate checking ~const bounds on const_trait_implMichael Goulet-50/+1
2024-11-02NFC add known bug nr to testMatthias Krüger-1/+1
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-10-26Pass constness with span into lower_poly_trait_refMichael Goulet-12/+12
2024-10-24Implement const effect predicate in new solverMichael Goulet-45/+17
2024-10-15rebase and update fixed `crashes`lcnr-0/+86
2024-10-15stabilize `-Znext-solver=coherence`lcnr-22/+74
2024-10-10UI tests: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-4/+4
2024-09-29fix(hir_analysis/wfcheck): don't leak {type error}Barrett Ray-1/+1
avoid `{type error}` being leaked in user-facing messages, particularly when using the `adt_const_params` feature
2024-09-12Re-enable `ConstArgKind::Path` lowering by defaultNoah Lev-26/+4
...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-09-11Revert 'Stabilize -Znext-solver=coherence'Michael Goulet-160/+22
2024-09-05rebase and update fixed `crashes`lcnr-0/+86
2024-09-05stabilize `-Znext-solver=coherence`lcnr-22/+74
2024-08-19Retroactively feature gate `ConstArgKind::Path`Boxy-4/+26
2024-08-10Differentiate between methods and associated functionsEsteban Küber-5/+5
Accurately refer to assoc fn without receiver as assoc fn instead of methods. Add `AssocItem::descr` method to centralize where we call methods and associated functions.
2024-07-16Add `ConstArgKind::Path` and make `ConstArg` its own HIR nodeNoah Lev-26/+4
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-06-28bless tests part 1Deadbeef-2/+66
2024-06-19Const generic parameters aren't bounds, even if we end up erroring because ↵Oli Scherer-2/+2
of the bound that binds the parameter's type
2024-06-07Only compute specializes query if specialization is enabled in the crate of ↵Michael Goulet-1/+1
the specialized impl
2024-06-07Failing testMichael Goulet-0/+43
2024-06-05Rollup merge of #125792 - compiler-errors:dont-drop-upcast-cand, r=lcnrMatthias Krüger-0/+24
Don't drop `Unsize` candidate in intercrate mode Fixes #125767
2024-05-31Stop using translate_args in the new solverMichael Goulet-0/+89
2024-05-31Rollup merge of #125786 - compiler-errors:fold-item-bounds, r=lcnrMatthias Krüger-36/+7
Fold item bounds before proving them in `check_type_bounds` in new solver Vaguely confident that this is sufficient to prevent rust-lang/trait-system-refactor-initiative#46 and rust-lang/trait-system-refactor-initiative#62. This is not the "correct" solution, but will probably suffice until coinduction, at which point we implement the right solution (`check_type_bounds` must prove `Assoc<...> alias-eq ConcreteType`, normalizing requires proving item bounds). r? lcnr
2024-05-31Avoid unwrap diag.code directlyr0cky-0/+55
2024-05-30Don't drop Upcast candidate in intercrate modeMichael Goulet-0/+24
2024-05-30Fold item bound before checking that they holdMichael Goulet-36/+7
2024-05-29Partially implement `ConstArgHasType`Boxy-29/+10
2024-05-24Fail relating constants of different typesOli Scherer-10/+29
2024-04-30fix `NormalizesTo` proof tree issuelcnr-2/+59
2024-04-16Fail candidate assembly for erroneous typesGurinder Singh-2/+13
Trait predicates for types which have errors may still evaluate to OK leading to downstream ICEs. Now we return a selection error for such types in candidate assembly and thereby prevent such issues
2024-04-04Specialization already rejects defining opaque typesOli Scherer-0/+71
2024-03-31Always make inductive cycles as ambig during typeckMichael Goulet-24/+33
2024-03-25Rollup merge of #122988 - matthiaskrgr:icetests, r=petrochenkovMatthias Krüger-0/+36
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-25Auto merge of #122802 - estebank:unconstrained-generic-const, r=Nadrierilbors-1/+4
Provide structured suggestion for unconstrained generic constant ``` 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-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-03-23add test for #107228Matthias Krüger-0/+28
Fixes #107228
2024-03-21Provide structured suggestion for unconstrained generic constantEsteban Küber-1/+4
``` 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-18Provide structured suggestion for `#![feature(foo)]`Esteban Küber-4/+16
``` 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.