about summary refs log tree commit diff
path: root/src/test/ui/const-generics
AgeCommit message (Collapse)AuthorLines
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.
2022-07-07Track implicit `Sized` obligations in type paramsEsteban Küber-3/+3
Suggest adding a `?Sized` bound if appropriate on E0599 by inspecting the HIR Generics. (Fix #98539)
2022-07-07Rollup merge of #99004 - TaKO8Ki:add-test-for-70408, r=Mark-SimulacrumMatthias Krüger-0/+13
Add a test for #70408 closes #70408
2022-07-07add a test for #70408Takayuki Maeda-0/+13
2022-07-07add a test for #80471Takayuki Maeda-0/+31
2022-07-02Rollup merge of #98715 - matthiaskrgr:test_97047, r=Mark-SimulacrumRalf Jung-0/+86
add ice test for #97047 Fixes #97047
2022-07-01Auto merge of #98781 - GuillaumeGomez:rollup-798kb8u, r=GuillaumeGomezbors-7/+7
Rollup of 5 pull requests Successful merges: - #97249 (`<details>`/`<summary>` UI fixes) - #98418 (Allow macOS to build LLVM as shared library) - #98460 (Use CSS variables to handle theming) - #98497 (Improve some inference diagnostics) - #98708 (rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests) Failed merges: - #98761 (more `need_type_info` improvements) r? `@ghost` `@rustbot` modify labels: rollup
2022-07-01Don't point at Self type if we can't find an infer variable in ambiguous ↵Michael Goulet-6/+6
trait predicate
2022-07-01Show source of ambiguity in a few more placesMichael Goulet-1/+1
2022-07-01Shorten def_span for more items.Camille GILLOT-2/+2
2022-07-01Rollup merge of #98686 - matthiaskrgr:test-46511, r=compiler-errorsMatthias Krüger-0/+29
add ice test for 46511 Fixes #46511 r? ``@compiler-errors``
2022-06-30add ice test for #97047Matthias Krüger-0/+86
Fixes #97047
2022-06-30Auto merge of #98691 - matthiaskrgr:rollup-ymsa64p, r=matthiaskrgrbors-0/+19
Rollup of 6 pull requests Successful merges: - #96727 (Make TAIT behave exactly like RPIT) - #98681 (rustdoc-json: Make default value of blanket impl assoc types work) - #98682 (add tests for ICE 94432) - #98683 (add test for ice 68875) - #98685 (Replace `sort_modules_alphabetically` boolean with enum) - #98687 (add test for 47814) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-30Rollup merge of #98683 - matthiaskrgr:ice-test-68875, r=compiler-errorsMatthias Krüger-0/+19
add test for ice 68875 Fixes #68875
2022-06-29Auto merge of #98520 - RalfJung:invalid, r=compiler-errorsbors-8/+8
interpret: adjust error from constructing an invalid value
2022-06-29add ice test for 46511Matthias Krüger-0/+29
Fixes #46511
2022-06-29add test for ice 68875Matthias Krüger-0/+19
Fixes #68875
2022-06-29Rollup merge of #98643 - voidc:valtree-ref-pretty, r=lcnrMatthias Krüger-0/+48
Improve pretty printing of valtrees for references This implements the changes outlined in https://github.com/rust-lang/rust/issues/66451#issuecomment-1168859638. r? `@lcnr` Fixes #66451
2022-06-29interpret: adjust error from constructing an invalid valueRalf Jung-8/+8
2022-06-29Rollup merge of #98499 - JulianKnodt:erase_lifetime, r=lcnrDylan DPC-0/+33
Erase regions in New Abstract Consts When an abstract const is constructed, we previously included lifetimes in the set of substitutes, so it was not able to unify two abstract consts if their lifetimes did not match but the values did, despite the values not depending on the lifetimes. This caused code that should have compiled to not compile. Fixes #98452 r? ```@lcnr```
2022-06-29Erase regions in new abstract constskadmin-0/+33
2022-06-28Note concrete type being coerced into objectMichael Goulet-2/+2
2022-06-28Address code review commentsDominik Stolz-1/+1
2022-06-28Improve pretty printing of valtrees for referencesDominik Stolz-0/+48
2022-06-28Auto merge of #98222 - cjgillot:single-wf, r=michaelwoeristerbors-9/+9
Only keep a single query for well-formed checking There are currently 3 queries to perform wf checks on different item-likes. This complexity is not required. This PR replaces the query by: - one query per item; - one query to invoke it for a whole module. This allows to remove HIR `ParItemLikeVisitor`.
2022-06-25Rollup merge of #98429 - b-naber:use-correct-substs-discriminant-cast, r=lcnrMatthias Krüger-0/+10
Use correct substs in enum discriminant cast Fixes https://github.com/rust-lang/rust/issues/97634 r? ```@lcnr```
2022-06-25Rollup merge of #98298 - TaKO8Ki:point-to-type-param-definition, ↵Matthias Krüger-14/+8
r=compiler-errors Point to type parameter definition when not finding variant, method and associated item fixes #77391
2022-06-24fmtb-naber-1/+1
2022-06-24add testb-naber-0/+10
2022-06-22Rollup merge of #97818 - compiler-errors:rpit-error-spanned, r=oli-obkYuki Okushi-0/+9
Point at return expression for RPIT-related error Certainly this needs some diagnostic refining, but I wanted to show that it was possible first and foremost. Not sure if this is the right approach. Open to feedback. Fixes #80583
2022-06-22point to type param definition when not finding variant, method and assoc typeTakayuki Maeda-14/+8
use `def_ident_span` , `body_owner_def_id` instead of `in_progress_typeck_results`, `guess_head_span` use `body_id.owner` directly add description to label
2022-06-21Point at return expression for RPIT-related errorMichael Goulet-0/+9
2022-06-21Only keep a single well-formed query.Camille GILLOT-9/+9
2022-06-21Add a full regression test for #73727Yuki Okushi-7/+15
Signed-off-by: Yuki Okushi <jtitor@2k36.org>