Skip to content

Commit 840f227

Browse files
committed
Auto merge of #2712 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 7d75cc4 + 29814f2 commit 840f227

File tree

728 files changed

+10507
-7117
lines changed

Some content is hidden

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

728 files changed

+10507
-7117
lines changed

.mailmap

+12-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Björn Steinbrink <bsteinbr@gmail.com> <B.Steinbrink@gmx.de>
7373
blake2-ppc <ulrik.sverdrup@gmail.com> <blake2-ppc>
7474
boolean_coercion <booleancoercion@gmail.com>
7575
Boris Egorov <jightuse@gmail.com> <egorov@linux.com>
76+
bors <bors@rust-lang.org> bors[bot] <26634292+bors[bot]@users.noreply.github.com>
77+
bors <bors@rust-lang.org> bors[bot] <bors[bot]@users.noreply.github.com>
7678
Braden Nelson <moonheart08@users.noreply.github.com>
7779
Brandon Sanderson <singingboyo@gmail.com> Brandon Sanderson <singingboyo@hotmail.com>
7880
Brett Cannon <brett@python.org> Brett Cannon <brettcannon@users.noreply.github.com>
@@ -139,6 +141,10 @@ David Ross <daboross@daboross.net>
139141
David Wood <david@davidtw.co> <david.wood@huawei.com>
140142
Deadbeef <ent3rm4n@gmail.com>
141143
Deadbeef <ent3rm4n@gmail.com> <fee1-dead-beef@protonmail.com>
144+
dependabot[bot] <dependabot[bot]@users.noreply.github.com> <27856297+dependabot-preview[bot]@users.noreply.github.com>
145+
dependabot[bot] <dependabot[bot]@users.noreply.github.com> <49699333+dependabot[bot]@users.noreply.github.com>
146+
dependabot[bot] <dependabot[bot]@users.noreply.github.com> <dependabot-preview[bot]@users.noreply.github.com>
147+
dependabot[bot] <dependabot[bot]@users.noreply.github.com> <support@dependabot.com>
142148
Derek Chiang <derekchiang93@gmail.com> Derek Chiang (Enchi Jiang) <derekchiang93@gmail.com>
143149
DeveloperC <DeveloperC@protonmail.com>
144150
Devin Ragotzy <devin.ragotzy@gmail.com>
@@ -229,7 +235,7 @@ Jacob <jacob.macritchie@gmail.com>
229235
Jacob Greenfield <xales@naveria.com>
230236
Jacob Pratt <jacob@jhpratt.dev> <the.z.cuber@gmail.com>
231237
Jake Vossen <jake@vossen.dev>
232-
Jakob Degen <jakob@degen.com>
238+
Jakob Degen <jakob.e.degen@gmail.com> <jakob@degen.com>
233239
Jakob Lautrup Nysom <jako3047@gmail.com>
234240
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com>
235241
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub.bukaj@yahoo.com>
@@ -396,6 +402,10 @@ Nathaniel Herman <nherman@post.harvard.edu> Nathaniel Herman <nherman@college.ha
396402
Neil Pankey <npankey@gmail.com> <neil@wire.im>
397403
Ngo Iok Ui (Wu Yu Wei) <wusyong9104@gmail.com>
398404
Nicholas Baron <nicholas.baron.ten@gmail.com>
405+
Nicholas Bishop <nbishop@nbishop.net> <nicholasbishop@gmail.com>
406+
Nicholas Bishop <nbishop@nbishop.net> <nicholasbishop@google.com>
407+
Nicholas Nethercote <n.nethercote@gmail.com> <nnethercote@apple.com>
408+
Nicholas Nethercote <n.nethercote@gmail.com> <nnethercote@mozilla.com>
399409
Nick Platt <platt.nicholas@gmail.com>
400410
Niclas Schwarzlose <15schnic@gmail.com>
401411
Nicolas Abram <abramlujan@gmail.com>
@@ -522,6 +532,7 @@ Tomas Koutsky <tomas@stepnivlk.net>
522532
Torsten Weber <TorstenWeber12@gmail.com>
523533
Torsten Weber <TorstenWeber12@gmail.com> <torstenweber12@gmail.com>
524534
Trevor Spiteri <tspiteri@ieee.org> <trevor.spiteri@um.edu.mt>
535+
Tshepang Mbambo <tshepang@gmail.com>
525536
Ty Overby <ty@pre-alpha.com>
526537
Tyler Mandry <tmandry@gmail.com> <tmandry@google.com>
527538
Tyler Ruckinger <t.ruckinger@gmail.com>

Cargo.lock

