about summary refs log tree commit diff
path: root/tests/ui/specialization
AgeCommit message (Collapse)AuthorLines
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.
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-60/+60
2024-02-14Continue compilation after check_mod_type_wf errorsOli Scherer-4/+32
2024-02-13Do not assemble candidates for default implsMichael Goulet-40/+37
2024-02-10Allow restricted trait impls in macros with `min_specialization`Zalathar-1/+8
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-02-08Continue to borrowck even if there were previous errorsOli Scherer-1/+29
2024-02-08Auto merge of #120558 - oli-obk:missing_impl_item_ice, r=estebankbors-9/+16
Stop bailing out from compilation just because there were incoherent traits fixes #120343 but also has a lot of "type annotations needed" fallout. Some are fixed in the second commit.
2024-02-07Update testsr0cky-6/+6
2024-02-05Stop bailing out from compilation just because there were incoherent traitsOli Scherer-9/+16
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-30Rollup merge of #120400 - estebank:bound-error-cleanup, r=oli-obkGuillaume Gomez-4/+1
Bound errors span label cleanup Consolidate span labels for "this type doesn't satisfy a bound" for more compact diagnostic output.
2024-01-26Use single label for method not found due to unmet boundEsteban Küber-4/+1
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-20Auto merge of #119821 - oli-obk:reveal_all_const_evals, r=lcnrbors-0/+69
Always use RevealAll for const eval queries implements what is described in https://github.com/rust-lang/rust/pull/116803#discussion_r1364089471 Using `UserFacing` for const eval does not make sense anymore, unless we significantly change things like avoiding revealing opaque types. New tests are copied from https://github.com/rust-lang/rust/pull/101478
2024-01-19Always use RevealAll for const eval queriesOli Scherer-0/+69
2024-01-15Rollup merge of #119963 - clubby789:spec-allow-internal-unstable, ↵Matthias Krüger-0/+18
r=compiler-errors Fix `allow_internal_unstable` for `(min_)specialization` Fixes #119950 Blocked on #119949 (comment doesn't make sense until that merges) I'd like to follow this up and look for more instances of not properly checking spans for features but I wanted to fix the motivating issue.
2024-01-14Fix `allow_internal_unstable` for `(min_)specialization`clubby789-0/+18
2024-01-13Bless testsGeorge-lewis-0/+2
Update tests
2024-01-05Auto merge of #118297 - shepmaster:warn-dead-tuple-fields, r=WaffleLapkinbors-2/+2
Merge `unused_tuple_struct_fields` into `dead_code` This implicitly upgrades the lint from `allow` to `warn` and places it into the `unused` lint group. [Discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Moving.20.60unused_tuple_struct_fields.60.20from.20allow.20to.20warn)
2024-01-02Adjust compiler tests for unused_tuple_struct_fields -> dead_codeJake Goulding-2/+2
2024-01-02Reorder `check_item_type` diagnostics so they occur next to the ↵Oli Scherer-4/+4
corresponding `check_well_formed` diagnostics
2023-12-27Introduce `const Trait` (always-const trait bounds)León Orell Valerian Liehr-3/+3
2023-12-14update use of feature flagslcnr-2/+2
2023-12-10remove redundant importssurechen-1/+0
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-11-24Show number in error message even for one errorNilstrieb-40/+40
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-10-09Extend impl's def_span to include where clausesMichael Goulet-4/+6
2023-09-23Tweak expected message to explain what it's actually signifyingMichael Goulet-1/+1
2023-09-10Point out if a local trait has no implementationsMichael Goulet-0/+5
2023-06-28Adjust inner span of implicit self ref argumentMichael Goulet-2/+2
2023-06-06bless coherence testMichael Goulet-2/+31
2023-05-09Rollup merge of #111252 - matthewjasper:min-spec-improvements, r=compiler-errorsDylan DPC-0/+187
Min specialization improvements - Don't allow specialization impls with no items, such implementations are probably not correct and only occur as mistakes in the compiler and standard library - Fix a missing normalization call - Adds spans for lifetime errors from overly general specializations Closes #79457 Closes #109815
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.