Skip to content

Commit 6e05769

Browse files
author
Erik Kaneda
authored
Merge branch 'master' into erik/target-triple
2 parents 1002959 + 82b804c commit 6e05769

File tree

996 files changed

+18312
-14534
lines changed

Some content is hidden

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

996 files changed

+18312
-14534
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ standard library in the [Standard library developers Guide][std-dev-guide], comm
1515
## About the [rustc-dev-guide]
1616

1717
The [rustc-dev-guide] is meant to help document how rustc –the Rust compiler– works,
18-
as well as to help new contributors get involved in rustc development. It is recommend
18+
as well as to help new contributors get involved in rustc development. It is recommended
1919
to read and understand the [rustc-dev-guide] before making a contribution. This guide
2020
talks about the different bots in the Rust ecosystem, the Rust development tools,
2121
bootstrapping, the compiler architecture, source code representation, and more.

Cargo.lock

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
553553

554554
[[package]]
555555
name = "clippy"
556-
version = "0.1.75"
556+
version = "0.1.76"
557557
dependencies = [
558558
"anstream",
559559
"clippy_config",
@@ -581,7 +581,7 @@ dependencies = [
581581

582582
[[package]]
583583
name = "clippy_config"
584-
version = "0.1.75"
584+
version = "0.1.76"
585585
dependencies = [
586586
"rustc-semver",
587587
"serde",
@@ -604,14 +604,13 @@ dependencies = [
604604

605605
[[package]]
606606
name = "clippy_lints"
607-
version = "0.1.75"
607+
version = "0.1.76"
608608
dependencies = [
609609
"arrayvec",
610610
"cargo_metadata 0.15.4",
611611
"clippy_config",
612612
"clippy_utils",
613613
"declare_clippy_lint",
614-
"if_chain",
615614
"itertools",
616615
"quine-mc_cluskey",
617616
"regex",
@@ -630,11 +629,10 @@ dependencies = [
630629

631630
[[package]]
632631
name = "clippy_utils"
633-
version = "0.1.75"
632+
version = "0.1.76"
634633
dependencies = [
635634
"arrayvec",
636635
"clippy_config",
637-
"if_chain",
638636
"itertools",
639637
"rustc-semver",
640638
]
@@ -1016,7 +1014,7 @@ checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69"
10161014

10171015
[[package]]
10181016
name = "declare_clippy_lint"
1019-
version = "0.1.75"
1017+
version = "0.1.76"
10201018
dependencies = [
10211019
"itertools",
10221020
"quote",
@@ -3817,6 +3815,7 @@ dependencies = [
38173815
"rustc_query_system",
38183816
"rustc_resolve",
38193817
"rustc_session",
3818+
"rustc_smir",
38203819
"rustc_span",
38213820
"rustc_symbol_mangling",
38223821
"rustc_target",

RELEASES.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ Language
77
--------
88

99
- [Codify that `std::mem::Discriminant<T>` does not depend on any lifetimes in T](https://github.com/rust-lang/rust/pull/104299/)
10-
- [Replace `private_in_public` lint with `private_interfaces` and `private_bounds` per RFC 2145](https://github.com/rust-lang/rust/pull/113126/)
10+
- [Replace `private_in_public` lint with `private_interfaces` and `private_bounds` per RFC 2145.](https://github.com/rust-lang/rust/pull/113126/)
1111
Read more in [RFC 2145](https://rust-lang.github.io/rfcs/2145-type-privacy.html).
1212
- [Allow explicit `#[repr(Rust)]`](https://github.com/rust-lang/rust/pull/114201/)
1313
- [closure field capturing: don't depend on alignment of packed fields](https://github.com/rust-lang/rust/pull/115315/)
1414
- [Enable MIR-based drop-tracking for `async` blocks](https://github.com/rust-lang/rust/pull/107421/)
15+
- [Stabilize `impl_trait_projections`](https://github.com/rust-lang/rust/pull/115659)
1516

1617
<a id="1.74.0-Compiler"></a>
1718

@@ -70,17 +71,17 @@ These APIs are now stable in const contexts:
7071
Cargo
7172
-----
7273

73-
- [fix: Set MSRV for internal packages](https://github.com/rust-lang/cargo/pull/12381/)
74-
- [config: merge lists in precedence order](https://github.com/rust-lang/cargo/pull/12515/)
75-
- [fix(update): Clarify meaning of --aggressive as --recursive](https://github.com/rust-lang/cargo/pull/12544/)
76-
- [fix(update): Make `-p` more convenient by being positional](https://github.com/rust-lang/cargo/pull/12545/)
77-
- [feat(help): Add styling to help output ](https://github.com/rust-lang/cargo/pull/12578/)
78-
- [feat(pkgid): Allow incomplete versions when unambigious](https://github.com/rust-lang/cargo/pull/12614/)
79-
- [feat: stabilize credential-process and registry-auth](https://github.com/rust-lang/cargo/pull/12649/)
80-
- [feat(cli): Add '-n' to dry-run](https://github.com/rust-lang/cargo/pull/12660/)
74+
- [In `Cargo.toml`, stabilize `[lints]`](https://github.com/rust-lang/cargo/pull/12648/)
75+
- [Stabilize credential-process and registry-auth](https://github.com/rust-lang/cargo/pull/12649/)
76+
- [Stabilize `--keep-going` build flag](https://github.com/rust-lang/cargo/pull/12568/)
77+
- [Add styling to `--help` output](https://github.com/rust-lang/cargo/pull/12578/)
78+
- [For `cargo clean`, add `--dry-run` flag and summary line at the end](https://github.com/rust-lang/cargo/pull/12638)
79+
- [For `cargo update`, make `--package` more convenient by being positional](https://github.com/rust-lang/cargo/pull/12545/)
80+
- [For `cargo update`, clarify meaning of --aggressive as --recursive](https://github.com/rust-lang/cargo/pull/12544/)
81+
- [Add '-n' as an alias for `--dry-run`](https://github.com/rust-lang/cargo/pull/12660/)
82+
- [Allow version-prefixes in pkgid's (e.g. `--package` flags) to resolve ambiguities](https://github.com/rust-lang/cargo/pull/12614/)
83+
- [In `.cargo/config.toml`, merge lists in precedence order](https://github.com/rust-lang/cargo/pull/12515/)
8184
- [Add support for `target.'cfg(..)'.linker`](https://github.com/rust-lang/cargo/pull/12535/)
82-
- [Stabilize `--keep-going`](https://github.com/rust-lang/cargo/pull/12568/)
83-
- [feat: Stabilize lints](https://github.com/rust-lang/cargo/pull/12648/)
8485

8586
<a id="1.74.0-Rustdoc"></a>
8687

@@ -101,6 +102,7 @@ Compatibility Notes
101102
- [make Cell::swap panic if the Cells partially overlap](https://github.com/rust-lang/rust/pull/114795/)
102103
- [Reject invalid crate names in `--extern`](https://github.com/rust-lang/rust/pull/116001/)
103104
- [Don't resolve generic impls that may be shadowed by dyn built-in impls](https://github.com/rust-lang/rust/pull/114941/)
105+
- [The new `impl From<{&,&mut} [T; N]> for Vec<T>` is known to cause some inference failures with overly-generic code.](https://github.com/rust-lang/rust/issues/117054) In those examples using the `tui` crate, the combination of `AsRef<_>` and `Into<Vec>` leaves the middle type ambiguous, and the new `impl` adds another possibility, so it now requires an explicit type annotation.
104106

105107
<a id="1.74.0-Internal-Changes"></a>
106108

@@ -198,7 +200,6 @@ These APIs are now stable in const contexts:
198200
Cargo
199201
-----
200202

201-
- [Encode URL params correctly for `SourceId` in `Cargo.lock`.](https://github.com/rust-lang/cargo/pull/12280/)
202203
- [Bail out an error when using `cargo::` in custom build script.](https://github.com/rust-lang/cargo/pull/12332/)
203204

204205
<a id="1.73.0-Misc"></a>

compiler/rustc_abi/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![cfg_attr(feature = "nightly", feature(step_trait))]
22
#![cfg_attr(feature = "nightly", allow(internal_features))]
3-
#![cfg_attr(all(not(bootstrap), feature = "nightly"), doc(rust_logo))]
4-
#![cfg_attr(all(not(bootstrap), feature = "nightly"), feature(rustdoc_internals))]
3+
#![cfg_attr(feature = "nightly", doc(rust_logo))]
4+
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
55

66
use std::fmt;
77
use std::num::{NonZeroUsize, ParseIntError};

compiler/rustc_arena/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
1212
test(no_crate_inject, attr(deny(warnings)))
1313
)]
14-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
15-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
14+
#![doc(rust_logo)]
15+
#![feature(rustdoc_internals)]
1616
#![feature(core_intrinsics)]
1717
#![feature(dropck_eyepatch)]
1818
#![feature(new_uninit)]

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ impl MetaItem {
342342
let span = span.with_hi(segments.last().unwrap().ident.span.hi());
343343
Path { span, segments, tokens: None }
344344
}
345-
Some(TokenTree::Token(Token { kind: token::Interpolated(nt), .. }, _)) => match &**nt {
345+
Some(TokenTree::Token(Token { kind: token::Interpolated(nt), .. }, _)) => match &nt.0 {
346346
token::Nonterminal::NtMeta(item) => return item.meta(item.path.span),
347347
token::Nonterminal::NtPath(path) => (**path).clone(),
348348
_ => return None,

compiler/rustc_ast/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
99
test(attr(deny(warnings)))
1010
)]
11-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
12-
#![cfg_attr(not(bootstrap), allow(internal_features))]
13-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
11+
#![doc(rust_logo)]
12+
#![allow(internal_features)]
13+
#![feature(rustdoc_internals)]
1414
#![feature(associated_type_bounds)]
1515
#![feature(box_patterns)]
1616
#![feature(const_trait_impl)]

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,10 @@ pub fn visit_token<T: MutVisitor>(t: &mut Token, vis: &mut T) {
764764
return; // Avoid visiting the span for the second time.
765765
}
766766
token::Interpolated(nt) => {
767-
visit_nonterminal(Lrc::make_mut(nt), vis);
767+
let nt = Lrc::make_mut(nt);
768+
let (nt, sp) = (&mut nt.0, &mut nt.1);
769+
vis.visit_span(sp);
770+
visit_nonterminal(nt, vis);
768771
}
769772
_ => {}
770773
}

compiler/rustc_ast/src/token.rs

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl Lit {
110110
Ident(name, false) if name.is_bool_lit() => Some(Lit::new(Bool, name, None)),
111111
Literal(token_lit) => Some(token_lit),
112112
Interpolated(ref nt)
113-
if let NtExpr(expr) | NtLiteral(expr) = &**nt
113+
if let NtExpr(expr) | NtLiteral(expr) = &nt.0
114114
&& let ast::ExprKind::Lit(token_lit) = expr.kind =>
115115
{
116116
Some(token_lit)
@@ -314,7 +314,7 @@ pub enum TokenKind {
314314
/// - It prevents `Token` from implementing `Copy`.
315315
/// It adds complexity and likely slows things down. Please don't add new
316316
/// occurrences of this token kind!
317-
Interpolated(Lrc<Nonterminal>),
317+
Interpolated(Lrc<(Nonterminal, Span)>),
318318

319319
/// A doc comment token.
320320
/// `Symbol` is the doc comment's data excluding its "quotes" (`///`, `/**`, etc)
@@ -388,7 +388,8 @@ impl TokenKind {
388388
match *self {
389389
Comma => Some(vec![Dot, Lt, Semi]),
390390
Semi => Some(vec![Colon, Comma]),
391-
FatArrow => Some(vec![Eq, RArrow]),
391+
Colon => Some(vec![Semi]),
392+
FatArrow => Some(vec![Eq, RArrow, Ge, Gt]),
392393
_ => None,
393394
}
394395
}
@@ -421,7 +422,7 @@ impl Token {
421422
/// if they keep spans or perform edition checks.
422423
pub fn uninterpolated_span(&self) -> Span {
423424
match &self.kind {
424-
Interpolated(nt) => nt.span(),
425+
Interpolated(nt) => nt.0.use_span(),
425426
_ => self.span,
426427
}
427428
}
@@ -464,7 +465,7 @@ impl Token {
464465
ModSep | // global path
465466
Lifetime(..) | // labeled loop
466467
Pound => true, // expression attributes
467-
Interpolated(ref nt) => matches!(**nt, NtLiteral(..) |
468+
Interpolated(ref nt) => matches!(&nt.0, NtLiteral(..) |
468469
NtExpr(..) |
469470
NtBlock(..) |
470471
NtPath(..)),
@@ -488,7 +489,7 @@ impl Token {
488489
| DotDot | DotDotDot | DotDotEq // ranges
489490
| Lt | BinOp(Shl) // associated path
490491
| ModSep => true, // global path
491-
Interpolated(ref nt) => matches!(**nt, NtLiteral(..) |
492+
Interpolated(ref nt) => matches!(&nt.0, NtLiteral(..) |
492493
NtPat(..) |
493494
NtBlock(..) |
494495
NtPath(..)),
@@ -511,7 +512,7 @@ impl Token {
511512
Lifetime(..) | // lifetime bound in trait object
512513
Lt | BinOp(Shl) | // associated path
513514
ModSep => true, // global path
514-
Interpolated(ref nt) => matches!(**nt, NtTy(..) | NtPath(..)),
515+
Interpolated(ref nt) => matches!(&nt.0, NtTy(..) | NtPath(..)),
515516
// For anonymous structs or unions, which only appear in specific positions
516517
// (type of struct fields or union fields), we don't consider them as regular types
517518
_ => false,
@@ -522,7 +523,7 @@ impl Token {
522523
pub fn can_begin_const_arg(&self) -> bool {
523524
match self.kind {
524525
OpenDelim(Delimiter::Brace) => true,
525-
Interpolated(ref nt) => matches!(**nt, NtExpr(..) | NtBlock(..) | NtLiteral(..)),
526+
Interpolated(ref nt) => matches!(&nt.0, NtExpr(..) | NtBlock(..) | NtLiteral(..)),
526527
_ => self.can_begin_literal_maybe_minus(),
527528
}
528529
}
@@ -576,7 +577,7 @@ impl Token {
576577
match self.uninterpolate().kind {
577578
Literal(..) | BinOp(Minus) => true,
578579
Ident(name, false) if name.is_bool_lit() => true,
579-
Interpolated(ref nt) => match &**nt {
580+
Interpolated(ref nt) => match &nt.0 {
580581
NtLiteral(_) => true,
581582
NtExpr(e) => match &e.kind {
582583
ast::ExprKind::Lit(_) => true,
@@ -597,9 +598,9 @@ impl Token {
597598
/// otherwise returns the original token.
598599
pub fn uninterpolate(&self) -> Cow<'_, Token> {
599600
match &self.kind {
600-
Interpolated(nt) => match **nt {
601+
Interpolated(nt) => match &nt.0 {
601602
NtIdent(ident, is_raw) => {
602-
Cow::Owned(Token::new(Ident(ident.name, is_raw), ident.span))
603+
Cow::Owned(Token::new(Ident(ident.name, *is_raw), ident.span))
603604
}
604605
NtLifetime(ident) => Cow::Owned(Token::new(Lifetime(ident.name), ident.span)),
605606
_ => Cow::Borrowed(self),
@@ -614,8 +615,8 @@ impl Token {
614615
// We avoid using `Token::uninterpolate` here because it's slow.
615616
match &self.kind {
616617
&Ident(name, is_raw) => Some((Ident::new(name, self.span), is_raw)),
617-
Interpolated(nt) => match **nt {
618-
NtIdent(ident, is_raw) => Some((ident, is_raw)),
618+
Interpolated(nt) => match &nt.0 {
619+
NtIdent(ident, is_raw) => Some((*ident, *is_raw)),
619620
_ => None,
620621
},
621622
_ => None,
@@ -628,8 +629,8 @@ impl Token {
628629
// We avoid using `Token::uninterpolate` here because it's slow.
629630
match &self.kind {
630631
&Lifetime(name) => Some(Ident::new(name, self.span)),
631-
Interpolated(nt) => match **nt {
632-
NtLifetime(ident) => Some(ident),
632+
Interpolated(nt) => match &nt.0 {
633+
NtLifetime(ident) => Some(*ident),
633634
_ => None,
634635
},
635636
_ => None,
@@ -655,7 +656,7 @@ impl Token {
655656
/// Returns `true` if the token is an interpolated path.
656657
fn is_path(&self) -> bool {
657658
if let Interpolated(nt) = &self.kind
658-
&& let NtPath(..) = **nt
659+
&& let NtPath(..) = &nt.0
659660
{
660661
return true;
661662
}
@@ -668,7 +669,7 @@ impl Token {
668669
/// (which happens while parsing the result of macro expansion)?
669670
pub fn is_whole_expr(&self) -> bool {
670671
if let Interpolated(nt) = &self.kind
671-
&& let NtExpr(_) | NtLiteral(_) | NtPath(_) | NtBlock(_) = **nt
672+
&& let NtExpr(_) | NtLiteral(_) | NtPath(_) | NtBlock(_) = &nt.0
672673
{
673674
return true;
674675
}
@@ -679,7 +680,7 @@ impl Token {
679680
/// Is the token an interpolated block (`$b:block`)?
680681
pub fn is_whole_block(&self) -> bool {
681682
if let Interpolated(nt) = &self.kind
682-
&& let NtBlock(..) = **nt
683+
&& let NtBlock(..) = &nt.0
683684
{
684685
return true;
685686
}
@@ -927,7 +928,7 @@ impl fmt::Display for NonterminalKind {
927928
}
928929

929930
impl Nonterminal {
930-
pub fn span(&self) -> Span {
931+
pub fn use_span(&self) -> Span {
931932
match self {
932933
NtItem(item) => item.span,
933934
NtBlock(block) => block.span,
@@ -941,6 +942,23 @@ impl Nonterminal {
941942
NtVis(vis) => vis.span,
942943
}
943944
}
945+
946+
pub fn descr(&self) -> &'static str {
947+
match self {
948+
NtItem(..) => "item",
949+
NtBlock(..) => "block",
950+
NtStmt(..) => "statement",
951+
NtPat(..) => "pattern",
952+
NtExpr(..) => "expression",
953+
NtLiteral(..) => "literal",
954+
NtTy(..) => "type",
955+
NtIdent(..) => "identifier",
956+
NtLifetime(..) => "lifetime",
957+
NtMeta(..) => "attribute",
958+
NtPath(..) => "path",
959+
NtVis(..) => "visibility",
960+
}
961+
}
944962
}
945963

946964
impl PartialEq for Nonterminal {

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,13 +477,13 @@ impl TokenStream {
477477

478478
fn flatten_token(token: &Token, spacing: Spacing) -> TokenTree {
479479
match &token.kind {
480-
token::Interpolated(nt) if let token::NtIdent(ident, is_raw) = **nt => {
480+
token::Interpolated(nt) if let token::NtIdent(ident, is_raw) = nt.0 => {
481481
TokenTree::Token(Token::new(token::Ident(ident.name, is_raw), ident.span), spacing)
482482
}
483483
token::Interpolated(nt) => TokenTree::Delimited(
484484
DelimSpan::from_single(token.span),
485485
Delimiter::Invisible,
486-
TokenStream::from_nonterminal_ast(nt).flattened(),
486+
TokenStream::from_nonterminal_ast(&nt.0).flattened(),
487487
),
488488
_ => TokenTree::Token(token.clone(), spacing),
489489
}

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
4242
}
4343
// Merge attributes into the inner expression.
4444
if !e.attrs.is_empty() {
45-
let old_attrs =
46-
self.attrs.get(&ex.hir_id.local_id).map(|la| *la).unwrap_or(&[]);
45+
let old_attrs = self.attrs.get(&ex.hir_id.local_id).copied().unwrap_or(&[]);
4746
self.attrs.insert(
4847
ex.hir_id.local_id,
4948
&*self.arena.alloc_from_iter(

0 commit comments

Comments
 (0)