]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Auto merge of #87465 - audunhalland:refactor_typeck_primary_body_of, r=eddyb
authorbors <bors@rust-lang.org>
Mon, 9 Aug 2021 01:08:52 +0000 (01:08 +0000)
committerbors <bors@rust-lang.org>
Mon, 9 Aug 2021 01:08:52 +0000 (01:08 +0000)
commitd3928b183db1023c023f8afb4f5dfbee34994051
tree7263a1ee859e0e265680158e9e35a8b733b04ec4
parent74a11c63f85c2b1796852f317358188f9cde236e
parent855fa13463eea85cf91b37726c5d2e4351a6da6f
Auto merge of #87465 - audunhalland:refactor_typeck_primary_body_of, r=eddyb

Simplify typeck/primary_body_of, fix comment to match return signature

Hi, new contributor here! I'm carefully reading through the various modules just to learn. I noticed this function, `primary_body_of`, which has gone through a couple of refactors over time, adding new `Option`s to its returned tuple. Observations:

1. the `fn`'s documentation was not all up to date with the the current return signature.
2. `FnHeader` and `FnDecl` are always both `Some` or `None`. So I figured it might just return a reference to the full `hir::FnSig`, for simplicity and more precise typing. It's a pure refactor.

I'm learning better by working with code than just reading it, so here goes! If you want to avoid pure refactor PRs that don't really fix anything, I can revert the code change to only update the comment instead.
compiler/rustc_typeck/src/check/mod.rs