Skip to content

Rollup of 9 pull requests #143556

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

Merged
merged 28 commits into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
468f913
Stabilize `mixed_integer_ops_unsigned_sub`
nxsaken Jun 30, 2025
21c8715
Link to 2024 edition page for `!` fallback changes
clubby789 Jul 3, 2025
39575d3
Renamed retain_mut to retain on LinkedList as mentioned in the ACP
pixel27 Jul 6, 2025
8b65c2f
Remove duplicate word
reallesee Jul 6, 2025
8ee1e98
mbe: Change `unused_macro_rules` to a `DenseBitSet`
joshtriplett Jul 4, 2025
ef3d774
Move check for new attribute to `check_builtin_meta_item`
JonathanBrouwer Jul 2, 2025
244d64e
Port `#[path]` to the new attribute parsing infrastructure
JonathanBrouwer Jul 6, 2025
97a7b9b
Remove `repr(align)` code
Jules-Bertholet Jun 29, 2025
a1cefee
Support `#[align(…)]` on fns in `extern` blocks
Jules-Bertholet Jun 29, 2025
ce8ab08
Test `async fn`
Jules-Bertholet Jun 29, 2025
a144fd6
Add test for `dyn` alignment
Jules-Bertholet Jun 29, 2025
1c93e16
Add FIXME for gen et al
Jules-Bertholet Jul 1, 2025
196e3ed
Add more tests for invalid alignments
Jules-Bertholet Jul 1, 2025
0a4f87a
compiler: rename {ast,hir}::BareFn* to FnPtr*
workingjubilee Jul 6, 2025
5c8ac15
rustdoc: migrate BareFn -> FnPtr
workingjubilee Jul 6, 2025
e47f565
clippy: migrate BareFn -> FnPtr
workingjubilee Jul 6, 2025
3c9b986
rustfmt: migrate BareFn -> FnPtr
workingjubilee Jul 6, 2025
8f86c4a
Skip `align` tests on wasm
Jules-Bertholet Jul 6, 2025
49806a5
lib: more eagerly return `self.len()` from `ceil_char_boundary`
nagisa Jul 6, 2025
d748e70
Rollup merge of #143206 - Jules-Bertholet:align-attr-fixes, r=working…
jhpratt Jul 7, 2025
00c67d1
Rollup merge of #143236 - nxsaken:mixed_integer_ops_unsigned_sub, r=i…
jhpratt Jul 7, 2025
11b24c1
Rollup merge of #143344 - JonathanBrouwer:path-parser, r=jdonszelmann
jhpratt Jul 7, 2025
11d8667
Rollup merge of #143359 - clubby789:fallback-2024-doc, r=ibraheemdev
jhpratt Jul 7, 2025
a1b51aa
Rollup merge of #143456 - joshtriplett:mbe-unused-rules-bitset, r=lqd
jhpratt Jul 7, 2025
02da294
Rollup merge of #143529 - pixel27:master, r=jhpratt
jhpratt Jul 7, 2025
3e76cd7
Rollup merge of #143535 - reallesee:patch-1, r=jdonszelmann
jhpratt Jul 7, 2025
7eea141
Rollup merge of #143544 - workingjubilee:rename-bare-fn, r=fmease
jhpratt Jul 7, 2025
2992997
Rollup merge of #143552 - nagisa:makes-ceil-char-boundary-go-zoom, r=…
jhpratt Jul 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4474,6 +4474,7 @@ dependencies = [
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_macros",
"rustc_metadata",
"rustc_middle",
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2422,7 +2422,7 @@ impl Ty {
}

#[derive(Clone, Encodable, Decodable, Debug)]
pub struct BareFnTy {
pub struct FnPtrTy {
pub safety: Safety,
pub ext: Extern,
pub generic_params: ThinVec<GenericParam>,
Expand Down Expand Up @@ -2455,8 +2455,8 @@ pub enum TyKind {
///
/// Desugars into `Pin<&'a T>` or `Pin<&'a mut T>`.
PinnedRef(Option<Lifetime>, MutTy),
/// A bare function (e.g., `fn(usize) -> bool`).
BareFn(P<BareFnTy>),
/// A function pointer type (e.g., `fn(usize) -> bool`).
FnPtr(P<FnPtrTy>),
/// An unsafe existential lifetime binder (e.g., `unsafe<'a> &'a ()`).
UnsafeBinder(P<UnsafeBinderTy>),
/// The never type (`!`).
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/util/classify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ fn type_trailing_braced_mac_call(mut ty: &ast::Ty) -> Option<&ast::MacCall> {
ty = &binder.inner_ty;
}

ast::TyKind::BareFn(fn_ty) => match &fn_ty.decl.output {
ast::TyKind::FnPtr(fn_ty) => match &fn_ty.decl.output {
ast::FnRetTy::Default(_) => break None,
ast::FnRetTy::Ty(ret) => ty = ret,
},
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1059,8 +1059,8 @@ macro_rules! common_visitor_and_walkers {
TyKind::Tup(tuple_element_types) => {
walk_list!(vis, visit_ty, tuple_element_types);
}
TyKind::BareFn(function_declaration) => {
let BareFnTy { safety, ext: _, generic_params, decl, decl_span } =
TyKind::FnPtr(function_declaration) => {
let FnPtrTy { safety, ext: _, generic_params, decl, decl_span } =
&$($mut)? **function_declaration;
try_visit!(visit_safety(vis, safety));
try_visit!(visit_generic_params(vis, generic_params));
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,9 +1269,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
let path = self.make_lang_item_qpath(LangItem::Pin, span, Some(args));
hir::TyKind::Path(path)
}
TyKind::BareFn(f) => {
TyKind::FnPtr(f) => {
let generic_params = self.lower_lifetime_binder(t.id, &f.generic_params);
hir::TyKind::BareFn(self.arena.alloc(hir::BareFnTy {
hir::TyKind::FnPtr(self.arena.alloc(hir::FnPtrTy {
generic_params,
safety: self.lower_safety(f.safety, hir::Safety::Safe),
abi: self.lower_extern(f.ext),
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_ast_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ ast_passes_auto_super_lifetime = auto traits cannot have super traits or lifetim

ast_passes_bad_c_variadic = only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg

ast_passes_bare_fn_invalid_safety = function pointers cannot be declared with `safe` safety qualifier
.suggestion = remove safe from this item

ast_passes_body_in_extern = incorrect `{$kind}` inside `extern` block
.cannot_have = cannot have a body
.invalid = the invalid body
Expand Down Expand Up @@ -135,6 +132,9 @@ ast_passes_fn_param_forbidden_self =
ast_passes_fn_param_too_many =
function can not have more than {$max_num_args} arguments

ast_passes_fn_ptr_invalid_safety = function pointers cannot be declared with `safe` safety qualifier
.suggestion = remove safe from this item

ast_passes_fn_without_body =
free function without a body
.suggestion = provide a definition for the function
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
}

Expand Down Expand Up @@ -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 });
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ pub(crate) struct InvalidSafetyOnItem {
}

#[derive(Diagnostic)]
#[diag(ast_passes_bare_fn_invalid_safety)]
pub(crate) struct InvalidSafetyOnBareFn {
#[diag(ast_passes_fn_ptr_invalid_safety)]
pub(crate) struct InvalidSafetyOnFnPtr {
#[primary_span]
pub span: Span,
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {

fn visit_ty(&mut self, ty: &'a ast::Ty) {
match &ty.kind {
ast::TyKind::BareFn(bare_fn_ty) => {
ast::TyKind::FnPtr(fn_ptr_ty) => {
// Function pointers cannot be `const`
self.check_late_bound_lifetime_defs(&bare_fn_ty.generic_params);
self.check_late_bound_lifetime_defs(&fn_ptr_ty.generic_params);
}
ast::TyKind::Never => {
gate!(&self, never_type, ty.span, "the `!` type is experimental");
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ impl<'a> State<'a> {
self.print_type(typ);
self.pclose();
}
ast::TyKind::BareFn(f) => {
ast::TyKind::FnPtr(f) => {
self.print_ty_fn(f.ext, f.safety, &f.decl, None, &f.generic_params);
}
ast::TyKind::UnsafeBinder(f) => {
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_attr_data_structures/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub enum UsedBy {
/// ## Attribute Processing
/// While attributes are initially parsed by [`rustc_parse`] into [`ast::Attribute`], they still contain raw token streams
/// because different attributes have different internal structures. This enum represents the final,
/// fully parsed form of these attributes, where each variant contains contains all the information and
/// fully parsed form of these attributes, where each variant contains all the information and
/// structure relevant for the specific attribute.
///
/// Some attributes can be applied multiple times to the same item, and they are "collapsed" into a single
Expand Down Expand Up @@ -298,6 +298,9 @@ pub enum AttributeKind {
/// Represents `#[rustc_pass_by_value]` (used by the `rustc_pass_by_value` lint).
PassByValue(Span),

/// Represents `#[path]`
Path(Symbol, Span),

/// Represents `#[rustc_pub_transparent]` (used by the `repr_transparent_external_private_fields` lint).
PubTransparent(Span),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ impl AttributeKind {
NonExhaustive(..) => Yes,
Optimize(..) => No,
PassByValue(..) => Yes,
Path(..) => No,
PubTransparent(..) => Yes,
Repr { .. } => No,
RustcLayoutScalarValidRangeEnd(..) => Yes,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_attr_parsing/src/attributes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub(crate) mod loop_match;
pub(crate) mod must_use;
pub(crate) mod no_implicit_prelude;
pub(crate) mod non_exhaustive;
pub(crate) mod path;
pub(crate) mod repr;
pub(crate) mod rustc_internal;
pub(crate) mod semantics;
Expand Down
29 changes: 29 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/path.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use rustc_attr_data_structures::AttributeKind;
use rustc_feature::{AttributeTemplate, template};
use rustc_span::{Symbol, sym};

use crate::attributes::{AttributeOrder, OnDuplicate, SingleAttributeParser};
use crate::context::{AcceptContext, Stage};
use crate::parser::ArgParser;

pub(crate) struct PathParser;

impl<S: Stage> SingleAttributeParser<S> for PathParser {
const PATH: &[Symbol] = &[sym::path];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepLast;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "file");

fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
let Some(nv) = args.name_value() else {
cx.expected_name_value(cx.attr_span, None);
return None;
};
let Some(path) = nv.value_as_str() else {
cx.expected_string_literal(nv.value_span, Some(nv.value_as_lit()));
return None;
};

Some(AttributeKind::Path(path, cx.attr_span))
}
}
2 changes: 2 additions & 0 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use crate::attributes::loop_match::{ConstContinueParser, LoopMatchParser};
use crate::attributes::must_use::MustUseParser;
use crate::attributes::no_implicit_prelude::NoImplicitPreludeParser;
use crate::attributes::non_exhaustive::NonExhaustiveParser;
use crate::attributes::path::PathParser as PathAttributeParser;
use crate::attributes::repr::{AlignParser, ReprParser};
use crate::attributes::rustc_internal::{
RustcLayoutScalarValidRangeEnd, RustcLayoutScalarValidRangeStart,
Expand Down Expand Up @@ -133,6 +134,7 @@ attribute_parsers!(
Single<LinkSectionParser>,
Single<MustUseParser>,
Single<OptimizeParser>,
Single<PathAttributeParser>,
Single<RustcForceInlineParser>,
Single<RustcLayoutScalarValidRangeEnd>,
Single<RustcLayoutScalarValidRangeStart>,
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,12 @@ fn find_type_parameters(
impl<'a, 'b> visit::Visitor<'a> for Visitor<'a, 'b> {
fn visit_ty(&mut self, ty: &'a ast::Ty) {
let stack_len = self.bound_generic_params_stack.len();
if let ast::TyKind::BareFn(bare_fn) = &ty.kind
&& !bare_fn.generic_params.is_empty()
if let ast::TyKind::FnPtr(fn_ptr) = &ty.kind
&& !fn_ptr.generic_params.is_empty()
{
// Given a field `x: for<'a> fn(T::SomeType<'a>)`, we wan't to account for `'a` so
// that we generate `where for<'a> T::SomeType<'a>: ::core::clone::Clone`. #122622
self.bound_generic_params_stack.extend(bare_fn.generic_params.iter().cloned());
self.bound_generic_params_stack.extend(fn_ptr.generic_params.iter().cloned());
}

if let ast::TyKind::Path(_, path) = &ty.kind
Expand Down
10 changes: 1 addition & 9 deletions compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc_abi::{Align, ExternAbi};
use rustc_ast::expand::autodiff_attrs::{AutoDiffAttrs, DiffActivity, DiffMode};
use rustc_ast::{LitKind, MetaItem, MetaItemInner, attr};
use rustc_attr_data_structures::{
AttributeKind, InlineAttr, InstructionSetAttr, OptimizeAttr, ReprAttr, UsedBy, find_attr,
AttributeKind, InlineAttr, InstructionSetAttr, OptimizeAttr, UsedBy, find_attr,
};
use rustc_hir::def::DefKind;
use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId};
Expand Down Expand Up @@ -109,14 +109,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {

if let hir::Attribute::Parsed(p) = attr {
match p {
AttributeKind::Repr { reprs, first_span: _ } => {
codegen_fn_attrs.alignment = reprs
.iter()
.filter_map(
|(r, _)| if let ReprAttr::ReprAlign(x) = r { Some(*x) } else { None },
)
.max();
}
AttributeKind::Cold(_) => codegen_fn_attrs.flags |= CodegenFnAttrFlags::COLD,
AttributeKind::ExportName { name, .. } => {
codegen_fn_attrs.export_name = Some(*name);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ pub enum LifetimeRes {
/// Id of the introducing place. That can be:
/// - an item's id, for the item's generic parameters;
/// - a TraitRef's ref_id, identifying the `for<...>` binder;
/// - a BareFn type's id.
/// - a FnPtr type's id.
///
/// This information is used for impl-trait lifetime captures, to know when to or not to
/// capture any given lifetime.
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3526,7 +3526,7 @@ impl PrimTy {
}

#[derive(Debug, Clone, Copy, HashStable_Generic)]
pub struct BareFnTy<'hir> {
pub struct FnPtrTy<'hir> {
pub safety: Safety,
pub abi: ExternAbi,
pub generic_params: &'hir [GenericParam<'hir>],
Expand Down Expand Up @@ -3645,8 +3645,8 @@ pub enum TyKind<'hir, Unambig = ()> {
Ptr(MutTy<'hir>),
/// A reference (i.e., `&'a T` or `&'a mut T`).
Ref(&'hir Lifetime, MutTy<'hir>),
/// A bare function (e.g., `fn(usize) -> bool`).
BareFn(&'hir BareFnTy<'hir>),
/// A function pointer (e.g., `fn(usize) -> bool`).
FnPtr(&'hir FnPtrTy<'hir>),
/// An unsafe binder type (e.g. `unsafe<'a> Foo<'a>`).
UnsafeBinder(&'hir UnsafeBinderTy<'hir>),
/// The never type (`!`).
Expand Down Expand Up @@ -4498,7 +4498,7 @@ pub enum ForeignItemKind<'hir> {
///
/// All argument idents are actually always present (i.e. `Some`), but
/// `&[Option<Ident>]` is used because of code paths shared with `TraitFn`
/// and `BareFnTy`. The sharing is due to all of these cases not allowing
/// and `FnPtrTy`. The sharing is due to all of these cases not allowing
/// arbitrary patterns for parameters.
Fn(FnSig<'hir>, &'hir [Option<Ident>], &'hir Generics<'hir>),
/// A foreign static item (`static ext: u8`).
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v, AmbigArg>) -
TyKind::Tup(tuple_element_types) => {
walk_list!(visitor, visit_ty_unambig, tuple_element_types);
}
TyKind::BareFn(ref function_declaration) => {
TyKind::FnPtr(ref function_declaration) => {
walk_list!(visitor, visit_generic_param, function_declaration.generic_params);
try_visit!(visitor.visit_fn_decl(function_declaration.decl));
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ fn placeholder_type_error_diag<'cx, 'tcx>(
let mut is_const_or_static = false;

if let Some(hir_ty) = hir_ty
&& let hir::TyKind::BareFn(_) = hir_ty.kind
&& let hir::TyKind::FnPtr(_) = hir_ty.kind
{
is_fn = true;

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/collect/generics_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
type Result = ControlFlow<Span>;
fn visit_ty(&mut self, ty: &'tcx hir::Ty<'tcx, AmbigArg>) -> ControlFlow<Span> {
match ty.kind {
hir::TyKind::BareFn(..) => {
hir::TyKind::FnPtr(..) => {
self.outer_index.shift_in(1);
let res = intravisit::walk_ty(self, ty);
self.outer_index.shift_out(1);
Expand Down
10 changes: 4 additions & 6 deletions compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
#[instrument(level = "debug", skip(self))]
fn visit_ty(&mut self, ty: &'tcx hir::Ty<'tcx, AmbigArg>) {
match ty.kind {
hir::TyKind::BareFn(c) => {
hir::TyKind::FnPtr(c) => {
let (mut bound_vars, binders): (FxIndexMap<LocalDefId, ResolvedArg>, Vec<_>) = c
.generic_params
.iter()
Expand All @@ -728,8 +728,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
where_bound_origin: None,
};
self.with(scope, |this| {
// a bare fn has no bounds, so everything
// contained within is scoped within its binder.
// a FnPtr has no bounds, so everything within is scoped within its binder
intravisit::walk_ty(this, ty);
});
}
Expand Down Expand Up @@ -758,8 +757,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
where_bound_origin: None,
};
self.with(scope, |this| {
// a bare fn has no bounds, so everything
// contained within is scoped within its binder.
// everything within is scoped within its binder
intravisit::walk_ty(this, ty);
});
}
Expand Down Expand Up @@ -1419,7 +1417,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
hir::Node::OpaqueTy(_) => "higher-ranked lifetime from outer `impl Trait`",
// Other items are fine.
hir::Node::Item(_) | hir::Node::TraitItem(_) | hir::Node::ImplItem(_) => return Ok(()),
hir::Node::Ty(hir::Ty { kind: hir::TyKind::BareFn(_), .. }) => {
hir::Node::Ty(hir::Ty { kind: hir::TyKind::FnPtr(_), .. }) => {
"higher-ranked lifetime from function pointer"
}
hir::Node::Ty(hir::Ty { kind: hir::TyKind::TraitObject(..), .. }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
let params = if let Some(generics) = node.generics() {
generics.params
} else if let hir::Node::Ty(ty) = node
&& let hir::TyKind::BareFn(bare_fn) = ty.kind
&& let hir::TyKind::FnPtr(fn_ptr) = ty.kind
{
bare_fn.generic_params
fn_ptr.generic_params
} else {
&[]
};
Expand Down
Loading
Loading