Auto merge of #38813 - eddyb:lazy-11, r=nikomatsakis
[11/n] Separate ty::Tables into one per each body. _This is part of a series ([prev](https://github.com/rust-lang/rust/pull/38449) | [next]()) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well. If any motivation is unclear, please ask for additional PR description clarifications or code comments._ <hr> In order to track the results of type-checking and inference for incremental recompilation, they must be stored separately for each function or constant value, instead of lumped together. These side-`Tables` also have to be tracked by various passes, as they visit through bodies (all of which have `Tables`, even if closures share the ones from their parent functions). This is usually done by switching a `tables` field in an override of `visit_nested_body` before recursing through `visit_body`, to the relevant one and then restoring it - however, in many cases the nesting is unnecessary and creating the visitor for each body in the crate and then visiting that body, would be a much cleaner solution. To simplify handling of inlined HIR & its side-tables, their `NodeId` remapping and entries HIR map were fully stripped out, which means that `NodeId`s from inlined HIR must not be used where a local `NodeId` is expected. It might be possible to make the nodes (`Expr`, `Block`, `Pat`, etc.) that only show up within a `Body` have IDs that are scoped to that `Body`, which would also allow `Tables` to use `Vec`s. That last part also fixes #38790 which was accidentally introduced in a previous refactor.
This commit is contained in:
commit
cbf88730e7
76 changed files with 1128 additions and 1415 deletions
|
|
@ -15,6 +15,8 @@
|
|||
// change this warn to a deny, then the compiler will exit before
|
||||
// those errors are detected.
|
||||
|
||||
#![warn(const_err)]
|
||||
|
||||
use std::fmt;
|
||||
use std::{i8, i16, i32, i64, isize};
|
||||
use std::{u8, u16, u32, u64, usize};
|
||||
|
|
@ -80,7 +82,8 @@ const VALS_I64: (i64, i64, i64, i64) =
|
|||
);
|
||||
|
||||
const VALS_U8: (u8, u8, u8, u8) =
|
||||
(-(u8::MIN as i8) as u8,
|
||||
( //~ WARN constant evaluation error: attempt to subtract with overflow.
|
||||
-(u8::MIN as i8) as u8,
|
||||
u8::MIN - 1,
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| attempt to subtract with overflow
|
||||
|
|
@ -93,7 +96,8 @@ const VALS_U8: (u8, u8, u8, u8) =
|
|||
);
|
||||
|
||||
const VALS_U16: (u16, u16, u16, u16) =
|
||||
(-(u16::MIN as i16) as u16,
|
||||
( //~ WARN constant evaluation error: attempt to subtract with overflow.
|
||||
-(u16::MIN as i16) as u16,
|
||||
u16::MIN - 1,
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| attempt to subtract with overflow
|
||||
|
|
@ -106,7 +110,8 @@ const VALS_U16: (u16, u16, u16, u16) =
|
|||
);
|
||||
|
||||
const VALS_U32: (u32, u32, u32, u32) =
|
||||
(-(u32::MIN as i32) as u32,
|
||||
( //~ WARN constant evaluation error: attempt to subtract with overflow.
|
||||
-(u32::MIN as i32) as u32,
|
||||
u32::MIN - 1,
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| attempt to subtract with overflow
|
||||
|
|
@ -119,7 +124,8 @@ const VALS_U32: (u32, u32, u32, u32) =
|
|||
);
|
||||
|
||||
const VALS_U64: (u64, u64, u64, u64) =
|
||||
(-(u64::MIN as i64) as u64,
|
||||
( //~ WARN constant evaluation error: attempt to subtract with overflow.
|
||||
-(u64::MIN as i64) as u64,
|
||||
u64::MIN - 1,
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| attempt to subtract with overflow
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue