about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-03-19 12:39:34 +0000
committerbors <bors@rust-lang.org>2025-03-19 12:39:34 +0000
commita7fc463dd8fbeca800d4b3efc501069502cffe64 (patch)
tree097c6944fd8660666094e1c1f7adfca493dd37dc /compiler/rustc_middle/src
parentc4b38a596767c9c6275c937cf3a2d4b9612b4875 (diff)
parent3b7faca09c7a2e86390e354e83cb1acac6b3a1fd (diff)
downloadrust-a7fc463dd8fbeca800d4b3efc501069502cffe64.tar.gz
rust-a7fc463dd8fbeca800d4b3efc501069502cffe64.zip
Auto merge of #138693 - matthiaskrgr:rollup-ejq8mwp, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #136177 (clarify BufRead::{fill_buf, consume} docs)
 - #138654 (Remove the regex dependency from coretests)
 - #138655 (rustc-dev-guide sync)
 - #138656 (Remove double nesting in post-merge workflow)
 - #138658 (CI: mirror alpine and centos images to ghcr)
 - #138659 (coverage: Don't store a body span in `FunctionCoverageInfo`)
 - #138661 (Revert: Add *_value methods to proc_macro lib)
 - #138670 (Remove existing AFIDT implementation)
 - #138674 (Various codegen_llvm cleanups)
 - #138684 (use then in docs for `fuse` to enhance readability)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/mir/coverage.rs1
