Skip to content

Commit 1122033

Browse files
Stop using Key trait randomly
1 parent 48aee7e commit 1122033

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

compiler/rustc_const_eval/src/const_eval/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Not in interpret to make sure we do not use private implementation details
22

33
use rustc_abi::{FieldIdx, VariantIdx};
4-
use rustc_middle::query::Key;
54
use rustc_middle::ty::{self, Ty, TyCtxt};
65
use rustc_middle::{bug, mir};
6+
use rustc_span::DUMMY_SP;
77
use tracing::instrument;
88

99
use crate::interpret::InterpCx;
@@ -71,8 +71,7 @@ pub fn tag_for_variant_provider<'tcx>(
7171
let (ty, variant_index) = key.value;
7272
assert!(ty.is_enum());
7373

74-
let ecx =
75-
InterpCx::new(tcx, ty.default_span(tcx), key.typing_env, crate::const_eval::DummyMachine);
74+
let ecx = InterpCx::new(tcx, DUMMY_SP, key.typing_env, crate::const_eval::DummyMachine);
7675

7776
let layout = ecx.layout_of(ty).unwrap();
7877
ecx.tag_for_variant(layout, variant_index).unwrap().map(|(tag, _tag_field)| tag)

compiler/rustc_lint/src/map_unit_fn.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use rustc_hir::{Expr, ExprKind, HirId, Stmt, StmtKind};
2-
use rustc_middle::query::Key;
32
use rustc_middle::ty::{self, Ty};
43
use rustc_session::{declare_lint, declare_lint_pass};
54

@@ -69,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for MapUnitFn {
6968
.span_of_impl(*id)
7069
.unwrap_or(default_span),
7170
argument_label: args[0].span,
72-
map_label: arg_ty.default_span(cx.tcx),
71+
map_label: path.ident.span,
7372
suggestion: path.ident.span,
7473
replace: "for_each".to_string(),
7574
},
@@ -88,7 +87,7 @@ impl<'tcx> LateLintPass<'tcx> for MapUnitFn {
8887
.span_of_impl(*id)
8988
.unwrap_or(default_span),
9089
argument_label: args[0].span,
91-
map_label: arg_ty.default_span(cx.tcx),
90+
map_label: path.ident.span,
9291
suggestion: path.ident.span,
9392
replace: "for_each".to_string(),
9493
},

0 commit comments

Comments
 (0)