Skip to content

Commit 4076106

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 981f38e + c53d2d4 commit 4076106

File tree

169 files changed

+1671
-1009
lines changed

Some content is hidden

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

169 files changed

+1671
-1009
lines changed

Cargo.lock

+72-57
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ dependencies = [
582582
"cargo_metadata 0.12.0",
583583
"clippy-mini-macro-test",
584584
"clippy_lints",
585-
"compiletest_rs 0.6.0",
585+
"compiletest_rs",
586586
"derive-new",
587587
"quote",
588588
"regex",
@@ -592,7 +592,7 @@ dependencies = [
592592
"serde",
593593
"syn",
594594
"tempfile",
595-
"tester 0.9.0",
595+
"tester",
596596
]
597597

598598
[[package]]
@@ -700,28 +700,6 @@ dependencies = [
700700
"winapi 0.3.9",
701701
]
702702

703-
[[package]]
704-
name = "compiletest_rs"
705-
version = "0.5.0"
706-
source = "registry+https://github.com/rust-lang/crates.io-index"
707-
checksum = "9f737835bfbbe29ed1ff82d5137520338d7ed5bf1a1d4b9c1c7c58bb45b8fa29"
708-
dependencies = [
709-
"diff",
710-
"filetime",
711-
"getopts",
712-
"libc",
713-
"log",
714-
"miow 0.3.6",
715-
"regex",
716-
"rustfix",
717-
"serde",
718-
"serde_derive",
719-
"serde_json",
720-
"tempfile",
721-
"tester 0.7.0",
722-
"winapi 0.3.9",
723-
]
724-
725703
[[package]]
726704
name = "compiletest_rs"
727705
version = "0.6.0"
@@ -741,7 +719,7 @@ dependencies = [
741719
"serde_derive",
742720
"serde_json",
743721
"tempfile",
744-
"tester 0.9.0",
722+
"tester",
745723
"winapi 0.3.9",
746724
]
747725

@@ -1094,6 +1072,26 @@ dependencies = [
10941072
"log",
10951073
]
10961074

1075+
[[package]]
1076+
name = "enum-iterator"
1077+
version = "0.6.0"
1078+
source = "registry+https://github.com/rust-lang/crates.io-index"
1079+
checksum = "c79a6321a1197d7730510c7e3f6cb80432dfefecb32426de8cea0aa19b4bb8d7"
1080+
dependencies = [
1081+
"enum-iterator-derive",
1082+
]
1083+
1084+
[[package]]
1085+
name = "enum-iterator-derive"
1086+
version = "0.6.0"
1087+
source = "registry+https://github.com/rust-lang/crates.io-index"
1088+
checksum = "1e94aa31f7c0dc764f57896dc615ddd76fc13b0d5dca7eb6cc5e018a5a09ec06"
1089+
dependencies = [
1090+
"proc-macro2",
1091+
"quote",
1092+
"syn",
1093+
]
1094+
10971095
[[package]]
10981096
name = "env_logger"
10991097
version = "0.6.2"
@@ -1439,6 +1437,18 @@ dependencies = [
14391437
"wasi",
14401438
]
14411439

1440+
[[package]]
1441+
name = "getset"
1442+
version = "0.1.1"
1443+
source = "registry+https://github.com/rust-lang/crates.io-index"
1444+
checksum = "24b328c01a4d71d2d8173daa93562a73ab0fe85616876f02500f53d82948c504"
1445+
dependencies = [
1446+
"proc-macro-error",
1447+
"proc-macro2",
1448+
"quote",
1449+
"syn",
1450+
]
1451+
14421452
[[package]]
14431453
name = "gimli"
14441454
version = "0.23.0"
@@ -1732,17 +1742,6 @@ version = "0.4.6"
17321742
source = "registry+https://github.com/rust-lang/crates.io-index"
17331743
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
17341744

1735-
[[package]]
1736-
name = "jemalloc-sys"
1737-
version = "0.3.2"
1738-
source = "registry+https://github.com/rust-lang/crates.io-index"
1739-
checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
1740-
dependencies = [
1741-
"cc",
1742-
"fs_extra",
1743-
"libc",
1744-
]
1745-
17461745
[[package]]
17471746
name = "jobserver"
17481747
version = "0.1.21"
@@ -2315,13 +2314,13 @@ name = "miri"
23152314
version = "0.1.0"
23162315
dependencies = [
23172316
"colored",
2318-
"compiletest_rs 0.5.0",
2319-
"env_logger 0.7.1",
2317+
"compiletest_rs",
2318+
"env_logger 0.8.1",
23202319
"getrandom 0.2.0",
23212320
"hex 0.4.2",
23222321
"libc",
23232322
"log",
2324-
"rand 0.7.3",
2323+
"rand 0.8.3",
23252324
"rustc-workspace-hack",
23262325
"rustc_version",
23272326
"shell-escape",
@@ -3586,9 +3585,10 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
35863585
name = "rustc-main"
35873586
version = "0.0.0"
35883587
dependencies = [
3589-
"jemalloc-sys",
35903588
"rustc_codegen_ssa",
35913589
"rustc_driver",
3590+
"tikv-jemalloc-sys",
3591+
"tikv-jemallocator",
35923592
]
35933593

35943594
[[package]]
@@ -4591,11 +4591,11 @@ dependencies = [
45914591

45924592
[[package]]
45934593
name = "rustc_version"
4594-
version = "0.2.3"
4594+
version = "0.3.3"
45954595
source = "registry+https://github.com/rust-lang/crates.io-index"
4596-
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
4596+
checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
45974597
dependencies = [
4598-
"semver 0.9.0",
4598+
"semver 0.11.0",
45994599
]
46004600

46014601
[[package]]
@@ -5241,17 +5241,6 @@ dependencies = [
52415241
"term 0.0.0",
52425242
]
52435243

5244-
[[package]]
5245-
name = "tester"
5246-
version = "0.7.0"
5247-
source = "registry+https://github.com/rust-lang/crates.io-index"
5248-
checksum = "ee72ec31009a42b53de9a6b7d8f462b493ab3b1e4767bda1fcdbb52127f13b6c"
5249-
dependencies = [
5250-
"getopts",
5251-
"libc",
5252-
"term 0.6.1",
5253-
]
5254-
52555244
[[package]]
52565245
name = "tester"
52575246
version = "0.9.0"
@@ -5318,6 +5307,27 @@ dependencies = [
53185307
name = "tier-check"
53195308
version = "0.1.0"
53205309

5310+
[[package]]
5311+
name = "tikv-jemalloc-sys"
5312+
version = "0.4.1+5.2.1-patched"
5313+
source = "registry+https://github.com/rust-lang/crates.io-index"
5314+
checksum = "8a26331b05179d4cb505c8d6814a7e18d298972f0a551b0e3cefccff927f86d3"
5315+
dependencies = [
5316+
"cc",
5317+
"fs_extra",
5318+
"libc",
5319+
]
5320+
5321+
[[package]]
5322+
name = "tikv-jemallocator"
5323+
version = "0.4.1"
5324+
source = "registry+https://github.com/rust-lang/crates.io-index"
5325+
checksum = "3c14a5a604eb8715bc5785018a37d00739b180bcf609916ddf4393d33d49ccdf"
5326+
dependencies = [
5327+
"libc",
5328+
"tikv-jemalloc-sys",
5329+
]
5330+
53215331
[[package]]
53225332
name = "time"
53235333
version = "0.1.43"
@@ -5665,12 +5675,17 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
56655675

56665676
[[package]]
56675677
name = "vergen"
5668-
version = "3.1.0"
5678+
version = "5.1.0"
56695679
source = "registry+https://github.com/rust-lang/crates.io-index"
5670-
checksum = "4ce50d8996df1f85af15f2cd8d33daae6e479575123ef4314a51a70a230739cb"
5680+
checksum = "dfbc87f9a7a9d61b15d51d1d3547284f67b6b4f1494ce3fc5814c101f35a5183"
56715681
dependencies = [
5672-
"bitflags",
5682+
"anyhow",
56735683
"chrono",
5684+
"enum-iterator",
5685+
"getset",
5686+
"git2",
5687+
"rustversion",
5688+
"thiserror",
56745689
]
56755690

56765691
[[package]]

compiler/rustc/Cargo.toml

+7-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ rustc_driver = { path = "../rustc_driver" }
1111
# crate is intended to be used by codegen backends, which may not be in-tree.
1212
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
1313

14-
[dependencies.jemalloc-sys]
15-
version = '0.3.0'
14+
[dependencies.tikv-jemalloc-sys]
15+
version = '0.4.0'
1616
optional = true
1717
features = ['unprefixed_malloc_on_supported_platforms']
1818

19+
[dependencies.tikv-jemallocator]
20+
version = '0.4.0'
21+
optional = true
22+
1923
[features]
20-
jemalloc = ['jemalloc-sys']
24+
jemalloc = ['tikv-jemalloc-sys', 'tikv-jemallocator']
2125
llvm = ['rustc_driver/llvm']
2226
max_level_info = ['rustc_driver/max_level_info']

compiler/rustc/src/main.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
// Configure jemalloc as the `global_allocator` when configured. This is
2+
// so that we use the sized deallocation apis jemalloc provides
3+
// (namely `sdallocx`).
4+
//
5+
// The symbol overrides documented below are also performed so that we can
6+
// ensure that we use a consistent allocator across the rustc <-> llvm boundary
7+
#[cfg(feature = "jemalloc")]
8+
#[global_allocator]
9+
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
10+
11+
#[cfg(feature = "tikv-jemalloc-sys")]
12+
use tikv_jemalloc_sys as jemalloc_sys;
13+
114
fn main() {
215
// Pull in jemalloc when enabled.
316
//
@@ -7,7 +20,7 @@ fn main() {
720
// dynamic libraries. That means to pull in jemalloc we actually need to
821
// reference allocation symbols one way or another (as this file is the only
922
// object code in the rustc executable).
10-
#[cfg(feature = "jemalloc-sys")]
23+
#[cfg(feature = "tikv-jemalloc-sys")]
1124
{
1225
use std::os::raw::{c_int, c_void};
1326

compiler/rustc_ast/src/tokenstream.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ impl<CTX> HashStable<CTX> for LazyTokenStream {
178178
/// The goal is for procedural macros to work with `TokenStream`s and `TokenTree`s
179179
/// instead of a representation of the abstract syntax tree.
180180
/// Today's `TokenTree`s can still contain AST via `token::Interpolated` for
181-
/// backwards compatability.
181+
/// backwards compatibility.
182182
#[derive(Clone, Debug, Default, Encodable, Decodable)]
183183
pub struct TokenStream(pub(crate) Lrc<Vec<TreeAndSpacing>>);
184184

compiler/rustc_attr/src/builtin.rs

+14-36
Original file line numberDiff line numberDiff line change
@@ -862,18 +862,6 @@ pub fn find_repr_attrs(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
862862
if let Some(items) = attr.meta_item_list() {
863863
sess.mark_attr_used(attr);
864864
for item in items {
865-
if !item.is_meta_item() {
866-
handle_errors(
867-
&sess.parse_sess,
868-
item.span(),
869-
AttrError::UnsupportedLiteral(
870-
"meta item in `repr` must be an identifier",
871-
false,
872-
),
873-
);
874-
continue;
875-
}
876-
877865
let mut recognised = false;
878866
if item.is_word() {
879867
let hint = match item.name_or_empty() {
@@ -890,23 +878,6 @@ pub fn find_repr_attrs(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
890878
acc.push(h);
891879
}
892880
} else if let Some((name, value)) = item.name_value_literal() {
893-
let parse_alignment = |node: &ast::LitKind| -> Result<u32, &'static str> {
894-
if let ast::LitKind::Int(literal, ast::LitIntType::Unsuffixed) = node {
895-
if literal.is_power_of_two() {
896-
// rustc_middle::ty::layout::Align restricts align to <= 2^29
897-
if *literal <= 1 << 29 {
898-
Ok(*literal as u32)
899-
} else {
900-
Err("larger than 2^29")
901-
}
902-
} else {
903-
Err("not a power of two")
904-
}
905-
} else {
906-
Err("not an unsuffixed integer")
907-
}
908-
};
909-
910881
let mut literal_error = None;
911882
if name == sym::align {
912883
recognised = true;
@@ -966,13 +937,7 @@ pub fn find_repr_attrs(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
966937
}
967938
if !recognised {
968939
// Not a word we recognize
969-
struct_span_err!(
970-
diagnostic,
971-
item.span(),
972-
E0552,
973-
"unrecognized representation hint"
974-
)
975-
.emit();
940+
diagnostic.delay_span_bug(item.span(), "unrecognized representation hint");
976941
}
977942
}
978943
}
@@ -1080,3 +1045,16 @@ fn allow_unstable<'a>(
10801045
name
10811046
})
10821047
}
1048+
1049+
pub fn parse_alignment(node: &ast::LitKind) -> Result<u32, &'static str> {
1050+
if let ast::LitKind::Int(literal, ast::LitIntType::Unsuffixed) = node {
1051+
if literal.is_power_of_two() {
1052+
// rustc_middle::ty::layout::Align restricts align to <= 2^29
1053+
if *literal <= 1 << 29 { Ok(*literal as u32) } else { Err("larger than 2^29") }
1054+
} else {
1055+
Err("not a power of two")
1056+
}
1057+
} else {
1058+
Err("not an unsuffixed integer")
1059+
}
1060+
}

compiler/rustc_codegen_llvm/src/attributes.rs

+4
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
254254
attributes::emit_uwtable(llfn, true);
255255
}
256256

257+
// FIXME: none of these three functions interact with source level attributes.
257258
set_frame_pointer_elimination(cx, llfn);
258259
set_instrument_function(cx, llfn);
259260
set_probestack(cx, llfn);
@@ -279,6 +280,9 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
279280
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::CMSE_NONSECURE_ENTRY) {
280281
llvm::AddFunctionAttrString(llfn, Function, cstr!("cmse_nonsecure_entry"));
281282
}
283+
if let Some(align) = codegen_fn_attrs.alignment {
284+
llvm::set_alignment(llfn, align as usize);
285+
}
282286
sanitize(cx, codegen_fn_attrs.no_sanitize, llfn);
283287

284288
// Always annotate functions with the target-cpu they are compiled for.

compiler/rustc_codegen_llvm/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ pub unsafe fn with_llvm_pmb(
10471047
// thresholds copied from clang.
10481048
match (opt_level, opt_size, inline_threshold) {
10491049
(.., Some(t)) => {
1050-
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, t as u32);
1050+
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, t);
10511051
}
10521052
(llvm::CodeGenOptLevel::Aggressive, ..) => {
10531053
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, 275);

0 commit comments

Comments
 (0)