Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
b165183
a bit optimize four-digit chunks in integer formatting
chirizxc Jul 11, 2026
25435a0
add SAFETY
chirizxc Jul 11, 2026
19c6065
Optimize slice::contains for bytewise types
SomeFlyingThing Jul 18, 2026
40d419f
ci: loongarch64-linux: Bump binutils to 2.46.1 and gcc to 16.1
heiher Jul 17, 2026
e9eb770
Promote loongarch32-unknown-none* to Tier 2
heiher Jul 20, 2026
ad3ce24
test: add regression test for bool indexing codegen
amirHdev Jul 26, 2026
bf7eb64
When compiling without a specified `--edition`, emit a note
estebank Jun 18, 2026
69db212
Use same wording as cargo does when `package.edition` is unspecified
estebank Jun 19, 2026
f95bf57
Remove `--edition=2015` from rustdoc-gui tests only
estebank Jun 22, 2026
a1d6de2
fix run-make test
estebank Jul 27, 2026
87e2c0b
remove InterpError::map_err_info
RalfJung Jul 27, 2026
6618eb6
review
chirizxc Jul 28, 2026
20ec372
Update library/core/src/fmt/num.rs
chirizxc Jul 28, 2026
c10ff54
review (x3)
chirizxc Jul 28, 2026
dedf120
fix tidy
chirizxc Jul 28, 2026
917aa16
review
chirizxc Jul 29, 2026
af98396
review (x2)
chirizxc Jul 29, 2026
a614120
Account for ownership mismatch on argument that doesn't meet bound
estebank Mar 11, 2026
1e1a699
deduplicate method/function call "point at arg" logic
estebank Jul 29, 2026
c257aef
review (x3)
chirizxc Jul 29, 2026
1d77f8a
reject varargs without pattern post-expansion
folkertdev Jul 29, 2026
2851362
tests: Enable `feature(stmt_expr_attributes)` in `2229_closure_analys…
petrochenkov Jul 29, 2026
b5e581f
mark `enc_16lsd` as `unsafe`
chirizxc Jul 29, 2026
8d309d2
Add regression test for supertrait projection normalization through dyn
zakrad Jul 29, 2026
3874adb
Add -Zinstrument-mcount={fentry-nop-record,fentry-record}
pmur Jul 29, 2026
f48274b
Linkify C-SKY targets in `platform-support.md`
beetrees Jul 31, 2026
bacfb80
Fix rustdoc ICE when checking if a generic arg can be elided
Colepng Jul 31, 2026
ce8f413
Add regression test for rustdoc ICE when checking if a generic arg ca…
Colepng Jul 31, 2026
6e2de73
point at trait definition when it is used as a derive macro
Albab-Hasan Aug 1, 2026
2ffc259
Add regression test for unused_parens on contract clauses
chenyukang Aug 1, 2026
d443d45
fix borrowck ICE for consts with fn pointer type
im-lunex Aug 1, 2026
2cee421
ElaborateBoxDeref: remove unnecessary projection
RalfJung Aug 1, 2026
5ab7f50
Comment fix for rustdoc ICE when checking if a generic arg can be elided
Colepng Aug 2, 2026
569e0bc
Further minimize regression test for rustdoc ICE
Colepng Aug 2, 2026
5ba0b9f
Add (failing) test to check for an exact alias before a similar name
joshtriplett Aug 2, 2026
f7596e8
Add doc aliases for transpositions `read_exact_buf` and `read_exact_b…
joshtriplett Aug 2, 2026
32c2ca0
When suggesting method names, prefer *exact* doc aliases over similar…
joshtriplett Aug 2, 2026
ad2ca88
fix: restrict bool indexing assembly test from Windows
amirHdev Aug 2, 2026
910ec5a
Simplify `DepKind` constants
nnethercote Aug 2, 2026
c4e9932
Remove `DepKind::label_strs`
nnethercote Aug 2, 2026
a707cbf
Document `dep_kind_from_label_string`
nnethercote Aug 2, 2026
2b80cd0
refactor(attrs): move rustc_must_implement_one_of duplicate check int…
sethryanrollins Aug 3, 2026
3c80f17
add regression test for direct inline const generic defaults
TaKO8Ki Jul 14, 2026
a0ac21b
fix generics lookup for direct inline const defaults
TaKO8Ki Jul 14, 2026
fd3c89d
Add PR body notes for Cargo lock file maintenance
marcoieni Aug 3, 2026
ea0c39c
add `# Safety` for `enc_16lsd`
chirizxc Aug 3, 2026
1a3d919
Deny multiple EII impls on a single item
bjorn3 Jul 15, 2026
496056f
Use `thread::available_parallelism` as the default limit for backend …
petrochenkov Aug 3, 2026
6a91af6
Run try builds on EC2 by default
Kobzol Aug 3, 2026
6daa152
bump tracing-tree
RalfJung Aug 3, 2026
86e039f
Allow running both quick and full codebuild Linux x64 dist job
Kobzol Aug 3, 2026
07e1398
Fix lookup of object files
Kobzol Aug 3, 2026
6b47c96
Update the tracking issue for `borrowed_buf_init`
tgross35 Aug 4, 2026
300de2c
Rollup merge of #153749 - estebank:issue-134805, r=jackh726
jhpratt Aug 4, 2026
97c52b5
Rollup merge of #159130 - chirizxc:num_fmt, r=clarfonthey
jhpratt Aug 4, 2026
d80a860
Rollup merge of #159326 - bjorn3:deny_multiple_eii_impls, r=jdonszelmann
jhpratt Aug 4, 2026
93976db
Rollup merge of #159535 - SomeFlyingThing:optimize-slice-contains-byt…
jhpratt Aug 4, 2026
803467d
Rollup merge of #159595 - heiher:promote-loong32-none, r=Mark-Simulacrum
jhpratt Aug 4, 2026
64a94a8
Rollup merge of #160184 - pmur:murp/add-mcount-opts, r=mati865
jhpratt Aug 4, 2026
e26efe4
Rollup merge of #160320 - Albab-Hasan:derive-trait-not-a-derive-macro…
jhpratt Aug 4, 2026
9b38bcf
Rollup merge of #160369 - joshtriplett:suggest-exact-alias-before-sim…
jhpratt Aug 4, 2026
80147f7
Rollup merge of #160406 - nnethercote:DepKind-cleanups, r=Zalathar
jhpratt Aug 4, 2026
7912501
Rollup merge of #160424 - petrochenkov:jobdflt, r=bjorn3
jhpratt Aug 4, 2026
e252a66
Rollup merge of #158102 - estebank:note-default-edition, r=jieyouxu
jhpratt Aug 4, 2026
348f1f5
Rollup merge of #159303 - TaKO8Ki:fix-inline-const-generic-default-pa…
jhpratt Aug 4, 2026
fb88925
Rollup merge of #159977 - amirHdev:test-123216-bool-indexing, r=petro…
jhpratt Aug 4, 2026
fa33874
Rollup merge of #160011 - RalfJung:map_err_info, r=oli-obk
jhpratt Aug 4, 2026
2066cee
Rollup merge of #160165 - folkertdev:reject-dotdotdot-post-expansion,…
jhpratt Aug 4, 2026
2bb3899
Rollup merge of #160172 - petrochenkov:noclosegate, r=adwinwhite
jhpratt Aug 4, 2026
59e1c16
Rollup merge of #160295 - Colepng:main, r=GuillaumeGomez
jhpratt Aug 4, 2026
878857c
Rollup merge of #160305 - beetrees:csky-platform-support-link, r=folk…
jhpratt Aug 4, 2026
866665f
Rollup merge of #160314 - im-lunex:fix_#160255, r=TaKO8Ki
jhpratt Aug 4, 2026
0bc1266
Rollup merge of #160322 - RalfJung:ElaborateBoxDeref, r=oli-obk
jhpratt Aug 4, 2026
2acbc71
Rollup merge of #160338 - zakrad:regr-test-61083, r=JohnTitor
jhpratt Aug 4, 2026
e5b84c6
Rollup merge of #160340 - chenyukang:yukang-fix-143754-contract-unuse…
jhpratt Aug 4, 2026
ef18808
Rollup merge of #160371 - joshtriplett:read_exact_buf_alias, r=Mark-S…
jhpratt Aug 4, 2026
2485566
Rollup merge of #160384 - marcoieni:assign-lockfile-reviewer, r=Kobzol
jhpratt Aug 4, 2026
7c4b9d1
Rollup merge of #160412 - sethryanrollins:sethr/issue-153101/check_ru…
jhpratt Aug 4, 2026
d0b4756
Rollup merge of #160427 - Kobzol:try-builds-ec2, r=Mark-Simulacrum
jhpratt Aug 4, 2026
f5d68e7
Rollup merge of #160435 - RalfJung:tracing-tree, r=lqd
jhpratt Aug 4, 2026
5ae34d6
Rollup merge of #160449 - Kobzol:filesearch-lookup-fix, r=petrochenkov
jhpratt Aug 4, 2026
c05e0e4
Rollup merge of #160477 - tgross35:borrowed-buf-init-tracking, r=jhpratt
jhpratt Aug 4, 2026
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
13 changes: 9 additions & 4 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,24 @@
"dependencyDashboardApproval": false
},
{
// Update all Cargo.lock files except library/Cargo.lock in one PR.
// Set defaults for all Cargo.lock files.
// library/Cargo.lock is grouped into a dedicated PR by the more
// specific rule below.
"matchManagers": ["cargo"],
"matchUpdateTypes": ["lockFileMaintenance"],
"groupName": "Cargo lock file maintenance",
"commitMessageAction": "Cargo lock file maintenance"
"commitMessageAction": "Compiler and tools lock file update",
// Renovate merges all matching rules, so the lockfiles rules below
// also inherits this note and asks Triagebot for a dep-bumps reviewer.
"prBodyNotes": ["r? dep-bumps"]
},
{
// Update library/Cargo.lock in a dedicated PR.
"matchManagers": ["cargo"],
"matchUpdateTypes": ["lockFileMaintenance"],
"matchFileNames": ["library/Cargo.lock"],
"groupName": "library lock file maintenance",
"commitMessageAction": "Library lock file maintenance"
"commitMessageAction": "Library lock file update"
},
{
// These packages don't have a committed Cargo.lock file.
Expand All @@ -63,7 +68,7 @@
"matchManagers": ["npm"],
"matchUpdateTypes": ["lockFileMaintenance"],
"groupName": "Yarn lock file maintenance",
"commitMessageAction": "Yarn lock file maintenance"
"commitMessageAction": "Yarn lock file update"
}
],
"ignorePaths": [
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5927,9 +5927,9 @@ dependencies = [

[[package]]
name = "tracing-tree"
version = "0.3.1"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b56c62d2c80033cb36fae448730a2f2ef99410fe3ecbffc916681a32f6807dbe"
checksum = "ac87aa03b6a4d5a7e4810d1a80c19601dbe0f8a837e9177f23af721c7ba7beec"
dependencies = [
"nu-ansi-term",
"tracing-core",
Expand Down
6 changes: 2 additions & 4 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3981,7 +3981,7 @@ pub struct Fn {
/// This function is an implementation of an externally implementable item (EII).
/// This means, there was an EII declared somewhere and this function is the
/// implementation that should be run when the declaration is called.
pub eii_impls: ThinVec<EiiImpl>,
pub eii_impl: Option<Box<EiiImpl>>,
}

impl Fn {
Expand Down Expand Up @@ -4073,9 +4073,7 @@ pub struct StaticItem {
/// This static is an implementation of an externally implementable item (EII).
/// This means, there was an EII declared somewhere and this static is the
/// implementation that should be used for the declaration.
///
/// For statics, there may be at most one `EiiImpl`, but this is a `ThinVec` to make usages of this field nicer.
pub eii_impls: ThinVec<EiiImpl>,
pub eii_impl: Option<Box<EiiImpl>>,
}

#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
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 @@ -933,12 +933,12 @@ macro_rules! common_visitor_and_walkers {
_ctxt,
// Visibility is visited as a part of the item.
_vis,
Fn { defaultness, ident, sig, generics, contract, body, define_opaque, eii_impls },
Fn { defaultness, ident, sig, generics, contract, body, define_opaque, eii_impl },
) => {
let FnSig { header, decl, span } = sig;
visit_visitable!($($mut)? vis,
defaultness, ident, header, generics, decl,
contract, body, span, define_opaque, eii_impls
contract, body, span, define_opaque, eii_impl
);
}
FnKind::Closure(binder, coroutine_kind, decl, body) =>
Expand Down
24 changes: 11 additions & 13 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
i: &ItemKind,
) -> Vec<hir::Attribute> {
match i {
ItemKind::Fn(Fn { eii_impls, .. }) | ItemKind::Static(StaticItem { eii_impls, .. })
if eii_impls.is_empty() =>
{
Vec::new()
}
ItemKind::Fn(Fn { eii_impls, .. }) | ItemKind::Static(StaticItem { eii_impls, .. }) => {
vec![hir::Attribute::Parsed(AttributeKind::EiiImpls(
eii_impls.iter().map(|i| self.lower_eii_impl(i)).collect(),
))]
ItemKind::Fn(Fn { eii_impl: None, .. })
| ItemKind::Static(StaticItem { eii_impl: None, .. }) => Vec::new(),
ItemKind::Fn(Fn { eii_impl: Some(eii_impl), .. })
| ItemKind::Static(StaticItem { eii_impl: Some(eii_impl), .. }) => {
vec![hir::Attribute::Parsed(AttributeKind::EiiImpl(Box::new(
self.lower_eii_impl(eii_impl),
)))]
}
ItemKind::MacroDef(name, MacroDef { eii_declaration: Some(target), .. }) => self
.lower_eii_decl(id, *name, target)
Expand Down Expand Up @@ -226,7 +224,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
kind,
vis_span,
span: self.lower_span(i.span),
eii: find_attr!(attrs, EiiImpls(..) | EiiDeclaration(..)),
eii: find_attr!(attrs, EiiImpl(..) | EiiDeclaration(..)),
};
self.arena.alloc(item)
}
Expand Down Expand Up @@ -259,7 +257,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
mutability: m,
expr: e,
define_opaque,
eii_impls: _,
eii_impl: _,
}) => {
let ident = self.lower_ident(*ident);
let ty = self
Expand Down Expand Up @@ -696,7 +694,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
kind,
vis_span,
span: this.lower_span(use_tree.span()),
eii: find_attr!(attrs, EiiImpls(..) | EiiDeclaration(..)),
eii: find_attr!(attrs, EiiImpl(..) | EiiDeclaration(..)),
};
hir::OwnerNode::Item(this.arena.alloc(item))
});
Expand Down Expand Up @@ -763,7 +761,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
expr: _,
safety,
define_opaque,
eii_impls: _,
eii_impl: _,
}) => {
let ty = self
.lower_ty_alloc(ty, ImplTraitContext::Disallowed(ImplTraitPosition::StaticTy));
Expand Down
37 changes: 21 additions & 16 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,13 @@ impl<'a> AstValidator<'a> {
match fn_ctxt {
FnCtxt::Foreign => return,
FnCtxt::Free | FnCtxt::Assoc(_) => {
// Reject `...` without a pattern post-expansion. The varargs_without_pattern
// FCW is already triggered pre-expansion.
if let PatKind::Missing = variadic_param.pat.kind {
self.dcx()
.emit_err(diagnostics::VarargsWithoutPattern { span: variadic_param.span });
}

match self.sess.target.supports_c_variadic_definitions() {
CVariadicStatus::NotSupported => {
self.dcx().emit_err(diagnostics::CVariadicNotSupported {
Expand Down Expand Up @@ -1259,10 +1266,10 @@ impl<'a> AstValidator<'a> {
}

// Check EII implementation attributes against an allowlist.
fn check_eii_impl_attrs(&self, attrs: &[Attribute], eii_impls: &[EiiImpl]) {
if eii_impls.is_empty() {
fn check_eii_impl_attrs(&self, attrs: &[Attribute], eii_impl: &Option<Box<EiiImpl>>) {
let Some(eii_impl) = eii_impl else {
return;
}
};

let allowed_attrs: &[Symbol] = &[
sym::allow,
Expand All @@ -1289,14 +1296,12 @@ impl<'a> AstValidator<'a> {
}

let attr_name = pprust::path_to_string(&normal.item.path);
for eii_impl in eii_impls {
self.dcx().emit_err(diagnostics::EiiImplAttributeNotSupported {
attr_span: attr.span,
attr_name: &attr_name,
eii_span: eii_impl.span,
eii_name: pprust::path_to_string(&eii_impl.eii_macro_path),
});
}
self.dcx().emit_err(diagnostics::EiiImplAttributeNotSupported {
attr_span: attr.span,
attr_name: &attr_name,
eii_span: eii_impl.span,
eii_name: pprust::path_to_string(&eii_impl.eii_macro_path),
});
}
}
}
Expand Down Expand Up @@ -1479,16 +1484,16 @@ impl Visitor<'_> for AstValidator<'_> {
contract: _,
body,
define_opaque: _,
eii_impls,
eii_impl,
},
) => {
self.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
self.check_defaultness(item.span, *defaultness, AllowDefault::No, AllowFinal::No);

for EiiImpl { eii_macro_path, .. } in eii_impls {
if let Some(EiiImpl { eii_macro_path, .. }) = eii_impl {
self.visit_path(eii_macro_path);
}
self.check_eii_impl_attrs(&item.attrs, eii_impls);
self.check_eii_impl_attrs(&item.attrs, eii_impl);

let is_intrinsic = item.attrs.iter().any(|a| a.has_name(sym::rustc_intrinsic));
if body.is_none() && !is_intrinsic && !self.is_sdylib_interface {
Expand Down Expand Up @@ -1664,9 +1669,9 @@ impl Visitor<'_> for AstValidator<'_> {

visit::walk_item(self, item);
}
ItemKind::Static(StaticItem { expr, safety, eii_impls, .. }) => {
ItemKind::Static(StaticItem { expr, safety, eii_impl, .. }) => {
self.check_item_safety(item.span, *safety);
self.check_eii_impl_attrs(&item.attrs, eii_impls);
self.check_eii_impl_attrs(&item.attrs, eii_impl);
if matches!(safety, Safety::Unsafe(_)) {
self.dcx().emit_err(diagnostics::UnsafeStatic { span: item.span });
}
Expand Down
12 changes: 12 additions & 0 deletions compiler/rustc_ast_passes/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1245,3 +1245,15 @@ pub(crate) enum DeprecatedWhereClauseLocationSugg {
span: Span,
},
}

#[derive(Diagnostic)]
#[diag("missing pattern for `...` argument")]
pub(crate) struct VarargsWithoutPattern {
#[suggestion(
"add a pattern for this argument",
applicability = "machine-applicable",
code = "_: ..."
)]
#[primary_span]
pub span: Span,
}
20 changes: 10 additions & 10 deletions compiler/rustc_ast_pretty/src/pprust/state/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<'a> State<'a> {
expr,
safety,
define_opaque,
eii_impls,
eii_impl,
}) => self.print_item_const(
*ident,
Some(*mutability),
Expand All @@ -53,7 +53,7 @@ impl<'a> State<'a> {
*safety,
ast::Defaultness::Implicit,
define_opaque.as_deref(),
eii_impls,
eii_impl.as_deref(),
),
ast::ForeignItemKind::TyAlias(ast::TyAlias {
defaultness,
Expand Down Expand Up @@ -94,10 +94,10 @@ impl<'a> State<'a> {
safety: ast::Safety,
defaultness: ast::Defaultness,
define_opaque: Option<&[(ast::NodeId, ast::Path)]>,
eii_impls: &[EiiImpl],
eii_impl: Option<&EiiImpl>,
) {
self.print_define_opaques(define_opaque);
for eii_impl in eii_impls {
if let Some(eii_impl) = eii_impl {
self.print_eii_impl(eii_impl);
}
let (cb, ib) = self.head("");
Expand Down Expand Up @@ -196,7 +196,7 @@ impl<'a> State<'a> {
mutability: mutbl,
expr: body,
define_opaque,
eii_impls,
eii_impl,
}) => {
self.print_safety(*safety);
self.print_item_const(
Expand All @@ -209,7 +209,7 @@ impl<'a> State<'a> {
ast::Safety::Default,
ast::Defaultness::Implicit,
define_opaque.as_deref(),
eii_impls,
eii_impl.as_deref(),
);
}
ast::ItemKind::ConstBlock(ast::ConstBlockItem { id: _, span: _, block }) => {
Expand Down Expand Up @@ -242,7 +242,7 @@ impl<'a> State<'a> {
ast::Safety::Default,
*defaultness,
define_opaque.as_deref(),
&[],
None,
);
}
ast::ItemKind::Fn(func) => {
Expand Down Expand Up @@ -631,7 +631,7 @@ impl<'a> State<'a> {
ast::Safety::Default,
*defaultness,
define_opaque.as_deref(),
&[],
None,
);
}
ast::AssocItemKind::Type(ast::TyAlias {
Expand Down Expand Up @@ -731,12 +731,12 @@ impl<'a> State<'a> {
}

fn print_fn_full(&mut self, vis: &ast::Visibility, attrs: &[ast::Attribute], func: &ast::Fn) {
let ast::Fn { defaultness, ident, generics, sig, contract, body, define_opaque, eii_impls } =
let ast::Fn { defaultness, ident, generics, sig, contract, body, define_opaque, eii_impl } =
func;

self.print_define_opaques(define_opaque.as_deref());

for eii_impl in eii_impls {
if let Some(eii_impl) = eii_impl {
self.print_eii_impl(eii_impl);
}

Expand Down
13 changes: 13 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::path::PathBuf;

use rustc_ast::{LitIntType, LitKind, MetaItemLit};
use rustc_data_structures::fx::FxHashMap;
use rustc_feature::AttributeStability;
use rustc_hir::LangItem;
use rustc_hir::attrs::{
Expand Down Expand Up @@ -72,6 +73,18 @@ impl SingleAttributeParser for RustcMustImplementOneOfParser {
return None;
}

if cx.target == Target::Trait {
// Check for duplicates
let mut seen: FxHashMap<Symbol, Span> = FxHashMap::default();
for ident in &fn_names {
if let Some(dup) = seen.insert(ident.name, ident.span) {
cx.emit_err(diagnostics::FunctionNamesDuplicated {
spans: vec![dup, ident.span],
});
}
}
}

Some(AttributeKind::RustcMustImplementOneOf { attr_span: cx.attr_span, fn_names })
}
}
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_attr_parsing/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ pub(crate) struct MustBeNameOfAssociatedFunction {
pub span: Span,
}

#[derive(Diagnostic)]
#[diag("functions names are duplicated")]
#[note("all `#[rustc_must_implement_one_of]` arguments must be unique")]
pub(crate) struct FunctionNamesDuplicated {
#[primary_span]
pub spans: Vec<Span>,
}

#[derive(Diagnostic)]
#[diag("unsafe attribute used without unsafe")]
pub(crate) struct UnsafeAttrOutsideUnsafeLint {
Expand Down
7 changes: 5 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4277,7 +4277,8 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
) -> Option<AnnotatedBorrowFnSignature<'tcx>> {
// Define a fallback for when we can't match a closure.
let fallback = || {
let is_closure = self.infcx.tcx.is_closure_like(self.mir_def_id().to_def_id());
let tcx = self.infcx.tcx;
let is_closure = tcx.is_closure_like(self.mir_def_id().to_def_id());
if is_closure {
None
} else {
Expand All @@ -4288,14 +4289,16 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
.instantiate_identity()
.skip_norm_wip();
match ty.kind() {
ty::FnDef(_, _) | ty::FnPtr(..) => self.annotate_fn_sig(
ty::FnDef(_, _) => self.annotate_fn_sig(
self.mir_def_id(),
self.infcx
.tcx
.fn_sig(self.mir_def_id())
.instantiate_identity()
.skip_norm_wip(),
),
// a const/static can have a fn ptr type, take the sig from the type instead.
ty::FnPtr(_, _) => self.annotate_fn_sig(self.mir_def_id(), ty.fn_sig(tcx)),
_ => None,
}
}
Expand Down
Loading
Loading