summary refs log tree commit diff
path: root/src/test/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2022-10-29Fix testsMark Rousskov-0/+2
2022-10-29Add test validating successful backportMark Rousskov-0/+35
2022-10-04Bless test output changesFrank Steffahn-1/+1
(cherry picked from commit 07767784ad667f4763e3ad6d7914849f3a43c65f)
2022-09-10Rollup merge of #101578 - lcnr:resolve-hack, r=jackh726Dylan DPC-2/+2
remove bound var hack in `resolve` somehow dropped that change from #98900. r? `@jackh726`
2022-09-09reviewlcnr-10/+10
2022-09-09rename `codegen_fulfill_obligation`lcnr-2/+2
2022-09-08update ui testslcnr-10/+10
2022-09-01Auto merge of #100707 - dzvon:fix-typo, r=davidtwcobors-1/+1
Fix a bunch of typo This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-31Rollup merge of #100838 - ↵Matthias Krüger-3/+10
hkmatsumoto:move-gen-args-to-trait-when-appropriate, r=davidtwco Suggest moving redundant generic args of an assoc fn to its trait Closes #89064
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-29Rollup merge of #100437 - compiler-errors:better-const-mismatch-err, r=oli-obkMatthias Krüger-42/+164
Improve const mismatch `FulfillmentError` Fixes #100414
2022-08-28Support method callsHirochika Matsumoto-3/+10
2022-08-27use smaller span for suggestionsTakayuki Maeda-3/+5
2022-08-26make read_immediate error immediately on uninit, so ImmTy can carry ↵Ralf Jung-38/+20
initialized Scalar
2022-08-24Add test for #100414Michael Goulet-0/+44
2022-08-24Note binding obligation causes for const equate errorsMichael Goulet-0/+78
2022-08-24Call them constants instead of typesMichael Goulet-42/+42
2022-08-23Improve local generic parameter suggestions.Camille GILLOT-1/+1
2022-08-21Rework point-at-argMichael Goulet-14/+10
2022-08-18Reword "Required because of the requirements on the impl of ..."Andy Wang-8/+8
2022-08-18Rollup merge of #100643 - ↵Matthias Krüger-1/+3
TaKO8Ki:point-at-type-parameter-shadowing-another-type, r=estebank Point at a type parameter shadowing another type This patch fixes a part of #97459.
2022-08-17point at a type parameter shadowing another typeTakayuki Maeda-1/+3
2022-08-12Erase regions better in promote_candidateMichael Goulet-0/+25
2022-08-11Auto merge of #100315 - compiler-errors:norm-ct-in-proj, r=lcnrbors-0/+279
Keep going if normalized projection has unevaluated consts in `QueryNormalizer` #100312 was the wrong approach, I think this is the right one. When normalizing a type, if we see that it's a projection, we currently defer to `tcx.normalize_projection_ty`, which normalizes the projections away but doesn't touch the unevaluated constants. So now we just continue to fold the type if it has unevaluated constants so we make sure to evaluate those too, if we can. Fixes #100217 Fixes #83972 Fixes #84669 Fixes #86710 Fixes #82268 Fixes #73298
2022-08-10add testb-naber-0/+36
2022-08-09Keep going if normalized projection has unevaluated consts in QueryNormalizerMichael Goulet-0/+279
2022-08-03Warn about dead tuple struct fieldsFabian Wolff-2/+4
2022-07-27Rollup merge of #99651 - compiler-errors:fn-and-raw-ptr-in-const-generics, ↵Guillaume Gomez-13/+54
r=oli-obk Deeply deny fn and raw ptrs in const generics I think this is right -- just because we wrap a fn ptr in a wrapper type does not mean we should allow it in a const parameter. We now reject both of these in the same way: ``` #![feature(adt_const_params)] #[derive(Eq, PartialEq)] struct Wrapper(); fn foo<const W: Wrapper>() {} fn foo2<const F: fn()>() {} ``` This does regress one test (`src/test/ui/consts/refs_check_const_eq-issue-88384.stderr`), but I'm not sure it should've passed in the first place. cc: ``@b-naber`` who introduced that test^ fixes #99641
2022-07-26Fix diagnostics for unfulfilled obligationsDeadbeef-2/+0
2022-07-26bless tests, remove nonexistent E0395Deadbeef-44/+20
2022-07-25handle consts with param/infer in const_eval_resolve betterMichael Goulet-43/+2
2022-07-25Deeply deny fn and raw ptrs in const genericsMichael Goulet-13/+54
2022-07-22Do not resolve associated const when there is no provided valueMichael Goulet-18/+28
2022-07-22Rollup merge of #99393 - ↵Dylan DPC-137/+146
Logarithmus:feature/99255-omit-const-generic-suffixes, r=petrochenkov feat: omit suffixes in const generics (e.g. `1_i32`) Closes #99255
2022-07-20Add regression test for #71547Yuki Okushi-0/+18
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-19feat: omit suffixes in const generics (e.g. `1_i32`)Artur Sinila-137/+146
Closes #99255
2022-07-15Auto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, ↵bors-54/+54
r=cjgillot gather body owners Issue #96341
2022-07-14Rollup merge of #99222 - atsuzaki:generic_const_err, r=lcnrDylan DPC-7/+10
Better error message for generic_const_exprs inference failure Fixes #90531 This code: ```rs #![feature(generic_const_exprs)] fn foo<const N: usize>(_arr: [u64; N + 1]) where [u64; N + 1]: {} fn main() { let arr = [5; 5]; foo(arr); } ``` Will now emit the following error: ```rs warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes --> test.rs:1:12 | 1 | #![feature(generic_const_exprs)] | ^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(incomplete_features)]` on by default = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information error[E0284]: type annotations needed --> test.rs:8:7 | 8 | foo(arr); | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | note: required by a bound in `foo` --> test.rs:3:56 | 3 | fn foo<const N: usize>(_arr: [u64; N + 1]) where [u64; N + 1]: {} | ^^^^^ required by this bound in `foo` help: consider specifying the generic argument | 8 | foo::<N>(arr); | +++++ error: aborting due to previous error; 1 warning emitted ``` cc: `@lcnr` thanks a lot again for the help on this
2022-07-14Rollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnrDylan DPC-0/+36
Move abstract const to middle Moves AbstractConst (and all associated methods) to rustc middle for use in `rustc_infer`. This allows for const resolution in infer to use abstract consts to walk consts and check if they are resolvable. This attempts to resolve the issue where `Foo<{ concrete const }, generic T>` is incorrectly marked as conflicting, and is independent from the other issue where nested abstract consts must be resolved. r? `@lcnr`
2022-07-14Fix overlapping implskadmin-0/+36
2022-07-13Update testsKatherine Philip-7/+10
2022-07-13use gathered body_owners in par_body_ownersMiguel Guarniz-54/+54
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-13Rollup merge of #99168 - TaKO8Ki:add-regression-test-for-74713, r=Dylan-DPCGuillaume Gomez-0/+30
Add regression test for #74713 closes #74713
2022-07-12add regression test for #74713Takayuki Maeda-0/+30
2022-07-11Deny floats even when adt_const_params is enabledMichael Goulet-0/+34
2022-07-08Auto merge of #98816 - estebank:implicit-sized, r=oli-obkbors-3/+3
Track implicit `Sized` obligations in type params When we evaluate `ty::GenericPredicates` we introduce the implicit `Sized` predicate of type params, but we do so with only the `Predicate` its `Span` as context, we don't have an `Obligation` or `ObligationCauseCode` we could influence. To try and carry this information through, we add a new field to `ty::GenericPredicates` that tracks both which predicates come from a type param and whether that param has any bounds already (to use in suggestions). We also suggest adding a `?Sized` bound if appropriate on E0599. Address part of #98539.
2022-07-07Auto merge of #98360 - estebank:uninit-binding, r=oli-obkbors-4/+5
On partial uninit error point at where we need init When a binding is declared without a value, borrowck verifies that all codepaths have *one* assignment to them to initialize them fully. If there are any cases where a condition can be met that leaves the binding uninitialized or we attempt to initialize a field of an uninitialized binding, we emit E0381. We now look at all the statements that initialize the binding, and use them to explore branching code paths that *don't* and point at them. If we find *no* potential places where an assignment to the binding might be missing, we display the spans of all the existing initializers to provide some context. Fix https://github.com/rust-lang/rust/issues/97956.
2022-07-07Wording tweakEsteban Küber-1/+1
2022-07-07Tweak wording and spansEsteban Küber-3/+3
2022-07-07On partial uninit error point at where we need initEsteban Küber-4/+5
When a binding is declared without a value, borrowck verifies that all codepaths have *one* assignment to them to initialize them fully. If there are any cases where a condition can be met that leaves the binding uninitialized or we attempt to initialize a field of an unitialized binding, we emit E0381. We now look at all the statements that initialize the binding, and use them to explore branching code paths that *don't* and point at them. If we find *no* potential places where an assignment to the binding might be missing, we display the spans of all the existing initializers to provide some context.