Skip to content

Commit e24da8e

Browse files
Movability doesn't need to be a query anymore
1 parent 15ccf2e commit e24da8e

File tree

21 files changed

+29
-56
lines changed

21 files changed

+29
-56
lines changed

compiler/rustc_borrowck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ fn do_mir_borrowck<'tcx>(
275275
if let Some(local) = body.local_decls.raw.get(1)
276276
// Get the interior types and args which typeck computed
277277
&& let ty::Coroutine(def_id, _) = *local.ty.kind()
278-
&& tcx.movability(def_id) == hir::Movability::Movable
278+
&& tcx.coroutine_movability(def_id) == hir::Movability::Movable
279279
{
280280
true
281281
} else {

compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ provide! { tcx, def_id, other, cdata,
240240
mir_const_qualif => { table }
241241
rendered_const => { table }
242242
asyncness => { table_direct }
243-
movability => { table_direct }
244243
fn_arg_names => { table }
245244
coroutine_kind => { table_direct }
246245
trait_def => { table }

compiler/rustc_metadata/src/rmeta/encoder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,8 +1444,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
14441444
if def_kind == DefKind::Closure
14451445
&& let Some(coroutine_kind) = self.tcx.coroutine_kind(def_id)
14461446
{
1447-
self.tables.coroutine_kind.set(def_id.index, Some(coroutine_kind));
1448-
self.tables.movability.set(def_id.index, Some(self.tcx.movability(def_id)));
1447+
self.tables.coroutine_kind.set(def_id.index, Some(coroutine_kind))
14491448
}
14501449
if let DefKind::Enum | DefKind::Struct | DefKind::Union = def_kind {
14511450
self.encode_info_for_adt(local_id);

compiler/rustc_metadata/src/rmeta/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ define_tables! {
448448
mir_const_qualif: Table<DefIndex, LazyValue<mir::ConstQualifs>>,
449449
rendered_const: Table<DefIndex, LazyValue<String>>,
450450
asyncness: Table<DefIndex, ty::Asyncness>,
451-
movability: Table<DefIndex, hir::Movability>,
452451
fn_arg_names: Table<DefIndex, LazyArray<Ident>>,
453452
coroutine_kind: Table<DefIndex, hir::CoroutineKind>,
454453
trait_def: Table<DefIndex, LazyValue<ty::TraitDef>>,

compiler/rustc_metadata/src/rmeta/table.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,6 @@ fixed_size_enum! {
213213
}
214214
}
215215

216-
fixed_size_enum! {
217-
ty::Movability {
218-
( Movable )
219-
( Static )
220-
}
221-
}
222-
223216
fixed_size_enum! {
224217
ty::AssocItemContainer {
225218
( TraitContainer )

compiler/rustc_middle/src/mir/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ impl<'tcx> Visitor<'tcx> for ExtraComments<'tcx> {
13081308
self.push("coroutine");
13091309
self.push(&format!("+ def_id: {def_id:?}"));
13101310
self.push(&format!("+ args: {args:#?}"));
1311-
self.push(&format!("+ movability: {:?}", self.tcx.movability(def_id)));
1311+
self.push(&format!("+ kind: {:?}", self.tcx.coroutine_kind(def_id)));
13121312
}
13131313

13141314
AggregateKind::Adt(_, _, _, Some(user_ty), _) => {

compiler/rustc_middle/src/query/erase.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ trivial! {
254254
rustc_hir::IsAsync,
255255
rustc_hir::ItemLocalId,
256256
rustc_hir::LangItem,
257-
rustc_hir::Movability,
258257
rustc_hir::OwnerId,
259258
rustc_hir::Upvar,
260259
rustc_index::bit_set::FiniteBitSet<u32>,

compiler/rustc_middle/src/query/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -721,11 +721,6 @@ rustc_queries! {
721721
desc { |tcx| "computing drop-check constraints for `{}`", tcx.def_path_str(key) }
722722
}
723723

724-
query movability(key: DefId) -> hir::Movability {
725-
desc { |tcx| "checking if coroutine is movable: `{}`", tcx.def_path_str(key) }
726-
separate_provide_extern
727-
}
728-
729724
/// Returns `true` if this is a const fn, use the `is_const_fn` to know whether your crate
730725
/// actually sees it as const fn (e.g., the const-fn-ness might be unstable and you might
731726
/// not have the feature gate active).

compiler/rustc_middle/src/ty/context.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,12 @@ impl<'tcx> TyCtxt<'tcx> {
847847
self.coroutine_kind(def_id).is_some()
848848
}
849849

850+
/// Returns the movability of the coroutine of `def_id`, or panics
851+
/// if given a `def_id` that is not a coroutine.
852+
pub fn coroutine_movability(self, def_id: DefId) -> hir::Movability {
853+
self.coroutine_kind(def_id).expect("expected a coroutine").movability()
854+
}
855+
850856
/// Returns `true` if the node pointed to by `def_id` is a coroutine for an async construct.
851857
pub fn coroutine_is_async(self, def_id: DefId) -> bool {
852858
matches!(

compiler/rustc_middle/src/ty/parameterized.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ trivially_parameterized_over_tcx! {
8686
rustc_hir::CoroutineKind,
8787
rustc_hir::IsAsync,
8888
rustc_hir::LangItem,
89-
rustc_hir::Movability,
9089
rustc_hir::def::DefKind,
9190
rustc_hir::def::DocLinkResMap,
9291
rustc_hir::def_id::DefId,

0 commit comments

Comments
 (0)