about summary refs log tree commit diff
path: root/src/test/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2021-03-27Add regression tests for #56445Simon Jakobi-3/+48
Closes #56445.
2021-03-23Update to not have extra matchkadmin-0/+75
2021-03-23Update with commentskadmin-3/+33
2021-03-23Update with commentskadmin-0/+53
A bunch of nits fixed, and a new test for pretty printing the AST.
2021-03-23Add query for const_param_defaultkadmin-0/+56
2021-03-23progress, stuff compiles nowlcnr-16/+33
2021-03-23Some refactoringvarkor-16/+11
2021-03-23Add has_default to GenericParamDefKind::Constkadmin-2/+18
This currently creates a field which is always false on GenericParamDefKind for future use when consts are permitted to have defaults Update const_generics:default locations Previously just ignored them, now actually do something about them. Fix using type check instead of value Add parsing This adds all the necessary changes to lower const-generics defaults from parsing. Change P<Expr> to AnonConst This matches the arguments passed to instantiations of const generics, and makes it specific to just anonymous constants. Attempt to fix lowering bugs
2021-03-21Rollup merge of #82707 - BoxyUwU:errooaaar, r=oli-obkDylan DPC-21/+38
const_evaluatable_checked: Stop eagerly erroring in `is_const_evaluatable` Fixes #82279 We don't want to be emitting errors inside of is_const_evaluatable because we may call this during selection where it should be able to fail silently There were two errors being emitted in `is_const_evaluatable`. The one causing the compile error in #82279 was inside the match arm for `FailureKind::MentionsParam` but I moved the other error being emitted too since it made things cleaner imo The `NotConstEvaluatable` enum \*should\* have a fourth variant for when we fail to evaluate a concrete const, e.g. `0 - 1` but that cant happen until #81339 cc `@oli-obk` `@lcnr` r? `@nikomatsakis`
2021-03-19Add a second regression testOli Scherer-0/+32
2021-03-19Do not ICE on ty::Error as an error must already have been reportedOli Scherer-0/+35
2021-03-10Rollup merge of #81309 - lcnr:lazy-norm-err-msgh, r=nikomatsakisDylan DPC-4/+6
always eagerly eval consts in Relate r? ```@nikomatsakis``` cc ```@varkor```
2021-03-05Bump mir-opt-level from 3 to 4 in testsSantiago Pastorino-1/+1
2021-03-02errooaaar~Ellen-21/+38
2021-02-24Auto merge of #82159 - BoxyUwU:uwu, r=varkorbors-0/+47
Use correct param_env in conservative_is_privately_uninhabited cc `@lcnr` r? `@varkor` since this is your FIXME that was removed ^^
2021-02-23yeetEllen-0/+47
2021-02-18Rollup merge of #82112 - BoxyUwU:tumbleweed, r=varkorDylan DPC-0/+34
const_generics: Dont evaluate array length const when handling yet another error Same ICE as #82009 except triggered by a different error. cc ``@lcnr`` r? ``@varkor``
2021-02-18Rollup merge of #82055 - JulianKnodt:ty_where_const, r=estebankYuki Okushi-14/+84
Add diagnostics for specific cases for const/type mismatch err For now, this adds at least more information so better diagnostics can be emitted for const mismatch errors. I'm not sure what exactly we want to emit, so I've left notes there temporarily, also to see if this is the right approach r? ```@lcnr``` cc: ```@estebank```
2021-02-16Remove ordering hintkadmin-2/+0
2021-02-16Update w/ commentskadmin-16/+68
2021-02-15Rollup merge of #82067 - BoxyUwU:hahaicantthinkofabadpun, r=oli-obkJonas Schievink-0/+24
const_generics: Fix incorrect ty::ParamEnv::empty() usage Fixes #80561 Not sure if I should keep the `debug!(..)`s or not but its the second time I've needed them so they sure seem useful lol cc ``@lcnr`` r? ``@oli-obk``
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