-rw-r--r--compiler/rustc_middle/src/mir/pretty.rs3
-rw-r--r--compiler/rustc_middle/src/ty/instance.rs5
-rw-r--r--compiler/rustc_middle/src/ty/mod.rs1
-rw-r--r--compiler/rustc_middle/src/ty/return_position_impl_trait_in_trait.rs95
5 files changed, 2 insertions, 103 deletions
diff --git a/compiler/rustc_middle/src/mir/coverage.rs b/compiler/rustc_middle/src/mir/coverage.rs
index 8c6b11a681e..e26575b552e 100644
--- a/compiler/rustc_middle/src/mir/coverage.rs
+++ b/compiler/rustc_middle/src/mir/coverage.rs
@@ -194,7 +194,6 @@ pub struct Mapping {
 #[derive(TyEncodable, TyDecodable, Hash, HashStable)]
 pub struct FunctionCoverageInfo {
     pub function_source_hash: u64,
-    pub body_span: Span,
 
     /// Used in conjunction with `priority_list` to create physical counters
     /// and counter expressions, after MIR optimizations.
diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs
index 573f7895da2..5a038b27337 100644
--- a/compiler/rustc_middle/src/mir/pretty.rs
+++ b/compiler/rustc_middle/src/mir/pretty.rs
@@ -620,9 +620,8 @@ fn write_function_coverage_info(
     function_coverage_info: &coverage::FunctionCoverageInfo,
     w: &mut dyn io::Write,
 ) -> io::Result<()> {
-    let coverage::FunctionCoverageInfo { body_span, mappings, .. } = function_coverage_info;
+    let coverage::FunctionCoverageInfo { mappings, .. } = function_coverage_info;
 
-    writeln!(w, "{INDENT}coverage body span: {body_span:?}")?;
     for coverage::Mapping { kind, span } in mappings {
         writeln!(w, "{INDENT}coverage {kind:?} => {span:?};")?;
     }
diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs
index b99148f3368..980d20f9d3b 100644
--- a/compiler/rustc_middle/src/ty/instance.rs
+++ b/compiler/rustc_middle/src/ty/instance.rs
@@ -712,10 +712,7 @@ impl<'tcx> Instance<'tcx> {
                             ..
                         })
                     );
-                // We also need to generate a shim if this is an AFIT.
-                let needs_rpitit_shim =
-                    tcx.return_position_impl_trait_in_trait_shim_data(def).is_some();
-                if needs_track_caller_shim || needs_rpitit_shim {
+                if needs_track_caller_shim {
                     if tcx.is_closure_like(def) {
                         debug!(
                             " => vtable fn pointer created for closure with #[track_caller]: {:?} for method {:?} {:?}",
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index a508487c796..fc439416a1a 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -149,7 +149,6 @@ mod opaque_types;
 mod parameterized;
 mod predicate;
 mod region;
-mod return_position_impl_trait_in_trait;
 mod rvalue_scopes;
 mod structural_impls;
 #[allow(hidden_glob_reexports)]
diff --git a/compiler/rustc_middle/src/ty/return_position_impl_trait_in_trait.rs b/compiler/rustc_middle/src/ty/return_position_impl_trait_in_trait.rs
deleted file mode 100644
index 568e504b940..00000000000
--- a/compiler/rustc_middle/src/ty/return_position_impl_trait_in_trait.rs
+++ /dev/null
@@ -1,95 +0,0 @@
-use rustc_hir::def_id::DefId;
-
-use crate::ty::{self, ExistentialPredicateStableCmpExt, TyCtxt};
-
-impl<'tcx> TyCtxt<'tcx> {
-    /// Given a `def_id` of a trait or impl method, compute whether that method needs to
-    /// have an RPITIT shim applied to it for it to be dyn compatible. If so, return the
-    /// `def_id` of the RPITIT, and also the args of trait method that returns the RPITIT.
-    ///
-    /// NOTE that these args are not, in general, the same as than the RPITIT's args. They
-    /// are a subset of those args,  since they do not include the late-bound lifetimes of
-    /// the RPITIT. Depending on the context, these will need to be dealt with in different
-    /// ways -- in codegen, it's okay to fill them with ReErased.
-    pub fn return_position_impl_trait_in_trait_shim_data(
-        self,
-        def_id: DefId,
-    ) -> Option<(DefId, ty::EarlyBinder<'tcx, ty::GenericArgsRef<'tcx>>)> {
-        let assoc_item = self.opt_associated_item(def_id)?;
-
-        let (trait_item_def_id, opt_impl_def_id) = match assoc_item.container {
-            ty::AssocItemContainer::Impl => {
-                (assoc_item.trait_item_def_id?, Some(self.parent(def_id)))
-            }
-            ty::AssocItemContainer::Trait => (def_id, None),
-        };
-
-        let sig = self.fn_sig(trait_item_def_id);
-
-        // Check if the trait returns an RPITIT.
-        let ty::Alias(ty::Projection, ty::AliasTy { def_id, .. }) =
-            *sig.skip_binder().skip_binder().output().kind()
-        else {
-            return None;
-        };
-        if !self.is_impl_trait_in_trait(def_id) {
-            return None;
-        }
-
-        let args = if let Some(impl_def_id) = opt_impl_def_id {
-            // Rebase the args from the RPITIT onto the impl trait ref, so we can later
-            // substitute them with the method args of the *impl* method, since that's
-            // the instance we're building a vtable shim for.
-            ty::GenericArgs::identity_for_item(self, trait_item_def_id).rebase_onto(
-                self,
-                self.parent(trait_item_def_id),
-                self.impl_trait_ref(impl_def_id)
-                    .expect("expected impl trait ref from parent of impl item")
-                    .instantiate_identity()
-                    .args,
-            )
-        } else {
-            // This is when we have a default trait implementation.
-            ty::GenericArgs::identity_for_item(self, trait_item_def_id)
-        };
-
-        Some((def_id, ty::EarlyBinder::bind(args)))
-    }
-
-    /// Given a `DefId` of an RPITIT and its args, return the existential predicates
-    /// that corresponds to the RPITIT's bounds with the self type erased.
-    pub fn item_bounds_to_existential_predicates(
-        self,
-        def_id: DefId,
-        args: ty::GenericArgsRef<'tcx>,
-    ) -> &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>> {
-        let mut bounds: Vec<_> = self
-            .item_self_bounds(def_id)
-            .iter_instantiated(self, args)
-            .filter_map(|clause| {
-                clause
-                    .kind()
-                    .map_bound(|clause| match clause {
-                        ty::ClauseKind::Trait(trait_pred) => Some(ty::ExistentialPredicate::Trait(
-                            ty::ExistentialTraitRef::erase_self_ty(self, trait_pred.trait_ref),
-                        )),
-                        ty::ClauseKind::Projection(projection_pred) => {
-                            Some(ty::ExistentialPredicate::Projection(
-                                ty::ExistentialProjection::erase_self_ty(self, projection_pred),
-                            ))
-                        }
-                        ty::ClauseKind::TypeOutlives(_) => {
-                            // Type outlives bounds don't really turn into anything,
-                            // since we must use an intersection region for the `dyn*`'s
-                            // region anyways.
-                            None
-                        }
-                        _ => unreachable!("unexpected clause in item bounds: {clause:?}"),
-                    })
-                    .transpose()
-            })
-            .collect();
-        bounds.sort_by(|a, b| a.skip_binder().stable_cmp(self, &b.skip_binder()));
-        self.mk_poly_existential_predicates(&bounds)
-    }
-}