about summary refs log tree commit diff
path: root/src/test/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2021-02-15the environment round here is awfully emptyEllen-0/+34
capitalism
2021-02-13Add additional type info to mismatch errkadmin-20/+40
2021-02-13a wild test has appeared uwuEllen-0/+24
2021-02-13Heat up the ICE-y error reportingEllen-0/+35
rest in peace match bool <3
2021-02-03Miscellaneous small diagnostics cleanupCamelid-5/+5
2021-02-02Rollup merge of #81544 - JulianKnodt:sat_where, r=lcnrJack Huey-5/+5
Add better diagnostic for unbounded Abst. Const ~~In the case where a generic abst. const requires a trivial where bound: `where TypeWithConst<const_fn(N)>: ,`, instead of requiring a where bound, just check that only consts are being substituted in to skip over where check.~~ ~~This is pretty sketchy, but I think it works. Presumably, if there is checking for type bounds added later, it can first check nested requirements, and see if they're satisfied by the current `ParamEnv`.~~ Changed the diagnostic to add a better example, which is more practical than what was previously proposed. r? ```@lcnr```
2021-02-02Add better diagnostic for missing where clausekadmin-5/+5
Previously, it's not clear what exactly should be added in the suggested where clause, so this adds an example to demonstrate.
2021-02-01more things are const evaluatable *sparkles*Ellen-1/+17
2021-02-01Rollup merge of #79291 - JulianKnodt:ce_priv, r=petrochenkovJonas Schievink-0/+74
Add error message for private fn Attempts to add a more detailed error when a `const_evaluatable` fn from another scope is used inside of a scope which cannot access it. r? ````@lcnr````
2021-01-31Add error message for private fnkadmin-0/+74
Bless tests Update with changes from comments
2021-01-31Rollup merge of #81566 - osa1:issue71202, r=jonas-schievinkJonas Schievink-0/+33
Add a test for #71202 Closes #71202 --- Note that the test normally generates this warning: ``` warning: cannot use constants which depend on generic parameters in types --> test.rs:10:5 | 10 | / const ITEM_IS_COPY: [(); 1 - { 11 | | trait NotCopy { 12 | | const VALUE: bool = false; 13 | | } ... | 26 | | <IsCopy<T>>::VALUE 27 | | } as usize] = []; | |_____________________^ | = note: `#[warn(const_evaluatable_unchecked)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #76200 <https://github.com/rust-lang/rust/issues/76200> ``` I added `allow(const_evaluatable_unchecked)`, but maybe we just don't want to add a test for this as the program is not really valid?
2021-01-31Rollup merge of #80470 - SimonSapin:array-intoiter-type, r=m-ou-seJonas Schievink-2/+0
Stabilize by-value `[T; N]` iterator `core::array::IntoIter` Tracking issue: https://github.com/rust-lang/rust/issues/65798 This is unblocked now that `min_const_generics` has been stabilized in https://github.com/rust-lang/rust/pull/79135. This PR does *not* include the corresponding `IntoIterator` impl, which is https://github.com/rust-lang/rust/pull/65819. Instead, an iterator can be constructed through the `new` method. `new` would become unnecessary when `IntoIterator` is implemented and might be deprecated then, although it will stay stable.
2021-01-30Add a test for #71202Ömer Sinan Ağacan-0/+33
Closes #71202
2021-01-28Rollup merge of #81433 - lcnr:stop-looking-into-ty-alias, r=oli-obkYuki Okushi-4/+35
const_evaluatable: stop looking into type aliases see https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/const_evaluatable.3A.20type.20alias r? ````@oli-obk````
2021-01-28Rollup merge of #81430 - lcnr:elaborate-const-eval, r=oli-obkYuki Okushi-0/+24
add const_evaluatable_checked test cc `````@oli-obk`````
2021-01-27fix tidy errorsEllen-3/+6
2021-01-27commentsEllen-0/+8
2021-01-27const_evaluatable: stop looking into type aliasesBastian Kauschke-4/+35
2021-01-27add const_evaluatable_checked testBastian Kauschke-0/+24
2021-01-27boop, ur abstract consts are now expandedEllen-0/+112
2021-01-23add test for lazy norm errBastian Kauschke-4/+6
2021-01-17Rollup merge of #79298 - lcnr:new-elysium, r=matthewjasperMara Bos-0/+34
correctly deal with late-bound lifetimes in anon consts adds support for using late bound lifetimes of the parent context in anon consts. ```rust #![feature(const_generics)] const fn inner<'a>() -> usize where &'a (): Sized { 3 } fn test<'a>() { let _: [u8; inner::<'a>()]; } ``` The lifetime `'a` is late bound in `test` so it's not included in its generics but is instead dealt with separately in borrowck. This didn't previously work for anon consts as they have to use the late bound lifetimes of their parent which has to be explicitly handled. r? ```@matthewjasper``` cc ```@varkor``` ```@eddyb```
2021-01-16Move some tests to more reasonable directories - 2Caio-0/+37
Address comments Update limits
2021-01-16correctly deal with late-bound lifetimes in anon constsBastian Kauschke-0/+34
2021-01-10Rework diagnostics for wrong number of generic argsPatryk Wychowaniec-29/+113
2021-01-05fixed const_generics error helpJake Vossen-53/+53
2021-01-05Rollup merge of #80538 - JulianKnodt:err_usize, r=lcnrYuki Okushi-0/+25
Add check for `[T;N]`/`usize` mismatch in astconv Helps clarify the issue in #80506 by adding a specific check for mismatches between [T;N] and usize. r? `@lcnr`
2021-01-04Add check for array/usize mismatch in astconvkadmin-0/+25
2021-01-01make `const_generics_defaults` use the unstable syntax mechanismRémy Rakic-8/+12
This is important to not accidentally stabilize the parsing of the syntax while it still is experimental and not formally accepted
2021-01-01adjust const generics defaults FIXMEs to the new feature gateRémy Rakic-1/+1
2021-01-01update `min_const_generics` tests using default values for const paramsRémy Rakic-8/+12
The `const_generics_defaults` now handles them, and they correctly parse, so we can update these tests expecting a parser error .
2020-12-31Rollup merge of #80551 - lcnr:const-arg-wildcard, r=varkorDylan DPC-0/+76
support pattern as const parents in type_of nice to know that there's still stuff about rust i didn't know about :laughing: fixes #80531 r? `@varkor`
2020-12-31Rollup merge of #80519 - max-heller:issue-80512-fix, r=varkorDylan DPC-10/+10
Take type defaults into account in suggestions to reorder generic parameters Fixes #80512
2020-12-31support pattern as const parents in type_ofBastian Kauschke-0/+76
2020-12-30Take type defaults into account in suggestions to reorder generic parametersmax-heller-10/+10
2020-12-30Add regression test for #80062LeSeulArtichaut-0/+21
2020-12-29Stabilize by-value `[T; N]` iterator `core::array::IntoIter`Simon Sapin-2/+0
Tracking issue: https://github.com/rust-lang/rust/issues/65798 This is unblocked now that `min_const_generics` has been stabilized in https://github.com/rust-lang/rust/pull/79135. This PR does *not* include the corresponding `IntoIterator` impl, which is https://github.com/rust-lang/rust/pull/65819. Instead, an iterator can be constructed through the `new` method. `new` would become unnecessary when `IntoIterator` is implemented and might be deprecated then, although it will stay stable.
2020-12-27Add regression test for #80375LeSeulArtichaut-0/+15
2020-12-26update testsBastian Kauschke-661/+423
2020-12-26delete no longer relevant testsBastian Kauschke-72/+0
2020-12-20Auto merge of #79635 - lcnr:const-eval-idk, r=oli-obkbors-0/+32
const_evaluatable_checked: fix occurs check fixes #79615 this is kind of a hack because we use `TypeRelation` for both the `Generalizer` and the `ConstInferUnifier` but i am not sure if there is a useful way to disentangle this without unnecessarily duplicating some code. The error in the added test is kind of unavoidable until we erase the unused substs of `ConstKind::Unevaluated`. We talked a bit about this in the cg lazy norm meeting (https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/lazy_normalization_consts)
2020-12-05Const parameters can not be inferred with `_`Ethan Brierley-0/+21
Small improvement. Thanks varkor Co-authored-by: varkor <github@varkor.com> Bless
2020-12-02const_evaluatable_checked: fix occurs checkBastian Kauschke-0/+32
2020-12-02add comment and bless some testsVishnunarayan K I-10/+2
2020-11-29Update tests to remove old numeric constantsbstrie-17/+17
Part of #68490. Care has been taken to leave the old consts where appropriate, for testing backcompat regressions, module shadowing, etc. The intrinsics docs were accidentally referring to some methods on f64 as std::f64, which I changed due to being contrary with how we normally disambiguate the shadow module from the primitive. In one other place I changed std::u8 to std::ops since it was just testing path handling in macros. For places which have legitimate uses of the old consts, deprecated attributes have been optimistically inserted. Although currently unnecessary, they exist to emphasize to any future deprecation effort the necessity of these specific symbols and prevent them from being accidentally removed.
2020-11-26Fix new 'unnecessary trailing semicolon' warningsAaron Hill-5/+5
2020-11-26Rollup merge of #77758 - Stupremee:turbofish-help-for-const, r=varkorJonas Schievink-3/+83
suggest turbofish syntax for uninferred const arguments When not providing a const generic value, and it can not be inferred, the following suggestion is suggested: ![image](https://user-images.githubusercontent.com/39732259/95616180-af127b80-0a69-11eb-8877-551c815f9627.png) Resolves #76737 r? ``@varkor``
2020-11-24Swap note for helpmendess-111/+111
2020-11-24Requested changesmendess-40/+58
2020-11-24Add note to use nightly when using expr in const genericsmendess-0/+40