Add an opt-out in pretty printing for RTN rendering
This commit is contained in:
parent
6650252439
commit
7a08d0368f
8 changed files with 154 additions and 32 deletions
|
@ -27,7 +27,7 @@ use rustc_middle::traits::IsConstable;
|
|||
use rustc_middle::ty::error::TypeError;
|
||||
use rustc_middle::ty::print::{
|
||||
PrintPolyTraitPredicateExt as _, PrintPolyTraitRefExt, PrintTraitPredicateExt as _,
|
||||
with_forced_trimmed_paths, with_no_trimmed_paths,
|
||||
with_forced_trimmed_paths, with_no_trimmed_paths, with_types_for_suggestion,
|
||||
};
|
||||
use rustc_middle::ty::{
|
||||
self, AdtKind, GenericArgs, InferTy, IsSuggestable, Ty, TyCtxt, TypeFoldable, TypeFolder,
|
||||
|
@ -111,7 +111,7 @@ impl<'a, 'tcx> CoroutineData<'a, 'tcx> {
|
|||
fn predicate_constraint(generics: &hir::Generics<'_>, pred: ty::Predicate<'_>) -> (Span, String) {
|
||||
(
|
||||
generics.tail_span_for_predicate_suggestion(),
|
||||
format!("{} {}", generics.add_where_or_trailing_comma(), pred),
|
||||
with_types_for_suggestion!(format!("{} {}", generics.add_where_or_trailing_comma(), pred)),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,8 @@ pub fn suggest_restriction<'tcx, G: EmissionGuarantee>(
|
|||
if hir_generics.where_clause_span.from_expansion()
|
||||
|| hir_generics.where_clause_span.desugaring_kind().is_some()
|
||||
|| projection.is_some_and(|projection| {
|
||||
tcx.is_impl_trait_in_trait(projection.def_id)
|
||||
(tcx.is_impl_trait_in_trait(projection.def_id)
|
||||
&& !tcx.features().return_type_notation())
|
||||
|| tcx.lookup_stability(projection.def_id).is_some_and(|stab| stab.is_unstable())
|
||||
})
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue