Skip to content

Commit 6391e70

Browse files
authored
Merge branch 'rust-lang:master' into feat/enable-f16
2 parents dd8dc65 + a4ce33c commit 6391e70

Some content is hidden

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

60 files changed

+1513
-1276
lines changed

.clang-format

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BasedOnStyle: LLVM

.reuse/dep5

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Files: compiler/*
2929
x
3030
x.ps1
3131
x.py
32+
.clang-format
3233
.editorconfig
3334
.git-blame-ignore-revs
3435
.gitattributes

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -5627,6 +5627,7 @@ dependencies = [
56275627
"regex",
56285628
"rustc-hash",
56295629
"semver",
5630+
"similar",
56305631
"termcolor",
56315632
"walkdir",
56325633
]

compiler/rustc_ast/src/attr/mod.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ impl MetaItem {
327327
I: Iterator<Item = &'a TokenTree>,
328328
{
329329
// FIXME: Share code with `parse_path`.
330-
let path = match tokens.next().map(|tt| TokenTree::uninterpolate(tt)).as_deref() {
330+
let tt = tokens.next().map(|tt| TokenTree::uninterpolate(tt));
331+
let path = match tt.as_deref() {
331332
Some(&TokenTree::Token(
332333
Token { kind: ref kind @ (token::Ident(..) | token::PathSep), span },
333334
_,
@@ -368,6 +369,12 @@ impl MetaItem {
368369
token::Nonterminal::NtPath(path) => (**path).clone(),
369370
_ => return None,
370371
},
372+
Some(TokenTree::Token(
373+
Token { kind: token::OpenDelim(_) | token::CloseDelim(_), .. },
374+
_,
375+
)) => {
376+
panic!("Should be `AttrTokenTree::Delimited`, not delim tokens: {:?}", tt);
377+
}
371378
_ => return None,
372379
};
373380
let list_closing_paren_pos = tokens.peek().map(|tt| tt.span().hi());

compiler/rustc_ast/src/tokenstream.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ impl AttrTokenStream {
224224
// Inner attributes are only supported on extern blocks, functions,
225225
// impls, and modules. All of these have their inner attributes
226226
// placed at the beginning of the rightmost outermost braced group:
227-
// e.g. fn foo() { #![my_attr} }
227+
// e.g. fn foo() { #![my_attr] }
228228
//
229229
// Therefore, we can insert them back into the right location
230230
// without needing to do any extra position tracking.

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

-17
Original file line numberDiff line numberDiff line change
@@ -124,22 +124,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
124124
.emit();
125125
}
126126
}
127-
sym::coverage => {
128-
let inner = attr.meta_item_list();
129-
match inner.as_deref() {
130-
Some([item]) if item.has_name(sym::off) => {
131-
codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_COVERAGE;
132-
}
133-
Some([item]) if item.has_name(sym::on) => {
134-
// Allow #[coverage(on)] for being explicit, maybe also in future to enable
135-
// coverage on a smaller scope within an excluded larger scope.
136-
}
137-
Some(_) | None => {
138-
tcx.dcx()
139-
.span_delayed_bug(attr.span, "unexpected value of coverage attribute");
140-
}
141-
}
142-
}
143127
sym::rustc_std_internal_symbol => {
144128
codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL
145129
}
@@ -584,7 +568,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
584568
}
585569

586570
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NAKED) {
587-
codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_COVERAGE;
588571
codegen_fn_attrs.inline = InlineAttr::Never;
589572
}
590573

compiler/rustc_data_structures/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ libc = "0.2"
5050
memmap2 = "0.2.1"
5151
# tidy-alphabetical-end
5252

53-
[target.'cfg(any(target_arch = "powerpc", target_arch = "mips"))'.dependencies]
53+
[target.'cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "sparc"))'.dependencies]
5454
portable-atomic = "1.5.1"
5555

5656
[features]

compiler/rustc_data_structures/src/marker.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ cfg_match! {
147147
[crate::owned_slice::OwnedSlice]
148148
);
149149

150-
// PowerPC and MIPS platforms with 32-bit pointers do not
150+
// MIPS, PowerPC and SPARC platforms with 32-bit pointers do not
151151
// have AtomicU64 type.
152-
#[cfg(not(any(target_arch = "powerpc", target_arch = "mips")))]
152+
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc", target_arch = "sparc")))]
153153
already_sync!(
154154
[std::sync::atomic::AtomicU64]
155155
);
156156

157-
#[cfg(any(target_arch = "powerpc", target_arch = "mips"))]
157+
#[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "sparc"))]
158158
already_sync!(
159159
[portable_atomic::AtomicU64]
160160
);

compiler/rustc_data_structures/src/sync.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,12 @@ cfg_match! {
270270

271271
pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32};
272272

273-
// PowerPC and MIPS platforms with 32-bit pointers do not
273+
// MIPS, PowerPC and SPARC platforms with 32-bit pointers do not
274274
// have AtomicU64 type.
275-
#[cfg(not(any(target_arch = "powerpc", target_arch = "mips")))]
275+
#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "sparc")))]
276276
pub use std::sync::atomic::AtomicU64;
277277

278-
#[cfg(any(target_arch = "powerpc", target_arch = "mips"))]
278+
#[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "sparc"))]
279279
pub use portable_atomic::AtomicU64;
280280

281281
pub use std::sync::Arc as Lrc;

compiler/rustc_expand/src/config.rs

+6
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ impl<'a> StripUnconfigured<'a> {
214214
) => {
215215
panic!("Nonterminal should have been flattened: {:?}", tree);
216216
}
217+
AttrTokenTree::Token(
218+
Token { kind: TokenKind::OpenDelim(_) | TokenKind::CloseDelim(_), .. },
219+
_,
220+
) => {
221+
panic!("Should be `AttrTokenTree::Delimited`, not delim tokens: {:?}", tree);
222+
}
217223
AttrTokenTree::Token(token, spacing) => {
218224
Some(AttrTokenTree::Token(token, spacing)).into_iter()
219225
}

compiler/rustc_llvm/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ fn main() {
235235
|| target.starts_with("mips-")
236236
|| target.starts_with("mipsel-")
237237
|| target.starts_with("powerpc-")
238+
|| target.starts_with("sparc-")
238239
{
239240
// 32-bit targets need to link libatomic.
240241
println!("cargo:rustc-link-lib=atomic");

compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp

+14-19
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ struct RustArchiveMember {
1313
Archive::Child Child;
1414

1515
RustArchiveMember()
16-
: Filename(nullptr), Name(nullptr),
17-
Child(nullptr, nullptr, nullptr)
18-
{
19-
}
16+
: Filename(nullptr), Name(nullptr), Child(nullptr, nullptr, nullptr) {}
2017
~RustArchiveMember() {}
2118
};
2219

@@ -27,11 +24,8 @@ struct RustArchiveIterator {
2724
std::unique_ptr<Error> Err;
2825

2926
RustArchiveIterator(Archive::child_iterator Cur, Archive::child_iterator End,
30-
std::unique_ptr<Error> Err)
31-
: First(true),
32-
Cur(Cur),
33-
End(End),
34-
Err(std::move(Err)) {}
27+
std::unique_ptr<Error> Err)
28+
: First(true), Cur(Cur), End(End), Err(std::move(Err)) {}
3529
};
3630

3731
enum class LLVMRustArchiveKind {
@@ -66,8 +60,8 @@ typedef Archive::Child const *LLVMRustArchiveChildConstRef;
6660
typedef RustArchiveIterator *LLVMRustArchiveIteratorRef;
6761

6862
extern "C" LLVMRustArchiveRef LLVMRustOpenArchive(char *Path) {
69-
ErrorOr<std::unique_ptr<MemoryBuffer>> BufOr =
70-
MemoryBuffer::getFile(Path, /*IsText*/false, /*RequiresNullTerminator=*/false);
63+
ErrorOr<std::unique_ptr<MemoryBuffer>> BufOr = MemoryBuffer::getFile(
64+
Path, /*IsText*/ false, /*RequiresNullTerminator=*/false);
7165
if (!BufOr) {
7266
LLVMRustSetLastError(BufOr.getError().message().c_str());
7367
return nullptr;
@@ -146,8 +140,8 @@ extern "C" const char *
146140
LLVMRustArchiveChildName(LLVMRustArchiveChildConstRef Child, size_t *Size) {
147141
Expected<StringRef> NameOrErr = Child->getName();
148142
if (!NameOrErr) {
149-
// rustc_codegen_llvm currently doesn't use this error string, but it might be
150-
// useful in the future, and in the meantime this tells LLVM that the
143+
// rustc_codegen_llvm currently doesn't use this error string, but it might
144+
// be useful in the future, and in the meantime this tells LLVM that the
151145
// error was not ignored and that it shouldn't abort the process.
152146
LLVMRustSetLastError(toString(NameOrErr.takeError()).c_str());
153147
return nullptr;
@@ -172,10 +166,9 @@ extern "C" void LLVMRustArchiveMemberFree(LLVMRustArchiveMemberRef Member) {
172166
delete Member;
173167
}
174168

175-
extern "C" LLVMRustResult
176-
LLVMRustWriteArchive(char *Dst, size_t NumMembers,
177-
const LLVMRustArchiveMemberRef *NewMembers,
178-
bool WriteSymbtab, LLVMRustArchiveKind RustKind, bool isEC) {
169+
extern "C" LLVMRustResult LLVMRustWriteArchive(
170+
char *Dst, size_t NumMembers, const LLVMRustArchiveMemberRef *NewMembers,
171+
bool WriteSymbtab, LLVMRustArchiveKind RustKind, bool isEC) {
179172

180173
std::vector<NewArchiveMember> Members;
181174
auto Kind = fromRust(RustKind);
@@ -206,8 +199,10 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers,
206199
#if LLVM_VERSION_LT(18, 0)
207200
auto Result = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false);
208201
#else
209-
auto SymtabMode = WriteSymbtab ? SymtabWritingMode::NormalSymtab : SymtabWritingMode::NoSymtab;
210-
auto Result = writeArchive(Dst, Members, SymtabMode, Kind, true, false, nullptr, isEC);
202+
auto SymtabMode = WriteSymbtab ? SymtabWritingMode::NormalSymtab
203+
: SymtabWritingMode::NoSymtab;
204+
auto Result =
205+
writeArchive(Dst, Members, SymtabMode, Kind, true, false, nullptr, isEC);
211206
#endif
212207
if (!Result)
213208
return LLVMRustResult::Success;

compiler/rustc_llvm/llvm-wrapper/Linker.cpp

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "SuppressLLVMWarnings.h"
21
#include "llvm/Linker/Linker.h"
2+
#include "SuppressLLVMWarnings.h"
33

44
#include "LLVMWrapper.h"
55

@@ -9,26 +9,18 @@ struct RustLinker {
99
Linker L;
1010
LLVMContext &Ctx;
1111

12-
RustLinker(Module &M) :
13-
L(M),
14-
Ctx(M.getContext())
15-
{}
12+
RustLinker(Module &M) : L(M), Ctx(M.getContext()) {}
1613
};
1714

18-
extern "C" RustLinker*
19-
LLVMRustLinkerNew(LLVMModuleRef DstRef) {
15+
extern "C" RustLinker *LLVMRustLinkerNew(LLVMModuleRef DstRef) {
2016
Module *Dst = unwrap(DstRef);
2117

2218
return new RustLinker(*Dst);
2319
}
2420

25-
extern "C" void
26-
LLVMRustLinkerFree(RustLinker *L) {
27-
delete L;
28-
}
21+
extern "C" void LLVMRustLinkerFree(RustLinker *L) { delete L; }
2922

30-
extern "C" bool
31-
LLVMRustLinkerAdd(RustLinker *L, char *BC, size_t Len) {
23+
extern "C" bool LLVMRustLinkerAdd(RustLinker *L, char *BC, size_t Len) {
3224
std::unique_ptr<MemoryBuffer> Buf =
3325
MemoryBuffer::getMemBufferCopy(StringRef(BC, Len));
3426

0 commit comments

Comments
 (0)