diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-07-07 03:26:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-07 03:26:09 +0200 |
| commit | 7eea141b8755528ecc8cb004deeadd652104d43d (patch) | |
| tree | 4379b4fc10147a4e317290e4cab9c75b5f29dec1 /compiler/rustc_ast_passes/src/ast_validation.rs | |
| parent | 3e76cd796f297f66c36ade5c6d39ab61464bc677 (diff) | |
| parent | 3c9b98699dae7d99048c07265735b81353cbd8d7 (diff) | |
| download | rust-7eea141b8755528ecc8cb004deeadd652104d43d.tar.gz rust-7eea141b8755528ecc8cb004deeadd652104d43d.zip | |
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.
Diffstat (limited to 'compiler/rustc_ast_passes/src/ast_validation.rs')
| -rw-r--r-- | compiler/rustc_ast_passes/src/ast_validation.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 53e2a1c695a..38889d28151 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -499,9 +499,9 @@ impl<'a> AstValidator<'a> { } } - fn check_bare_fn_safety(&self, span: Span, safety: Safety) { + fn check_fn_ptr_safety(&self, span: Span, safety: Safety) { if matches!(safety, Safety::Safe(_)) { - self.dcx().emit_err(errors::InvalidSafetyOnBareFn { span }); + self.dcx().emit_err(errors::InvalidSafetyOnFnPtr { span }); } } @@ -785,8 +785,8 @@ impl<'a> AstValidator<'a> { fn visit_ty_common(&mut self, ty: &'a Ty) { match &ty.kind { - TyKind::BareFn(bfty) => { - self.check_bare_fn_safety(bfty.decl_span, bfty.safety); + TyKind::FnPtr(bfty) => { + self.check_fn_ptr_safety(bfty.decl_span, bfty.safety); self.check_fn_decl(&bfty.decl, SelfSemantic::No); Self::check_decl_no_pat(&bfty.decl, |span, _, _| { self.dcx().emit_err(errors::PatternFnPointer { span }); |
