Skip to content

Commit 4e358c9

Browse files
committed
Merge branch 'main' of github.com:ssg/rust
2 parents 4db83c9 + d940e56 commit 4e358c9

File tree

329 files changed

+4720
-1488
lines changed

Some content is hidden

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

329 files changed

+4720
-1488
lines changed

.github/ISSUE_TEMPLATE/ice.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name: Internal Compiler Error
33
about: Create a report for an internal compiler error in rustc.
44
labels: C-bug, I-ICE, T-compiler
5+
title: "[ICE]: "
56
---
67
<!--
78
Thank you for finding an Internal Compiler Error! 🧊 If possible, try to provide

.github/workflows/dependencies.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,9 @@ jobs:
6262
rustup toolchain install --no-self-update --profile minimal $TOOLCHAIN
6363
rustup default $TOOLCHAIN
6464
65-
- name: cargo update compiler & tools
66-
# Remove first line that always just says "Updating crates.io index"
67-
run: |
68-
echo -e "\ncompiler & tools dependencies:" >> cargo_update.log
69-
cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
70-
- name: cargo update library
71-
run: |
72-
echo -e "\nlibrary dependencies:" >> cargo_update.log
73-
cargo update --manifest-path library/Cargo.toml 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
74-
- name: cargo update rustbook
75-
run: |
76-
echo -e "\nrustbook dependencies:" >> cargo_update.log
77-
cargo update --manifest-path src/tools/rustbook/Cargo.toml 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
65+
- name: cargo update
66+
run: ./src/tools/update-lockfile.sh
67+
7868
- name: upload Cargo.lock artifact for use in PR
7969
uses: actions/upload-artifact@v4
8070
with:

compiler/rustc_abi/src/extern_abi/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use std::assert_matches::assert_matches;
21
use std::str::FromStr;
32

3+
use rustc_data_structures::assert_matches;
4+
45
use super::*;
56

