about summary refs log tree commit diff
path: root/src/test/ui/const-generics/generic_const_exprs
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-3267/+0
2023-01-05Tweak wording of fn call with wrong number of argsEsteban Küber-1/+1
2022-12-27Rollup merge of #105994 - JohnTitor:issue-99647, r=compiler-errorsMatthias Krüger-0/+15
Add regression test for #99647 Closes #99647 r? `@compiler-errors` Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-12-22Add regression test for #94293Yuki Okushi-0/+31
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-12-22Add regression test for #99647Yuki Okushi-0/+15
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-12-14Highlight conflicting param-env candidates, againMichael Goulet-4/+22
2022-12-14Rollup merge of #105611 - BoxyUwU:more_granular_placeholderification, ↵Matthias Krüger-0/+29
r=wesleywiser fold instead of obliterating args Fixes #105608 we call `const_eval_resolve` on the following constant: ``` def: playground::{impl#0}::and::{constant#0}, substs: [ ConstKind::Unevaluated { def: playground::{impl#0}::and::{constant#0}, substs: [ ConstKind::Value(0x0), _, ] } _, ], ``` when expanded out to `ConstKind::Expr` there are no infer vars so we attempt to evaluate it after replacing infer vars with garbage, however the current logic for replacing with garbage replaces _the whole arg containing the infer var_ rather than just the infer var. This means that after garbage replacement has occured we attempt to evaluate: ``` def: playground::{impl#0}::and::{constant#0}, substs: [ PLACEHOLDER, PLACEHOLDER, ], ``` Which then leads to ctfe being unable to evaluate the const. With this PR we attempt to evaluate: ``` def: playground::{impl#0}::and::{constant#0}, substs: [ ConstKind::Unevaluated { def: playground::{impl#0}::and::{constant#0}, substs: [ ConstKind::Value(0x0), PLACEHOLDER, ] } PLACEHOLDER, ], ``` which ctfe _can_ handle. I am not entirely sure why this function is supposed to replace params with placeholders rather than just inference vars :thinking:
2022-12-14Rollup merge of #105523 - estebank:suggest-collect-vec, r=compiler-errorsMatthias Krüger-0/+2
Suggest `collect`ing into `Vec<_>` Fix #105510.
2022-12-13Mention implementations that satisfy the traitEsteban Küber-0/+2
2022-12-13Make some diagnostics not depend on the source of what they reference being ↵Oli Scherer-14/+4
available
2022-12-12what is `unstable_features` lolBoxy-1/+1
2022-12-12fold instead of obliterating argsBoxy-0/+29
2022-12-10Introduce `with_forced_trimmed_paths`Esteban Küber-12/+12
2022-12-10Rollup merge of #105410 - TaKO8Ki:fix-105257, r=BoxyUwUMatthias Krüger-0/+23
Consider `parent_count` for const param defaults Fixes #105257
2022-12-10Rollup merge of #105192 - estebank:point-at-lhs-on-binop, r=fee1-deadMatthias Krüger-1/+3
Point at LHS on binop type err if relevant
2022-12-09Auto merge of #104449 - oli-obk:unhide_unknown_spans, r=estebank,RalfJungbors-12/+18
Start emitting labels even if their pointed to file is not available locally r? `@estebank` cc `@RalfJung` fixes #97699
2022-12-08Point at LHS on binop type err if relevantEsteban Küber-1/+3
2022-12-08add a test case for `generic_const_exprs` in trait itemsTakayuki Maeda-1/+8
2022-12-07consider `parent_count` for const param defaultsTakayuki Maeda-0/+16
2022-12-06normalize before matching on `ConstKind`Boxy-0/+12
2022-12-06Change CTFE backtraces to use `note` instead of `label` to preserve their orderOli Scherer-12/+18
labels are reordered within the file in which they are reported, which can mess up the stack trace
2022-12-06Remove now-redundant file/line info from const backtracesOli Scherer-4/+4
2022-12-05support `Expr` in `is_const_evaluatable` and `compute`Boxy-0/+42
2022-11-27Auto merge of #104048 - cjgillot:split-lifetime, r=compiler-errorsbors-1/+1
Separate lifetime ident from lifetime resolution in HIR Drive-by: change how suggested generic args are computed. Fixes https://github.com/rust-lang/rust/issues/103815 I recommend reviewing commit-by-commit.
2022-11-25`super_relate_consts` do not spurriously fail on assoc constsBoxy-0/+20
2022-11-25handle assoc consts in fulfill `ConstEquate`Boxy-0/+27
2022-11-25handle nested obligations in `satisfied_from_param_env`Boxy-0/+43
2022-11-24Change how suggested lifetime args are computed.Camille GILLOT-1/+1
2022-11-01fix(generic_const_exprs): Fix predicate inheritance for children of opaque typesZhixing Zhang-0/+33
2022-10-22Auto merge of #103227 - lcnr:bye-bye-unevaluated-const, r=oli-obkbors-9/+11
stop using `ty::UnevaluatedConst` directly best reviewed commit by commit. simplifies #99798 because we now don't have to expand `ty::UnevaluatedConst` to `ty::Const`. I also remember some other places where using `ty::UnevaluatedConst` directly was annoying and caused issues, though I don't quite remember what they were rn '^^ r? `@oli-obk` cc `@JulianKnodt`
2022-10-18Clean up query descriptionsnils-2/+2
Use the same tense everywhere and prefer display over debug, as these descriptions are user facing.
2022-10-18`const_evaluatable_unchecked` to const evallcnr-9/+11
2022-10-07fix a ICE #102768Takayuki Maeda-0/+47
2022-10-04Normalize substs before resolving instance in NoopMethodCall lintMichael Goulet-0/+23
2022-10-01bless ui testsMaybe Waffle-10/+10
2022-09-22Bless test output changesFrank Steffahn-1/+1
2022-08-24Add test for #100414Michael Goulet-0/+44
2022-08-24Note binding obligation causes for const equate errorsMichael Goulet-0/+54
2022-08-24Call them constants instead of typesMichael Goulet-30/+30
2022-08-21Rework point-at-argMichael Goulet-8/+8
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-09Keep going if normalized projection has unevaluated consts in QueryNormalizerMichael Goulet-0/+279
2022-08-03Warn about dead tuple struct fieldsFabian Wolff-1/+1
2022-07-25handle consts with param/infer in const_eval_resolve betterMichael Goulet-43/+2
2022-07-19feat: omit suffixes in const generics (e.g. `1_i32`)Artur Sinila-28/+31
Closes #99255
2022-07-14Rollup merge of #99222 - atsuzaki:generic_const_err, r=lcnrDylan DPC-4/+7
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