about summary refs log tree commit diff
path: root/src/test/ui/const-generics/defaults
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-982/+0
2022-12-16remove unused stderr filesTakayuki Maeda-8/+0
2022-12-06Rollup merge of #105338 - estebank:other-impls, r=compiler-errorsYuki Okushi-6/+2
Tweak "the following other types implement trait" When *any* of the suggested impls is an exact match, *only* show the exact matches. This is particularly relevant for integer types. r? `@compiler-errors`
2022-12-05Tweak "the following other types implement trait"Esteban Küber-6/+2
When *any* of the suggested impls is an exact match, *only* show the exact matches. This is particularly relevant for integer types. fix fmt
2022-12-03Skip recording resolution for duplicated generic params.Camille GILLOT-0/+15
2022-09-09reviewlcnr-6/+6
2022-09-08update ui testslcnr-6/+6
2022-08-24Call them constants instead of typesMichael Goulet-4/+4
2022-08-21Rework point-at-argMichael Goulet-6/+2
2022-07-19feat: omit suffixes in const generics (e.g. `1_i32`)Artur Sinila-66/+72
Closes #99255
2022-06-28Note concrete type being coerced into objectMichael Goulet-2/+2
2022-06-21Point at return expression for RPIT-related errorMichael Goulet-0/+9
2022-06-08dedup diagnostics default params handlinglcnr-10/+10
2022-06-02add new `emit_inference_failure_err`lcnr-4/+7
2022-05-06wording tweaksEllen-11/+11
2022-05-05 make `compare_generic_param_kinds` errors consistentEllen-24/+69
2022-05-05exit out of `compare_number_of_generics` earlyEllen-29/+16
2022-05-05 handle mismatched generic parameter kindsEllen-0/+77
2022-04-28Revert diagnostic duplication and accidental stabilizationOli Scherer-49/+3
2022-04-05Rollup merge of #95654 - notriddle:notriddle/issue-95616, r=davidtwcoDylan DPC-2/+2
diagnostics: use correct span for const generics Fixes #95616
2022-04-04Remove hack, fix fmt and testsEsteban Kuber-3/+3
2022-04-04Refer to the TraitRef::identity in the message to be clearerEsteban Kuber-2/+2
2022-04-04Dedup logic and improve output for other types that impl traitEsteban Kuber-3/+3
2022-04-04Mention implementers of unsatisfied traitEsteban Kuber-12/+6
When encountering an unsatisfied trait bound, if there are no other suggestions, mention all the types that *do* implement that trait: ``` error[E0277]: the trait bound `f32: Foo` is not satisfied --> $DIR/impl_wf.rs:22:6 | LL | impl Baz<f32> for f32 { } | ^^^^^^^^ the trait `Foo` is not implemented for `f32` | = help: the following other types implement trait `Foo`: Option<T> i32 str note: required by a bound in `Baz` --> $DIR/impl_wf.rs:18:31 | LL | trait Baz<U: ?Sized> where U: Foo { } | ^^^ required by this bound in `Baz` ``` Mention implementers of traits in `ImplObligation`s. Do not mention other `impl`s for closures, ranges and `?`.
2022-04-04diagnostics: use correct span for const genericsMichael Howell-2/+2
Fixes #95616
2022-03-28Revert to inference variable based hidden type computation for RPITOli Scherer-13/+60
2022-03-28Revert "Auto merge of #93893 - oli-obk:sad_revert, r=oli-obk"Oli Scherer-12/+12
This reverts commit 6499c5e7fc173a3f55b7a3bd1e6a50e9edef782d, reversing changes made to 78450d2d602b06d9b94349aaf8cece1a4acaf3a8.
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)