Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DefiningOpaqueTypes::Yes in rustdoc, where the InferCtxt is guaranteed to have no opaque types it can define #124168

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Apr 19, 2024

r? @lcnr

I manually checked there it's always tcx.infer_ctxt().build()

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 19, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

compiler-errors commented Apr 19, 2024

LOL did you check rustdoc tests?

Ah, I missed the "modulo rustdoc, but that doesn't count".

But why doesn't it count? 🤔

@fmease
Copy link
Member

fmease commented Apr 19, 2024

(modulo rustdoc, but that doesn't count).

It does count. In practice, AutoTraitFinder only exists to serve rustdoc. In theory, it's available to rustdoc and “other tools” (#49711). I very much dislike that rustdoc's auto trait impl synthesis code was split in two and I'm thinking about moving the rustc part back into rustdoc again.

@fmease
Copy link
Member

fmease commented Apr 19, 2024

One such “other tool” was supposed to be rust-lang/rust-semverver (now archived). However, it never actually got to use AutoTraitFinder. See rust-lang/rust-semverver#48.

@fmease
Copy link
Member

fmease commented Apr 19, 2024

NB: AutoTraitFinder is one of the most atrocious, abysmal, hairy and hacky pieces of code I've seen so far in rustc (respectfully). I've yet to understand the implementation details. It continuously resets the InferCtxt cache to keep going etc. and does other questionable stuff.

@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 19, 2024

But why doesn't it count? 🤔

I assumed it was operating on broken code or sth. Should have checked before assuming. I did not realize auto trait finder exists for Rustdoc only

@lukas-code
Copy link
Contributor

lukas-code commented Apr 19, 2024

It continuously resets the InferCtxt cache to keep going etc. and does other questionable stuff.

AFAICT it only does that because the projection cache only uses the AliasTy as a key and not the ParamEnv. This makes it so that a single InferCtxt can never be used to normalize in different ParamEnvs without resetting the cache, which also seems rather questionable.

@oli-obk oli-obk changed the title Remove some type relating logic that has no tests Use DefiningOpaqueTypes::Yes in rustdoc, where the InferCtxt is guaranteed to have no opaque types it can define Apr 22, 2024
@lcnr
Copy link
Contributor

lcnr commented Apr 22, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 22, 2024

📌 Commit 6bff7f4 has been approved by lcnr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 22, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#123680 (Deny gen keyword in `edition_2024_compat` lints)
 - rust-lang#124057 (Fix ICE when ADT tail has type error)
 - rust-lang#124168 (Use `DefiningOpaqueTypes::Yes` in rustdoc, where the `InferCtxt` is guaranteed to have no opaque types it can define)
 - rust-lang#124197 (Move duplicated code in functions in `tests/rustdoc-gui/notable-trait.goml`)
 - rust-lang#124200 (Improve handling of expr->field errors)
 - rust-lang#124220 (Miri: detect wrong vtables in wide pointers)
 - rust-lang#124266 (remove an unused type from the reentrant lock tests)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 326cd5c into rust-lang:master Apr 23, 2024
12 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 23, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2024
Rollup merge of rust-lang#124168 - oli-obk:define_opaque_types12, r=lcnr

Use `DefiningOpaqueTypes::Yes` in rustdoc, where the `InferCtxt` is guaranteed to have no opaque types it can define

r? `@lcnr`

I manually checked there it's always `tcx.infer_ctxt().build()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants