Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --The command causes an ICE error. This happens when we use the features of () in different workspaces. workspace- : workspace- : <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOT_END --
label T-rustdoc
label -needs-triage A-cross-crate-reexports Ah lol, just noticed that we're also leaking the desugared form of RPITITs (the assoc ty) for a slightly altered non-icing version of this code (still cross-crate tho). Also needs to be addressed at some point, taking a mental note. claim

Discussion:
} } <del> query is_impossible_method(key: (DefId, DefId)) -> bool { </del> <ins> query is_impossible_associated_item(key: (DefId, DefId)) -> bool { </ins> desc { |tcx| <del> "checking if `{}` is impossible to call within `{}`", </del> <ins> "checking if `{}` is impossible to reference within `{}`", </ins> tcx.def_path_str(key.1), tcx.def_path_str(key.0), }

result } <del> /// Checks whether a trait's method is impossible to call on a given impl. </del> <ins> /// Checks whether a trait's associated item is impossible to reference on a given impl. </ins> /// /// This only considers predicates that reference the impl's generics, and not /// those that reference the method's generics. <del> fn is_impossible_method(tcx: TyCtxt<'_>, (impl_def_id, trait_item_def_id): (DefId, DefId)) -> bool { </del> <ins> fn is_impossible_associated_item( tcx: TyCtxt<'_>, (impl_def_id, trait_item_def_id): (DefId, DefId), ) -> bool { </ins> struct ReferencesOnlyParentGenerics<'tcx> { tcx: TyCtxt<'tcx>, generics: &'tcx ty::Generics,

specializes: specialize::specializes, subst_and_check_impossible_predicates, check_tys_might_be_eq: misc::check_tys_might_be_eq, <del> is_impossible_method, </del> <ins> is_impossible_associated_item, </ins> ..*providers }; }

.tcx .associated_items(impl_def_id) .in_definition_order() <del> .map(|x| clean_middle_assoc_item(x, cx)) </del> <ins> .filter(|item| !item.is_impl_trait_in_trait()) .map(|item| clean_middle_assoc_item(item, cx)) </ins> .collect::<Vec<_>>(), polarity: ty::ImplPolarity::Positive, kind: ImplKind::Blanket(Box::new(clean_middle_ty(

.tcx .associated_items(did) .in_definition_order() <ins> .filter(|item| !item.is_impl_trait_in_trait()) </ins> .map(|item| clean_middle_assoc_item(item, cx)) .collect();

None => ( tcx.associated_items(did) .in_definition_order() <ins> .filter(|item| !item.is_impl_trait_in_trait()) </ins> .filter(|item| { // If this is a trait impl, filter out associated items whose corresponding item // in the associated trait is marked `doc(hidden)`.

rendering_params: ImplRenderingParameters, ) { for trait_item in &t.items { <del> // Skip over any default trait items that are impossible to call </del> <ins> // Skip over any default trait items that are impossible to reference </ins> // (e.g. if it has a `Self: Sized` bound on an unsized type). if let Some(impl_def_id) = parent.item_id.as_def_id() && let Some(trait_item_def_id) = trait_item.item_id.as_def_id() <del> && cx.tcx().is_impossible_method((impl_def_id, trait_item_def_id)) </del> <ins> && cx.tcx().is_impossible_associated_item((impl_def_id, trait_item_def_id)) </ins> { continue; }

<ins> #![feature(return_position_impl_trait_in_trait)] pub trait Trait { fn create() -> impl Iterator<Item = u64> { std::iter::empty() } } pub struct Basic; pub struct Intermediate; pub struct Advanced; impl Trait for Basic { // method provided by the trait } impl Trait for Intermediate { fn create() -> std::ops::Range<u64> { // concrete return type 0..1 } } impl Trait for Advanced { fn create() -> impl Iterator<Item = u64> { // opaque return type std::iter::repeat(0) } } // Regression test for issue #113929: pub trait Def { fn def<T>() -> impl Default {} } impl Def for () {} </ins>

<ins> #![crate_name = "user"] // aux-crate:rpitit=ret-pos-impl-trait-in-trait.rs // edition:2021 // Test that we can correctly render cross-crate RPITITs. // In particular, check that we don't render the internal associated type generated by // their desugaring. We count the number of associated items and ensure that it is exactly one. // This is more robust than checking for the absence of the associated type. // @has user/trait.Trait.html // @has - '//*[@id="method.create"]' 'fn create() -> impl Iterator<Item = u64>' // The class "method" is used for all three kinds of associated items at the time of writing. // @count - '//*[@id="main-content"]//section[@class="method"]' 1 pub use rpitit::Trait; // @has user/struct.Basic.html // @has - '//*[@id="method.create"]' 'fn create() -> impl Iterator<Item = u64>' // @count - '//*[@id="trait-implementations-list"]//*[@class="impl-items"]' 1 pub use rpitit::Basic; // @has user/struct.Intermediate.html // @has - '//*[@id="method.create"]' 'fn create() -> Range<u64>' // @count - '//*[@id="trait-implementations-list"]//*[@class="impl-items"]' 1 pub use rpitit::Intermediate; // @has user/struct.Advanced.html // @has - '//*[@id="method.create"]' 'fn create() -> impl Iterator<Item = u64>' // @count - '//*[@id="trait-implementations-list"]//*[@class="impl-items"]' 1 pub use rpitit::Advanced; // Regression test for issue #113929: // @has user/trait.Def.html // @has - '//*[@id="method.def"]' 'fn def<T>() -> impl Default' pub use rpitit::Def; </ins>