about summary refs log tree commit diff
path: root/src/test/ui/const-generics/defaults
AgeCommit message (Collapse)AuthorLines
2021-08-30`feature(const_generics)` -> `feature(const_param_types)`lcnr-139/+28
2021-08-30rename const_evaluatable_checked to generic_const_exprsEllen-5/+5
:sparkles:
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-1/+0
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-07-24Auto merge of #86580 - BoxyUwU:cgd-subst-ice, r=nikomatsakisbors-0/+96
dont provide fwd declared params to cg defaults Fixes #83938 ```rust #![feature(const_evaluatable_checked, const_generics, const_generics_defaults)] #![allow(incomplete_features)] pub struct Bar<const N: usize, const M: usize = { N + 1 }>; pub fn foo<const N1: usize>() -> Bar<N1> { loop {} } fn main() {} ``` This PR makes this code no longer ICE, it was ICE'ing previously because when building substs for `Bar<N1>` we would subst the anon ct: `ConstKind::Unevaluated({N + 1}, substs: [N, M])` with substs of `[N1]`. the anon const has forward declared params supplied though so we end up trying to substitute the provided `M` param which causes the ICE. This PR doesn't handle the predicates of the const so ```rust trait Foo<const N: usize> { const Assoc: usize; } pub struct Bar<const N: usize = { <()>::Assoc }> where (): Foo<N>; ``` Resolves to `<() as Foo<N>>::Assoc` which can allow for using fwd declared params indirectly. ```rust trait Foo<const N: usize> {} struct Bar<const N: usize = { 2 + 3 }> where (): Foo<N>; ``` This code also ICEs under this PR because instantiating the default's predicates causes an ICE as predicates_of contains predicates with fwd declared params PR was briefly discussed [in this zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/evil.20preds.20in.20param.20env.20.2386580)
2021-07-14OOPSEllen-9/+9
2021-07-14Change type param -> generic paramEllen-0/+37
2021-07-10redo testsEllen-31/+96
2021-07-10Moves changes to explicit_preds_of/inferred_outlives_of/generics_ofEllen-1/+10
2021-07-10Dont provide all parent generics to cgdefaultsEllen-0/+22
2021-07-08only check cg defaults wf once instantiatedlcnr-23/+4
2021-06-12Rollup merge of #85800 - BoxyUwU:const-param-default-diagnostics, r=oli-obkYuki Okushi-12/+40
Fix some diagnostic issues with const_generics_defaults feature gate This PR makes a few changes: - print out const param defaults in "lifetime ordering" errors rather than discarding them - update `is_simple_text` to account for const params when checking if a type has no generics, this was causing a note to be failed to add to an error message - fixes some diagnostic wording that incorrectly said there was ordering restrictions between type/const params despite the `const_generics_defaults` feature gate is active
2021-06-07note :sparkles: uwuuuEllen-8/+13
2021-06-01Add test for forward declared const param defaultsEllen-0/+42
2021-05-29Fix missing note on type mismatch error diagnosticsEllen-4/+14
2021-05-29Make lifetime ordering error pretty print const param defaultsEllen-2/+15
2021-05-13wowEllen-1/+1
2021-05-13completion uwuEllen-6/+0
2021-04-21supply substs to anon consts in defaultslcnr-25/+29
2021-04-21improve wf check for const param defaultslcnr-5/+54
2021-04-21loosen ordering restricts for `const_generics_defaults`lcnr-71/+128
2021-04-21fix name resolution for param defaultslcnr-2/+63
2021-03-29Prefer 4 spacesJohnTitor-52/+52
2021-03-29Add a regression test for issue-82792JohnTitor-0/+14
2021-03-23Update to not have extra matchkadmin-0/+75
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/+42
2021-03-23progress, stuff compiles nowlcnr-7/+25
2021-03-23Some refactoringvarkor-4/+1
2021-03-23Add has_default to GenericParamDefKind::Constkadmin-0/+15
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
2020-12-30Take type defaults into account in suggestions to reorder generic parametersmax-heller-10/+10
2020-12-26update testsBastian Kauschke-34/+16
2020-10-17Suggest minimal subset features in `incomplete_features` lintYuki Okushi-0/+1
2020-09-10Add revisions to const generic default UI tests.Hameer Abbasi-13/+64
2020-08-12Flip order of const & typekadmin-1/+1
2020-08-09Change Ord impl for ParamKindOrdkadmin-40/+43
Updated tests and error msgs Update stderr from test Update w/ lcnr comments Change some tests around, and also updated Ord implementation for ParamKindOrd Update w/ nits from lcnr
2020-08-09Test lifetimes after types after consts forbiddenkadmin-2/+39
Added more complex test and changed error message
2020-08-09Added +1 test for only works w/ feat const genkadmin-1/+54
Added this test to ensure that reordering the parameters only works with the feature const generics enabled. Fixed nits Also added another test to verify that intermixed lifetimes are forbidden
2020-08-08Rm restriction on ord of default types w/ constskadmin-0/+11
2020-08-07test min_const_generics using revisionsBastian Kauschke-5/+17
2020-07-23tweak wordingBastian Kauschke-1/+1
Co-authored-by: varkor <github@varkor.com>
2020-07-22require type defaults to be after const generic parametersBastian Kauschke-0/+27
as if this is currently possible. HA!