Skip to content

Commit 6661762

Browse files
author
The Miri Cronjob Bot
committed
Merge ref '864339abf952' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 864339a Filtered ref: f6ad94b050ea0db6b49b3fd3faa6a49504fb4a50 Upstream diff: 3ff30e7...864339a This merge was created using https://github.com/rust-lang/josh-sync.
2 parents 66e9c33 + 864339a commit 6661762

File tree

1,016 files changed

+16567
-11710
lines changed

Some content is hidden

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

1,016 files changed

+16567
-11710
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ jobs:
313313
needs: [ calculate_matrix, job ]
314314
# !cancelled() executes the job regardless of whether the previous jobs passed or failed
315315
if: ${{ !cancelled() && contains(fromJSON('["auto", "try"]'), needs.calculate_matrix.outputs.run_type) }}
316+
environment: ${{ ((github.repository == 'rust-lang/rust' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf' || github.ref == 'refs/heads/automation/bors/try' || github.ref == 'refs/heads/auto')) && 'bors') || '' }}
316317
steps:
317318
- name: checkout the source code
318319
uses: actions/checkout@v5

.mailmap

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Andre Bogus <bogusandre@gmail.com>
4343
Andre Bogus <bogusandre@gmail.com> <andre.bogus@aleph-alpha.de>
4444
Andre Bogus <bogusandre@gmail.com> <andre.bogus@ankordata.de>
4545
Andrea Ciliberti <meziu210@icloud.com>
46+
4647
Andreas Gal <gal@mozilla.com> <andreas.gal@gmail.com>
4748
Andreas Jonson <andjo403@users.noreply.github.com>
4849
Andrew Gauger <andygauge@gmail.com>
@@ -87,7 +88,9 @@ bjorn3 <17426603+bjorn3@users.noreply.github.com> <bjorn3@users.noreply.github.c
8788
bjorn3 <17426603+bjorn3@users.noreply.github.com> <bjorn3_gh@protonmail.com>
8889
Björn Steinbrink <bsteinbr@gmail.com> <B.Steinbrink@gmx.de>
8990
blake2-ppc <ulrik.sverdrup@gmail.com> <blake2-ppc>
90-
blyxyas <blyxyas@gmail.com> Alejandra González <blyxyas@gmail.com>
91+
Alejandra González <blyxyas@goose.love> blyxyas <blyxyas@gmail.com>
92+
Alejandra González <blyxyas@goose.love> blyxyas <blyxyas@goose.love>
93+
Alejandra González <blyxyas@goose.love> Alejandra González <blyxyas@gmail.com>
9194
boolean_coercion <booleancoercion@gmail.com>
9295
Boris Egorov <jightuse@gmail.com> <egorov@linux.com>
9396
bors <bors@rust-lang.org> bors[bot] <26634292+bors[bot]@users.noreply.github.com>

Cargo.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ dependencies = [
7474

7575
[[package]]
7676
name = "annotate-snippets"
77-
version = "0.12.9"
77+
version = "0.12.10"
7878
source = "registry+https://github.com/rust-lang/crates.io-index"
79-
checksum = "a44baf24dd94e781f74dfe67ffee75a09a57971ddf0f615a178b4f6d404b48ff"
79+
checksum = "15580ece6ea97cbf832d60ba19c021113469480852c6a2a6beb0db28f097bf1f"
8080
dependencies = [
8181
"anstyle",
8282
"memchr",
@@ -3838,7 +3838,7 @@ dependencies = [
38383838
name = "rustc_errors"
38393839
version = "0.0.0"
38403840
dependencies = [
3841-
"annotate-snippets 0.12.9",
3841+
"annotate-snippets 0.12.10",
38423842
"anstream",
38433843
"anstyle",
38443844
"derive_setters",

compiler/rustc_arena/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
// tidy-alphabetical-start
1111
#![allow(clippy::mut_from_ref)] // Arena allocators are one place where this pattern is fine.
1212
#![allow(internal_features)]
13+
#![cfg_attr(bootstrap, feature(maybe_uninit_slice))]
1314
#![cfg_attr(test, feature(test))]
1415
#![deny(unsafe_op_in_unsafe_fn)]
1516
#![doc(test(no_crate_inject, attr(deny(warnings), allow(internal_features))))]
1617
#![feature(core_intrinsics)]
1718
#![feature(decl_macro)]
1819
#![feature(dropck_eyepatch)]
19-
#![feature(maybe_uninit_slice)]
2020
#![feature(never_type)]
2121
#![feature(rustc_attrs)]
2222
#![feature(unwrap_infallible)]

compiler/rustc_ast_passes/messages.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ ast_passes_c_variadic_must_be_unsafe =
8080
ast_passes_c_variadic_no_extern = `...` is not supported for non-extern functions
8181
.help = only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
8282
83+
ast_passes_c_variadic_not_supported = the `{$target}` target does not support c-variadic functions
84+
8385
ast_passes_const_and_c_variadic = functions cannot be both `const` and C-variadic
8486
.const = `const` because of this
8587
.variadic = C-variadic because of this

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,14 @@ impl<'a> AstValidator<'a> {
710710
match fn_ctxt {
711711
FnCtxt::Foreign => return,
712712
FnCtxt::Free | FnCtxt::Assoc(_) => {
713+
if !self.sess.target.arch.supports_c_variadic_definitions() {
714+
self.dcx().emit_err(errors::CVariadicNotSupported {
715+
variadic_span: variadic_param.span,
716+
target: &*self.sess.target.llvm_target,
717+
});
718+
return;
719+
}
720+
713721
match sig.header.ext {
714722
Extern::Implicit(_) => {
715723
if !matches!(sig.header.safety, Safety::Unsafe(_)) {
@@ -1067,7 +1075,7 @@ fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericPara
10671075

10681076
impl<'a> Visitor<'a> for AstValidator<'a> {
10691077
fn visit_attribute(&mut self, attr: &Attribute) {
1070-
validate_attr::check_attr(&self.sess.psess, attr, self.lint_node_id);
1078+
validate_attr::check_attr(&self.sess.psess, attr);
10711079
}
10721080

10731081
fn visit_ty(&mut self, ty: &'a Ty) {

compiler/rustc_ast_passes/src/errors.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,14 @@ pub(crate) struct CoroutineAndCVariadic {
733733
pub variadic_span: Span,
734734
}
735735

736+
#[derive(Diagnostic)]
737+
#[diag(ast_passes_c_variadic_not_supported)]
738+
pub(crate) struct CVariadicNotSupported<'a> {
739+
#[primary_span]
740+
pub variadic_span: Span,
741+
pub target: &'a str,
742+
}
743+
736744
#[derive(Diagnostic)]
737745
#[diag(ast_passes_pattern_in_foreign, code = E0130)]
738746
// FIXME: deduplicate with rustc_lint (`BuiltinLintDiag::PatternsInFnsWithoutBody`)

compiler/rustc_attr_parsing/src/attributes/cfg.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::convert::identity;
2+
13
use rustc_ast::token::Delimiter;
24
use rustc_ast::tokenstream::DelimSpan;
35
use rustc_ast::{AttrItem, Attribute, CRATE_NODE_ID, LitKind, NodeId, ast, token};
@@ -353,7 +355,7 @@ pub fn parse_cfg_attr(
353355
span,
354356
attr_span: cfg_attr.span,
355357
template: CFG_ATTR_TEMPLATE,
356-
path: AttrPath::from_ast(&cfg_attr.get_normal_item().path),
358+
path: AttrPath::from_ast(&cfg_attr.get_normal_item().path, identity),
357359
description: ParsedDescription::Attribute,
358360
reason,
359361
suggestions: CFG_ATTR_TEMPLATE
@@ -398,6 +400,7 @@ fn parse_cfg_attr_internal<'a>(
398400
.into_boxed_slice(),
399401
span: attribute.span,
400402
},
403+
Some(attribute.get_normal_item().unsafety),
401404
ParsedDescription::Attribute,
402405
pred_span,
403406
CRATE_NODE_ID,

compiler/rustc_attr_parsing/src/attributes/cfg_select.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ pub fn parse_cfg_select(
6363
segments: vec![Ident::from_str("cfg_select")].into_boxed_slice(),
6464
span: cfg_span,
6565
},
66+
None,
6667
ParsedDescription::Macro,
6768
cfg_span,
6869
lint_node_id,

compiler/rustc_attr_parsing/src/interface.rs

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::borrow::Cow;
22

33
use rustc_ast as ast;
4-
use rustc_ast::{AttrStyle, NodeId};
4+
use rustc_ast::{AttrStyle, NodeId, Safety};
55
use rustc_errors::DiagCtxtHandle;
66
use rustc_feature::{AttributeTemplate, Features};
77
use rustc_hir::attrs::AttributeKind;
@@ -146,6 +146,7 @@ impl<'sess> AttributeParser<'sess, Early> {
146146
normal_attr.item.span(),
147147
attr.style,
148148
path.get_attribute_path(),
149+
Some(normal_attr.item.unsafety),
149150
ParsedDescription::Attribute,
150151
target_span,
151152
target_node_id,
@@ -165,6 +166,7 @@ impl<'sess> AttributeParser<'sess, Early> {
165166
inner_span: Span,
166167
attr_style: AttrStyle,
167168
attr_path: AttrPath,
169+
attr_safety: Option<Safety>,
168170
parsed_description: ParsedDescription,
169171
target_span: Span,
170172
target_node_id: NodeId,
@@ -181,14 +183,24 @@ impl<'sess> AttributeParser<'sess, Early> {
181183
sess,
182184
stage: Early { emit_errors },
183185
};
186+
let mut emit_lint = |lint| {
187+
crate::lints::emit_attribute_lint(&lint, sess);
188+
};
189+
if let Some(safety) = attr_safety {
190+
parser.check_attribute_safety(
191+
&attr_path,
192+
inner_span,
193+
safety,
194+
&mut emit_lint,
195+
target_node_id,
196+
)
197+
}
184198
let mut cx: AcceptContext<'_, 'sess, Early> = AcceptContext {
185199
shared: SharedContext {
186200
cx: &mut parser,
187201
target_span,
188202
target_id: target_node_id,
189-
emit_lint: &mut |lint| {
190-
crate::lints::emit_attribute_lint(&lint, sess);
191-
},
203+
emit_lint: &mut emit_lint,
192204
},
193205
attr_span,
194206
inner_span,
@@ -288,6 +300,15 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
288300
// }
289301
ast::AttrKind::Normal(n) => {
290302
attr_paths.push(PathParser(Cow::Borrowed(&n.item.path)));
303+
let attr_path = AttrPath::from_ast(&n.item.path, lower_span);
304+
305+
self.check_attribute_safety(
306+
&attr_path,
307+
lower_span(n.item.span()),
308+
n.item.unsafety,
309+
&mut emit_lint,
310+
target_id,
311+
);
291312

292313
let parts =
293314
n.item.path.segments.iter().map(|seg| seg.ident.name).collect::<Vec<_>>();
@@ -301,7 +322,6 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
301322
) else {
302323
continue;
303324
};
304-
let path = parser.path();
305325
let args = parser.args();
306326
for accept in accepts {
307327
let mut cx: AcceptContext<'_, 'sess, S> = AcceptContext {
@@ -312,11 +332,11 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
312332
emit_lint: &mut emit_lint,
313333
},
314334
attr_span: lower_span(attr.span),
315-
inner_span: lower_span(attr.get_normal_item().span()),
335+
inner_span: lower_span(n.item.span()),
316336
attr_style: attr.style,
317337
parsed_description: ParsedDescription::Attribute,
318338
template: &accept.template,
319-
attr_path: path.get_attribute_path(),
339+
attr_path: attr_path.clone(),
320340
};
321341

322342
(accept.accept_fn)(&mut cx, args);
@@ -341,7 +361,7 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
341361
// );
342362

343363
attributes.push(Attribute::Unparsed(Box::new(AttrItem {
344-
path: AttrPath::from_ast(&n.item.path),
364+
path: attr_path.clone(),
345365
args: self.lower_attr_args(&n.item.args, lower_span),
346366
id: HashIgnoredAttrId { attr_id: attr.id },
347367
style: attr.style,

0 commit comments

Comments
 (0)