Skip to content

Rename various resolving functions for consistency, and document them - #162126

Open
jdonszelmann wants to merge 5 commits into
rust-lang:mainfrom
jdonszelmann:rename-resolving
Open

Rename various resolving functions for consistency, and document them#162126
jdonszelmann wants to merge 5 commits into
rust-lang:mainfrom
jdonszelmann:rename-resolving

Conversation

@jdonszelmann

@jdonszelmann jdonszelmann commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

r? @lcnr or anyone in @rust-lang/initiative-trait-system-refactor

This is all changes from https://github.com/rust-lang/rust/pull/160913/changes that are just renames. Updating that PR to be just the logic changes

All interesting changes happened in rustc_infer/src/infer/mod.rs across all commits. Everything else is renames propagating through other files.

The functions are now called:

before after note
shallow_resolve_* (unchanged) shallow_resolve_* Now with newly added docs.
resolve_vars_if_possible_* deeply_resolve_ignoring_regions_* deliberately longer name, we want to encourage using deeply_resolve instead.
eager_resolve_vars deeply_resolve moved onto the InferCtxtLike as an inherent method with default body.
fully_resolve (unchanged) deeply_resolve_and_assert_fully_resolved Resolves with regions and asserts that all variables are resolved at the end. Note, we only use this function 3x so the long name is ok, it shouldn't be your go-to anyway.
opportunistic_resolve_var gone, same as shalllow_resolve now that we resolve to roots

Note

I've not used an LLM for any part of this PR, or any other PR I make. This includes any related work like research.

@rustbot

rustbot commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

changes to inspect_obligations.rs

cc @lcnr

changes to the core type system

cc @lcnr

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

Some changes occurred in need_type_info.rs

cc @lcnr

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 1, 2026
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 1, 2026
@jdonszelmann jdonszelmann changed the title Rename various resolving functions Rename various resolving functions for consistencym and document them Sep 1, 2026
@jdonszelmann jdonszelmann changed the title Rename various resolving functions for consistencym and document them Rename various resolving functions for consistency, and document them Sep 1, 2026
@BoxyUwU

BoxyUwU commented Sep 1, 2026

Copy link
Copy Markdown
Member

bikeshed: fully_resolve to deeply_resolve_and_assert_blah or sth? it feels odd to me that there wouldnt be a naming similarity between fully_resolve and all the other methods

@jdonszelmann

Copy link
Copy Markdown
Contributor Author

hm, I do like that, lemme change that @BoxyUwU :)

@rust-log-analyzer

This comment has been minimized.

Comment thread compiler/rustc_infer/src/infer/outlives/obligations.rs

@BoxyUwU BoxyUwU left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable enough 🤔 It feels a little unfortunate that we lose "var" being in the name of resolve_vars_if_possible. It's also a little unfortunate that deeply_resolve has naming similarities with deeply_normalize which errors if it can't normalize sth, whereas deeply_normalize is fine if it can't resolve something 🤔

I do like the new names more though since they feel more internally consistent with eachother

View changes since this review

@BoxyUwU BoxyUwU self-assigned this Sep 2, 2026
@rust-bors

This comment has been minimized.

@BoxyUwU

BoxyUwU commented Sep 8, 2026

Copy link
Copy Markdown
Member

@rustbot author (conflicts)

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 8, 2026
@rustbot

rustbot commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot

rustbot commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@jdonszelmann

Copy link
Copy Markdown
Contributor Author

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 8, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
 Documenting rustc_infer v0.0.0 (/checkout/compiler/rustc_infer)
warning: unresolved link to `rustc_type_ir::deeply_resolve`
    --> compiler/rustc_infer/src/infer/mod.rs:1268:38
     |
1268 |     /// or better [`deeply_resolve`](rustc_type_ir::deeply_resolve), if you can, which *does* resolve regions.
     |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `deeply_resolve` in module `rustc_type_ir`
     |
     = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default

 Documenting rustc_symbol_mangling v0.0.0 (/checkout/compiler/rustc_symbol_mangling)
 Documenting rustc_public_bridge v0.0.0 (/checkout/compiler/rustc_public_bridge)
 Documenting rustc_ty_walk v0.0.0 (/checkout/compiler/rustc_ty_walk)
