about summary refs log tree commit diff
path: root/tests/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2023-03-28Move const trait bounds checks to MIR constckDeadbeef-2/+18
Fixes #109543. When checking paths in HIR typeck, we don't want to check for const predicates since all we want might just be a function pointer. Therefore we move this to MIR constck and check that bounds are met during MIR constck.
2023-03-27Bless tidyMaybe Waffle-1/+1
2023-03-23Note type mismatch on ConstArgHasTypeMichael Goulet-1/+1
2023-03-23Refine error spans for const args in hir typeckMichael Goulet-6/+6
2023-03-23Rollup merge of #109380 - Randl:patch-1, r=oli-obkMatthias Krüger-0/+52
add `known-bug` test for unsoundness issue Test for https://github.com/rust-lang/rust/issues/97156
2023-03-21Rollup merge of #109336 - compiler-errors:constrain-to-ct-err, r=BoxyUwUMatthias Krüger-0/+22
Constrain const vars to error if const types are mismatched When equating two consts of different types, if either are const variables, constrain them to the correct const error kind. This helps us avoid "successfully" matching a const against an impl signature but leaving unconstrained const vars, which will lead to incremental ICEs when we call const-eval queries during const projection. Fixes #109296 The second commit in the stack fixes a regression in the first commit where we end up mentioning `[const error]` in an impl overlap error message. I think the error message changes for the better, but I could implement alternative strategies to avoid this without delaying the overlap error message... r? `@BoxyUwU`
2023-03-20Add `known-bug` test for typeid unsoundness issueEvgenii Zheltonozhskii-0/+52
2023-03-19Only expect a GAT const argMichael Goulet-0/+29
2023-03-19Constrain const vars to error if const types are mismatchedMichael Goulet-0/+22
2023-03-18Rollup merge of #107416 - czzrr:issue-80618, r=GuillaumeGomezMatthias Krüger-17/+18
Error code E0794 for late-bound lifetime parameter error. This PR addresses [#80618](https://github.com/rust-lang/rust/issues/80618).
2023-03-09Use param's real type in try_eval_lit_or_paramMichael Goulet-15/+19
2023-03-08Suppress copy impl error when post-normalized type references errorsMichael Goulet-0/+18
2023-03-07Error code E0794 for late-bound lifetime parameter error.Christopher Acosta-17/+18
2023-03-01Add regression test for #105821Yuki Okushi-0/+23
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-02-23diagnostics: remove inconsistent English article "this" from E0107Michael Howell-19/+19
Consider `tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`, the error message where it gives additional notes about where the associated type is defined, and how the dead code lint doesn't have an article, like in `tests/ui/lint/dead-code/issue-85255.stderr`. They don't have articles, so it seems unnecessary to have one here.
2023-02-22diagnostics: update test cases to refer to assoc fn with `self` as methodMichael Howell-5/+5
2023-02-21Specify what 'this' actually isMichael Goulet-16/+16
2023-02-20`const` generic -> const parameter in err msglcnr-6/+3
2023-02-17add predicate evaluation logicBoxy-2/+11
2023-02-16Remove save-analysis.Nicholas Nethercote-11/+6
Most tests involving save-analysis were removed, but I kept a few where the `-Zsave-analysis` was an add-on to the main thing being tested, rather than the main thing being tested. For `x.py install`, the `rust-analysis` target has been removed. For `x.py dist`, the `rust-analysis` target has been kept in a degenerate form: it just produces a single file `reduced.json` indicating that save-analysis has been removed. This is necessary for rustup to keep working. Closes #43606.
2023-02-15Auto merge of #107940 - BoxyUwU:const_ty_assertion_use_semantic_equality, ↵bors-0/+181
r=compiler-errors use semantic equality for const param type equality assertion Fixes #107898 See added test for what caused this ICE --- The current in assertion in `relate.rs` is rather inadequate when keeping in mind future expansions to const generics: - it will ICE when there are infer vars in a projection in a const param ty - it will spurriously return false when either ty has infer vars because of using `==` instead of `infcx.at(..).eq` - i am also unsure if it would be possible with `adt_const_params` to craft a situation where the const param type is not wf causing `normalize_erasing_regions` to `bug!` when we would have emitted a diagnostic. This impl feels pretty Not Great to me although i am not sure what a better idea would be. - We have to have the logic behind a query because neither `relate.rs` or `combine.rs` have access to trait solving machinery (without evaluating nested obligations this assert will become _far_ less useful under lazy norm, which consts are already doing) - `relate.rs` does not have access to canonicalization machinery which is necessary in order to have types potentially containing infer vars in query arguments. We could possible add a method to `TypeRelation` to do this assertion rather than a query but to avoid implementing the same logic over and over we'd probably end up with the logic in a free function somewhere in `rustc_trait_selection` _anyway_ so I don't think that would be much better. We could also just remove this assertion, it should not actually be necessary for it to be present. It has caught some bugs in the past though so if possible I would like to keep it. r? `@compiler-errors`
2023-02-13Tighter spans for bad inherent impl typesMichael Goulet-2/+2
2023-02-11make `relate`'s const ty assertion use semantic equalityBoxy-0/+181
2023-02-11Rollup merge of #107857 - GuillaumeGomez:ui-test-impl-projections, r=oli-obkDylan DPC-0/+30
Add ui test for implementation on projection The error in full can be seen in https://github.com/rust-lang/rust/pull/107263 and is part of why the PR is blocked (it still requires the approval from the team for supporting it). r? ``@oli-obk``
2023-02-10Add test for implementation on projectionGuillaume Gomez-0/+30
2023-02-09Introduce `ReError`Esteban Küber-12/+12
CC #69314
2023-02-05emit `ConstEquate` in `TypeRelating<D>`Boxy-0/+70
2023-01-31Auto merge of #106399 - estebank:type-err-span-label, r=nagisabors-13/+13
Modify primary span label for E0308 Looking at the reactions to https://hachyderm.io/`@ekuber/109622160673605438,` a lot of people seem to have trouble understanding the current output, where the primary span label on type errors talks about the specific types that diverged, but these can be deeply nested type parameters. Because of that we could see "expected i32, found u32" in the label while the note said "expected Vec<i32>, found Vec<u32>". This understandably confuses people. I believe that once people learn to read these errors it starts to make more sense, but this PR changes the output to be more in line with what people might expect, without sacrificing terseness. Fix #68220.
2023-01-30Modify primary span label for E0308Esteban Küber-13/+13
The previous output was unintuitive to users.
2023-01-30Use ObligationCtxt::new_in_snapshot in satisfied_from_param_envMichael Goulet-0/+39
2023-01-28Auto merge of #106916 - lukas-code:overlapping-substs, r=estebankbors-14/+9
Remove overlapping parts of multipart suggestions This PR adds a debug assertion that the parts of a single substitution cannot overlap, fixes a overlapping substitution from the testsuite, and fixes https://github.com/rust-lang/rust/issues/106870. Note that a single suggestion can still have multiple overlapping substitutions / possible edits, we just don't suggest overlapping replacements in a single edit anymore. I've also included a fix for an unrelated bug where rustfix for `explicit_outlives_requirements` would produce multiple trailing commas for a where clause.
2023-01-28Rollup merge of #107190 - fmease:fix-81698, r=compiler-errorsMatthias Krüger-8/+132
Recover from more const arguments that are not wrapped in curly braces Recover from some array, borrow, tuple & arithmetic expressions in const argument positions that lack curly braces and provide a suggestion to fix the issue continuing where #92884 left off. Examples of such expressions: `[]`, `[0]`, `[1, 2]`, `[0; 0xff]`, `&9`, `("", 0)` and `(1 + 2) * 3` (we previously did not recover from them). I am not entirely happy with my current solution because the code that recovers from `[0]` (coinciding with a malformed slice type) and `[0; 0]` (coinciding with a malformed array type) is quite fragile as the aforementioned snippets are actually successfully parsed as types by `parse_ty` since it itself already recovers from them (returning `[⟨error⟩]` and `[⟨error⟩; 0]` respectively) meaning I have to manually look for `TyKind::Err`s and construct a separate diagnostic for the suggestion to attach to (thereby emitting two diagnostics in total). Fixes #81698. `@rustbot` label A-diagnostics r? diagnostics
2023-01-27recover more unbraced const argsLeón Orell Valerian Liehr-8/+132
2023-01-20preserve delim spans during `macro_rules!` expansion if ableLukas Markeffsky-14/+9
2023-01-20Auto merge of #107106 - matthiaskrgr:rollup-g7r1ep0, r=matthiaskrgrbors-3/+1
Rollup of 6 pull requests Successful merges: - #106699 ([drop tracking] Visit break expressions ) - #106738 (Fix known-bug annotations) - #106891 (Tweak "borrow closure argument" suggestion) - #106928 (add raw identifier for keyword in suggestion) - #107065 (Clippy: Make sure to include in beta: Move `unchecked_duration_subtraction` to pedantic) - #107068 (autoderive Subdiagnostic for AddtoExternBlockSuggestion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-19Fix known-bug, silence ICE stderrMichael Goulet-3/+1
2023-01-19Added UI test case for issue #106419Patrik Kårlin-0/+12
2023-01-18i am freeBoxy-2/+2
2023-01-18actually print out non local anon constsBoxy-2/+2
2023-01-18test for non local anon const printingBoxy-0/+36
2023-01-18defer array len printing to const arg printingBoxy-23/+33
2023-01-17Rollup merge of #101698 - raldone01:feat/const_cmp_typeid, r=scottmcmDylan DPC-21/+16
Constify `TypeId` ordering impls Tracking issue: #101871 Adding const ordering to `TypeId` allows rtti crates to optimize some casting scenarios (without transmuting to `u64`). This would also prevent these crates from breaking if the underlying type is changed from `u64` to something different. Feature gate: `#![feature(const_cmp_type_id)]`
2023-01-16Constify `TypeId` ordering implsonestacked-21/+16
2023-01-16Properly pluralize 'generic constants'Michael Goulet-11/+11
2023-01-16ConstBlocks are poly if their substs are polyMichael Goulet-0/+31
2023-01-14Fix `unused_braces` on generic const expr macro callclubby789-1/+15
2023-01-13Auto merge of #106004 - fee1-dead-contrib:const-closures, r=oli-obkbors-0/+1
Const closures cc https://github.com/rust-lang/rust/issues/106003
2023-01-12Rollup merge of #106702 - estebank:trait-bounds, r=compiler-errorsMatthias Krüger-4/+19
Conserve cause of `ImplDerivedObligation` in E0599 CC #86377.
2023-01-12Rollup merge of #106309 - compiler-errors:prefer-non-err-candidates, r=oli-obkMatthias Krüger-42/+3
Prefer non-`[type error]` candidates during selection Fixes #102130 Fixes #106351 r? types note: Alternatively we could filter out error where-clauses during param-env construction? But we still need to filter out impls with errors during `match_impl`, I think.
2023-01-12fix fmt and blessDeadbeef-0/+1