summary refs log tree commit diff
path: root/src/test/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2020-11-12Rollup merge of #78987 - lcnr:integer-sizes, r=varkorMara Bos-5/+94
extend min_const_generics param ty tests Apparently we never tested for `u128` and `i128` before this, so I added a test for all types which are allowed. r? ``@varkor``
2020-11-12extend min_const_generics param ty testsBastian Kauschke-5/+94
2020-11-12Rollup merge of #78960 - ethanboxx:const-gen-test-default-error, r=lcnrGuillaume Gomez-0/+28
Test default values for const parameters. The last topic on #78433 I originally intended to place these tests in a single file, however, due to them being parser errors that are fatal, they must be in separate files to be detected. Thanks, ``@lcnr`` for mentoring me on this PR. r? ``@lcnr``
2020-11-12Rollup merge of #78916 - lcnr:const-generics-tests, r=varkorGuillaume Gomez-0/+954
extend const generics test suite should implement most of #78433, especially all parts of [the hackmd](https://hackmd.io/WnFmN4MjRCqAjGmYfYcu2A?view) which I did not explicitly mention in that issue. r? ``@varkor``
2020-11-11default_trait_paramEthan Brierley-0/+14
2020-11-11Add test `default_function_param`Ethan Brierley-0/+14
2020-11-11Rollup merge of #78832 - lcnr:const-evaluatable-unevaluated, r=oli-obkJonas Schievink-0/+61
look at assoc ct, check the type of nodes an example where types matter are function objects, see the added test which previously passed. Now does a shallow comparison of unevaluated constants. r? ```@oli-obk```
2020-11-10add cross crate testBastian Kauschke-0/+47
2020-11-10add test for where clauses mentioning const paramsBastian Kauschke-0/+35
2020-11-10const param in asyncBastian Kauschke-0/+35
2020-11-10try referencing outer paramsBastian Kauschke-0/+247
2020-11-10exhaustively enumerate all values of a const paramBastian Kauschke-0/+310
2020-11-10add associated type bounds testBastian Kauschke-0/+71
2020-11-10add macro_rules test regarding bracesBastian Kauschke-0/+149
2020-11-10Add macro test for min-const-genericskadmin-0/+212
2020-11-10add generic param mismatch testBastian Kauschke-0/+38
2020-11-10const param macro testBastian Kauschke-0/+22
2020-11-07look at assoc ct, check the type of nodesBastian Kauschke-0/+61
2020-10-29Rollup merge of #78478 - hameerabbasi:const-generics-supertraits, r=lcnrYuki Okushi-0/+85
Add const generics tests for supertraits + dyn traits. Partially addresses #78433
2020-10-29Rollup merge of #78460 - varkor:turbofish-string-generic, r=lcnrYuki Okushi-12/+12
Adjust turbofish help message for const generics Types are no longer special. (This message arguably only makes sense with `min_const_generics` or more, but we'll be there soon.) r? @lcnr
2020-10-29Rollup merge of #78428 - JulianKnodt:invalid_patterns, r=lcnrYuki Okushi-0/+105
MinConstGenerics UI test for invalid values for bool & char This adds a test for `feature(min_const_generics)` with some invalid values for bools and chars and ensures that they do not ICE and error with understandable messages. r? @lcnr
2020-10-29Rollup merge of #78224 - lcnr:repeat-expr, r=varkorYuki Okushi-20/+144
min_const_generics: allow ty param in repeat expr implements https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/repeat.20expressions Even with `min_const_generics` active, now keeps resulting in future compat warnings instead of hard errors. Const parameters, for example `[0; N + 1]`, still result in hard errors during resolve. ```rust #![allow(dead_code)] fn foo<T>() { [0; std::mem::size_of::<*mut T>()]; } struct Foo<T>(T); impl<T> Foo<T> { const ASSOC: usize = 4; fn test() { [0; Self::ASSOC]; } } ``` r? @varkor cc @petrochenkov
2020-10-28Assert in every case.Hameer Abbasi-19/+22
2020-10-28Extend test to cover dyn methods/functions.Hameer Abbasi-20/+44
2020-10-28Adjust turbofish help message for const genericsvarkor-12/+12
2020-10-28Add const generics tests for supertraits + dyn traits.Hameer Abbasi-0/+58
2020-10-28Rollup merge of #78391 - JulianKnodt:mc_test, r=lcnrDylan DPC-0/+17
Add const_fn in generics test Adds a test that constant functions in generic parameters work properly. I was surprised this works, but I also to turbofish the constant in main, otherwise it didn't infer properly: ``` let v: ConstU32<3> = ... ``` Did not work as I expected, which I can highlight in the test if that's the intended behaviour. r? @lcnr
2020-10-28Rollup merge of #78365 - lcnr:const-eval-obj-safety, r=oli-obkDylan DPC-0/+140
check object safety of generic constants As `Self` can only be effectively used in constants with `const_evaluatable_checked` this should not matter outside of it. Implements the first item of #72219 > Object safety interactions with constants r? @oli-obk for now cc @nikomatsakis
2020-10-27Add UI test for invalid values for bool & charkadmin-0/+105
2020-10-27Add const_fn in generics testkadmin-0/+17
2020-10-27Auto merge of #77502 - varkor:const-generics-suggest-enclosing-braces, ↵bors-7/+554
r=petrochenkov Suggest that expressions that look like const generic arguments should be enclosed in brackets I pulled out the changes for const expressions from https://github.com/rust-lang/rust/pull/71592 (without the trait object diagnostic changes) and made some small changes; the implementation is `@estebank's.` We're also going to want to make some changes separately to account for trait objects (they result in poor diagnostics, as is evident from one of the test cases here), such as an adaption of https://github.com/rust-lang/rust/pull/72273. Fixes https://github.com/rust-lang/rust/issues/70753. r? `@petrochenkov`
2020-10-26Suggest expressions that look like const generic arguments should be ↵varkor-7/+554
enclosed in brackets Co-Authored-By: Esteban Kuber <github@kuber.com.ar>
2020-10-26add fixmeBastian Kauschke-1/+2
2020-10-25check for object safety violations in constantsBastian Kauschke-0/+139
2020-10-24Rollup merge of #78272 - lcnr:abstract-const-unused-node, r=oli-obkJonas Schievink-0/+68
const_evaluatable_checked: deal with unused nodes + div r? @oli-obk
2020-10-23add tests for self with const paramsBastian Kauschke-6/+28
2020-10-23reviewBastian Kauschke-3/+9
2020-10-23const_eval_checked: deal with unused nodes + divBastian Kauschke-0/+62
2020-10-22improve const infer errorBastian Kauschke-1/+1
2020-10-22min_const_generics: allow ty param in repeat exprBastian Kauschke-20/+122
2020-10-17Suggest minimal subset features in `incomplete_features` lintYuki Okushi-0/+10
2020-10-12Bless expected errorsEthan Brierley-132/+132
2020-10-11`min_const_generics` diagnostics improvementsEthan Brierley-174/+174
2 3
2020-10-05Rollup merge of #77439 - varkor:min_const_generics-tests, r=lcnr,estebankDylan DPC-62/+623
Fix missing diagnostic span for `impl Trait` with const generics, and add various tests for `min_const_generics` and `const_generics` Closes https://github.com/rust-lang/rust/issues/61410. Adds `min_const_generics` tests for: - https://github.com/rust-lang/rust/issues/73727 - https://github.com/rust-lang/rust/issues/72293 - https://github.com/rust-lang/rust/issues/67375 - https://github.com/rust-lang/rust/issues/75153 - https://github.com/rust-lang/rust/issues/71922 - https://github.com/rust-lang/rust/issues/69913 - https://github.com/rust-lang/rust/issues/67945 - https://github.com/rust-lang/rust/issues/69239 Adds `const_generics` tests for: - https://github.com/rust-lang/rust/issues/67375 - https://github.com/rust-lang/rust/issues/75153 - https://github.com/rust-lang/rust/issues/71922 - https://github.com/rust-lang/rust/issues/69913 - https://github.com/rust-lang/rust/issues/67945 - https://github.com/rust-lang/rust/issues/69239 (I only added separate `min_const_generics` and `const_generics` tests if they were handled differently by the two features.) We need to figure out how to deduplicate when `const_generics` is stabilised, but we can discuss that later. For now, we should be checking neither feature breaks, so require regression tests for both. I've given them identical names when I've added both, which should make it easier to spot them later. r? @lcnr
2020-10-04Rollup merge of #77388 - JohnTitor:add-tests, r=Dylan-DPCYuki Okushi-0/+11
Add some regression tests Closes #66501 Closes #68951 Closes #72565 Closes #74244 Closes #75299 The first issue is fixed in 1.43.0, other issues are fixed in the recent nightly.
2020-10-03Add `const_generics` test for `impl-trait-with-const-arguments`varkor-2/+14
2020-10-03Move testsvarkor-148/+0
2020-10-03Add tests for `const_generics`varkor-21/+392
2020-10-03Replace "non trivial" with "non-trivial"varkor-82/+82
2020-10-02resolve: prohibit anon const non-static lifetimesDavid Wood-0/+48
This commit modifies name resolution to emit an error when non-static lifetimes are used in anonymous constants when the `min_const_generics` feature is enabled. Signed-off-by: David Wood <david@davidtw.co>