Skip to content

Commit d12e868

Browse files
committed
fix(upstream): update hir::Constness and join_codegen
1 parent b535c7c commit d12e868

3 files changed

Lines changed: 14 additions & 12 deletions

File tree

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/driver.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ use std::sync::{Arc, LazyLock, Mutex};
55

66
use rustc_codegen_ssa::traits::CodegenBackend;
77
use rustc_codegen_ssa::{CompiledModules, CrateInfo, TargetConfig};
8-
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
8+
use rustc_data_structures::fx::FxHashMap;
99
use rustc_data_structures::sync::{DynSend, DynSync};
10+
use rustc_data_structures::unord::UnordMap;
1011
use rustc_driver::{Callbacks, Compilation};
1112
use rustc_interface::Config;
1213
use rustc_interface::interface::Compiler;
@@ -170,7 +171,7 @@ impl<C: CallbacksExt> CodegenBackend for BackendWrapper<C> {
170171
_sess: &Session,
171172
_outputs: &OutputFilenames,
172173
_crate_info: &CrateInfo,
173-
) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
174+
) -> (CompiledModules, UnordMap<WorkProductId, WorkProduct>) {
174175
*ongoing_codegen.downcast().unwrap()
175176
}
176177

src/mir.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ fn remap_mir_for_const_eval_select<'tcx>(
5555
let ty = tupled_args.node.ty(&body.local_decls, tcx);
5656
let fields = ty.tuple_fields();
5757
let num_args = fields.len();
58-
let func = if context == hir::Constness::Const {
59-
called_in_const
60-
} else {
61-
called_at_rt
58+
let func = match context {
59+
// Using `const_eval_select` in always-const code is useful when used in macros
60+
// that you don't know whether they are going to be used in `const fn` or in `const` items.
61+
hir::Constness::Const { .. } => called_in_const,
62+
hir::Constness::NotConst => called_at_rt,
6263
};
6364
let (method, place): (fn(Place<'tcx>) -> Operand<'tcx>, Place<'tcx>) =
6465
match tupled_args.node {

0 commit comments

Comments
 (0)