about summary refs log tree commit diff
path: root/tests/ui/inline-const
AgeCommit message (Collapse)AuthorLines
2025-01-09Make sure to walk into nested const blocks in RegionResolutionVisitorMichael Goulet-0/+16
2025-01-06`best_blame_constraint`: don't filter constraints by sup SCCdianne-5/+4
The SCCs of the region graph are not a reliable heuristic to use for blaming an interesting constraint for diagnostics. For region errors, if the outlived region is `'static`, or the involved types are invariant in their lifetiems, there will be cycles in the constraint graph containing both the target region and the most interesting constraints to blame. To get better diagnostics in these cases, this commit removes that heuristic.
2024-12-04review comments: reword messages and simplify logicEsteban Küber-4/+4
2024-12-04Specify type kind of constant that can't be used in patternsEsteban Küber-2/+2
``` error: trait object `dyn Send` cannot be used in patterns --> $DIR/issue-70972-dyn-trait.rs:6:9 | LL | const F: &'static dyn Send = &7u32; | -------------------------- constant defined here ... LL | F => panic!(), | ^ trait object can't be used in patterns ```
2024-12-04Point at generic param through which a const is used in a patternEsteban Küber-4/+4
``` error[E0158]: constant pattern depends on a generic parameter, which is not allowed --> $DIR/associated-const-type-parameter-pattern.rs:20:9 | LL | pub trait Foo { | ------------- LL | const X: EFoo; | ------------- constant defined here ... LL | pub fn test<A: Foo, B: Foo>(arg: EFoo) { | - constant depends on this generic param LL | match arg { LL | A::X => println!("A::X"), | ^^^^ `const` depends on a generic parameter ```
2024-11-16tests: ui/inline-consts: add issue number to a test, rename other tests from ↵Matthias Krüger-11/+11
a_b_c to a-b-c
2024-11-13Add test casesKirill Podoprigora-0/+124
2024-09-15stabilize const_mut_refsRalf Jung-9/+3
2024-09-03Rollup merge of #128701 - veera-sivarajan:fix-128604, r=estebankMatthias Krüger-0/+64
Don't Suggest Labeling `const` and `unsafe` Blocks Fixes #128604 Previously, both anonymous constant blocks (E.g. The labeled block inside `['_'; 'block: { break 'block 1 + 2; }]`) and inline const blocks (E.g. `const { ... }`) were considered to be the same kind of blocks. This caused the compiler to incorrectly suggest labeling both the blocks when only anonymous constant blocks can be labeled. This PR adds an other enum variant to `Context` so that both the blocks can be handled appropriately. Also, adds some doc comments and removes unnecessary `&mut` in a couple of places.
2024-08-08Add testtiif-0/+35
2024-08-06Don't Suggest Labeling `const` and `unsafe` BlocksVeera-13/+20
2024-08-06Add TestsVeera-0/+57
2024-07-18avoid creating an Instance only to immediately disassemble it againRalf Jung-2/+3
2024-06-07Add regression testOli Scherer-0/+18
2024-05-30Auto merge of #125711 - oli-obk:const_block_ice2, r=Nadrierilbors-0/+22
Make `body_owned_by` return the `Body` instead of just the `BodyId` fixes #125677 Almost all `body_owned_by` callers immediately called `body`, too, so just return `Body` directly. This makes the inline-const query feeding more robust, as all calls to `body_owned_by` will now yield a body for inline consts, too. I have not yet figured out a good way to make `tcx.hir().body()` return an inline-const body, but that can be done as a follow-up
2024-05-29Make `body_owned_by` return the body directly.Oli Scherer-0/+22
Almost all callers want this anyway, and now we can use it to also return fed bodies
2024-05-29Reintroduce name resolution check for trying to access locals from an inline ↵Oli Scherer-0/+17
const
2024-05-02Stabilize exclusive_rangeRoss Smyth-1/+1
2024-04-24Fix tests and blessGary Guo-46/+18
2024-03-14preserve span when evaluating mir::ConstOperandRalf Jung-0/+26
2024-02-25fix use of platform_intrinsics in testsRalf Jung-1/+1
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-21/+21
2024-02-01`#![feature(inline_const_pat)]` is no longer incompleteMatthew Jasper-29/+11
2024-01-29Enable tests for unsafe blocks in inline const patternsMatthew Jasper-3/+39
2024-01-29Borrow check inline const patternsMatthew Jasper-5/+48
Add type annotations to MIR so that borrowck can pass constraints from inline constants in patterns to the containing function.
2024-01-05Stabilize THIR unsafeckMatthew Jasper-1/+1
2024-01-05Remove revisions for THIR unsafeckMatthew Jasper-77/+8
This is to make the diff when stabilizing it easier to review.
2023-11-24Show number in error message even for one errorNilstrieb-8/+8
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-10-25Make THIR unused_unsafe lint consistent with MIRMatthew Jasper-9/+0
Updates THIR behavior to match the changes from #93678
2023-10-16Fix inline const pattern unsafety checking in THIRMatthew Jasper-4/+70
THIR unsafety checking was getting a cycle of function unsafety checking -> building THIR for the function -> evaluating pattern inline constants in the function -> building MIR for the inline constant -> checking unsafety of functions (so that THIR can be stolen) This is fixed by not stealing THIR when generating MIR but instead when unsafety checking. This leaves an issue with pattern inline constants not being unsafety checked because they are evaluated away when generating THIR. To fix that we now represent inline constants in THIR patterns and visit them in THIR unsafety checking.
2023-09-21Prevent promotion of const fn calls in inline constsOli Scherer-1/+16
2023-09-21Add regression testOli Scherer-0/+21
2023-08-18Add a test to check that inline const is in required_constsGary Guo-0/+24
Suggested in https://github.com/rust-lang/rust/issues/76001#issuecomment-1315975027
2023-08-15Deny FnDef in patternsMichael Goulet-0/+30
2023-08-09Don't use type_of to determine if item has intrinsic shimMichael Goulet-0/+10
2023-07-19Fix inline_const with interpolated blockMichael Goulet-0/+32
2023-06-01add inline-const test for elided lifetimes being infer varsZiru Niu-0/+11
2023-04-15Add some reasons why tests are ignored.Eric Huss-1/+1
2023-04-03Perform match checking on THIR.Camille GILLOT-16/+2
2023-01-15Tweak E0597Esteban Küber-0/+1
CC #99430
2023-01-11Move /src/test to /testsAlbert Larsan-0/+585