Repository navigation
-Znext-solver Support a bit more types for rustdoc auto traits - #164161
ShoyuVanilla wants to merge 1 commit into
Conversation
-Znext-solver Support a bit more types for rustdoc auto traits
| ty | ||
| } else if let ty::Adt(adt_def, _) = *ty.kind() { | ||
| let fresh_args = infcx.fresh_args_for_item(DUMMY_SP, adt_def.did()); | ||
| ty::EarlyBinder::bind(tcx, ty).instantiate(tcx, fresh_args).skip_norm_wip() |
There was a problem hiding this comment.
consider just yeeting the Adt special case, it doesn't change the behavior and it feels nicer to stay consistent
There was a problem hiding this comment.
also, feels nicer to first check "does this type implement the autotrait for litreally any generic args, and only then collect the constituent types
| }) | ||
| .collect::<Vec<ty::Clause<'tcx>>>(); | ||
| let full_user_env = ty::ParamEnv::new(tcx, orig_env.caller_bounds().chain(field_clauses)); | ||
| let full_user_env = |
There was a problem hiding this comment.
should prolly normalize the ParamEnv here
| /// Gather types that needs to be the RHS of the where bounds for auto trait impls, | ||
| /// by recursing into each field type. This is a recursive function rather than a | ||
| /// `TypeVisitor` because we have to look into nested fields. | ||
| fn gather_constituent_tys<'tcx>( |
There was a problem hiding this comment.
this is confusing 🤔 the NeedsAutoTraitEvaluation is only used when calling gather_constituent_tys in the root. Feels easier to have one match to check whether a type is interesting, and then have this function return ()
|
@rustbot author |
f238261 to
1b71961
Compare
|
Updated test diff as well main...ShoyuVanilla:rust:rustdoc-auto-tests |
| } | ||
|
|
||
| for field_ty in | ||
| adt_def.all_fields().map(|field| field.ty(tcx, args).skip_norm_wip()) |
There was a problem hiding this comment.
this can diverge, can it not?
i would assume this causes a stack overflow for struct Foo<T>(Box<Foo<(T,)>>);
There was a problem hiding this comment.
So, this goes into Foo<T> -> Foo<(T, )> -> Foo<((T, ), )> -> .. in such cases and it doesn't feel so clear to me how to avoid that 🤔 Would it make sense to just use the recursion limit as it would fail with the similar problem with the solver as well?
| /// Gather types that needs to be the RHS of the where bounds for auto trait impls, | ||
| /// by recursing into each field type. This is a recursive function rather than a | ||
| /// `TypeVisitor` because we have to look into nested fields. | ||
| fn gather_constituent_tys<'tcx>( |
There was a problem hiding this comment.
move this function to where it's used?
1b71961 to
a5edf95
Compare
cc https://hackmd.io/ydc_nIbHQqG-ctMDapXYTg#rustdoc-html
rustdoc-htmltest drifts are addressed here: main...ShoyuVanilla:rust:rustdoc-auto-testsr? lcnr