about summary refs log tree commit diff
path: root/src/test/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2020-11-21Auto merge of #78461 - TimDiekmann:vec-alloc, r=Amanieubors-4/+6
Add support for custom allocators in `Vec` This follows the [roadmap](https://github.com/rust-lang/wg-allocators/issues/7) of the allocator WG to add custom allocators to collections. r? `@Amanieu` This pull request requires a crater run. ### Prior work: - #71873: Crater-test to solve rust-lang/wg-allocators#1 - [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg)-crate
2020-11-18Use `Cell` instead of `Vec` in const-generics testTim Diekmann-4/+6
As `Cell` won't receive an allocator parameter, it is used. Otherwise a `#![feature(allocator_api)]` could have been added, but for the purpose of this test, changing the type is more clear.
2020-11-18Suggest turbofish for uninferred const argumentJustus K-3/+83
2020-11-18Add tests for multi-segment paths in const generic argumentsvarkor-12/+49
2020-11-18Permit standalone generic parameters as const generic arguments in macrosvarkor-25/+3
2020-11-17extend macro braces testBastian Kauschke-2/+44
2020-11-16Rollup merge of #79032 - lcnr:arg-count, r=varkorMara Bos-141/+95
improve type const mismatch errors Doesn't completely remove `check_generic_arg_count` as that would have required some more complex changes but instead checks type and const params in only one step. Also moved the help added by `@JulianKnodt` in #75611 to `generic_arg_mismatch_err`. r? `@varkor` cc `@petrochenkov`
2020-11-16improve error message for const ty param mismatchBastian Kauschke-141/+95
2020-11-14Auto merge of #78809 - vn-ki:fix-issue-76064, r=oli-obkbors-19/+4
add error_occured field to ConstQualifs, fix #76064 I wasn't sure what `in_return_place` actually did and not sure why it returns `ConstQualifs` while it's sibling functions return `bool`. So I tried to make as minimal changes to the structure as possible. Please point out whether I have to refactor it or not. r? `@oli-obk` cc `@RalfJung`
2020-11-13lessen restriction in `check_kind_count`Bastian Kauschke-4/+4
2020-11-13Rollup merge of #78996 - lcnr:cg-promotion, r=RalfJungGuillaume Gomez-0/+11
add explicit test for const param promotion r? `@RalfJung`
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-12cg: add explicit test for const param promotionBastian Kauschke-0/+11
2020-11-12check mir exists before validation; fix testsVishnunarayan K I-19/+4
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