summary refs log tree commit diff
path: root/src/test/ui/const-generics/defaults
AgeCommit message (Collapse)AuthorLines
2022-02-16allow special behavior when printing const inferlcnr-2/+2
2022-02-14Make `find_similar_impl_candidates` a little fuzzier.Ben Reeves-0/+2
2022-02-11Revert "Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis"Oli Scherer-12/+12
This reverts commit e7cc3bddbe0d0e374d05e7003e662bba1742dbae, reversing changes made to 734368a200904ef9c21db86c595dc04263c87be0.
2022-02-02Lazily resolve type-alias-impl-trait defining usesOli Scherer-12/+12
by using an opaque type obligation to bubble up comparisons between opaque types and other types Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
2022-01-30Bless all pretty printer tests and ui testsDavid Tolnay-1/+1
2021-12-14testEllen-0/+25
2021-12-10update testsEllen-117/+36
2021-12-07Refer to const params as "const params" and not "type params"Esteban Kuber-1/+1
2021-12-07Refer to uninferred `const` params by their name, instead of `{ _: _ }`Esteban Kuber-1/+1
When the value of a const param isn't inferred, replace it with the param name from the definition.
2021-12-07Only shown relevant type params in E0283 labelEsteban Kuber-1/+1
When we point at a binding to suggest giving it a type, erase all the type for ADTs that have been resolved, leaving only the ones that could not be inferred. For small shallow types this is not a problem, but for big nested types with lots of params, this can otherwise cause a lot of unnecessary visual output.
2021-12-01Pretty print empty blocks as {}David Tolnay-2/+2
2021-11-20Do not mention associated items when they introduce an obligationEsteban Kuber-5/+0
2021-10-21*dust dust*Ellen-2/+2
2021-10-20OrderingEllen-1/+10
2021-10-20add fixmeEllen-1/+1
2021-10-20InferenceEllen-0/+26
2021-10-20WfnessEllen-0/+59
2021-10-20Return pos impl traitEllen-0/+94
2021-10-20Trait objectsEllen-0/+104
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