about summary refs log tree commit diff
path: root/src/test/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2021-12-23implement `generic_arg_infer` for array lengthslcnr-0/+80
2021-12-18Rollup merge of #89090 - cjgillot:bare-dyn, r=jackh726Matthias Krüger-23/+11
Lint bare traits in AstConv. Removing the lint from lowering allows to: - make lowering querification easier; - have the lint implementation in only one place. r? `@estebank`
2021-12-14testEllen-0/+25
2021-12-13extra test for bug i foundEllen-0/+15
2021-12-13hurray for portable simd finding a nice test for this FIXMEEllen-0/+26
2021-12-12Auto merge of #90207 - BoxyUwU:stabilise_cg_defaults, r=lcnrbors-206/+46
Stabilise `feature(const_generics_defaults)` `feature(const_generics_defaults)` is complete implementation wise and has a pretty extensive test suite so I think is ready for stabilisation. needs stabilisation report and maybe an RFC :sweat_smile: r? `@lcnr` cc `@rust-lang/project-const-generics`
2021-12-11Auto merge of #91769 - estebank:type-trait-bound-span-2, r=oli-obkbors-2/+2
Tweak assoc type obligation spans * Point at RHS of associated type in obligation span * Point at `impl` assoc type on projection error * Reduce verbosity of recursive obligations * Point at source of binding lifetime obligation * Tweak "required bound" note * Tweak "expected... found opaque (return) type" labels * Point at set type in impl assoc type WF errors r? `@oli-obk` This is a(n uncontroversial) subset of #85799.
2021-12-11Tweak assoc type obligation spansEsteban Kuber-2/+2
* Point at RHS of associated type in obligation span * Point at `impl` assoc type on projection error * Reduce verbosity of recursive obligations * Point at source of binding lifetime obligation * Tweak "required bound" note * Tweak "expected... found opaque (return) type" labels * Point at set type in impl assoc type WF errors
2021-12-10Rollup merge of #91678 - b-naber:tests-for-postpone-const-eval, r=jackh726Matthias Krüger-0/+387
Add tests fixed by #90023 The following issues were fixed by https://github.com/rust-lang/rust/pull/90023 Fixes https://github.com/rust-lang/rust/issues/79674 Fixes https://github.com/rust-lang/rust/issues/83765 Fixes https://github.com/rust-lang/rust/issues/86033 Fixes https://github.com/rust-lang/rust/issues/90318 Fixes https://github.com/rust-lang/rust/issues/88468 The following issues were duplicates of https://github.com/rust-lang/rust/issues/90654 Fixes https://github.com/rust-lang/rust/issues/86850 Fixes https://github.com/rust-lang/rust/issues/89022 r? ````@jackh726````
2021-12-10update testsEllen-206/+46
2021-12-08add testsb-naber-0/+387
2021-12-08Rollup merge of #91551 - b-naber:const-eval-normalization-ice, r=oli-obkMatthias Krüger-0/+61
Allow for failure of subst_normalize_erasing_regions in const_eval Fixes https://github.com/rust-lang/rust/issues/72845 Using associated types that cannot be normalized previously resulted in an ICE. We now allow for normalization failure and return a "TooGeneric" error in that case. r? ```@RalfJung``` maybe?
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-05Rollup merge of #91437 - dtolnay:emptybrace, r=nagisaMatthias Krüger-2/+2
Pretty print empty blocks as {} **Example:** ```rust macro_rules! p { ($e:expr) => { println!("{}", stringify!($e)); }; ($i:item) => { println!("{}", stringify!($i)); }; } fn main() { p!(if true {}); p!(struct S {}); } ``` **Before:** ```console if true { } struct S { } ``` **After:** ```console if true {} struct S {} ``` This affects [`dbg!`](https://doc.rust-lang.org/std/macro.dbg.html), as well as ecosystem uses of stringify such as in [`anyhow::ensure!`](https://docs.rs/anyhow/1/anyhow/macro.ensure.html). Printing a `{ }` in today's heavily rustfmt'd world comes out looking jarring/sloppy.
2021-12-05Rollup merge of #90529 - b-naber:reborrows-consts, r=lcnrMatthias Krüger-1/+23
Skip reborrows in AbstractConstBuilder Fixes https://github.com/rust-lang/rust/issues/90455 Temporary fix to prevent confusing diagnostics that refer to implicit borrows and derefs until we allow borrows and derefs on constant expressions. r? `@oli-obk`
2021-12-05add test and bless existing onesb-naber-0/+61
2021-12-05bless testsb-naber-1/+1
2021-12-05add testb-naber-0/+22
2021-12-05Rollup merge of #90023 - b-naber:postpone_const_eval_infer_vars, r=nikomatsakisMatthias Krüger-3/+239
Postpone the evaluation of constant expressions that depend on inference variables Previously `delay_span_bug` calls were triggered once an inference variable was included in the substs of a constant that was to be evaluated. Some of these would merely have resulted in trait candidates being rejected, hence no real error was ever encountered, but the triggering of the `delay_span_bug` then caused an ICE in later stages of the compiler due to no error ever occurring. We now postpone the evaluation of these constants, so any trait obligation fulfillment will simply stall on this constant and the existing type inference machinery of the compiler handles any type errors if present. Fixes https://github.com/rust-lang/rust/issues/89320 Fixes https://github.com/rust-lang/rust/issues/89146 Fixes https://github.com/rust-lang/rust/issues/87964 Fixes https://github.com/rust-lang/rust/issues/87470 Fixes https://github.com/rust-lang/rust/issues/83288 Fixes https://github.com/rust-lang/rust/issues/83249 Fixes https://github.com/rust-lang/rust/issues/90654 I want to thank `@BoxyUwU` for cooperating on this and for providing some help. r? `@lcnr` maybe?
2021-12-04Lint bare traits in AstConv.Camille GILLOT-23/+11
2021-12-01Pretty print empty blocks as {}David Tolnay-2/+2
2021-11-27Only check for errors in predicate when skipping impl assemblyAaron Hill-16/+7
Prior to PR #91205, checking for errors in the overall obligation would check checking the `ParamEnv`, due to an incorrect `super_visit_with` impl. With this bug fixed, we will now bail out of impl candidate assembly if the `ParamEnv` contains any error types. In practice, this appears to be overly conservative - when an error occurs early in compilation, we end up giving up early for some predicates that we could have successfully evaluated without overflow. By only checking for errors in the predicate itself, we avoid causing additional spurious 'type annotations needed' errors after a 'real' error has already occurred. With this PR, the diagnostic changes caused by PR #91205 are reverted.
2021-11-25Visit `param_env` field in Obligation's `TypeFoldable` implAaron Hill-7/+16
This oversight appears to have gone unnoticed for a long time without causing issues, but it should still be fixed.
2021-11-20Do not mention associated items when they introduce an obligationEsteban Kuber-16/+0
2021-11-20Point at source of trait bound obligations in more placesEsteban Kuber-16/+9
Be more thorough in using `ItemObligation` and `BindingObligation` when evaluating obligations so that we can point at trait bounds that introduced unfulfilled obligations. We no longer incorrectly point at unrelated trait bounds (`substs-ppaux.verbose.stderr`). In particular, we now point at trait bounds on method calls. We no longer point at "obvious" obligation sources (we no longer have a note pointing at `Trait` saying "required by a bound in `Trait`", like in `associated-types-no-suitable-supertrait*`). Address part of #89418.
2021-11-19Rollup merge of #90578 - lcnr:add-test, r=Mark-SimulacrumYuki Okushi-0/+85
add const generics test cc https://github.com/rust-lang/rust/pull/89829#issuecomment-948921310 r? rust-lang/project-const-generics
2021-11-18bless nlllcnr-0/+26
2021-11-17add const generics testlcnr-0/+59
2021-11-14Fix span for non-satisfied trivial trait boundsNilstrieb-41/+28
The spans for "trait bound not satisfied" errors in trivial trait bounds referenced the entire item (fn, impl, struct) before. Now they only reference the obligation itself (`String: Copy`) Address #90869
2021-11-08Add a note about feature(explicit_generic_args_with_impl_trait) to the ↵Jakub Kądziołka-0/+3
relevant error message
2021-11-07consider unevaluated consts in extract_inference_diagnostics_datab-naber-15/+29
2021-11-06Move some tests to more reasonable directoriesCaio-0/+60
2021-11-05add testsb-naber-3/+225
2021-10-30Rollup merge of #90396 - b-naber:type_flags_ices_default_anon_consts, r=lcnrMatthias Krüger-0/+47
Prevent type flags assertions being thrown in default_anon_const_substs if errors occurred Fixes https://github.com/rust-lang/rust/issues/90364 Fixes https://github.com/rust-lang/rust/issues/88997 r? ``@lcnr``
2021-10-29ignore type flags insertion in default_anon_const_substs if error occurredb-naber-0/+47
2021-10-29add testb-naber-0/+20
2021-10-26Rollup merge of #90181 - notriddle:notriddle/error-pointer, r=estebankMatthias Krüger-4/+8
fix(rustc_typeck): report function argument errors on matching type Fixes #90101
2021-10-25Rollup merge of #90266 - b-naber:uneval_substs, r=lcnrMatthias Krüger-0/+25
Prevent duplicate caller bounds candidates by exposing default substs in Unevaluated Fixes https://github.com/rust-lang/rust/issues/89334 The changes introduced in https://github.com/rust-lang/rust/pull/87280 allowed for "duplicate" caller bounds candidates to be assembled that only differed in their default substs having been "exposed" or not and resulted in an ambiguity error during trait selection. To fix this we expose the defaults substs during the creation of the ParamEnv. r? `@lcnr`
2021-10-25fix(rustc_typeck): report function argument errors on matching typeMichael Howell-4/+8
Fixes #90101
2021-10-25add testsb-naber-0/+25
2021-10-23Rollup merge of #89829 - voidc:assoc-const-variance, r=lcnrMatthias Krüger-25/+5
Consider types appearing in const expressions to be invariant This is an approach to fix #80977. Currently, a type parameter which is only used in a constant expression is considered bivariant and will trigger error E0392 *"parameter T is never used"*. Here is a short example: ```rust pub trait Foo { const N: usize; } struct Bar<T: Foo>([u8; T::N]) where [(); T::N]:; ``` ([playgound](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2015&gist=b51a272853f75925e72efc1597478aa5)) While it is possible to silence this error by adding a `PhantomData<T>` field, I think the better solution would be to make `T` invariant. This would be analogous to the invariance constraints added for associated types. However, I'm quite new to the compiler and unsure whether this is the right approach. r? ``@varkor`` (since you authored #60058)
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