Skip to content

Commit 4643e33

Browse files
celinvaltedinski
authored andcommitted
Merge rustc into rmc - 2021 week 39 (rust-lang#502)
Conflicts: compiler/rustc_driver/src/lib.rs src/llvm-project (sub-module) src/tools/cargo (sub-module) src/tools/rust-analyzer (sub-module) Updates required: modified: compiler/rustc_codegen_rmc/src/compiler_interface.rs modified: compiler/rustc_codegen_rmc/src/context/goto_ctx.rs modified: compiler/rustc_codegen_rmc/src/overrides/stubs/rust_stubber.rs modified: compiler/rustc_monomorphize/src/collector.rs modified: src/test/rmc/Enum/result3.rs Note: We added a loop unwind option to rmc/Enum/result3.rs test. The merge uncovered an issue, filed here: rust-lang#540.
1 parent 0a8aa64 commit 4643e33

File tree

757 files changed

+20671
-4545
lines changed

Some content is hidden

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

757 files changed

+20671
-4545
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
[submodule "src/llvm-project"]
3535
path = src/llvm-project
3636
url = https://github.com/rust-lang/llvm-project.git
37-
branch = rustc/13.0-2021-08-08
37+
branch = rustc/13.0-2021-09-30
3838
[submodule "src/doc/embedded-book"]
3939
path = src/doc/embedded-book
4040
url = https://github.com/rust-embedded/book.git

Cargo.lock

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ version = "0.1.0"
370370
dependencies = [
371371
"directories",
372372
"rustc-workspace-hack",
373-
"rustc_version",
373+
"rustc_version 0.3.3",
374374
"serde",
375375
"serde_json",
376376
"vergen",
@@ -1143,19 +1143,6 @@ dependencies = [
11431143
"termcolor",
11441144
]
11451145

1146-
[[package]]
1147-
name = "env_logger"
1148-
version = "0.8.1"
1149-
source = "registry+https://github.com/rust-lang/crates.io-index"
1150-
checksum = "54532e3223c5af90a6a757c90b5c5521564b07e5e7a958681bcd2afad421cdcd"
1151-
dependencies = [
1152-
"atty",
1153-
"humantime 2.0.1",
1154-
"log",
1155-
"regex",
1156-
"termcolor",
1157-
]
1158-
11591146
[[package]]
11601147
name = "env_logger"
11611148
version = "0.9.0"
@@ -1711,7 +1698,7 @@ checksum = "3ca8957e71f04a205cb162508f9326aea04676c8dfd0711220190d6b83664f3f"
17111698
dependencies = [
17121699
"bitmaps",
17131700
"rand_core 0.5.1",
1714-
"rand_xoshiro",
1701+
"rand_xoshiro 0.4.0",
17151702
"sized-chunks",
17161703
"typenum",
17171704
"version_check",
@@ -2301,15 +2288,15 @@ version = "0.1.0"
23012288
dependencies = [
23022289
"colored",
23032290
"compiletest_rs",
2304-
"env_logger 0.8.1",
2291+
"env_logger 0.9.0",
23052292
"getrandom 0.2.0",
23062293
"hex 0.4.2",
23072294
"libc",
23082295
"log",
23092296
"measureme",
2310-
"rand 0.8.3",
2297+
"rand 0.8.4",
23112298
"rustc-workspace-hack",
2312-
"rustc_version",
2299+
"rustc_version 0.4.0",
23132300
"shell-escape",
23142301
"smallvec",
23152302
]
@@ -2960,9 +2947,9 @@ dependencies = [
29602947

29612948
[[package]]
29622949
name = "rand"
2963-
version = "0.8.3"
2950+
version = "0.8.4"
29642951
source = "registry+https://github.com/rust-lang/crates.io-index"
2965-
checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
2952+
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
29662953
dependencies = [
29672954
"libc",
29682955
"rand_chacha 0.3.0",
@@ -3053,6 +3040,15 @@ dependencies = [
30533040
"rand_core 0.5.1",
30543041
]
30553042

3043+
[[package]]
3044+
name = "rand_xoshiro"
3045+
version = "0.6.0"
3046+
source = "registry+https://github.com/rust-lang/crates.io-index"
3047+
checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
3048+
dependencies = [
3049+
"rand_core 0.6.2",
3050+
]
3051+
30563052
[[package]]
30573053
name = "rayon"
30583054
version = "1.3.1"
@@ -3783,6 +3779,7 @@ dependencies = [
37833779
"rustc_llvm",
37843780
"rustc_metadata",
37853781
"rustc_middle",
3782+
"rustc_query_system",
37863783
"rustc_serialize",
37873784
"rustc_session",
37883785
"rustc_span",
@@ -3846,7 +3843,9 @@ dependencies = [
38463843
"rustc_incremental",
38473844
"rustc_index",
38483845
"rustc_macros",
3846+
"rustc_metadata",
38493847
"rustc_middle",
3848+
"rustc_query_system",
38503849
"rustc_serialize",
38513850
"rustc_session",
38523851
"rustc_span",
@@ -3874,6 +3873,7 @@ dependencies = [
38743873
"rustc_macros",
38753874
"rustc_middle",
38763875
"rustc_mir_dataflow",
3876+
"rustc_query_system",
38773877
"rustc_session",
38783878
"rustc_span",
38793879
"rustc_target",
@@ -4227,6 +4227,8 @@ dependencies = [
42274227
"either",
42284228
"gsgdt",
42294229
"polonius-engine",
4230+
"rand 0.8.4",
4231+
"rand_xoshiro 0.6.0",
42304232
"rustc-rayon-core",
42314233
"rustc_apfloat",
42324234
"rustc_arena",
@@ -4307,6 +4309,7 @@ dependencies = [
43074309
"rustc_index",
43084310
"rustc_middle",
43094311
"rustc_mir_dataflow",
4312+
"rustc_query_system",
43104313
"rustc_serialize",
43114314
"rustc_session",
43124315
"rustc_span",
@@ -4437,13 +4440,17 @@ dependencies = [
44374440
"parking_lot",
44384441
"rustc-rayon-core",
44394442
"rustc_arena",
4443+
"rustc_ast",
44404444
"rustc_data_structures",
44414445
"rustc_errors",
4446+
"rustc_feature",
4447+
"rustc_hir",
44424448
"rustc_index",
44434449
"rustc_macros",
44444450
"rustc_serialize",
44454451
"rustc_session",
44464452
"rustc_span",
4453+
"rustc_target",
44474454
"smallvec",
44484455
"tracing",
44494456
]
@@ -4511,6 +4518,7 @@ dependencies = [
45114518
"rustc_errors",
45124519
"rustc_feature",
45134520
"rustc_fs_util",
4521+
"rustc_hir",
45144522
"rustc_lint_defs",
45154523
"rustc_macros",
45164524
"rustc_serialize",
@@ -4546,6 +4554,7 @@ dependencies = [
45464554
"rustc_data_structures",
45474555
"rustc_hir",
45484556
"rustc_middle",
4557+
"rustc_query_system",
45494558
"rustc_session",
45504559
"rustc_span",
45514560
"rustc_target",
@@ -4589,6 +4598,7 @@ dependencies = [
45894598
"rustc_macros",
45904599
"rustc_middle",
45914600
"rustc_parse_format",
4601+
"rustc_query_system",
45924602
"rustc_session",
45934603
"rustc_span",
45944604
"rustc_target",
@@ -4677,6 +4687,15 @@ dependencies = [
46774687
"semver 0.11.0",
46784688
]
46794689

4690+
[[package]]
4691+
name = "rustc_version"
4692+
version = "0.4.0"
4693+
source = "registry+https://github.com/rust-lang/crates.io-index"
4694+
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
4695+
dependencies = [
4696+
"semver 1.0.3",
4697+
]
4698+
46804699
[[package]]
46814700
name = "rustdoc"
46824701
version = "0.0.0"
@@ -5037,9 +5056,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
50375056

50385057
[[package]]
50395058
name = "smallvec"
5040-
version = "1.6.1"
5059+
version = "1.7.0"
50415060
source = "registry+https://github.com/rust-lang/crates.io-index"
5042-
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
5061+
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
50435062

50445063
[[package]]
50455064
name = "snap"
@@ -5237,7 +5256,7 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
52375256
dependencies = [
52385257
"cfg-if 1.0.0",
52395258
"libc",
5240-
"rand 0.8.3",
5259+
"rand 0.8.4",
52415260
"redox_syscall",
52425261
"remove_dir_all",
52435262
"winapi",
@@ -5486,9 +5505,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
54865505

54875506
[[package]]
54885507
name = "tracing"
5489-
version = "0.1.25"
5508+
version = "0.1.28"
54905509
source = "registry+https://github.com/rust-lang/crates.io-index"
5491-
checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f"
5510+
checksum = "84f96e095c0c82419687c20ddf5cb3eadb61f4e1405923c9dc8e53a1adacbda8"
54925511
dependencies = [
54935512
"cfg-if 1.0.0",
54945513
"pin-project-lite",
@@ -5498,9 +5517,9 @@ dependencies = [
54985517

54995518
[[package]]
55005519
name = "tracing-attributes"
5501-
version = "0.1.13"
5520+
version = "0.1.17"
55025521
source = "registry+https://github.com/rust-lang/crates.io-index"
5503-
checksum = "a8a9bd1db7706f2373a190b0d067146caa39350c486f3d455b0e33b431f94c07"
5522+
checksum = "c4f915eb6abf914599c200260efced9203504c4c37380af10cdf3b7d36970650"
55045523
dependencies = [
55055524
"proc-macro2",
55065525
"quote",
@@ -5509,9 +5528,9 @@ dependencies = [
55095528

55105529
[[package]]
55115530
name = "tracing-core"
5512-
version = "0.1.17"
5531+
version = "0.1.21"
55135532
source = "registry+https://github.com/rust-lang/crates.io-index"
5514-
checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f"
5533+
checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4"
55155534
dependencies = [
55165535
"lazy_static",
55175536
]

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ members = [
4242
exclude = [
4343
"build",
4444
"compiler/rustc_codegen_cranelift",
45+
"compiler/rustc_codegen_gcc",
4546
"src/test/rustdoc-gui",
4647
# HACK(eddyb) This hardcodes the fact that our CI uses `/checkout/obj`.
4748
"obj",

compiler/rustc_ast/src/ast.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,8 @@ impl Expr {
12111211
}
12121212
}
12131213

1214+
ExprKind::Underscore => TyKind::Infer,
1215+
12141216
// This expression doesn't look like a type syntactically.
12151217
_ => return None,
12161218
};

compiler/rustc_ast/src/token.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ impl TokenKind {
295295
match *self {
296296
Comma => Some(vec![Dot, Lt, Semi]),
297297
Semi => Some(vec![Colon, Comma]),
298+
FatArrow => Some(vec![Eq, RArrow]),
298299
_ => None,
299300
}
300301
}

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
100100
ExprKind::If(ref cond, ref then, ref else_opt) => {
101101
self.lower_expr_if(cond, then, else_opt.as_deref())
102102
}
103-
ExprKind::While(ref cond, ref body, opt_label) => self
104-
.with_loop_scope(e.id, |this| {
105-
this.lower_expr_while_in_loop_scope(e.span, cond, body, opt_label)
106-
}),
103+
ExprKind::While(ref cond, ref body, opt_label) => {
104+
self.with_loop_scope(e.id, |this| {
105+
let span =
106+
this.mark_span_with_reason(DesugaringKind::WhileLoop, e.span, None);
107+
this.lower_expr_while_in_loop_scope(span, cond, body, opt_label)
108+
})
109+
}
107110
ExprKind::Loop(ref body, opt_label) => self.with_loop_scope(e.id, |this| {
108111
hir::ExprKind::Loop(
109112
this.lower_block(body, false),

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,32 +1328,45 @@ impl<'hir> LoweringContext<'_, 'hir> {
13281328
// keep track of the Span info. Now, `add_implicitly_sized` in `AstConv` checks both param bounds and
13291329
// where clauses for `?Sized`.
13301330
for pred in &generics.where_clause.predicates {
1331-
if let WherePredicate::BoundPredicate(ref bound_pred) = *pred {
1332-
'next_bound: for bound in &bound_pred.bounds {
1333-
if let GenericBound::Trait(_, TraitBoundModifier::Maybe) = *bound {
1334-
// Check if the where clause type is a plain type parameter.
1335-
match self
1336-
.resolver
1337-
.get_partial_res(bound_pred.bounded_ty.id)
1338-
.map(|d| (d.base_res(), d.unresolved_segments()))
1339-
{
1340-
Some((Res::Def(DefKind::TyParam, def_id), 0))
1341-
if bound_pred.bound_generic_params.is_empty() =>
1342-
{
1343-
for param in &generics.params {
1344-
if def_id == self.resolver.local_def_id(param.id).to_def_id() {
1345-
continue 'next_bound;
1346-
}
1347-
}
1348-
}
1349-
_ => {}
1350-
}
1351-
self.diagnostic().span_err(
1352-
bound_pred.bounded_ty.span,
1353-
"`?Trait` bounds are only permitted at the \
1354-
point where a type parameter is declared",
1355-
);
1331+
let bound_pred = match *pred {
1332+
WherePredicate::BoundPredicate(ref bound_pred) => bound_pred,
1333+
_ => continue,
1334+
};
1335+
let compute_is_param = || {
1336+
// Check if the where clause type is a plain type parameter.
1337+
match self
1338+
.resolver
1339+
.get_partial_res(bound_pred.bounded_ty.id)
1340+
.map(|d| (d.base_res(), d.unresolved_segments()))
1341+
{
1342+
Some((Res::Def(DefKind::TyParam, def_id), 0))
1343+
if bound_pred.bound_generic_params.is_empty() =>
1344+
{
1345+
generics
1346+
.params
1347+
.iter()
1348+
.find(|p| def_id == self.resolver.local_def_id(p.id).to_def_id())
1349+
.is_some()
13561350
}
1351+
// Either the `bounded_ty` is not a plain type parameter, or
1352+
// it's not found in the generic type parameters list.
1353+
_ => false,
1354+
}
1355+
};
1356+
// We only need to compute this once per `WherePredicate`, but don't
1357+
// need to compute this at all unless there is a Maybe bound.
1358+
let mut is_param: Option<bool> = None;
1359+
for bound in &bound_pred.bounds {
1360+
if !matches!(*bound, GenericBound::Trait(_, TraitBoundModifier::Maybe)) {
1361+
continue;
1362+
}
1363+
let is_param = *is_param.get_or_insert_with(compute_is_param);
1364+
if !is_param {
1365+
self.diagnostic().span_err(
1366+
bound.span(),
1367+
"`?Trait` bounds are only permitted at the \
1368+
point where a type parameter is declared",
1369+
);
13571370
}
13581371
}
13591372
}

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ pub trait ResolverAstLowering {
166166
fn legacy_const_generic_args(&mut self, expr: &Expr) -> Option<Vec<usize>>;
167167

168168
/// Obtains resolution for a `NodeId` with a single resolution.
169-
fn get_partial_res(&mut self, id: NodeId) -> Option<PartialRes>;
169+
fn get_partial_res(&self, id: NodeId) -> Option<PartialRes>;
170170

171171
/// Obtains per-namespace resolutions for `use` statement with the given `NodeId`.
172172
fn get_import_res(&mut self, id: NodeId) -> PerNS<Option<Res<NodeId>>>;

0 commit comments

Comments
 (0)