]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #95976 - b-naber:valtree-constval-conversion, r=oli-obk
authorbors <bors@rust-lang.org>
Thu, 28 Apr 2022 13:18:22 +0000 (13:18 +0000)
committerbors <bors@rust-lang.org>
Thu, 28 Apr 2022 13:18:22 +0000 (13:18 +0000)
Implement Valtree to ConstValue conversion

Once we start to use `ValTree`s in the type system we will need to be able to convert them into `ConstValue` instances, which we want to continue to use after MIR construction.

r? `@oli-obk`

cc `@RalfJung`

1  2 
compiler/rustc_middle/src/query/mod.rs

index d8586a8a77df62075ce2bc11a66afe43b6f1fdd6,2834db261313717ffbaaffab05b1bf2183ba42ec..cc80ab8f16e9c9f7ff007f930c349948eca3a50e
@@@ -936,6 -936,11 +936,11 @@@ rustc_queries! 
          remap_env_constness
      }
  
+     /// Converts a type level constant value into `ConstValue`
+     query valtree_to_const_val(key: (Ty<'tcx>, ty::ValTree<'tcx>)) -> ConstValue<'tcx> {
+         desc { "convert type-level constant value to mir constant value"}
+     }
      /// Destructure a constant ADT or array into its variant index and its
      /// field values or return `None` if constant is invalid.
      ///
      // Does not include external symbols that don't have a corresponding DefId,
      // like the compiler-generated `main` function and so on.
      query reachable_non_generics(_: CrateNum)
 -        -> DefIdMap<SymbolExportLevel> {
 +        -> DefIdMap<SymbolExportInfo> {
          storage(ArenaCacheSelector<'tcx>)
          desc { "looking up the exported symbols of a crate" }
          separate_provide_extern
      ///   correspond to a publicly visible symbol in `cnum` machine code.
      /// - The `exported_symbols` sets of different crates do not intersect.
      query exported_symbols(_: CrateNum)
 -        -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportLevel)] {
 +        -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportInfo)] {
          desc { "exported_symbols" }
          separate_provide_extern
      }