Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit fe35447

Browse files
committed
fix: rename generator to coroutine also in dependencies
Follow the rename in nightly (see https://blog.rust-lang.org/inside-rust/2023/10/23/coroutines.html)
1 parent f937673 commit fe35447

File tree

11 files changed

+44
-44
lines changed

11 files changed

+44
-44
lines changed

Cargo.lock

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

crates/hir-ty/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ oorandom = "11.1.3"
2323
tracing.workspace = true
2424
rustc-hash.workspace = true
2525
scoped-tls = "1.0.0"
26-
chalk-solve = { version = "0.95.0", default-features = false }
27-
chalk-ir = "0.95.0"
28-
chalk-recursive = { version = "0.95.0", default-features = false }
29-
chalk-derive = "0.95.0"
26+
chalk-solve = { version = "0.96.0", default-features = false }
27+
chalk-ir = "0.96.0"
28+
chalk-recursive = { version = "0.96.0", default-features = false }
29+
chalk-derive = "0.96.0"
3030
la-arena.workspace = true
3131
once_cell = "1.17.0"
3232
triomphe.workspace = true

crates/hir-ty/src/chalk_db.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -424,18 +424,18 @@ impl chalk_solve::RustIrDatabase<Interner> for ChalkContext<'_> {
424424
fn fn_def_name(&self, fn_def_id: chalk_ir::FnDefId<Interner>) -> String {
425425
format!("fn_{}", fn_def_id.0)
426426
}
427-
fn generator_datum(
427+
fn coroutine_datum(
428428
&self,
429-
id: chalk_ir::GeneratorId<Interner>,
430-
) -> Arc<chalk_solve::rust_ir::GeneratorDatum<Interner>> {
429+
id: chalk_ir::CoroutineId<Interner>,
430+
) -> Arc<chalk_solve::rust_ir::CoroutineDatum<Interner>> {
431431
let (parent, expr) = self.db.lookup_intern_coroutine(id.into());
432432

433433
// We fill substitution with unknown type, because we only need to know whether the generic
434434
// params are types or consts to build `Binders` and those being filled up are for
435435
// `resume_type`, `yield_type`, and `return_type` of the coroutine in question.
436436
let subst = TyBuilder::subst_for_coroutine(self.db, parent).fill_with_unknown().build();
437437

438-
let input_output = rust_ir::GeneratorInputOutputDatum {
438+
let input_output = rust_ir::CoroutineInputOutputDatum {
439439
resume_type: TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0))
440440
.intern(Interner),
441441
yield_type: TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 1))
@@ -463,25 +463,25 @@ impl chalk_solve::RustIrDatabase<Interner> for ChalkContext<'_> {
463463
Movability::Movable => rust_ir::Movability::Movable,
464464
};
465465

466-
Arc::new(rust_ir::GeneratorDatum { movability, input_output })
466+
Arc::new(rust_ir::CoroutineDatum { movability, input_output })
467467
}
468-
fn generator_witness_datum(
468+
fn coroutine_witness_datum(
469469
&self,
470-
id: chalk_ir::GeneratorId<Interner>,
471-
) -> Arc<chalk_solve::rust_ir::GeneratorWitnessDatum<Interner>> {
470+
id: chalk_ir::CoroutineId<Interner>,
471+
) -> Arc<chalk_solve::rust_ir::CoroutineWitnessDatum<Interner>> {
472472
// FIXME: calculate inner types
473473
let inner_types =
474-
rust_ir::GeneratorWitnessExistential { types: wrap_empty_binders(vec![]) };
474+
rust_ir::CoroutineWitnessExistential { types: wrap_empty_binders(vec![]) };
475475

476476
let (parent, _) = self.db.lookup_intern_coroutine(id.into());
477-
// See the comment in `generator_datum()` for unknown types.
477+
// See the comment in `coroutine_datum()` for unknown types.
478478
let subst = TyBuilder::subst_for_coroutine(self.db, parent).fill_with_unknown().build();
479479
let it = subst
480480
.iter(Interner)
481481
.map(|it| it.constant(Interner).map(|c| c.data(Interner).ty.clone()));
482482
let inner_types = crate::make_type_and_const_binders(it, inner_types);
483483

484-
Arc::new(rust_ir::GeneratorWitnessDatum { inner_types })
484+
Arc::new(rust_ir::CoroutineWitnessDatum { inner_types })
485485
}
486486

487487
fn unification_database(&self) -> &dyn chalk_ir::UnificationDatabase<Interner> {
@@ -617,7 +617,7 @@ fn well_known_trait_from_lang_item(item: LangItem) -> Option<WellKnownTrait> {
617617
LangItem::Fn => WellKnownTrait::Fn,
618618
LangItem::FnMut => WellKnownTrait::FnMut,
619619
LangItem::FnOnce => WellKnownTrait::FnOnce,
620-
LangItem::Coroutine => WellKnownTrait::Generator,
620+
LangItem::Coroutine => WellKnownTrait::Coroutine,
621621
LangItem::Sized => WellKnownTrait::Sized,
622622
LangItem::Unpin => WellKnownTrait::Unpin,
623623
LangItem::Unsize => WellKnownTrait::Unsize,
@@ -639,7 +639,7 @@ fn lang_item_from_well_known_trait(trait_: WellKnownTrait) -> LangItem {
639639
WellKnownTrait::Fn => LangItem::Fn,
640640
WellKnownTrait::FnMut => LangItem::FnMut,
641641
WellKnownTrait::FnOnce => LangItem::FnOnce,
642-
WellKnownTrait::Generator => LangItem::Coroutine,
642+
WellKnownTrait::Coroutine => LangItem::Coroutine,
643643
WellKnownTrait::Sized => LangItem::Sized,
644644
WellKnownTrait::Tuple => LangItem::Tuple,
645645
WellKnownTrait::Unpin => LangItem::Unpin,

crates/hir-ty/src/display.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,8 @@ fn render_const_scalar(
659659
}
660660
TyKind::Never => f.write_str("!"),
661661
TyKind::Closure(_, _) => f.write_str("<closure>"),
662-
TyKind::Generator(_, _) => f.write_str("<coroutine>"),
663-
TyKind::GeneratorWitness(_, _) => f.write_str("<coroutine-witness>"),
662+
TyKind::Coroutine(_, _) => f.write_str("<coroutine>"),
663+
TyKind::CoroutineWitness(_, _) => f.write_str("<coroutine-witness>"),
664664
// The below arms are unreachable, since const eval will bail out before here.
665665
TyKind::Foreign(_) => f.write_str("<extern-type>"),
666666
TyKind::Error
@@ -1205,7 +1205,7 @@ impl HirDisplay for Ty {
12051205
write!(f, "{{unknown}}")?;
12061206
}
12071207
TyKind::InferenceVar(..) => write!(f, "_")?,
1208-
TyKind::Generator(_, subst) => {
1208+
TyKind::Coroutine(_, subst) => {
12091209
if f.display_target.is_source_code() {
12101210
return Err(HirDisplayError::DisplaySourceCodeError(
12111211
DisplaySourceCodeError::Coroutine,
@@ -1232,7 +1232,7 @@ impl HirDisplay for Ty {
12321232
write!(f, "{{coroutine}}")?;
12331233
}
12341234
}
1235-
TyKind::GeneratorWitness(..) => write!(f, "{{coroutine witness}}")?,
1235+
TyKind::CoroutineWitness(..) => write!(f, "{{coroutine witness}}")?,
12361236
}
12371237
Ok(())
12381238
}

crates/hir-ty/src/infer/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl InferenceContext<'_> {
5151
let _ = self.coerce(Some(closure_expr), closure_ty, &expected_ty);
5252

5353
// Coroutines are not Fn* so return early.
54-
if matches!(closure_ty.kind(Interner), TyKind::Generator(..)) {
54+
if matches!(closure_ty.kind(Interner), TyKind::Coroutine(..)) {
5555
return;
5656
}
5757

crates/hir-ty/src/infer/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl InferenceContext<'_> {
250250
.build();
251251

252252
let coroutine_id = self.db.intern_coroutine((self.owner, tgt_expr)).into();
253-
let coroutine_ty = TyKind::Generator(coroutine_id, subst).intern(Interner);
253+
let coroutine_ty = TyKind::Coroutine(coroutine_id, subst).intern(Interner);
254254

255255
(None, coroutine_ty, Some((resume_ty, yield_ty)))
256256
}

crates/hir-ty/src/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ pub fn layout_of_ty_query(
408408
cx.univariant(dl, &fields, &ReprOptions::default(), StructKind::AlwaysSized)
409409
.ok_or(LayoutError::Unknown)?
410410
}
411-
TyKind::Generator(_, _) | TyKind::GeneratorWitness(_, _) => {
411+
TyKind::Coroutine(_, _) | TyKind::CoroutineWitness(_, _) => {
412412
return Err(LayoutError::NotImplemented)
413413
}
414414
TyKind::Error => return Err(LayoutError::HasErrorType),

crates/hir-ty/src/mapping.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ impl From<crate::db::InternedClosureId> for chalk_ir::ClosureId<Interner> {
103103
}
104104
}
105105

106-
impl From<chalk_ir::GeneratorId<Interner>> for crate::db::InternedCoroutineId {
107-
fn from(id: chalk_ir::GeneratorId<Interner>) -> Self {
106+
impl From<chalk_ir::CoroutineId<Interner>> for crate::db::InternedCoroutineId {
107+
fn from(id: chalk_ir::CoroutineId<Interner>) -> Self {
108108
Self::from_intern_id(id.0)
109109
}
110110
}
111111

112-
impl From<crate::db::InternedCoroutineId> for chalk_ir::GeneratorId<Interner> {
112+
impl From<crate::db::InternedCoroutineId> for chalk_ir::CoroutineId<Interner> {
113113
fn from(id: crate::db::InternedCoroutineId) -> Self {
114-
chalk_ir::GeneratorId(id.as_intern_id())
114+
chalk_ir::CoroutineId(id.as_intern_id())
115115
}
116116
}
117117

crates/hir-ty/src/method_resolution.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ impl TyFingerprint {
9696
| TyKind::OpaqueType(_, _)
9797
| TyKind::FnDef(_, _)
9898
| TyKind::Closure(_, _)
99-
| TyKind::Generator(..)
100-
| TyKind::GeneratorWitness(..) => TyFingerprint::Unnameable,
99+
| TyKind::Coroutine(..)
100+
| TyKind::CoroutineWitness(..) => TyFingerprint::Unnameable,
101101
TyKind::Function(fn_ptr) => {
102102
TyFingerprint::Function(fn_ptr.substitution.0.len(Interner) as u32)
103103
}

crates/hir-ty/src/mir/eval.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,8 +2147,8 @@ impl Evaluator<'_> {
21472147
| TyKind::Str
21482148
| TyKind::Never
21492149
| TyKind::Closure(_, _)
2150-
| TyKind::Generator(_, _)
2151-
| TyKind::GeneratorWitness(_, _)
2150+
| TyKind::Coroutine(_, _)
2151+
| TyKind::CoroutineWitness(_, _)
21522152
| TyKind::Foreign(_)
21532153
| TyKind::Error
21542154
| TyKind::Placeholder(_)
@@ -2635,8 +2635,8 @@ impl Evaluator<'_> {
26352635
| TyKind::Str
26362636
| TyKind::Never
26372637
| TyKind::Closure(_, _)
2638-
| TyKind::Generator(_, _)
2639-
| TyKind::GeneratorWitness(_, _)
2638+
| TyKind::Coroutine(_, _)
2639+
| TyKind::CoroutineWitness(_, _)
26402640
| TyKind::Foreign(_)
26412641
| TyKind::Error
26422642
| TyKind::Placeholder(_)

crates/hir/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4103,8 +4103,8 @@ impl Type {
41034103
| TyKind::Function(_)
41044104
| TyKind::Alias(_)
41054105
| TyKind::Foreign(_)
4106-
| TyKind::Generator(..)
4107-
| TyKind::GeneratorWitness(..) => false,
4106+
| TyKind::Coroutine(..)
4107+
| TyKind::CoroutineWitness(..) => false,
41084108
}
41094109
}
41104110
}

0 commit comments

Comments
 (0)