Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
686ddd3
tests/debuginfo/basic-stepping.rs: Explain why all lines are not step…
Enselic Mar 16, 2026
c6cb2cc
resolve: Rename `NameResolution::binding` to `determined_decl`
petrochenkov Mar 25, 2026
5b84ee8
resolve: Avoid using `best_decl` in `NameResolution::determined_decl`
petrochenkov Mar 26, 2026
7559c2c
resolve: Avoid using `best_decl` in `try_plant_decl_into_local_module`
petrochenkov Mar 26, 2026
b0b1ebe
resolve: Remove a special case for dummy imports
petrochenkov Mar 26, 2026
c775de4
Make `DerefPure` dyn-incompatible
theemathas Mar 31, 2026
c7c9117
Add `const Default` impls for `LazyCell` and `LazyLock`
davidgauch Apr 7, 2026
aa6150b
Refactor arena_cache query values
zetanumbers Apr 7, 2026
fe309a0
Stabilize feature `uint_bit_width`
sorairolake Apr 10, 2026
e756d16
Add `eii_impls` argument to `StaticItem`
JonathanBrouwer Mar 26, 2026
607b062
Analysis for externally implementable statics
JonathanBrouwer Mar 27, 2026
c7e194f
Fix codegen for `add_static_aliases`
JonathanBrouwer Mar 26, 2026
fca29ad
Uitests for external statics
JonathanBrouwer Mar 26, 2026
59ed245
Reject mutable externally implementable statics
JonathanBrouwer Apr 10, 2026
1f2b090
Reject multiple EII implementations on one static
JonathanBrouwer Apr 10, 2026
63b5ab2
Stabilize feature `int_lowest_highest_one`
sorairolake Apr 11, 2026
21925e9
Lazily check diagnostic namespace features
mejrs Apr 11, 2026
d69403a
Properly emit diagnostic for diagnostic::on_move being used without f…
mejrs Apr 11, 2026
55cd476
Change edit distance to not suggest `on_move` and `on_const` against …
mejrs Apr 11, 2026
b5ddfd5
Fix thread::available_parallelism on WASI targets
surban Mar 9, 2026
106b16c
Add support for static EIIs in late resolution
JonathanBrouwer Apr 12, 2026
b26760f
Fix manpage version replacement and use verbose version
davidkna Apr 12, 2026
6442b48
Add more robust handling of nested query cycles
Zoxc Mar 25, 2026
aa1a5f8
Codegen non-overloaded LLVM intrinsics using their name
sayantn Feb 18, 2026
e4da934
moved 2 tests to organized locations
rishi-techo-14 Apr 12, 2026
c9bfc85
Move tests to appropriate subdirectories
ujjwalvishwakarma2006 Apr 12, 2026
9de8c8c
Add issue links and blessed error files
ujjwalvishwakarma2006 Apr 12, 2026
6733ce9
Add --verbose-run-make-subprocess-output flag to suppress run-make ou…
Ayuse Apr 12, 2026
08a12dc
Add feature hint for unstable diagnostic attributes
mejrs Apr 12, 2026
c21f4ee
Check for AutoUpgraded intrinsics, and lint on uses of deprecated int…
sayantn Nov 25, 2025
a5372be
Add target arch verification for LLVM intrinsics
sayantn Nov 25, 2025
3d89a5b
Add autocasts for structs
sayantn Nov 25, 2025
5aa800a
Add autocast for `i1` vectors
sayantn Nov 25, 2025
11f350d
Add autocast for `bf16` and `bf16xN`
sayantn Nov 25, 2025
84f4b80
Release notes for 1.95
BoxyUwU Apr 12, 2026
3f34b2c
ast: Preserve the star symbol span in glob delegation items
petrochenkov Mar 18, 2026
bde9065
expand: More precise location for glob delegation
petrochenkov Mar 18, 2026
32d9f47
delegation: Give declaration of `self` syntax context of the delegati…
petrochenkov Mar 18, 2026
a9c2819
Update some tests after rebase
petrochenkov Apr 8, 2026
da94899
cg_ssa: transmute between scalable vectors
davidtwco Apr 13, 2026
7aa3f3c
normalize each predicate inside `predicates_for_generics`
adwinwhite Apr 13, 2026
032a818
Rollup merge of #155162 - BoxyUwU:relnotes_1_95, r=Mark-Simulacrum
JonathanBrouwer Apr 13, 2026
3da91b8
Rollup merge of #140763 - sayantn:test-amx, r=dianqk
JonathanBrouwer Apr 13, 2026
8013f05
Rollup merge of #153604 - rust-wasi-web:wasi-available-parallelism-fi…
JonathanBrouwer Apr 13, 2026
7eecc07
Rollup merge of #154049 - petrochenkov:deleglobspan, r=jackh726
JonathanBrouwer Apr 13, 2026
d9d1284
Rollup merge of #154193 - JonathanBrouwer:external-static, r=jdonszel…
JonathanBrouwer Apr 13, 2026
c307938
Rollup merge of #154389 - Zoxc:nested-cycles, r=petrochenkov
JonathanBrouwer Apr 13, 2026
41aaa71
Rollup merge of #154435 - petrochenkov:cleandecl, r=jackh726
JonathanBrouwer Apr 13, 2026
7aa1cce
Rollup merge of #155236 - adwinwhite:refactor-predicates-for-generics…
JonathanBrouwer Apr 13, 2026
720d4ac
Rollup merge of #155243 - davidtwco:scalable-vectors-transmute, r=Ama…
JonathanBrouwer Apr 13, 2026
be80eeb
Rollup merge of #153941 - Enselic:fully-steppable, r=saethlin
JonathanBrouwer Apr 13, 2026
750c57d
Rollup merge of #154587 - Ayuse:compiletest-quiet-run-make, r=jieyouxu
JonathanBrouwer Apr 13, 2026
e26d7d4
Rollup merge of #154624 - theemathas:deref-pure-dyn-incompat, r=jackh726
JonathanBrouwer Apr 13, 2026
f863c10
Rollup merge of #154929 - davidgauch:const-default-lazy, r=jhpratt
JonathanBrouwer Apr 13, 2026
3fb6f8d
Rollup merge of #154944 - zetanumbers:refactor_arena_cache_queries, r…
JonathanBrouwer Apr 13, 2026
eb6840c
Rollup merge of #155055 - rishi-techo-14:ui-automation, r=Kivooeo
JonathanBrouwer Apr 13, 2026
0e264ba
Rollup merge of #155062 - ujjwalvishwakarma2006:reorg-tests, r=Kivooeo
JonathanBrouwer Apr 13, 2026
942b441
Rollup merge of #155131 - sorairolake:stabilize-uint-bit-width, r=jhp…
JonathanBrouwer Apr 13, 2026
ab3e351
Rollup merge of #155147 - sorairolake:stabilize-int-lowest-highest-on…
JonathanBrouwer Apr 13, 2026
825fdfe
Rollup merge of #155174 - mejrs:on_move_gating, r=JonathanBrouwer
JonathanBrouwer Apr 13, 2026
63d811d
Rollup merge of #155194 - davidkna:man-version, r=clubby789
JonathanBrouwer Apr 13, 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
131 changes: 131 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,134 @@
Version 1.95 (2026-04-16)
==========================