+99-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ name = "cargo"
288288
version = "0.68.0"
289289
dependencies = [
290290
"anyhow",
291-
"atty",
292291
"bytesize",
293292
"cargo-platform 0.1.2",
294293
"cargo-test-macro",
@@ -298,7 +297,7 @@ dependencies = [
298297
"crates-io",
299298
"curl",
300299
"curl-sys",
301-
"env_logger 0.9.0",
300+
"env_logger 0.10.0",
302301
"filetime",
303302
"flate2",
304303
"fwdansi",
@@ -312,6 +311,7 @@ dependencies = [
312311
"ignore",
313312
"im-rc",
314313
"indexmap",
314+
"is-terminal",
315315
"itertools",
316316
"jobserver",
317317
"lazy_static",
@@ -870,6 +870,12 @@ dependencies = [
870870
"memchr",
871871
]
872872

873+
[[package]]
874+
name = "convert_case"
875+
version = "0.4.0"
876+
source = "registry+https://github.com/rust-lang/crates.io-index"
877+
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
878+
873879
[[package]]
874880
name = "core"
875881
version = "0.0.0"
@@ -1060,6 +1066,19 @@ dependencies = [
10601066
"syn",
10611067
]
10621068

1069+
[[package]]
1070+
name = "derive_more"
1071+
version = "0.99.17"
1072+
source = "registry+https://github.com/rust-lang/crates.io-index"
1073+
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
1074+
dependencies = [
1075+
"convert_case",
1076+
"proc-macro2",
1077+
"quote",
1078+
"rustc_version",
1079+
"syn",
1080+
]
1081+
10631082
[[package]]
10641083
name = "diff"
10651084
version = "0.1.13"
@@ -1213,6 +1232,40 @@ dependencies = [
12131232
"termcolor",
12141233
]
12151234

1235+
[[package]]
1236+
name = "env_logger"
1237+
version = "0.10.0"
1238+
source = "registry+https://github.com/rust-lang/crates.io-index"
1239+
checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
1240+
dependencies = [
1241+
"humantime 2.0.1",
1242+
"is-terminal",
1243+
"log",
1244+
"regex",
1245+
"termcolor",
1246+
]
1247+
1248+
[[package]]
1249+
name = "errno"
1250+
version = "0.2.8"
1251+
source = "registry+https://github.com/rust-lang/crates.io-index"
1252+
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
1253+
dependencies = [
1254+
"errno-dragonfly",
1255+
"libc",
1256+
"winapi",
1257+
]
1258+
1259+
[[package]]
1260+
name = "errno-dragonfly"
1261+
version = "0.1.2"
1262+
source = "registry+https://github.com/rust-lang/crates.io-index"
1263+
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
1264+
dependencies = [
1265+
"cc",
1266+
"libc",
1267+
]
1268+
12161269
[[package]]
12171270
name = "error_index_generator"
12181271
version = "0.0.0"
@@ -1907,6 +1960,28 @@ dependencies = [
19071960
"unic-langid",
19081961
]
19091962

1963+
[[package]]
1964+
name = "io-lifetimes"
1965+
version = "1.0.2"
1966+
source = "registry+https://github.com/rust-lang/crates.io-index"
1967+
checksum = "e394faa0efb47f9f227f1cd89978f854542b318a6f64fa695489c9c993056656"
1968+
dependencies = [
1969+
"libc",
1970+
"windows-sys",
1971+
]
1972+
1973+
[[package]]
1974+
name = "is-terminal"
1975+
version = "0.4.0"
1976+
source = "registry+https://github.com/rust-lang/crates.io-index"
1977+
checksum = "aae5bc6e2eb41c9def29a3e0f1306382807764b9b53112030eff57435667352d"
1978+
dependencies = [
1979+
"hermit-abi 0.2.6",
1980+
"io-lifetimes",
1981+
"rustix",
1982+
"windows-sys",
1983+
]
1984+
19101985
[[package]]
19111986
name = "itertools"
19121987
version = "0.10.5"
@@ -2116,6 +2191,12 @@ dependencies = [
21162191
"walkdir",
21172192
]
21182193

2194+
[[package]]
2195+
name = "linux-raw-sys"
2196+
version = "0.1.3"
2197+
source = "registry+https://github.com/rust-lang/crates.io-index"
2198+
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
2199+
21192200
[[package]]
21202201
name = "litemap"
21212202
version = "0.6.0"
@@ -3193,6 +3274,7 @@ version = "1.0.0"
31933274
dependencies = [
31943275
"bstr 0.2.17",
31953276
"clap 3.2.20",
3277+
"libc",
31963278
"libz-sys",
31973279
"rand 0.8.5",
31983280
"regex",
@@ -3916,6 +3998,7 @@ version = "0.0.0"
39163998
dependencies = [
39173999
"bitflags",
39184000
"chalk-ir",
4001+
"derive_more",
39194002
"either",
39204003
"gsgdt",
39214004
"polonius-engine",
@@ -4508,6 +4591,20 @@ dependencies = [
45084591
"unicode_categories",
45094592
]
45104593

4594+
[[package]]
4595+
name = "rustix"
4596+
version = "0.36.3"
4597+
source = "registry+https://github.com/rust-lang/crates.io-index"
4598+
checksum = "0b1fbb4dfc4eb1d390c02df47760bb19a84bb80b301ecc947ab5406394d8223e"
4599+
dependencies = [
4600+
"bitflags",
4601+
"errno",
4602+
"io-lifetimes",
4603+
"libc",
4604+
"linux-raw-sys",
4605+
"windows-sys",
4606+
]
4607+
45114608
[[package]]
45124609
name = "rustversion"
45134610
version = "1.0.5"

compiler/rustc_abi/src/lib.rs

+96
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,102 @@ pub enum TargetDataLayoutErrors<'a> {
211211
}
212212

213213
impl TargetDataLayout {
214+
/// Parse data layout from an [llvm data layout string](https://llvm.org/docs/LangRef.html#data-layout)
215+
///
216+
/// This function doesn't fill `c_enum_min_size` and it will always be `I32` since it can not be
217+
/// determined from llvm string.
218+
pub fn parse_from_llvm_datalayout_string<'a>(
219+
input: &'a str,
220+
) -> Result<TargetDataLayout, TargetDataLayoutErrors<'a>> {
221+
// Parse an address space index from a string.
222+
let parse_address_space = |s: &'a str, cause: &'a str| {
223+
s.parse::<u32>().map(AddressSpace).map_err(|err| {
224+
TargetDataLayoutErrors::InvalidAddressSpace { addr_space: s, cause, err }
225+
})
226+
};
227+
228+
// Parse a bit count from a string.
229+
let parse_bits = |s: &'a str, kind: &'a str, cause: &'a str| {
230+
s.parse::<u64>().map_err(|err| TargetDataLayoutErrors::InvalidBits {
231+
kind,
232+
bit: s,
233+
cause,
234+
err,
235+
})
236+
};
237+
238+
// Parse a size string.
239+
let size = |s: &'a str, cause: &'a str| parse_bits(s, "size", cause).map(Size::from_bits);
240+
241+
// Parse an alignment string.
242+
let align = |s: &[&'a str], cause: &'a str| {
243+
if s.is_empty() {
244+
return Err(TargetDataLayoutErrors::MissingAlignment { cause });
245+
}
246+
let align_from_bits = |bits| {
247+
Align::from_bits(bits)
248+
.map_err(|err| TargetDataLayoutErrors::InvalidAlignment { cause, err })
249+
};
250+
let abi = parse_bits(s[0], "alignment", cause)?;
251+
let pref = s.get(1).map_or(Ok(abi), |pref| parse_bits(pref, "alignment", cause))?;
252+
Ok(AbiAndPrefAlign { abi: align_from_bits(abi)?, pref: align_from_bits(pref)? })
253+
};
254+
255+
let mut dl = TargetDataLayout::default();
256+
let mut i128_align_src = 64;
257+
for spec in input.split('-') {
258+
let spec_parts = spec.split(':').collect::<Vec<_>>();
259+
260+
match &*spec_parts {
261+
["e"] => dl.endian = Endian::Little,
262+
["E"] => dl.endian = Endian::Big,
263+
[p] if p.starts_with('P') => {
264+
dl.instruction_address_space = parse_address_space(&p[1..], "P")?
265+
}
266+
["a", ref a @ ..] => dl.aggregate_align = align(a, "a")?,
267+
["f32", ref a @ ..] => dl.f32_align = align(a, "f32")?,
268+
["f64", ref a @ ..] => dl.f64_align = align(a, "f64")?,
269+
[p @ "p", s, ref a @ ..] | [p @ "p0", s, ref a @ ..] => {
270+
dl.pointer_size = size(s, p)?;
271+
dl.pointer_align = align(a, p)?;
272+
}
273+
[s, ref a @ ..] if s.starts_with('i') => {
274+
let Ok(bits) = s[1..].parse::<u64>() else {
275+
size(&s[1..], "i")?; // For the user error.
276+
continue;
277+
};
278+
let a = align(a, s)?;
279+
match bits {
280+
1 => dl.i1_align = a,
281+
8 => dl.i8_align = a,
282+
16 => dl.i16_align = a,
283+
32 => dl.i32_align = a,
284+
64 => dl.i64_align = a,
285+
_ => {}
286+
}
287+
if bits >= i128_align_src && bits <= 128 {
288+
// Default alignment for i128 is decided by taking the alignment of
289+
// largest-sized i{64..=128}.
290+
i128_align_src = bits;
291+
dl.i128_align = a;
292+
}
293+
}
294+
[s, ref a @ ..] if s.starts_with('v') => {
295+
let v_size = size(&s[1..], "v")?;
296+
let a = align(a, s)?;
297+
if let Some(v) = dl.vector_align.iter_mut().find(|v| v.0 == v_size) {
298+
v.1 = a;
299+
continue;
300+
}
301+
// No existing entry, add a new one.
302+
dl.vector_align.push((v_size, a));
303+
}
304+
_ => {} // Ignore everything else.
305+
}
306+
}
307+
Ok(dl)
308+
}
309+
214310
/// Returns exclusive upper bound on object size.
215311
///
216312
/// The theoretical maximum object size is defined as the maximum positive `isize` value.

0 commit comments

Comments
 (0)