67
#[allow(non_snake_case)]

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2384,7 +2384,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23842384
Some(ConstItemRhs::TypeConst(anon)) => {
23852385
hir::ConstItemRhs::TypeConst(self.lower_anon_const_to_const_arg_and_alloc(anon))
23862386
}
2387-
None if attr::contains_name(attrs, sym::type_const) => {
2387+
None if find_attr!(attrs, AttributeKind::TypeConst(_)) => {
23882388
let const_arg = ConstArg {
23892389
hir_id: self.next_id(),
23902390
kind: hir::ConstArgKind::Error(

compiler/rustc_attr_parsing/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ attr_parsing_unstable_cfg_target_compact =
230230
compact `cfg(target(..))` is experimental and subject to change
231231
232232
attr_parsing_unstable_feature_bound_incompatible_stability = item annotated with `#[unstable_feature_bound]` should not be stable
233-
.help = If this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`
233+
.help = if this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`
234234
235235
attr_parsing_unsupported_instruction_set = target `{$current_target}` does not support `#[instruction_set({$instruction_set}::*)]`
236236

compiler/rustc_attr_parsing/src/attributes/crate_level.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,15 @@ impl<S: Stage> NoArgsAttributeParser<S> for NoStdParser {
136136
const CREATE: fn(Span) -> AttributeKind = AttributeKind::NoStd;
137137
}
138138

139+
pub(crate) struct NoMainParser;
140+
141+
impl<S: Stage> NoArgsAttributeParser<S> for NoMainParser {
142+
const PATH: &[Symbol] = &[sym::no_main];
143+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
144+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
145+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::NoMain;
146+
}
147+
139148
pub(crate) struct RustcCoherenceIsCoreParser;
140149

141150
impl<S: Stage> NoArgsAttributeParser<S> for RustcCoherenceIsCoreParser {

compiler/rustc_attr_parsing/src/attributes/link_attrs.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,3 +658,12 @@ impl<S: Stage> SingleAttributeParser<S> for LinkageParser {
658658
Some(AttributeKind::Linkage(linkage, cx.attr_span))
659659
}
660660
}
661+
662+
pub(crate) struct NeedsAllocatorParser;
663+
664+
impl<S: Stage> NoArgsAttributeParser<S> for NeedsAllocatorParser {
665+
const PATH: &[Symbol] = &[sym::needs_allocator];
666+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
667+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
668+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::NeedsAllocator;
669+
}

compiler/rustc_attr_parsing/src/attributes/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ pub(crate) mod pin_v2;
5858
pub(crate) mod proc_macro_attrs;
5959
pub(crate) mod prototype;
6060
pub(crate) mod repr;
61+
pub(crate) mod rustc_allocator;
6162
pub(crate) mod rustc_dump;
6263
pub(crate) mod rustc_internal;
6364
pub(crate) mod semantics;
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
use super::prelude::*;
2+
3+
pub(crate) struct RustcAllocatorParser;
4+
5+
impl<S: Stage> NoArgsAttributeParser<S> for RustcAllocatorParser {
6+
const PATH: &[Symbol] = &[sym::rustc_allocator];
7+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
8+
const ALLOWED_TARGETS: AllowedTargets =
9+
AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]);
10+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcAllocator;
11+
}
12+
13+
pub(crate) struct RustcAllocatorZeroedParser;
14+
15+
impl<S: Stage> NoArgsAttributeParser<S> for RustcAllocatorZeroedParser {
16+
const PATH: &[Symbol] = &[sym::rustc_allocator_zeroed];
17+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
18+
const ALLOWED_TARGETS: AllowedTargets =
19+
AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]);
20+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcAllocatorZeroed;
21+
}
22+
23+
pub(crate) struct RustcAllocatorZeroedVariantParser;
24+
25+
impl<S: Stage> SingleAttributeParser<S> for RustcAllocatorZeroedVariantParser {
26+
const PATH: &[Symbol] = &[sym::rustc_allocator_zeroed_variant];
27+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
28+
const ALLOWED_TARGETS: AllowedTargets =
29+
AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]);
30+
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "function");
31+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
32+
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
33+
let Some(name) = args.name_value().and_then(NameValueParser::value_as_str) else {
34+
cx.expected_name_value(cx.attr_span, None);
35+
return None;
36+
};
37+
38+
Some(AttributeKind::RustcAllocatorZeroedVariant { name })
39+
}
40+
}
41+
42+
pub(crate) struct RustcDeallocatorParser;
43+
44+
impl<S: Stage> NoArgsAttributeParser<S> for RustcDeallocatorParser {
45+
const PATH: &[Symbol] = &[sym::rustc_deallocator];
46+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
47+
const ALLOWED_TARGETS: AllowedTargets =
48+
AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]);
49+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDeallocator;
50+
}
51+
52+
pub(crate) struct RustcReallocatorParser;
53+
54+
impl<S: Stage> NoArgsAttributeParser<S> for RustcReallocatorParser {
55+
const PATH: &[Symbol] = &[sym::rustc_reallocator];
56+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
57+
const ALLOWED_TARGETS: AllowedTargets =
58+
AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]);
59+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcReallocator;
60+
}

compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,27 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcHasIncoherentInherentImplsParse
320320
]);
321321
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcHasIncoherentInherentImpls;
322322
}
323+
324+
pub(crate) struct RustcNounwindParser;
325+
326+
impl<S: Stage> NoArgsAttributeParser<S> for RustcNounwindParser {
327+
const PATH: &[Symbol] = &[sym::rustc_nounwind];
328+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
329+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
330+
Allow(Target::Fn),
331+
Allow(Target::ForeignFn),
332+
Allow(Target::Method(MethodKind::Inherent)),
333+
Allow(Target::Method(MethodKind::TraitImpl)),
334+
Allow(Target::Method(MethodKind::Trait { body: true })),
335+
]);
336+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcNounwind;
337+
}
338+
339+
pub(crate) struct RustcOffloadKernelParser;
340+
341+
impl<S: Stage> NoArgsAttributeParser<S> for RustcOffloadKernelParser {
342+
const PATH: &[Symbol] = &[sym::rustc_offload_kernel];
343+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
344+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
345+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcOffloadKernel;
346+
}

0 commit comments

Comments
 (0)