Skip to content

Commit 3659db0

Browse files
committed
Auto merge of #158811 - JonathanBrouwer:rollup-Rzb4mH7, r=JonathanBrouwer
Rollup of 19 pull requests Successful merges: - #158692 (Add release notes for 1.96.1) - #134021 (Implement `IntoIterator` for `[&[mut]] Box<[T; N], A>`) - #155932 (MIR Call terminator: evaluate destination place before arguments) - #155989 (Update `transmute_copy` to ub_checks and `?Sized`) - #156777 (Add -Zautodiff_post_passes flag to limit which llvm passes to run after enzyme to make autodiff tests more robust) - #157151 (JSON target specs: remove 'x86-softfloat' compatibility alias) - #157835 (expand free alias types in the auto-trait orphan check) - #157857 (Stabilize `#[my_macro] mod foo;` (part of `proc_macro_hygiene`)) - #158434 (delegation: refactor AST -> HIR lowering) - #158552 (make some tidy errors around python easier to understand) - #158624 (borrowck: Introduce BlameConstraint::to_obligation_cause_from_path()) - #158704 (Optimize `ArrayChunks::try_rfold` with `DoubleEndedIterator::next_chunk_back`) - #158711 (library: Comment on libtest's dicey internal soundness) - #158751 (rustdoc: Fix crash when trying to inline foreign item which cannot have attributes) - #158539 (Move `SizeHint` and `IoHandle` to `core::io`) - #158659 (refactor the normalization in `coerce_shared_info`) - #158689 (resolver: don't use `Finalize` when resolving visibilities during AST expansion) - #158698 (Update TypeVisitable implementation) - #158706 (Tweaks to MIR building scope API)
2 parents 1c02d90 + 9f3f117 commit 3659db0

93 files changed

Lines changed: 1787 additions & 1297 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

RELEASES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Version 1.96.1 (2026-06-30)
2+
===========================
3+
4+
<a id="1.96.1"></a>
5+
6+
- [Cargo: fix timeout/retry behavior](https://github.com/rust-lang/cargo/pull/17131)
7+
- [Cargo: apply patches for CVE-2025-15661, CVE-2026-55199, and CVE-2026-55200 to libssh2](https://github.com/rust-lang/cargo/pull/17140)
8+
- [rustc: fix miscompilation in MIR optimization](https://github.com/rust-lang/rust/pull/158214)
9+
110
Version 1.96.0 (2026-05-28)
211
==========================
312

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
use rustc_hir::attrs::{AttributeKind, InlineAttr};
2+
use rustc_hir::{self as hir};
3+
use rustc_span::Span;
4+
use rustc_span::def_id::DefId;
5+
6+
use crate::LoweringContext;
7+
use crate::delegation::DelegationResolution;
8+
9+
struct AdditionInfo {
10+
pub equals: fn(&hir::Attribute) -> bool,
11+
pub kind: AdditionKind,
12+
}
13+
14+
enum AdditionKind {
15+
Default { factory: fn(Span) -> hir::Attribute },
16+
Inherit { factory: fn(Span, &hir::Attribute) -> hir::Attribute },
17+
}
18+
19+
static ADDITIONS: &[AdditionInfo] = &[
20+
AdditionInfo {
21+
equals: |a| matches!(a, hir::Attribute::Parsed(AttributeKind::MustUse { .. })),
22+
kind: AdditionKind::Inherit {
23+
factory: |span, original_attr| {
24+
let reason = match original_attr {
25+
hir::Attribute::Parsed(AttributeKind::MustUse { reason, .. }) => *reason,
26+
_ => None,
27+
};
28+
29+
hir::Attribute::Parsed(AttributeKind::MustUse { span, reason })
30+
},
31+
},
32+
},
33+
AdditionInfo {
34+
equals: |a| matches!(a, hir::Attribute::Parsed(AttributeKind::Inline(..))),
35+
kind: AdditionKind::Default {
36+
factory: |span| hir::Attribute::Parsed(AttributeKind::Inline(InlineAttr::Hint, span)),
37+
},
38+
},
39+
];
40+
41+
impl<'hir> LoweringContext<'_, 'hir> {
42+
pub(super) fn add_attrs_if_needed(&mut self, resolution: &DelegationResolution) {
43+
let &DelegationResolution { span, sig_id, .. } = resolution;
44+
45+
const PARENT_ID: hir::ItemLocalId = hir::ItemLocalId::ZERO;
46+
let new_attrs = self.create_new_attrs(span, sig_id, self.attrs.get(&PARENT_ID));
47+
48+
if !new_attrs.is_empty() {
49+
let new_attrs = match self.attrs.get(&PARENT_ID) {
50+
Some(existing_attrs) => self.arena.alloc_from_iter(
51+
existing_attrs.iter().map(|a| a.clone()).chain(new_attrs.into_iter()),
52+
),
53+
None => self.arena.alloc_from_iter(new_attrs.into_iter()),
54+
};
55+
56+
self.attrs.insert(PARENT_ID, new_attrs);
57+
}
58+
}
59+
60+
fn create_new_attrs(
61+
&self,
62+
span: Span,
63+
sig_id: DefId,
64+
existing: Option<&&[hir::Attribute]>,
65+
) -> Vec<hir::Attribute> {
66+
ADDITIONS
67+
.iter()
68+
.filter_map(|addition| {
69+
existing
70+
.is_none_or(|attrs| !attrs.iter().any(|a| (addition.equals)(a)))
71+
.then(|| match addition.kind {
72+
AdditionKind::Default { factory } => Some(factory(span)),
73+
AdditionKind::Inherit { factory, .. } =>
74+
{
75+
#[allow(deprecated)]
76+
self.tcx
77+
.get_all_attrs(sig_id)
78+
.iter()
79+
.find_map(|a| (addition.equals)(a).then(|| factory(span, a)))
80+
}
81+
})
82+
.flatten()
83+
})
84+
.collect::<Vec<_>>()
85+
}
86+
}

0 commit comments

Comments
 (0)