Skip to content

Commit 0d225bc

Browse files
committed
Auto merge of #2780 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 6c8d407 + 8461c0e commit 0d225bc

File tree

440 files changed

+8438
-5491
lines changed

Some content is hidden

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

440 files changed

+8438
-5491
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
name: PR
3838
env:
3939
CI_JOB_NAME: "${{ matrix.name }}"
40+
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
4041
SCCACHE_BUCKET: rust-lang-ci-sccache2
4142
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
4243
CACHE_DOMAIN: ci-caches.rust-lang.org
@@ -162,6 +163,7 @@ jobs:
162163
name: auto
163164
env:
164165
CI_JOB_NAME: "${{ matrix.name }}"
166+
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
165167
SCCACHE_BUCKET: rust-lang-ci-sccache2
166168
DEPLOY_BUCKET: rust-lang-ci2
167169
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
@@ -584,6 +586,7 @@ jobs:
584586
name: try
585587
env:
586588
CI_JOB_NAME: "${{ matrix.name }}"
589+
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
587590
SCCACHE_BUCKET: rust-lang-ci-sccache2
588591
DEPLOY_BUCKET: rust-lang-ci2
589592
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ Eduard-Mihai Burtescu <edy.burt@gmail.com>
166166
Eduardo Bautista <me@eduardobautista.com> <=>
167167
Eduardo Bautista <me@eduardobautista.com> <mail@eduardobautista.com>
168168
Eduardo Broto <ebroto@tutanota.com>
169+
Edward Shen <code@eddie.sh> <xes@meta.com>
169170
Elliott Slaughter <elliottslaughter@gmail.com> <eslaughter@mozilla.com>
170171
Elly Fong-Jones <elly@leptoquark.net>
171172
Eric Holk <eric.holk@gmail.com> <eholk@cs.indiana.edu>

Cargo.lock

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3567,6 +3567,7 @@ dependencies = [
35673567
"jemalloc-sys",
35683568
"rustc_codegen_ssa",
35693569
"rustc_driver",
3570+
"rustc_driver_impl",
35703571
"rustc_smir",
35713572
]
35723573