error: `rustc_infer` (lib doc) generated 1 warning
error: warnings are denied by `build.warnings` configuration
warning: build failed, waiting for other jobs to finish...
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo doc --target x86_64-unknown-linux-gnu -Zbinary-dep-depinfo -j 4 -Zroot-dir=/checkout -Zembed-metadata=no --locked --color=always --profile=release --features 'llvm rustc' --manifest-path /checkout/compiler/rustc/Cargo.toml -Zskip-rustdoc-fingerprint --no-deps -Zrustdoc-map -p rustc-main -p rustc_abi -p rustc_arena -p rustc_ast -p rustc_ast_ir -p rustc_ast_lowering -p rustc_ast_passes -p rustc_ast_pretty -p rustc_attr_ir -p rustc_attr_parsing -p rustc_baked_icu_data -p rustc_borrowck -p rustc_builtin_macros -p rustc_codegen_llvm -p rustc_codegen_ssa -p rustc_const_eval -p rustc_crate_store -p rustc_data_structures -p rustc_driver -p rustc_driver_impl -p rustc_error_codes -p rustc_error_messages -p rustc_errors -p rustc_expand -p rustc_expand_queries -p rustc_feature -p rustc_fs_util -p rustc_graphviz -p rustc_hashes -p rustc_hir -p rustc_hir_analysis -p rustc_hir_id -p rustc_hir_pretty -p rustc_hir_typeck -p rustc_incremental -p rustc_index -p rustc_index_macros -p rustc_infer -p rustc_interface -p rustc_lexer -p rustc_lint -p rustc_lint_defs -p rustc_llvm -p rustc_log -p rustc_macros -p rustc_metadata -p rustc_middle -p rustc_mir_build -p rustc_mir_dataflow -p rustc_mir_transform -p rustc_monomorphize -p rustc_next_trait_solver -p rustc_parse -p rustc_parse_format -p rustc_passes -p rustc_pattern_analysis -p rustc_privacy -p rustc_proc_macro -p rustc_public -p rustc_public_bridge -p rustc_query_impl -p rustc_resolve -p rustc_sanitizers -p rustc_serialize -p rustc_session -p rustc_span -p rustc_structures -p rustc_symbol_mangling -p rustc_target -p rustc_thread_pool -p rustc_trait_selection -p rustc_traits -p rustc_transmute -p rustc_ty_utils -p rustc_ty_walk -p rustc_type_ir -p rustc_type_ir_macros -p rustc_windows_rc [workdir=/checkout]` failed with exit code 101
Created at: src/bootstrap/src/core/build_steps/doc.rs:946:25
Executed at: src/bootstrap/src/core/build_steps/doc.rs:1007:26

Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `doc compiler --stage 1`
Currently active steps:
doc::Rustc { build_compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, crates: ["rustc-main", "rustc_abi", "rustc_arena", "rustc_ast", "rustc_ast_ir", "rustc_ast_lowering", "rustc_ast_passes", "rustc_ast_pretty", "rustc_attr_ir", "rustc_attr_parsing", "rustc_baked_icu_data", "rustc_borrowck", "rustc_builtin_macros", "rustc_codegen_llvm", "rustc_codegen_ssa", "rustc_const_eval", "rustc_crate_store", "rustc_data_structures", "rustc_driver", "rustc_driver_impl", "rustc_error_codes", "rustc_error_messages", "rustc_errors", "rustc_expand", "rustc_expand_queries", "rustc_feature", "rustc_fs_util", "rustc_graphviz", "rustc_hashes", "rustc_hir", "rustc_hir_analysis", "rustc_hir_id", "rustc_hir_pretty", "rustc_hir_typeck", "rustc_incremental", "rustc_index", "rustc_index_macros", "rustc_infer", "rustc_interface", "rustc_lexer", "rustc_lint", "rustc_lint_defs", "rustc_llvm", "rustc_log", "rustc_macros", "rustc_metadata", "rustc_middle", "rustc_mir_build", "rustc_mir_dataflow", "rustc_mir_transform", "rustc_monomorphize", "rustc_next_trait_solver", "rustc_parse", "rustc_parse_format", "rustc_passes", "rustc_pattern_analysis", "rustc_privacy", "rustc_proc_macro", "rustc_public", "rustc_public_bridge", "rustc_query_impl", "rustc_resolve", "rustc_sanitizers", "rustc_serialize", "rustc_session", "rustc_span", "rustc_structures", "rustc_symbol_mangling", "rustc_target", "rustc_thread_pool", "rustc_trait_selection", "rustc_traits", "rustc_transmute", "rustc_ty_utils", "rustc_ty_walk", "rustc_type_ir", "rustc_type_ir_macros", "rustc_windows_rc"] } at src/bootstrap/src/core/build_steps/doc.rs:916
Build completed unsuccessfully in 0:02:11
  local time: Tue Sep  8 14:34:32 UTC 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants