diff --git a/Cargo.lock b/Cargo.lock index 15d06222eb..de3a5e8aa5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -160,9 +160,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chalk-derive" -version = "0.95.0" +version = "0.96.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "329427f28cd2bddaacd47c4dcd3d7082d315c61fb164394c690fe98c1b6ee9d3" +checksum = "5676cea088c32290fe65c82895be9d06dd21e0fa49bb97ca840529e9417ab71a" dependencies = [ "proc-macro2", "quote", @@ -172,9 +172,9 @@ dependencies = [ [[package]] name = "chalk-ir" -version = "0.95.0" +version = "0.96.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1e1659238bd598d0f7dbc5034cf1ff46010a3d6827704c9ed443c8359cb484" +checksum = "ff550c2cdd63ff74394214dce03d06386928a641c0f08837535f04af573a966d" dependencies = [ "bitflags 2.4.1", "chalk-derive", @@ -183,9 +183,9 @@ dependencies = [ [[package]] name = "chalk-recursive" -version = "0.95.0" +version = "0.96.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e0bff0ba1bed11407384fcec0353aeb6888901e63cb47d04505ec47adad847" +checksum = "4c4559e5c9b200240453b07d893f9c3c74413b53b0d33cbe272c68b0b77aa1c3" dependencies = [ "chalk-derive", "chalk-ir", @@ -196,9 +196,9 @@ dependencies = [ [[package]] name = "chalk-solve" -version = "0.95.0" +version = "0.96.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9c46d501cf83732a91056c0c846ae7a16d6b3c67a6a6bb5e9cc0a2e91563b6" +checksum = "0882e68ce9eb5a0a2413806538494d19df6ee520ab17d1faf489e952f32e98b8" dependencies = [ "chalk-derive", "chalk-ir", diff --git a/crates/hir-ty/Cargo.toml b/crates/hir-ty/Cargo.toml index 803c18677d..822a7d3e91 100644 --- a/crates/hir-ty/Cargo.toml +++ b/crates/hir-ty/Cargo.toml @@ -23,10 +23,10 @@ oorandom = "11.1.3" tracing.workspace = true rustc-hash.workspace = true scoped-tls = "1.0.0" -chalk-solve = { version = "0.95.0", default-features = false } -chalk-ir = "0.95.0" -chalk-recursive = { version = "0.95.0", default-features = false } -chalk-derive = "0.95.0" +chalk-solve = { version = "0.96.0", default-features = false } +chalk-ir = "0.96.0" +chalk-recursive = { version = "0.96.0", default-features = false } +chalk-derive = "0.96.0" la-arena.workspace = true once_cell = "1.17.0" triomphe.workspace = true diff --git a/crates/hir-ty/src/chalk_db.rs b/crates/hir-ty/src/chalk_db.rs index 90e1c247f8..5b0b16eb9a 100644 --- a/crates/hir-ty/src/chalk_db.rs +++ b/crates/hir-ty/src/chalk_db.rs @@ -424,10 +424,10 @@ impl chalk_solve::RustIrDatabase for ChalkContext<'_> { fn fn_def_name(&self, fn_def_id: chalk_ir::FnDefId) -> String { format!("fn_{}", fn_def_id.0) } - fn generator_datum( + fn coroutine_datum( &self, - id: chalk_ir::GeneratorId, - ) -> Arc> { + id: chalk_ir::CoroutineId, + ) -> Arc> { let (parent, expr) = self.db.lookup_intern_coroutine(id.into()); // We fill substitution with unknown type, because we only need to know whether the generic @@ -435,7 +435,7 @@ impl chalk_solve::RustIrDatabase for ChalkContext<'_> { // `resume_type`, `yield_type`, and `return_type` of the coroutine in question. let subst = TyBuilder::subst_for_coroutine(self.db, parent).fill_with_unknown().build(); - let input_output = rust_ir::GeneratorInputOutputDatum { + let input_output = rust_ir::CoroutineInputOutputDatum { resume_type: TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)) .intern(Interner), yield_type: TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 1)) @@ -463,25 +463,25 @@ impl chalk_solve::RustIrDatabase for ChalkContext<'_> { Movability::Movable => rust_ir::Movability::Movable, }; - Arc::new(rust_ir::GeneratorDatum { movability, input_output }) + Arc::new(rust_ir::CoroutineDatum { movability, input_output }) } - fn generator_witness_datum( + fn coroutine_witness_datum( &self, - id: chalk_ir::GeneratorId, - ) -> Arc> { + id: chalk_ir::CoroutineId, + ) -> Arc> { // FIXME: calculate inner types let inner_types = - rust_ir::GeneratorWitnessExistential { types: wrap_empty_binders(vec![]) }; + rust_ir::CoroutineWitnessExistential { types: wrap_empty_binders(vec![]) }; let (parent, _) = self.db.lookup_intern_coroutine(id.into()); - // See the comment in `generator_datum()` for unknown types. + // See the comment in `coroutine_datum()` for unknown types. let subst = TyBuilder::subst_for_coroutine(self.db, parent).fill_with_unknown().build(); let it = subst .iter(Interner) .map(|it| it.constant(Interner).map(|c| c.data(Interner).ty.clone())); let inner_types = crate::make_type_and_const_binders(it, inner_types); - Arc::new(rust_ir::GeneratorWitnessDatum { inner_types }) + Arc::new(rust_ir::CoroutineWitnessDatum { inner_types }) } fn unification_database(&self) -> &dyn chalk_ir::UnificationDatabase { @@ -617,7 +617,7 @@ fn well_known_trait_from_lang_item(item: LangItem) -> Option { LangItem::Fn => WellKnownTrait::Fn, LangItem::FnMut => WellKnownTrait::FnMut, LangItem::FnOnce => WellKnownTrait::FnOnce, - LangItem::Coroutine => WellKnownTrait::Generator, + LangItem::Coroutine => WellKnownTrait::Coroutine, LangItem::Sized => WellKnownTrait::Sized, LangItem::Unpin => WellKnownTrait::Unpin, LangItem::Unsize => WellKnownTrait::Unsize, @@ -639,7 +639,7 @@ fn lang_item_from_well_known_trait(trait_: WellKnownTrait) -> LangItem { WellKnownTrait::Fn => LangItem::Fn, WellKnownTrait::FnMut => LangItem::FnMut, WellKnownTrait::FnOnce => LangItem::FnOnce, - WellKnownTrait::Generator => LangItem::Coroutine, + WellKnownTrait::Coroutine => LangItem::Coroutine, WellKnownTrait::Sized => LangItem::Sized, WellKnownTrait::Tuple => LangItem::Tuple, WellKnownTrait::Unpin => LangItem::Unpin, diff --git a/crates/hir-ty/src/display.rs b/crates/hir-ty/src/display.rs index 2060f1e32e..e2ba221cf1 100644 --- a/crates/hir-ty/src/display.rs +++ b/crates/hir-ty/src/display.rs @@ -659,8 +659,8 @@ fn render_const_scalar( } TyKind::Never => f.write_str("!"), TyKind::Closure(_, _) => f.write_str(""), - TyKind::Generator(_, _) => f.write_str(""), - TyKind::GeneratorWitness(_, _) => f.write_str(""), + TyKind::Coroutine(_, _) => f.write_str(""), + TyKind::CoroutineWitness(_, _) => f.write_str(""), // The below arms are unreachable, since const eval will bail out before here. TyKind::Foreign(_) => f.write_str(""), TyKind::Error @@ -1205,7 +1205,7 @@ impl HirDisplay for Ty { write!(f, "{{unknown}}")?; } TyKind::InferenceVar(..) => write!(f, "_")?, - TyKind::Generator(_, subst) => { + TyKind::Coroutine(_, subst) => { if f.display_target.is_source_code() { return Err(HirDisplayError::DisplaySourceCodeError( DisplaySourceCodeError::Coroutine, @@ -1232,7 +1232,7 @@ impl HirDisplay for Ty { write!(f, "{{coroutine}}")?; } } - TyKind::GeneratorWitness(..) => write!(f, "{{coroutine witness}}")?, + TyKind::CoroutineWitness(..) => write!(f, "{{coroutine witness}}")?, } Ok(()) } diff --git a/crates/hir-ty/src/infer/closure.rs b/crates/hir-ty/src/infer/closure.rs index d385beb16b..3bf0a00cd1 100644 --- a/crates/hir-ty/src/infer/closure.rs +++ b/crates/hir-ty/src/infer/closure.rs @@ -51,7 +51,7 @@ impl InferenceContext<'_> { let _ = self.coerce(Some(closure_expr), closure_ty, &expected_ty); // Coroutines are not Fn* so return early. - if matches!(closure_ty.kind(Interner), TyKind::Generator(..)) { + if matches!(closure_ty.kind(Interner), TyKind::Coroutine(..)) { return; } diff --git a/crates/hir-ty/src/infer/expr.rs b/crates/hir-ty/src/infer/expr.rs index a5d8f1441b..9d8096d32f 100644 --- a/crates/hir-ty/src/infer/expr.rs +++ b/crates/hir-ty/src/infer/expr.rs @@ -250,7 +250,7 @@ impl InferenceContext<'_> { .build(); let coroutine_id = self.db.intern_coroutine((self.owner, tgt_expr)).into(); - let coroutine_ty = TyKind::Generator(coroutine_id, subst).intern(Interner); + let coroutine_ty = TyKind::Coroutine(coroutine_id, subst).intern(Interner); (None, coroutine_ty, Some((resume_ty, yield_ty))) } diff --git a/crates/hir-ty/src/layout.rs b/crates/hir-ty/src/layout.rs index b7bfaf2931..875906f9ab 100644 --- a/crates/hir-ty/src/layout.rs +++ b/crates/hir-ty/src/layout.rs @@ -408,7 +408,7 @@ pub fn layout_of_ty_query( cx.univariant(dl, &fields, &ReprOptions::default(), StructKind::AlwaysSized) .ok_or(LayoutError::Unknown)? } - TyKind::Generator(_, _) | TyKind::GeneratorWitness(_, _) => { + TyKind::Coroutine(_, _) | TyKind::CoroutineWitness(_, _) => { return Err(LayoutError::NotImplemented) } TyKind::Error => return Err(LayoutError::HasErrorType), diff --git a/crates/hir-ty/src/mapping.rs b/crates/hir-ty/src/mapping.rs index c24ae5f618..fba760974f 100644 --- a/crates/hir-ty/src/mapping.rs +++ b/crates/hir-ty/src/mapping.rs @@ -103,15 +103,15 @@ impl From for chalk_ir::ClosureId { } } -impl From> for crate::db::InternedCoroutineId { - fn from(id: chalk_ir::GeneratorId) -> Self { +impl From> for crate::db::InternedCoroutineId { + fn from(id: chalk_ir::CoroutineId) -> Self { Self::from_intern_id(id.0) } } -impl From for chalk_ir::GeneratorId { +impl From for chalk_ir::CoroutineId { fn from(id: crate::db::InternedCoroutineId) -> Self { - chalk_ir::GeneratorId(id.as_intern_id()) + chalk_ir::CoroutineId(id.as_intern_id()) } } diff --git a/crates/hir-ty/src/method_resolution.rs b/crates/hir-ty/src/method_resolution.rs index 03ed8d36a1..1c74c24371 100644 --- a/crates/hir-ty/src/method_resolution.rs +++ b/crates/hir-ty/src/method_resolution.rs @@ -96,8 +96,8 @@ impl TyFingerprint { | TyKind::OpaqueType(_, _) | TyKind::FnDef(_, _) | TyKind::Closure(_, _) - | TyKind::Generator(..) - | TyKind::GeneratorWitness(..) => TyFingerprint::Unnameable, + | TyKind::Coroutine(..) + | TyKind::CoroutineWitness(..) => TyFingerprint::Unnameable, TyKind::Function(fn_ptr) => { TyFingerprint::Function(fn_ptr.substitution.0.len(Interner) as u32) } diff --git a/crates/hir-ty/src/mir/eval.rs b/crates/hir-ty/src/mir/eval.rs index 16075d9073..482d61f695 100644 --- a/crates/hir-ty/src/mir/eval.rs +++ b/crates/hir-ty/src/mir/eval.rs @@ -2147,8 +2147,8 @@ impl Evaluator<'_> { | TyKind::Str | TyKind::Never | TyKind::Closure(_, _) - | TyKind::Generator(_, _) - | TyKind::GeneratorWitness(_, _) + | TyKind::Coroutine(_, _) + | TyKind::CoroutineWitness(_, _) | TyKind::Foreign(_) | TyKind::Error | TyKind::Placeholder(_) @@ -2635,8 +2635,8 @@ impl Evaluator<'_> { | TyKind::Str | TyKind::Never | TyKind::Closure(_, _) - | TyKind::Generator(_, _) - | TyKind::GeneratorWitness(_, _) + | TyKind::Coroutine(_, _) + | TyKind::CoroutineWitness(_, _) | TyKind::Foreign(_) | TyKind::Error | TyKind::Placeholder(_) diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 3180a2b713..c92939362c 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -4103,8 +4103,8 @@ impl Type { | TyKind::Function(_) | TyKind::Alias(_) | TyKind::Foreign(_) - | TyKind::Generator(..) - | TyKind::GeneratorWitness(..) => false, + | TyKind::Coroutine(..) + | TyKind::CoroutineWitness(..) => false, } } }