diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2019-11-06 11:44:56 -0800 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2019-11-13 10:44:13 -0800 |
| commit | 3a84efd0cc05ab2724b1f6a215dca089f863c310 (patch) | |
| tree | fdabc93fa4ce273accc763ba3344d3d2c77c3198 /src/librustc/query | |
| parent | 33b62be8626b28f3c6fa0e6186ad114c452bc966 (diff) | |
| download | rust-3a84efd0cc05ab2724b1f6a215dca089f863c310.tar.gz rust-3a84efd0cc05ab2724b1f6a215dca089f863c310.zip | |
Add HIR pass to check for `if`s and `loop`s in a `const`
These high-level constructs get mapped to control-flow primitives by the time the MIR const-checker runs, making it hard to get the span for the erroneous expression.
Diffstat (limited to 'src/librustc/query')
| -rw-r--r-- | src/librustc/query/mod.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs index bd7b77b0abb..9bd2a933c1c 100644 --- a/src/librustc/query/mod.rs +++ b/src/librustc/query/mod.rs @@ -329,6 +329,11 @@ rustc_queries! { desc { |tcx| "checking for unstable API usage in {}", key.describe_as_module(tcx) } } + /// Checks the const bodies in the module for illegal operations (e.g. `if` or `loop`). + query check_mod_const_bodies(key: DefId) -> () { + desc { |tcx| "checking consts in {}", key.describe_as_module(tcx) } + } + /// Checks the loops in the module. query check_mod_loops(key: DefId) -> () { desc { |tcx| "checking loops in {}", key.describe_as_module(tcx) } |
