-
Notifications
You must be signed in to change notification settings - Fork 13.5k
compiler: rename BareFn to FnPtr #143544
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
compiler: rename BareFn to FnPtr #143544
Conversation
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
Some changes occurred in compiler/rustc_passes/src/check_attr.rs Some changes occurred in src/tools/clippy cc @rust-lang/clippy HIR ty lowering was modified cc @fmease Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt |
r=me with nit addressed and some commit squashing (personally speaking I would've probably named the locals @bors rollup |
Fix some comments and related types and locals where it is obvious, e.g. - bare_fn -> fn_ptr - LifetimeBinderKind::BareFnType -> LifetimeBinderKind::FnPtrType Co-authored-by: León Orell Valerian Liehr <[email protected]>
06c463b
to
3c9b986
Compare
Added a few other comment fixups: 06c463b I preserved the tools changes as separate commits to make it easier to navigate those histories, while crushing the compiler ones. |
@bors r=fmease |
Rollup of 9 pull requests Successful merges: - #143206 (Align attr fixes) - #143236 (Stabilize `mixed_integer_ops_unsigned_sub`) - #143344 (Port `#[path]` to the new attribute parsing infrastructure ) - #143359 (Link to 2024 edition page for `!` fallback changes) - #143456 (mbe: Change `unused_macro_rules` to a `DenseBitSet`) - #143529 (Renamed retain_mut to retain on LinkedList as mentioned in the ACP) - #143535 (Remove duplicate word) - #143544 (compiler: rename BareFn to FnPtr) - #143552 (lib: more eagerly return `self.len()` from `ceil_char_boundary`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #143544 - workingjubilee:rename-bare-fn, r=fmease compiler: rename BareFn to FnPtr At some point "BareFn" was the chosen name for a "bare" function, without the niceties of `~fn`, `&fn`, or a few other ways of writing a function type. However, at some point the syntax for a "bare function" and any other function diverged even more. We started calling them what they are: function pointers, denoted by their own syntax. However, we never changed the *internal* name for these, as this divergence was very gradual. Personally, I have repeatedly searched for "FnPtr" and gotten confused until I find the name is BareFn, only to forget this until the next time, since I don't routinely interact with the higher-level AST and HIR. But even tools that interact with these internal types only touch on them in a few places, making a migration easy enough. Let's use a more intuitive and obvious name, as this 12+ year old name has little to do with current Rust.
Rollup of 9 pull requests Successful merges: - rust-lang/rust#143206 (Align attr fixes) - rust-lang/rust#143236 (Stabilize `mixed_integer_ops_unsigned_sub`) - rust-lang/rust#143344 (Port `#[path]` to the new attribute parsing infrastructure ) - rust-lang/rust#143359 (Link to 2024 edition page for `!` fallback changes) - rust-lang/rust#143456 (mbe: Change `unused_macro_rules` to a `DenseBitSet`) - rust-lang/rust#143529 (Renamed retain_mut to retain on LinkedList as mentioned in the ACP) - rust-lang/rust#143535 (Remove duplicate word) - rust-lang/rust#143544 (compiler: rename BareFn to FnPtr) - rust-lang/rust#143552 (lib: more eagerly return `self.len()` from `ceil_char_boundary`) r? `@ghost` `@rustbot` modify labels: rollup
At some point "BareFn" was the chosen name for a "bare" function, without the niceties of
~fn
,&fn
, or a few other ways of writing a function type. However, at some point the syntax for a "bare function" and any other function diverged even more. We started calling them what they are: function pointers, denoted by their own syntax.However, we never changed the internal name for these, as this divergence was very gradual. Personally, I have repeatedly searched for "FnPtr" and gotten confused until I find the name is BareFn, only to forget this until the next time, since I don't routinely interact with the higher-level AST and HIR. But even tools that interact with these internal types only touch on them in a few places, making a migration easy enough. Let's use a more intuitive and obvious name, as this 12+ year old name has little to do with current Rust.