<a id="1.95-Language"></a>

Language
--------
- [Stabilize `if let` guards on match arms](https://github.com/rust-lang/rust/pull/141295)
- [`irrefutable_let_patterns` lint no longer lints on let chains](https://github.com/rust-lang/rust/pull/146832)
- [Support importing path-segment keywords with renaming](https://github.com/rust-lang/rust/pull/146972)
- [Stabilize inline assembly for PowerPC and PowerPC64](https://github.com/rust-lang/rust/pull/147996)
- [const-eval: be more consistent in the behavior of padding during typed copies](https://github.com/rust-lang/rust/pull/148967)
- [Const blocks are no longer evaluated to determine if expressions involving fallible operations can implicitly be constant-promoted.](https://github.com/rust-lang/rust/pull/150557). Expressions whose ability to implicitly be promoted would depend on the result of a const block are no longer implicitly promoted.
- [Make operational semantics of pattern matching independent of crate and module](https://github.com/rust-lang/rust/pull/150681)


<a id="1.95-Compiler"></a>

Compiler
--------
- [Stabilize `--remap-path-scope` for controlling the scoping of how paths get remapped in the resulting binary](https://github.com/rust-lang/rust/pull/147611)


<a id="1.95-Platform-Support"></a>

Platform Support
----------------
- [Promote `powerpc64-unknown-linux-musl` to Tier 2 with host tools](https://github.com/rust-lang/rust/pull/149962)
- [Promote `aarch64-apple-tvos` to Tier 2](https://github.com/rust-lang/rust/pull/152021)
- [Promote `aarch64-apple-tvos-sim` to Tier 2](https://github.com/rust-lang/rust/pull/152021)
- [Promote `aarch64-apple-watchos` to Tier 2](https://github.com/rust-lang/rust/pull/152021)
- [Promote `aarch64-apple-watchos-sim` to Tier 2](https://github.com/rust-lang/rust/pull/152021)
- [Promote `aarch64-apple-visionos` to Tier 2](https://github.com/rust-lang/rust/pull/152021)
- [Promote `aarch64-apple-visionos-sim` to Tier 2](https://github.com/rust-lang/rust/pull/152021)


Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

[platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html

<a id="1.95-Libraries"></a>

Libraries
---------
- [`thread::scope`: document how join interacts with TLS destructors](https://github.com/rust-lang/rust/pull/149482)
- [Speed up `str::contains` on aarch64 targets with `neon` target feature enabled by default](https://github.com/rust-lang/rust/pull/152176)


<a id="1.95-Stabilized-APIs"></a>

Stabilized APIs
---------------

- [`MaybeUninit<[T; N]>: From<[MaybeUninit<T>; N]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-From%3CMaybeUninit%3C%5BT;+N%5D%3E%3E-for-%5BMaybeUninit%3CT%3E;+N%5D)
- [`MaybeUninit<[T; N]>: AsRef<[MaybeUninit<T>; N]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsRef%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E)
- [`MaybeUninit<[T; N]>: AsRef<[MaybeUninit<T>]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsRef%3C%5BMaybeUninit%3CT%3E%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E)
- [`MaybeUninit<[T; N]>: AsMut<[MaybeUninit<T>; N]>`](https://doc.rust-lang.org/beta/std/mem/union.MaybeUninit.html#impl-AsMut%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E)
- [`MaybeUninit<[T; N]>: AsMut<[MaybeUninit<T>]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsMut%3C%5BMaybeUninit%3CT%3E%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E)
- [`[MaybeUninit<T>; N]: From<MaybeUninit<[T; N]>>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-From%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E)
- [`Cell<[T; N]>: AsRef<[Cell<T>; N]>`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#impl-AsRef%3C%5BCell%3CT%3E;+N%5D%3E-for-Cell%3C%5BT;+N%5D%3E)
- [`Cell<[T; N]>: AsRef<[Cell<T>]>`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#impl-AsRef%3C%5BCell%3CT%3E%5D%3E-for-Cell%3C%5BT;+N%5D%3E)
- [`Cell<[T]>: AsRef<[Cell<T>]>`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#impl-AsRef%3C%5BCell%3CT%3E%5D%3E-for-Cell%3C%5BT%5D%3E)
- [`bool: TryFrom<{integer}>`](https://doc.rust-lang.org/stable/std/primitive.bool.html#impl-TryFrom%3Cu128%3E-for-bool)
- [`AtomicPtr::update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicPtr.html#method.update)
- [`AtomicPtr::try_update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicPtr.html#method.try_update)
- [`AtomicBool::update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicBool.html#method.update)
- [`AtomicBool::try_update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicBool.html#method.try_update)
- [`AtomicIn::update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicIsize.html#method.update)
- [`AtomicIn::try_update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicIsize.html#method.try_update)
- [`AtomicUn::update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicUsize.html#method.update)
- [`AtomicUn::try_update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicUsize.html#method.try_update)
- [`cfg_select!`](https://doc.rust-lang.org/stable/std/macro.cfg_select.html)
- [`mod core::range`](https://doc.rust-lang.org/stable/core/range/index.html)
- [`core::range::RangeInclusive`](https://doc.rust-lang.org/stable/core/range/struct.RangeInclusive.html)
- [`core::range::RangeInclusiveIter`](https://doc.rust-lang.org/stable/core/range/struct.RangeInclusiveIter.html)
- [`core::hint::cold_path`](https://doc.rust-lang.org/stable/core/hint/fn.cold_path.html)
- [`<*const T>::as_ref_unchecked`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_ref_unchecked)
- [`<*mut T>::as_ref_unchecked`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_ref_unchecked-1)
- [`<*mut T>::as_mut_unchecked`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_mut_unchecked)


These previously stable APIs are now stable in const contexts:

- [`fmt::from_fn`](https://doc.rust-lang.org/stable/std/fmt/fn.from_fn.html)
- [`ControlFlow::is_break`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.is_break)
- [`ControlFlow::is_continue`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.is_continue)


<a id="1.95-Cargo"></a>

Cargo
-----
- [docs(report): enhance man pages for `cargo report *`](https://github.com/rust-lang/cargo/pull/16430/)<a id="1.95-Rustdoc"></a>

Rustdoc
-----
- [In search results, rank unstable items lower](https://github.com/rust-lang/rust/pull/149460)
- [Add new "hide deprecated items" setting in rustdoc](https://github.com/rust-lang/rust/pull/151091)
<a id="1.95-Compatibility-Notes"></a>

Compatibility Notes
-------------------
- [Array coercions may now result in less inference constraints than before](https://github.com/rust-lang/rust/pull/140283)
- Importing `$crate` without renaming, i.e. `use $crate::{self};`, is now no longer permitted due to stricter error checking for `self` imports.
- [const-eval: be more consistent in the behavior of padding during typed copies.](https://github.com/rust-lang/rust/pull/148967)
In very rare cases, this may cause compilation errors due to bytes from parts of a pointer ending up in the padding bytes of a `const` or `static`.
- [A future-incompatibility warning lint `ambiguous_glob_imported_traits` is now reported when using an ambiguously glob imported trait](https://github.com/rust-lang/rust/pull/149058)
- [Check lifetime bounds of types mentioning only type parameters](https://github.com/rust-lang/rust/pull/149389)
- [Report more visibility-related ambiguous import errors](https://github.com/rust-lang/rust/pull/149596)
- [Deprecate `Eq::assert_receiver_is_total_eq` and emit future compatibility warnings on manual impls](https://github.com/rust-lang/rust/pull/149978)
- [powerpc64: Use the ELF ABI version set in target spec instead of guessing](https://github.com/rust-lang/rust/pull/150468) (fixes the ELF ABI used by the OpenBSD target)
- Matching on a `#[non_exhaustive]` enum [now reads the discriminant, even if the enum has only one variant](https://github.com/rust-lang/rust/pull/150681). This can cause closures to capture values that they previously wouldn't.
- `mut ref` and `mut ref mut` patterns, part of the unstable [Match Ergonomics 2024 RFC](https://github.com/rust-lang/rust/issues/123076), were accidentally allowed on stable within struct pattern field shorthand. These patterns are now correctly feature-gated as unstable in this position.
- [Add future-compatibility warning for derive helper attributes which conflict with built-in attributes](https://github.com/rust-lang/rust/pull/151152)
- [JSON target specs](https://doc.rust-lang.org/rustc/targets/custom.html) have been destabilized and now require `-Z unstable-options` to use. Previously, they could not be used without the standard library, which has no stable build mechanism. In preparation for the `build-std` project adding that support, JSON target specs are being proactively gated to ensure they remain unstable even if `build-std` is stabilized. Cargo now includes the `-Z json-target-spec` CLI flag to automatically pass `-Z unstable-options` to the compiler when needed. See [#150151](https://github.com/rust-lang/rust/pull/150151), [#151534](https://github.com/rust-lang/rust/pull/150151), and [rust-lang/cargo#16557](https://github.com/rust-lang/cargo/pull/16557).
- [The arguments of `#[feature]` attributes on invalid targets are now checked](https://github.com/rust-lang/rust/issues/153764)


<a id="1.95-Internal-Changes"></a>

Internal Changes
----------------

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

- [Update to LLVM 22](https://github.com/rust-lang/rust/pull/150722)


Version 1.94.1 (2026-03-26)
===========================

Expand Down
16 changes: 14 additions & 2 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3901,12 +3901,17 @@ pub struct Delegation {
pub from_glob: bool,
}

#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
pub enum DelegationSuffixes {
List(ThinVec<(Ident, Option<Ident>)>),
Glob(Span),
}

#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
pub struct DelegationMac {
pub qself: Option<Box<QSelf>>,
pub prefix: Path,
// Some for list delegation, and None for glob delegation.
pub suffixes: Option<ThinVec<(Ident, Option<Ident>)>>,
pub suffixes: DelegationSuffixes,
pub body: Option<Box<Block>>,
}

Expand All @@ -3918,6 +3923,13 @@ pub struct StaticItem {
pub mutability: Mutability,
pub expr: Option<Box<Expr>>,
pub define_opaque: Option<ThinVec<(NodeId, Path)>>,

/// 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>,
}

#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ macro_rules! common_visitor_and_walkers {
Defaultness,
Delegation,
DelegationMac,
DelegationSuffixes,
DelimArgs,
DelimSpan,
EnumDef,
Expand Down
13 changes: 10 additions & 3 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,14 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
i: &ItemKind,
) -> Vec<hir::Attribute> {
match i {
ItemKind::Fn(box Fn { eii_impls, .. }) if eii_impls.is_empty() => Vec::new(),
ItemKind::Fn(box Fn { eii_impls, .. }) => {
ItemKind::Fn(box Fn { eii_impls, .. })
| ItemKind::Static(box StaticItem { eii_impls, .. })
if eii_impls.is_empty() =>
{
Vec::new()
}
ItemKind::Fn(box Fn { eii_impls, .. })
| ItemKind::Static(box StaticItem { eii_impls, .. }) => {
vec![hir::Attribute::Parsed(AttributeKind::EiiImpls(
eii_impls.iter().map(|i| self.lower_eii_impl(i)).collect(),
))]
Expand All @@ -226,7 +232,6 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {

ItemKind::ExternCrate(..)
| ItemKind::Use(..)
| ItemKind::Static(..)
| ItemKind::Const(..)
| ItemKind::ConstBlock(..)
| ItemKind::Mod(..)
Expand Down Expand Up @@ -302,6 +307,7 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
mutability: m,
expr: e,
define_opaque,
eii_impls: _,
}) => {
let ident = self.lower_ident(*ident);
let ty = self
Expand Down Expand Up @@ -826,6 +832,7 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
expr: _,
safety,
define_opaque,
eii_impls: _,
}) => {
let ty = self
.lower_ty_alloc(ty, ImplTraitContext::Disallowed(ImplTraitPosition::StaticTy));
Expand Down
48 changes: 34 additions & 14 deletions compiler/rustc_ast_pretty/src/pprust/state/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ impl<'a> State<'a> {
expr,
safety,
define_opaque,
eii_impls,
}) => self.print_item_const(
*ident,
Some(*mutability),
Expand All @@ -53,6 +54,7 @@ impl<'a> State<'a> {
*safety,
ast::Defaultness::Implicit,
define_opaque.as_deref(),
eii_impls,
),
ast::ForeignItemKind::TyAlias(box ast::TyAlias {
defaultness,
Expand Down Expand Up @@ -93,8 +95,12 @@ impl<'a> State<'a> {
safety: ast::Safety,
defaultness: ast::Defaultness,
define_opaque: Option<&[(ast::NodeId, ast::Path)]>,
eii_impls: &[EiiImpl],
) {
self.print_define_opaques(define_opaque);
for eii_impl in eii_impls {
self.print_eii_impl(eii_impl);
}
let (cb, ib) = self.head("");
self.print_visibility(vis);
self.print_safety(safety);
Expand Down Expand Up @@ -191,6 +197,7 @@ impl<'a> State<'a> {
mutability: mutbl,
expr: body,
define_opaque,
eii_impls,
}) => {
self.print_safety(*safety);
self.print_item_const(
Expand All @@ -203,6 +210,7 @@ impl<'a> State<'a> {
ast::Safety::Default,
ast::Defaultness::Implicit,
define_opaque.as_deref(),
eii_impls,
);
}
ast::ItemKind::ConstBlock(ast::ConstBlockItem { id: _, span: _, block }) => {
Expand Down Expand Up @@ -234,6 +242,7 @@ impl<'a> State<'a> {
ast::Safety::Default,
*defaultness,
define_opaque.as_deref(),
&[],
);
}
ast::ItemKind::Fn(func) => {
Expand Down Expand Up @@ -435,7 +444,10 @@ impl<'a> State<'a> {
&item.vis,
&deleg.qself,
&deleg.prefix,
deleg.suffixes.as_ref().map_or(DelegationKind::Glob, |s| DelegationKind::List(s)),
match &deleg.suffixes {
ast::DelegationSuffixes::List(s) => DelegationKind::List(s),
ast::DelegationSuffixes::Glob(_) => DelegationKind::Glob,
},
&deleg.body,
),
}
Expand Down Expand Up @@ -602,6 +614,7 @@ impl<'a> State<'a> {
ast::Safety::Default,
*defaultness,
define_opaque.as_deref(),
&[],
);
}
ast::AssocItemKind::Type(box ast::TyAlias {
Expand Down Expand Up @@ -641,7 +654,10 @@ impl<'a> State<'a> {
vis,
&deleg.qself,
&deleg.prefix,
deleg.suffixes.as_ref().map_or(DelegationKind::Glob, |s| DelegationKind::List(s)),
match &deleg.suffixes {
ast::DelegationSuffixes::List(s) => DelegationKind::List(s),
ast::DelegationSuffixes::Glob(_) => DelegationKind::Glob,
},
&deleg.body,
),
}
Expand Down Expand Up @@ -703,18 +719,8 @@ impl<'a> State<'a> {

self.print_define_opaques(define_opaque.as_deref());

for EiiImpl { eii_macro_path, impl_safety, .. } in eii_impls {
self.word("#[");
if let Safety::Unsafe(..) = impl_safety {
self.word("unsafe");
self.popen();
}
self.print_path(eii_macro_path, false, 0);
if let Safety::Unsafe(..) = impl_safety {
self.pclose();
}
self.word("]");
self.hardbreak();
for eii_impl in eii_impls {
self.print_eii_impl(eii_impl);
}

let body_cb_ib = body.as_ref().map(|body| (body, self.head("")));
Expand All @@ -741,6 +747,20 @@ impl<'a> State<'a> {
}
}

fn print_eii_impl(&mut self, eii: &ast::EiiImpl) {
self.word("#[");
if let Safety::Unsafe(..) = eii.impl_safety {
self.word("unsafe");
self.popen();
}
self.print_path(&eii.eii_macro_path, false, 0);
if let Safety::Unsafe(..) = eii.impl_safety {
self.pclose();
}
self.word("]");
self.hardbreak();
}

fn print_define_opaques(&mut self, define_opaque: Option<&[(ast::NodeId, ast::Path)]>) {
if let Some(define_opaque) = define_opaque {
self.word("#[define_opaque(");
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,8 @@ pub(crate) struct RustcEiiForeignItemParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcEiiForeignItemParser {
const PATH: &[Symbol] = &[sym::rustc_eii_foreign_item];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::ForeignFn)]);
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::ForeignFn), Allow(Target::ForeignStatic)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcEiiForeignItem;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ impl<S: Stage> AttributeParser<S> for OnConstParser {
template!(List: &[r#"/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...""#]),
|this, cx, args| {
if !cx.features().diagnostic_on_const() {
// `UnknownDiagnosticAttribute` is emitted in rustc_resolve/macros.rs
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ impl OnMoveParser {
mode: Mode,
) {
if !cx.features().diagnostic_on_move() {
// `UnknownDiagnosticAttribute` is emitted in rustc_resolve/macros.rs
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ impl OnUnknownParser {
mode: Mode,
) {
if !cx.features().diagnostic_on_unknown() {
// `UnknownDiagnosticAttribute` is emitted in rustc_resolve/macros.rs
return;
}
let span = cx.attr_span;
Expand Down
Loading
Loading