Skip to content

Commit 085d6b8

Browse files
authored
Merge pull request #2717 from rust-lang/rustc-pull
Rustc pull update
2 parents da0ad30 + 874cbe6 commit 085d6b8

747 files changed

Lines changed: 13690 additions & 6645 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.

Cargo.lock

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,20 @@ version = "0.14.0"
188188
source = "registry+https://github.com/rust-lang/crates.io-index"
189189
checksum = "f75363874b771be265f4ffe307ca705ef6f3baa19011c149da8674a87f1b75c4"
190190
dependencies = [
191-
"askama_derive",
191+
"askama_derive 0.14.0",
192+
"itoa",
193+
"percent-encoding",
194+
"serde",
195+
"serde_json",
196+
]
197+
198+
[[package]]
199+
name = "askama"
200+
version = "0.15.1"
201+
source = "registry+https://github.com/rust-lang/crates.io-index"
202+
checksum = "bb7125972258312e79827b60c9eb93938334100245081cf701a2dee981b17427"
203+
dependencies = [
204+
"askama_macros",
192205
"itoa",
193206
"percent-encoding",
194207
"serde",
@@ -201,7 +214,7 @@ version = "0.14.0"
201214
source = "registry+https://github.com/rust-lang/crates.io-index"
202215
checksum = "129397200fe83088e8a68407a8e2b1f826cf0086b21ccdb866a722c8bcd3a94f"
203216
dependencies = [
204-
"askama_parser",
217+
"askama_parser 0.14.0",
205218
"basic-toml",
206219
"memchr",
207220
"proc-macro2",
@@ -212,6 +225,32 @@ dependencies = [
212225
"syn 2.0.110",
213226
]
214227

228+
[[package]]
229+
name = "askama_derive"
230+
version = "0.15.1"
231+
source = "registry+https://github.com/rust-lang/crates.io-index"
232+
checksum = "8ba5e7259a1580c61571e3116ebaaa01e3c001b2132b17c4cc5c70780ca3e994"
233+
dependencies = [
234+
"askama_parser 0.15.1",
235+
"basic-toml",
236+
"memchr",
237+
"proc-macro2",
238+
"quote",
239+
"rustc-hash 2.1.1",
240+
"serde",
241+
"serde_derive",
242+
"syn 2.0.110",
243+
]
244+
245+
[[package]]
246+
name = "askama_macros"
247+
version = "0.15.1"
248+
source = "registry+https://github.com/rust-lang/crates.io-index"
249+
checksum = "236ce20b77cb13506eaf5024899f4af6e12e8825f390bd943c4c37fd8f322e46"
250+
dependencies = [
251+
"askama_derive 0.15.1",
252+
]
253+
215254
[[package]]
216255
name = "askama_parser"
217256
version = "0.14.0"
@@ -224,6 +263,19 @@ dependencies = [
224263
"winnow 0.7.13",
225264
]
226265

266+
[[package]]
267+
name = "askama_parser"
268+
version = "0.15.1"
269+
source = "registry+https://github.com/rust-lang/crates.io-index"
270+
checksum = "f3c63392767bb2df6aa65a6e1e3b80fd89bb7af6d58359b924c0695620f1512e"
271+
dependencies = [
272+
"rustc-hash 2.1.1",
273+
"serde",
274+
"serde_derive",
275+
"unicode-ident",
276+
"winnow 0.7.13",
277+
]
278+
227279
[[package]]
228280
name = "assert_cmd"
229281
version = "2.1.1"
@@ -624,7 +676,7 @@ name = "clippy"
624676
version = "0.1.94"
625677
dependencies = [
626678
"anstream",
627-
"askama",
679+
"askama 0.14.0",
628680
"cargo_metadata 0.18.1",
629681
"clippy_config",
630682
"clippy_lints",
@@ -1515,7 +1567,7 @@ name = "generate-copyright"
15151567
version = "0.1.0"
15161568
dependencies = [
15171569
"anyhow",
1518-
"askama",
1570+
"askama 0.15.1",
15191571
"cargo_metadata 0.21.0",
15201572
"serde",
15211573
"serde_json",
@@ -4572,7 +4624,6 @@ dependencies = [
45724624
name = "rustc_resolve"
45734625
version = "0.0.0"
45744626
dependencies = [
4575-
"bitflags",
45764627
"indexmap",
45774628
"itertools",
45784629
"pulldown-cmark",
@@ -4862,7 +4913,7 @@ name = "rustdoc"
48624913
version = "0.0.0"
48634914
dependencies = [
48644915
"arrayvec",
4865-
"askama",
4916+
"askama 0.15.1",
48664917
"base64",
48674918
"expect-test",
48684919
"indexmap",

bootstrap.example.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@
106106
# Whether to build LLVM with support for it's gpu offload runtime.
107107
#llvm.offload = false
108108

109+
# Absolute path to the directory containing ClangConfig.cmake
110+
#llvm.offload-clang-dir = ""
111+
109112
# When true, link libstdc++ statically into the rustc_llvm.
110113
# This is useful if you don't want to use the dynamic version of that
111114
# library provided by LLVM.

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
5252
| asm::InlineAsmArch::LoongArch64
5353
| asm::InlineAsmArch::S390x
5454
);
55-
if !is_stable && !self.tcx.features().asm_experimental_arch() {
55+
if !is_stable
56+
&& !self.tcx.features().asm_experimental_arch()
57+
&& sp
58+
.ctxt()
59+
.outer_expn_data()
60+
.allow_internal_unstable
61+
.filter(|features| features.contains(&sym::asm_experimental_arch))
62+
.is_none()
63+
{
5664
feature_err(
5765
&self.tcx.sess,
5866
sym::asm_experimental_arch,

compiler/rustc_attr_parsing/messages.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ attr_parsing_unstable_cfg_target_compact =
229229
attr_parsing_unstable_feature_bound_incompatible_stability = item annotated with `#[unstable_feature_bound]` should not be stable
230230
.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]`
231231
232+
attr_parsing_unsupported_instruction_set = target `{$current_target}` does not support `#[instruction_set({$instruction_set}::*)]`
233+
232234
attr_parsing_unsupported_literal_suggestion =
233235
consider removing the prefix
234236
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
use rustc_hir::attrs::InstructionSetAttr;
2+
3+
use super::prelude::*;
4+
use crate::session_diagnostics;
5+
6+
pub(crate) struct InstructionSetParser;
7+
8+
impl<S: Stage> SingleAttributeParser<S> for InstructionSetParser {
9+
const PATH: &[Symbol] = &[sym::instruction_set];
10+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[
11+
Allow(Target::Fn),
12+
Allow(Target::Closure),
13+
Allow(Target::Method(MethodKind::Inherent)),
14+
Allow(Target::Method(MethodKind::TraitImpl)),
15+
Allow(Target::Method(MethodKind::Trait { body: true })),
16+
]);
17+
const TEMPLATE: AttributeTemplate = template!(List: &["set"], "https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute");
18+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
19+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
20+
21+
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
22+
const POSSIBLE_SYMBOLS: &[Symbol] = &[sym::arm_a32, sym::arm_t32];
23+
const POSSIBLE_ARM_SYMBOLS: &[Symbol] = &[sym::a32, sym::t32];
24+
let Some(maybe_meta_item) = args.list().and_then(MetaItemListParser::single) else {
25+
cx.expected_specific_argument(cx.attr_span, POSSIBLE_SYMBOLS);
26+
return None;
27+
};
28+
29+
let Some(meta_item) = maybe_meta_item.meta_item() else {
30+
cx.expected_specific_argument(maybe_meta_item.span(), POSSIBLE_SYMBOLS);
31+
return None;
32+
};
33+
34+
let mut segments = meta_item.path().segments();
35+
36+
let Some(architecture) = segments.next() else {
37+
cx.expected_specific_argument(meta_item.span(), POSSIBLE_SYMBOLS);
38+
return None;
39+
};
40+
41+
let Some(instruction_set) = segments.next() else {
42+
cx.expected_specific_argument(architecture.span, POSSIBLE_SYMBOLS);
43+
return None;
44+
};
45+
46+
let instruction_set = match architecture.name {
47+
sym::arm => {
48+
if !cx.sess.target.has_thumb_interworking {
49+
cx.dcx().emit_err(session_diagnostics::UnsupportedInstructionSet {
50+
span: cx.attr_span,
51+
instruction_set: sym::arm,
52+
current_target: &cx.sess.opts.target_triple,
53+
});
54+
return None;
55+
}
56+
match instruction_set.name {
57+
sym::a32 => InstructionSetAttr::ArmA32,
58+
sym::t32 => InstructionSetAttr::ArmT32,
59+
_ => {
60+
cx.expected_specific_argument(instruction_set.span, POSSIBLE_ARM_SYMBOLS);
61+
return None;
62+
}
63+
}
64+
}
65+
_ => {
66+
cx.expected_specific_argument(architecture.span, POSSIBLE_SYMBOLS);
67+
return None;
68+
}
69+
};
70+
71+
Some(AttributeKind::InstructionSet(instruction_set))
72+
}
73+
}

compiler/rustc_attr_parsing/src/attributes/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub(crate) mod deprecation;
4242
pub(crate) mod doc;
4343
pub(crate) mod dummy;
4444
pub(crate) mod inline;
45+
pub(crate) mod instruction_set;
4546
pub(crate) mod link_attrs;
4647
pub(crate) mod lint_helpers;
4748
pub(crate) mod loop_match;

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ use crate::attributes::deprecation::DeprecationParser;
3737
use crate::attributes::doc::DocParser;
3838
use crate::attributes::dummy::DummyParser;
3939
use crate::attributes::inline::{InlineParser, RustcForceInlineParser};
40+
use crate::attributes::instruction_set::InstructionSetParser;
4041
use crate::attributes::link_attrs::{
4142
ExportStableParser, FfiConstParser, FfiPureParser, LinkNameParser, LinkOrdinalParser,
4243
LinkParser, LinkSectionParser, LinkageParser, StdInternalSymbolParser,
@@ -198,6 +199,7 @@ attribute_parsers!(
198199
Single<ExportNameParser>,
199200
Single<IgnoreParser>,
200201
Single<InlineParser>,
202+
Single<InstructionSetParser>,
201203
Single<LinkNameParser>,
202204
Single<LinkOrdinalParser>,
203205
Single<LinkSectionParser>,

compiler/rustc_attr_parsing/src/session_diagnostics.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rustc_feature::AttributeTemplate;
99
use rustc_hir::AttrPath;
1010
use rustc_macros::{Diagnostic, Subdiagnostic};
1111
use rustc_span::{Span, Symbol};
12+
use rustc_target::spec::TargetTuple;
1213

1314
use crate::fluent_generated as fluent;
1415

@@ -936,3 +937,12 @@ pub(crate) struct DocAliasMalformed {
936937
#[primary_span]
937938
pub span: Span,
938939
}
940+
941+
#[derive(Diagnostic)]
942+
#[diag(attr_parsing_unsupported_instruction_set)]
943+
pub(crate) struct UnsupportedInstructionSet<'a> {
944+
#[primary_span]
945+
pub span: Span,
946+
pub instruction_set: Symbol,
947+
pub current_target: &'a TargetTuple,
948+
}

compiler/rustc_borrowck/src/universal_regions.rs

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -543,38 +543,9 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
543543
&indices,
544544
);
545545

546-
let (unnormalized_output_ty, mut unnormalized_input_tys) =
546+
let (unnormalized_output_ty, unnormalized_input_tys) =
547547
inputs_and_output.split_last().unwrap();
548548

549-
// C-variadic fns also have a `VaList` input that's not listed in the signature
550-
// (as it's created inside the body itself, not passed in from outside).
551-
if let DefiningTy::FnDef(def_id, _) = defining_ty {
552-
if self.infcx.tcx.fn_sig(def_id).skip_binder().c_variadic() {
553-
let va_list_did = self
554-
.infcx
555-
.tcx
556-
.require_lang_item(LangItem::VaList, self.infcx.tcx.def_span(self.mir_def));
557-
558-
let reg_vid = self
559-
.infcx
560-
.next_nll_region_var(NllRegionVariableOrigin::FreeRegion, || {
561-
RegionCtxt::Free(sym::c_dash_variadic)
562-
})
563-
.as_var();
564-
565-
let region = ty::Region::new_var(self.infcx.tcx, reg_vid);
566-
let va_list_ty = self
567-
.infcx
568-
.tcx
569-
.type_of(va_list_did)
570-
.instantiate(self.infcx.tcx, &[region.into()]);
571-
572-
unnormalized_input_tys = self.infcx.tcx.mk_type_list_from_iter(
573-
unnormalized_input_tys.iter().copied().chain(iter::once(va_list_ty)),
574-
);
575-
}
576-
}
577-
578549
let fr_fn_body = self
579550
.infcx
580551
.next_nll_region_var(NllRegionVariableOrigin::FreeRegion, || {
@@ -816,7 +787,40 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
816787
DefiningTy::FnDef(def_id, _) => {
817788
let sig = tcx.fn_sig(def_id).instantiate_identity();
818789
let sig = indices.fold_to_region_vids(tcx, sig);
819-
sig.inputs_and_output()
790+
let inputs_and_output = sig.inputs_and_output();
791+
792+
// C-variadic fns also have a `VaList` input that's not listed in the signature
793+
// (as it's created inside the body itself, not passed in from outside).
794+
if self.infcx.tcx.fn_sig(def_id).skip_binder().c_variadic() {
795+
let va_list_did = self
796+
.infcx
797+
.tcx
798+
.require_lang_item(LangItem::VaList, self.infcx.tcx.def_span(self.mir_def));
799+
800+
let reg_vid = self
801+
.infcx
802+
.next_nll_region_var(NllRegionVariableOrigin::FreeRegion, || {
803+
RegionCtxt::Free(sym::c_dash_variadic)
804+
})
805+
.as_var();
806+
807+
let region = ty::Region::new_var(self.infcx.tcx, reg_vid);
808+
let va_list_ty = self
809+
.infcx
810+
.tcx
811+
.type_of(va_list_did)
812+
.instantiate(self.infcx.tcx, &[region.into()]);
813+
814+
// The signature needs to follow the order [input_tys, va_list_ty, output_ty]
815+
return inputs_and_output.map_bound(|tys| {
816+
let (output_ty, input_tys) = tys.split_last().unwrap();
817+
tcx.mk_type_list_from_iter(
818+
input_tys.iter().copied().chain([va_list_ty, *output_ty]),
819+
)
820+
});
821+
}
822+
823+
inputs_and_output
820824
}
821825

822826
DefiningTy::Const(def_id, _) => {

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ pub(crate) fn target_machine_factory(
250250

251251
let use_emulated_tls = matches!(sess.tls_model(), TlsModel::Emulated);
252252

253-
let debuginfo_compression = match sess.opts.debuginfo_compression {
253+
let debuginfo_compression = match sess.opts.unstable_opts.debuginfo_compression {
254254
config::DebugInfoCompression::None => llvm::CompressionKind::None,
255255
config::DebugInfoCompression::Zlib => {
256256
if llvm::LLVMRustLLVMHasZlibCompression() {

0 commit comments

Comments
 (0)