Rollup merge of #134797 - spastorino:ergonomic-ref-counting-1, r=nikomatsakis

Ergonomic ref counting

This is an experimental first version of ergonomic ref counting.

This first version implements most of the RFC but doesn't implement any of the optimizations. This was left for following iterations.

RFC: https://github.com/rust-lang/rfcs/pull/3680
Tracking issue: https://github.com/rust-lang/rust/issues/132290
Project goal: https://github.com/rust-lang/rust-project-goals/issues/107

r? ```@nikomatsakis```
This commit is contained in:
Matthias Krüger 2025-03-07 19:15:33 +01:00 committed by GitHub
commit f5a143f796
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
119 changed files with 1401 additions and 79 deletions

View file

@ -53,6 +53,16 @@ impl<'tcx> InferCtxt<'tcx> {
traits::type_known_to_meet_bound_modulo_regions(self, param_env, ty, clone_def_id)
}
fn type_is_use_cloned_modulo_regions(
&self,
param_env: ty::ParamEnv<'tcx>,
ty: Ty<'tcx>,
) -> bool {
let ty = self.resolve_vars_if_possible(ty);
let use_cloned_def_id = self.tcx.require_lang_item(LangItem::UseCloned, None);
traits::type_known_to_meet_bound_modulo_regions(self, param_env, ty, use_cloned_def_id)
}
fn type_is_sized_modulo_regions(&self, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> bool {
let lang_item = self.tcx.require_lang_item(LangItem::Sized, None);
traits::type_known_to_meet_bound_modulo_regions(self, param_env, ty, lang_item)