Repository navigation
-Znext-solver Support a bit more types for rustdoc auto traits - #164161
Conversation
-Znext-solver Support a bit more types for rustdoc auto traits
|
This also fixes the first bullet point in https://hackmd.io/ydc_nIbHQqG-ctMDapXYTg#rustdoc-ui |
| 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?
There was a problem hiding this comment.
yeah, recursion limit or have a separate hashmap for the adt def_ids
There was a problem hiding this comment.
I simply chose the former b/c I might not recurse into non-diverging nested adts with the later
| /// 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
This comment has been minimized.
This comment has been minimized.
|
@rustbot author |
a5edf95 to
1203a9f
Compare
|
@rustbot ready |
| let fresh_ty = if !ty.has_param() { | ||
| ty | ||
| } else { | ||
| let mut tys = FxHashMap::default(); |
There was a problem hiding this comment.
| let mut tys = FxHashMap::default(); | |
| // We manually instantiate the generic args with inference variables | |
| // here to also trivially handle builtin types. | |
| let mut tys = FxHashMap::default(); |
1203a9f to
1b0daf0
Compare
|
@bors r=lcnr |
Rollup of 20 pull requests Successful merges: - #164161 (`-Znext-solver` Support a bit more types for rustdoc auto traits) - #165572 (Run the `FatLtoCleanup` pass to lower `llvm.type.checked.load`) - #166235 (Keep opening '(' when suggesting to remove '&' from pattern) - #166335 (A few fixes in x86 std_detect) - #166516 (Fix ICE in iterator method suggestion when the receiver is a block) - #166586 (abby test dsl: one binder to rule them all) - #166604 (fix: embed-source-dwarf test with remapped debuginfo) - #166620 (Change wording of overwrite span in `unused_assignments` lint) - #166626 (Remove some outdated comments about None terminator) - #164289 (Add regression test for self-referential GAT with missing lifetime argument) - #165859 (Add codegen test for MaybeUninit array built in the return slot) - #166092 (add fake borrow tests for divergent match guards) - #166292 (Don't suggest closure braces for errors inside the body) - #166435 (Encode direct const mir) - #166447 (Document allocator behaviour of BTreeMap::append and BTreeSet::append) - #166558 (triagebot: Send "in progress" message when nomination is in progress pt. 2) - #166584 (Arg pos const mismatch ice) - #166599 (add alias-bound test) - #166606 (llvm-wrapper: Pass LibraryOptionsContext to computeDeadSymbolsWithConstProp etc.) - #166623 (Correct feature name for `is_cased()` method) Failed merges: - #166583 (abby dsl tests: the passing test should check-pass)
Rollup merge of #164161 - ShoyuVanilla:rustdoc-auto, r=lcnr `-Znext-solver` Support a bit more types for rustdoc auto traits cc https://hackmd.io/ydc_nIbHQqG-ctMDapXYTg#rustdoc-html `rustdoc-html` test drifts are addressed here: main...ShoyuVanilla:rust:rustdoc-auto-tests r? lcnr
cc https://hackmd.io/ydc_nIbHQqG-ctMDapXYTg#rustdoc-html
rustdoc-htmltest drifts are addressed here: main...ShoyuVanilla:rust:rustdoc-auto-testsr? lcnr