Skip to content

Commit 73c85ab

Browse files
celinvaltedinski
authored andcommitted
Merge rustc into rmc - 2021 week
Fixes rust-lang#716 Conflicts: .github/workflows/ci.yml src/tools/compiletest/src/runtest.rs
1 parent f084794 commit 73c85ab

File tree

836 files changed

+10367
-10672
lines changed

Some content is hidden

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

836 files changed

+10367
-10672
lines changed

.mailmap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,14 @@ Tim Joseph Dumol <[email protected]>
289289
290290
291291
Ty Overby <[email protected]>
292+
292293
Ulrik Sverdrup <[email protected]> bluss <[email protected]>
293294
Ulrik Sverdrup <[email protected]> bluss <bluss>
294295
Ulrik Sverdrup <[email protected]> Ulrik Sverdrup <root@localhost>
295296
Vadim Petrochenkov <[email protected]>
296297
Vadim Petrochenkov <[email protected]> petrochenkov <[email protected]>
297298
Vitali Haravy <[email protected]> Vitali Haravy <[email protected]>
299+
298300
whitequark <[email protected]>
299301
300302
Xuefeng Wu <[email protected]> Xuefeng Wu <[email protected]>

Cargo.lock

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ dependencies = [
297297

298298
[[package]]
299299
name = "cargo"
300-
version = "0.59.0"
300+
version = "0.60.0"
301301
dependencies = [
302302
"anyhow",
303303
"atty",
@@ -440,7 +440,7 @@ dependencies = [
440440

441441
[[package]]
442442
name = "cargo-util"
443-
version = "0.1.1"
443+
version = "0.1.2"
444444
dependencies = [
445445
"anyhow",
446446
"core-foundation",
@@ -549,9 +549,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
549549

550550
[[package]]
551551
name = "chalk-derive"
552-
version = "0.55.0"
552+
version = "0.75.0"
553553
source = "registry+https://github.com/rust-lang/crates.io-index"
554-
checksum = "3983193cacd81f0f924acb666b7fe5e1a0d81db9f113fa69203eda7ea8ce8b6c"
554+
checksum = "d54e3b5f9e3425e6b119ff07568d8d006bfa5a8d6f78a9cbc3530b1e962e316c"
555555
dependencies = [
556556
"proc-macro2",
557557
"quote",
@@ -561,9 +561,9 @@ dependencies = [
561561

562562
[[package]]
563563
name = "chalk-engine"
564-
version = "0.55.0"
564+
version = "0.75.0"
565565
source = "registry+https://github.com/rust-lang/crates.io-index"
566-
checksum = "05a171ce5abbf0fbd06f221ab80ab182c7ef78603d23b858bc44e7ce8a86a396"
566+
checksum = "bdc891073396b167163db77123b0a3c00088edc00466cecc5531f33e3e989523"
567567
dependencies = [
568568
"chalk-derive",
569569
"chalk-ir",
@@ -574,9 +574,9 @@ dependencies = [
574574

575575
[[package]]
576576
name = "chalk-ir"
577-
version = "0.55.0"
577+
version = "0.75.0"
578578
source = "registry+https://github.com/rust-lang/crates.io-index"
579-
checksum = "a522f53af971e7678f472d687e053120157b3ae26e2ebd5ecbc0f5ab124f2cb6"
579+
checksum = "2b79e5a1d04b79311e90c69356a2c62027853906a7e33b3e070b93c055fc3e8a"
580580
dependencies = [
581581
"bitflags",
582582
"chalk-derive",
@@ -585,14 +585,14 @@ dependencies = [
585585

586586
[[package]]
587587
name = "chalk-solve"
588-
version = "0.55.0"
588+
version = "0.75.0"
589589
source = "registry+https://github.com/rust-lang/crates.io-index"
590-
checksum = "cdf79fb77a567e456a170f7ec84ea6584163d4ba3f13660cd182013d34ca667c"
590+
checksum = "a5d2a1db6605aba70a58820bd80ac422b218913a510f1a40beef9efc5371ea1d"
591591
dependencies = [
592592
"chalk-derive",
593593
"chalk-ir",
594594
"ena",
595-
"itertools 0.9.0",
595+
"itertools 0.10.1",
596596
"petgraph",
597597
"rustc-hash",
598598
"tracing",
@@ -737,9 +737,9 @@ dependencies = [
737737

738738
[[package]]
739739
name = "compiler_builtins"
740-
version = "0.1.55"
740+
version = "0.1.66"
741741
source = "registry+https://github.com/rust-lang/crates.io-index"
742-
checksum = "c9ac60765140c97aaf531dae151a287646b0805ec725805da9e2a3ee31cd501c"
742+
checksum = "191424db7756bbed2c4996959a0fbda94388abcf4f5a2728a8af17481ad9c4f7"
743743
dependencies = [
744744
"cc",
745745
"rustc-std-workspace-core",
@@ -836,7 +836,7 @@ checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"
836836

837837
[[package]]
838838
name = "crates-io"
839-
version = "0.33.0"
839+
version = "0.33.1"
840840
dependencies = [
841841
"anyhow",
842842
"curl",
@@ -2189,9 +2189,9 @@ dependencies = [
21892189

21902190
[[package]]
21912191
name = "matchers"
2192-
version = "0.0.1"
2192+
version = "0.1.0"
21932193
source = "registry+https://github.com/rust-lang/crates.io-index"
2194-
checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1"
2194+
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
21952195
dependencies = [
21962196
"regex-automata",
21972197
]
@@ -3857,6 +3857,7 @@ dependencies = [
38573857
"rustc_expand",
38583858
"rustc_feature",
38593859
"rustc_lexer",
3860+
"rustc_lint_defs",
38603861
"rustc_parse",
38613862
"rustc_parse_format",
38623863
"rustc_session",
@@ -5346,9 +5347,9 @@ dependencies = [
53465347

53475348
[[package]]
53485349
name = "synstructure"
5349-
version = "0.12.4"
5350+
version = "0.12.6"
53505351
source = "registry+https://github.com/rust-lang/crates.io-index"
5351-
checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
5352+
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
53525353
dependencies = [
53535354
"proc-macro2",
53545355
"quote",
@@ -5671,49 +5672,34 @@ dependencies = [
56715672
"tracing-core",
56725673
]
56735674

5674-
[[package]]
5675-
name = "tracing-serde"
5676-
version = "0.1.2"
5677-
source = "registry+https://github.com/rust-lang/crates.io-index"
5678-
checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b"
5679-
dependencies = [
5680-
"serde",
5681-
"tracing-core",
5682-
]
5683-
56845675
[[package]]
56855676
name = "tracing-subscriber"
5686-
version = "0.2.16"
5677+
version = "0.3.3"
56875678
source = "registry+https://github.com/rust-lang/crates.io-index"
5688-
checksum = "8ab8966ac3ca27126141f7999361cc97dd6fb4b71da04c02044fa9045d98bb96"
5679+
checksum = "245da694cc7fc4729f3f418b304cb57789f1bed2a78c575407ab8a23f53cb4d3"
56895680
dependencies = [
56905681
"ansi_term 0.12.1",
5691-
"chrono",
56925682
"lazy_static",
56935683
"matchers",
56945684
"parking_lot",
56955685
"regex",
5696-
"serde",
5697-
"serde_json",
56985686
"sharded-slab",
56995687
"smallvec",
57005688
"thread_local",
57015689
"tracing",
57025690
"tracing-core",
57035691
"tracing-log",
5704-
"tracing-serde",
57055692
]
57065693

57075694
[[package]]
57085695
name = "tracing-tree"
5709-
version = "0.1.9"
5696+
version = "0.2.0"
57105697
source = "registry+https://github.com/rust-lang/crates.io-index"
5711-
checksum = "1712b40907f8d9bc2bc66763ab61dec914b7123d7149e59feb0d4e2a95fc4967"
5698+
checksum = "3ce989c9962c7f61fe084dd4a230eec784649dfc2392467c790007c3a6e134e7"
57125699
dependencies = [
57135700
"ansi_term 0.12.1",
57145701
"atty",
5715-
"termcolor",
5716-
"tracing",
5702+
"tracing-core",
57175703
"tracing-log",
57185704
"tracing-subscriber",
57195705
]

compiler/rustc/src/main.rs

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
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`).
1+
// A note about jemalloc: rustc uses jemalloc when built for CI and
2+
// distribution. The obvious way to do this is with the `#[global_allocator]`
3+
// mechanism. However, for complicated reasons (see
4+
// https://github.com/rust-lang/rust/pull/81782#issuecomment-784438001 for some
5+
// details) that mechanism doesn't work here. Also, we must use a consistent
6+
// allocator across the rustc <-> llvm boundary, and `#[global_allocator]`
7+
// wouldn't provide that.
48
//
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-
9+
// Instead, we use a lower-level mechanism. rustc is linked with jemalloc in a
10+
// way such that jemalloc's implementation of `malloc`, `free`, etc., override
11+
// the libc allocator's implementation. This means that Rust's `System`
12+
// allocator, which calls `libc::malloc()` et al., is actually calling into
13+
// jemalloc.
14+
//
15+
// A consequence of not using `GlobalAlloc` (and the `tikv-jemallocator` crate
16+
// provides an impl of that trait, which is called `Jemalloc`) is that we
17+
// cannot use the sized deallocation APIs (`sdallocx`) that jemalloc provides.
18+
// It's unclear how much performance is lost because of this.
19+
//
20+
// As for the symbol overrides in `main` below: we're pulling in a static copy
21+
// of jemalloc. We need to actually reference its symbols for it to get linked.
22+
// The two crates we link to here, `std` and `rustc_driver`, are both dynamic
23+
// libraries. So we must reference jemalloc symbols one way or another, because
24+
// this file is the only object code in the rustc executable.
1125
#[cfg(feature = "tikv-jemalloc-sys")]
1226
use tikv_jemalloc_sys as jemalloc_sys;
1327

1428
fn main() {
15-
// Pull in jemalloc when enabled.
16-
//
17-
// Note that we're pulling in a static copy of jemalloc which means that to
18-
// pull it in we need to actually reference its symbols for it to get
19-
// linked. The two crates we link to here, std and rustc_driver, are both
20-
// dynamic libraries. That means to pull in jemalloc we actually need to
21-
// reference allocation symbols one way or another (as this file is the only
22-
// object code in the rustc executable).
29+
// See the comment at the top of this file for an explanation of this.
2330
#[cfg(feature = "tikv-jemalloc-sys")]
2431
{
2532
use std::os::raw::{c_int, c_void};

compiler/rustc_apfloat/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
3434
#![no_std]
3535
#![forbid(unsafe_code)]
36-
#![feature(iter_zip)]
3736
#![feature(nll)]
3837

3938
#[macro_use]

compiler/rustc_ast/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![feature(box_patterns)]
1212
#![feature(crate_visibility_modifier)]
1313
#![feature(if_let_guard)]
14-
#![feature(iter_zip)]
1514
#![feature(label_break_value)]
1615
#![feature(nll)]
1716
#![feature(min_specialization)]

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! A `MutVisitor` represents an AST modification; it accepts an AST piece and
2-
//! and mutates it in place. So, for instance, macro expansion is a `MutVisitor`
2+
//! mutates it in place. So, for instance, macro expansion is a `MutVisitor`
33
//! that walks over an AST and modifies it.
44
//!
55
//! Note: using a `MutVisitor` (other than the `MacroExpander` `MutVisitor`) on

compiler/rustc_ast/src/util/literal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ impl LitKind {
3535
LitKind::Bool(symbol == kw::True)
3636
}
3737
token::Byte => {
38-
return unescape_byte(&symbol.as_str())
38+
return unescape_byte(symbol.as_str())
3939
.map(LitKind::Byte)
4040
.map_err(|_| LitError::LexerError);
4141
}
4242
token::Char => {
43-
return unescape_char(&symbol.as_str())
43+
return unescape_char(symbol.as_str())
4444
.map(LitKind::Char)
4545
.map_err(|_| LitError::LexerError);
4646
}

compiler/rustc_ast_lowering/src/block.rs

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::{ImplTraitContext, ImplTraitPosition, LoweringContext};
22
use rustc_ast::{AttrVec, Block, BlockCheckMode, Expr, Local, LocalKind, Stmt, StmtKind};
33
use rustc_hir as hir;
44
use rustc_session::parse::feature_err;
5-
use rustc_span::symbol::Ident;
65
use rustc_span::{sym, DesugaringKind};
76

87
use smallvec::SmallVec;
@@ -39,8 +38,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
3938
let hir_id = self.lower_node_id(s.id);
4039
match &local.kind {
4140
LocalKind::InitElse(init, els) => {
42-
let (s, e) = self.lower_let_else(hir_id, local, init, els, tail);
43-
stmts.push(s);
41+
let e = self.lower_let_else(hir_id, local, init, els, tail);
4442
expr = Some(e);
4543
// remaining statements are in let-else expression
4644
break;
@@ -125,36 +123,25 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
125123
init: &Expr,
126124
els: &Block,
127125
tail: &[Stmt],
128-
) -> (hir::Stmt<'hir>, &'hir hir::Expr<'hir>) {
126+
) -> &'hir hir::Expr<'hir> {
129127
let ty = local
130128
.ty
131129
.as_ref()
132130
.map(|t| self.lower_ty(t, ImplTraitContext::Disallowed(ImplTraitPosition::Binding)));
133131
let span = self.lower_span(local.span);
134132
let span = self.mark_span_with_reason(DesugaringKind::LetElse, span, None);
135-
let init = Some(self.lower_expr(init));
136-
let val = Ident::with_dummy_span(sym::val);
137-
let (pat, val_id) =
138-
self.pat_ident_binding_mode(span, val, hir::BindingAnnotation::Unannotated);
133+
let init = self.lower_expr(init);
139134
let local_hir_id = self.lower_node_id(local.id);
140135
self.lower_attrs(local_hir_id, &local.attrs);
141-
// first statement which basically exists for the type annotation
142-
let stmt = {
143-
let local = self.arena.alloc(hir::Local {
136+
let let_expr = {
137+
let lex = self.arena.alloc(hir::Let {
144138
hir_id: local_hir_id,
139+
pat: self.lower_pat(&local.pat),
145140
ty,
146-
pat,
147141
init,
148142
span,
149-
source: hir::LocalSource::Normal,
150143
});
151-
let kind = hir::StmtKind::Local(local);
152-
hir::Stmt { hir_id: stmt_hir_id, kind, span }
153-
};
154-
let let_expr = {
155-
let scrutinee = self.expr_ident(span, val, val_id);
156-
let let_kind = hir::ExprKind::Let(self.lower_pat(&local.pat), scrutinee, span);
157-
self.arena.alloc(self.expr(span, let_kind, AttrVec::new()))
144+
self.arena.alloc(self.expr(span, hir::ExprKind::Let(lex), AttrVec::new()))
158145
};
159146
let then_expr = {
160147
let (stmts, expr) = self.lower_stmts(tail);
@@ -165,9 +152,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
165152
let block = self.lower_block(els, false);
166153
self.arena.alloc(self.expr_block(block, AttrVec::new()))
167154
};
155+
self.alias_attrs(let_expr.hir_id, local_hir_id);
168156
self.alias_attrs(else_expr.hir_id, local_hir_id);
169157
let if_expr = self.arena.alloc(hir::Expr {
170-
hir_id: self.next_id(),
158+
hir_id: stmt_hir_id,
171159
span,
172160
kind: hir::ExprKind::If(let_expr, then_expr, Some(else_expr)),
173161
});
@@ -180,6 +168,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
180168
)
181169
.emit();
182170
}
183-
(stmt, if_expr)
171+
if_expr
184172
}
185173
}

0 commit comments

Comments
 (0)