@@ -3688,7 +3689,6 @@ dependencies = [
36883689
name = "rustc_ast_lowering"
36893690
version = "0.0.0"
36903691
dependencies = [
3691-
"rustc_arena",
36923692
"rustc_ast",
36933693
"rustc_ast_pretty",
36943694
"rustc_data_structures",
@@ -3697,7 +3697,6 @@ dependencies = [
36973697
"rustc_index",
36983698
"rustc_macros",
36993699
"rustc_middle",
3700-
"rustc_query_system",
37013700
"rustc_session",
37023701
"rustc_span",
37033702
"rustc_target",
@@ -3730,7 +3729,6 @@ name = "rustc_ast_pretty"
37303729
version = "0.0.0"
37313730
dependencies = [
37323731
"rustc_ast",
3733-
"rustc_parse_format",
37343732
"rustc_span",
37353733
]
37363734

@@ -3837,7 +3835,6 @@ dependencies = [
38373835
"rustc_metadata",
38383836
"rustc_middle",
38393837
"rustc_query_system",
3840-
"rustc_serialize",
38413838
"rustc_session",
38423839
"rustc_span",
38433840
"rustc_symbol_mangling",
@@ -3863,7 +3860,6 @@ dependencies = [
38633860
"rustc_arena",
38643861
"rustc_ast",
38653862
"rustc_attr",
3866-
"rustc_const_eval",
38673863
"rustc_data_structures",
38683864
"rustc_errors",
38693865
"rustc_fs_util",
@@ -3904,7 +3900,6 @@ dependencies = [
39043900
"rustc_macros",
39053901
"rustc_middle",
39063902
"rustc_mir_dataflow",
3907-
"rustc_query_system",
39083903
"rustc_session",
39093904
"rustc_span",
39103905
"rustc_target",
@@ -3946,6 +3941,13 @@ dependencies = [
39463941
[[package]]
39473942
name = "rustc_driver"
39483943
version = "0.0.0"
3944+
dependencies = [
3945+
"rustc_driver_impl",
3946+
]
3947+
3948+
[[package]]
3949+
name = "rustc_driver_impl"
3950+
version = "0.0.0"
39493951
dependencies = [
39503952
"libc",
39513953
"rustc_ast",
@@ -4092,15 +4094,12 @@ dependencies = [
40924094
"rustc_data_structures",
40934095
"rustc_errors",
40944096
"rustc_feature",
4095-
"rustc_graphviz",
40964097
"rustc_hir",
4097-
"rustc_hir_pretty",
40984098
"rustc_index",
40994099
"rustc_infer",
41004100
"rustc_lint",
41014101
"rustc_macros",
41024102
"rustc_middle",
4103-
"rustc_serialize",
41044103
"rustc_session",
41054104
"rustc_span",
41064105
"rustc_target",
@@ -4187,7 +4186,6 @@ dependencies = [
41874186
"rustc_macros",
41884187
"rustc_middle",
41894188
"rustc_serialize",
4190-
"rustc_session",
41914189
"rustc_span",
41924190
"rustc_target",
41934191
"smallvec",
@@ -4230,7 +4228,6 @@ dependencies = [
42304228
"rustc_privacy",
42314229
"rustc_query_impl",
42324230
"rustc_resolve",
4233-
"rustc_serialize",
42344231
"rustc_session",
42354232
"rustc_span",
42364233
"rustc_symbol_mangling",
@@ -4396,7 +4393,6 @@ dependencies = [
43964393
"rustc_apfloat",
43974394
"rustc_arena",
43984395
"rustc_ast",
4399-
"rustc_attr",
44004396
"rustc_data_structures",
44014397
"rustc_errors",
44024398
"rustc_hir",
@@ -4428,7 +4424,6 @@ dependencies = [
44284424
"rustc_macros",
44294425
"rustc_middle",
44304426
"rustc_serialize",
4431-
"rustc_session",
44324427
"rustc_span",
44334428
"rustc_target",
44344429
"smallvec",
@@ -4559,7 +4554,6 @@ dependencies = [
45594554
"rustc_middle",
45604555
"rustc_session",
45614556
"rustc_span",
4562-
"rustc_trait_selection",
45634557
"tracing",
45644558
]
45654559

@@ -4580,7 +4574,6 @@ dependencies = [
45804574
"rustc_serialize",
45814575
"rustc_session",
45824576
"rustc_span",
4583-
"rustc_target",
45844577
"thin-vec",
45854578
"tracing",
45864579
]
@@ -4781,7 +4774,6 @@ dependencies = [
47814774
"rustc_hir",
47824775
"rustc_index",
47834776
"rustc_infer",
4784-
"rustc_lint_defs",
47854777
"rustc_macros",
47864778
"rustc_middle",
47874779
"rustc_parse_format",
@@ -4803,7 +4795,6 @@ dependencies = [
48034795
"chalk-ir",
48044796
"chalk-solve",
48054797
"rustc_ast",
4806-
"rustc_attr",
48074798
"rustc_data_structures",
48084799
"rustc_hir",
48094800
"rustc_index",

compiler/rustc/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ edition = "2021"
55

66
[dependencies]
77
rustc_driver = { path = "../rustc_driver" }
8+
rustc_driver_impl = { path = "../rustc_driver_impl" }
89

910
# Make sure rustc_codegen_ssa ends up in the sysroot, because this
1011
# crate is intended to be used by codegen backends, which may not be in-tree.
@@ -20,6 +21,6 @@ features = ['unprefixed_malloc_on_supported_platforms']
2021

2122
[features]
2223
jemalloc = ['jemalloc-sys']
23-
llvm = ['rustc_driver/llvm']
24-
max_level_info = ['rustc_driver/max_level_info']
25-
rustc_use_parallel_compiler = ['rustc_driver/rustc_use_parallel_compiler']
24+
llvm = ['rustc_driver_impl/llvm']
25+
max_level_info = ['rustc_driver_impl/max_level_info']
26+
rustc_use_parallel_compiler = ['rustc_driver_impl/rustc_use_parallel_compiler']

compiler/rustc_abi/src/lib.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,21 +1439,12 @@ impl<V: Idx> fmt::Debug for LayoutS<V> {
14391439

14401440
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
14411441
pub enum PointerKind {
1442-
/// Most general case, we know no restrictions to tell LLVM.
1443-
SharedMutable,
1444-
1445-
/// `&T` where `T` contains no `UnsafeCell`, is `dereferenceable`, `noalias` and `readonly`.
1446-
Frozen,
1447-
1448-
/// `&mut T` which is `dereferenceable` and `noalias` but not `readonly`.
1449-
UniqueBorrowed,
1450-
1451-
/// `&mut !Unpin`, which is `dereferenceable` but neither `noalias` nor `readonly`.
1452-
UniqueBorrowedPinned,
1453-
1454-
/// `Box<T>`, which is `noalias` (even on return types, unlike the above) but neither `readonly`
1455-
/// nor `dereferenceable`.
1456-
UniqueOwned,
1442+
/// Shared reference. `frozen` indicates the absence of any `UnsafeCell`.
1443+
SharedRef { frozen: bool },
1444+
/// Mutable reference. `unpin` indicates the absence of any pinned data.
1445+
MutableRef { unpin: bool },
1446+
/// Box. `unpin` indicates the absence of any pinned data.
1447+
Box { unpin: bool },
14571448
}
14581449

14591450
/// Note that this information is advisory only, and backends are free to ignore it.

compiler/rustc_ast/src/ast.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,6 +1826,13 @@ pub enum LitKind {
18261826
}
18271827

18281828
impl LitKind {
1829+
pub fn str(&self) -> Option<Symbol> {
1830+
match *self {
1831+
LitKind::Str(s, _) => Some(s),
1832+
_ => None,
1833+
}
1834+
}
1835+
18291836
/// Returns `true` if this literal is a string.
18301837
pub fn is_str(&self) -> bool {
18311838
matches!(self, LitKind::Str(..))

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,14 @@ impl Attribute {
140140

141141
pub fn value_str(&self) -> Option<Symbol> {
142142
match &self.kind {
143-
AttrKind::Normal(normal) => normal.item.meta_kind().and_then(|kind| kind.value_str()),
143+
AttrKind::Normal(normal) => normal.item.value_str(),
144144
AttrKind::DocComment(..) => None,
145145
}
146146
}
147147

148148
pub fn meta_item_list(&self) -> Option<Vec<NestedMetaItem>> {
149149
match &self.kind {
150-
AttrKind::Normal(normal) => match normal.item.meta_kind() {
151-
Some(MetaItemKind::List(list)) => Some(list),
152-
_ => None,
153-
},
150+
AttrKind::Normal(normal) => normal.item.meta_item_list(),
154151
AttrKind::DocComment(..) => None,
155152
}
156153
}
@@ -216,6 +213,20 @@ impl MetaItem {
216213
}
217214
}
218215

216+
impl AttrArgsEq {
217+
fn value_str(&self) -> Option<Symbol> {
218+
match self {
219+
AttrArgsEq::Ast(expr) => match expr.kind {
220+
ExprKind::Lit(token_lit) => {
221+
LitKind::from_token_lit(token_lit).ok().and_then(|lit| lit.str())
222+
}
223+
_ => None,
224+
},
225+
AttrArgsEq::Hir(lit) => lit.kind.str(),
226+
}
227+
}
228+
}
229+
219230
impl AttrItem {
220231
pub fn span(&self) -> Span {
221232
self.args.span().map_or(self.path.span, |args_span| self.path.span.to(args_span))
@@ -228,6 +239,22 @@ impl AttrItem {
228239
pub fn meta_kind(&self) -> Option<MetaItemKind> {
229240
MetaItemKind::from_attr_args(&self.args)
230241
}
242+
243+
fn meta_item_list(&self) -> Option<Vec<NestedMetaItem>> {
244+
match &self.args {
245+
AttrArgs::Delimited(args) if args.delim == MacDelimiter::Parenthesis => {
246+
MetaItemKind::list_from_tokens(args.tokens.clone())
247+
}
248+
AttrArgs::Delimited(_) | AttrArgs::Eq(..) | AttrArgs::Empty => None,
249+
}
250+
}
251+
252+
fn value_str(&self) -> Option<Symbol> {
253+
match &self.args {
254+
AttrArgs::Eq(_, args) => args.value_str(),
255+
AttrArgs::Delimited(_) | AttrArgs::Empty => None,
256+
}
257+
}
231258
}
232259

233260
impl Attribute {
@@ -247,13 +274,11 @@ impl Attribute {
247274
/// * `#[doc = "doc"]` returns `Some(("doc", CommentKind::Line))`.
248275
/// * `#[doc(...)]` returns `None`.
249276
pub fn doc_str_and_comment_kind(&self) -> Option<(Symbol, CommentKind)> {
250-
match self.kind {
251-
AttrKind::DocComment(kind, data) => Some((data, kind)),
252-
AttrKind::Normal(ref normal) if normal.item.path == sym::doc => normal
253-
.item
254-
.meta_kind()
255-
.and_then(|kind| kind.value_str())
256-
.map(|data| (data, CommentKind::Line)),
277+
match &self.kind {
278+
AttrKind::DocComment(kind, data) => Some((*data, *kind)),
279+
AttrKind::Normal(normal) if normal.item.path == sym::doc => {
280+
normal.item.value_str().map(|s| (s, CommentKind::Line))
281+
}
257282
_ => None,
258283
}
259284
}
@@ -265,9 +290,7 @@ impl Attribute {
265290
pub fn doc_str(&self) -> Option<Symbol> {
266291
match &self.kind {
267292
AttrKind::DocComment(.., data) => Some(*data),
268-
AttrKind::Normal(normal) if normal.item.path == sym::doc => {
269-
normal.item.meta_kind().and_then(|kind| kind.value_str())
270-
}
293+
AttrKind::Normal(normal) if normal.item.path == sym::doc => normal.item.value_str(),
271294
_ => None,
272295
}
273296
}
@@ -508,15 +531,12 @@ impl MetaItem {
508531
impl MetaItemKind {
509532
pub fn value_str(&self) -> Option<Symbol> {
510533
match self {
511-
MetaItemKind::NameValue(v) => match v.kind {
512-
LitKind::Str(s, _) => Some(s),
513-
_ => None,
514-
},
534+
MetaItemKind::NameValue(v) => v.kind.str(),
515535
_ => None,
516536
}
517537
}
518538

519-
fn list_from_tokens(tokens: TokenStream) -> Option<MetaItemKind> {
539+
fn list_from_tokens(tokens: TokenStream) -> Option<Vec<NestedMetaItem>> {
520540
let mut tokens = tokens.into_trees().peekable();
521541
let mut result = Vec::new();
522542
while tokens.peek().is_some() {
@@ -527,7 +547,7 @@ impl MetaItemKind {
527547
_ => return None,
528548
}
529549
}
530-
Some(MetaItemKind::List(result))
550+
Some(result)
531551
}
532552

533553
fn name_value_from_tokens(
@@ -551,7 +571,7 @@ impl MetaItemKind {
551571
dspan: _,
552572
delim: MacDelimiter::Parenthesis,
553573
tokens,
554-
}) => MetaItemKind::list_from_tokens(tokens.clone()),
574+
}) => MetaItemKind::list_from_tokens(tokens.clone()).map(MetaItemKind::List),
555575
AttrArgs::Delimited(..) => None,
556576
AttrArgs::Eq(_, AttrArgsEq::Ast(expr)) => match expr.kind {
557577
ExprKind::Lit(token_lit) => {
@@ -573,7 +593,7 @@ impl MetaItemKind {
573593
Some(TokenTree::Delimited(_, Delimiter::Parenthesis, inner_tokens)) => {
574594
let inner_tokens = inner_tokens.clone();
575595
tokens.next();
576-
MetaItemKind::list_from_tokens(inner_tokens)
596+
MetaItemKind::list_from_tokens(inner_tokens).map(MetaItemKind::List)
577597
}
578598
Some(TokenTree::Delimited(..)) => None,
579599
Some(TokenTree::Token(Token { kind: token::Eq, .. }, _)) => {

0 commit comments

Comments
 (0)