Skip to content

Commit 2bd94f4

Browse files
committed
Auto merge of rust-lang#83398 - JohnTitor:rollup-om80krv, r=JohnTitor
Rollup of 7 pull requests Successful merges: - rust-lang#80705 (Update Source Code Pro and include italics) - rust-lang#81917 (Update RELEASES.md for 1.51.0) - rust-lang#82732 (Remove theme.js file) - rust-lang#83356 (rustdoc: Replace pair of `Option`s with an enum) - rust-lang#83384 (rename :pat2018 -> :pat2015) - rust-lang#83385 (:arrow_up: rust-analyzer) - rust-lang#83389 (add rust-analyzer rustc_private option in librustdoc Cargo.toml) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5d04957 + 263c858 commit 2bd94f4

26 files changed

+315
-115
lines changed

Diff for: RELEASES.md

+171
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,174 @@
1+
Version 1.51.0 (2021-03-25)
2+
============================
3+
4+
Language
5+
--------
6+
- [You can now parameterize items such as functions, traits, and `struct`s by constant
7+
values in addition to by types and lifetimes.][79135] Also known as "const generics"
8+
E.g. you can now write the following. Note: Only values of primitive integers,
9+
`bool`, or `char` types are currently permitted.
10+
```rust
11+
struct GenericArray<T, const LENGTH: usize> {
12+
inner: [T; LENGTH]
13+
}
14+
15+
impl<T, const LENGTH: usize> GenericArray<T, LENGTH> {
16+
const fn last(&self) -> Option<&T> {
17+
if LENGTH == 0 {
18+
None
19+
} else {
20+
Some(&self.inner[LENGTH - 1])
21+
}
22+
}
23+
}
24+
```
25+
26+
27+
Compiler
28+
--------
29+
30+
- [Added the `-Csplit-debuginfo` codegen option for macOS platforms.][79570]
31+
This option controls whether debug information is split across multiple files
32+
or packed into a single file. **Note** This option is unstable on other platforms.
33+
- [Added tier 3\* support for `aarch64_be-unknown-linux-gnu`,
34+
`aarch64-unknown-linux-gnu_ilp32`, and `aarch64_be-unknown-linux-gnu_ilp32` targets.][81455]
35+
- [Added tier 3 support for `i386-unknown-linux-gnu` and `i486-unknown-linux-gnu` targets.][80662]
36+
- [The `target-cpu=native` option will now detect individual features of CPUs.][80749]
37+
- [Rust now uses `inline-asm` for stack probes when used with LLVM 11.0.1+][77885]
38+
39+
\* Refer to Rust's [platform support page][forge-platform-support] for more
40+
information on Rust's tiered platform support.
41+
42+
Libraries
43+
---------
44+
45+
- [`Box::downcast` is now also implemented for any `dyn Any + Send + Sync` object.][80945]
46+
- [`str` now implements `AsMut<str>`.][80279]
47+
- [`u64` and `u128` now implement `From<char>`.][79502]
48+
- [`Error` is now implemented for `&T` where `T` implements `Error`.][75180]
49+
- [`Poll::{map_ok, map_err}` are now implemented for `Poll<Option<Result<T, E>>>`.][80968]
50+
- [`unsigned_abs` is now implemented for all signed integer types.][80959]
51+
- [`io::Empty` now implements `io::Seek`.][78044]
52+
- [`rc::Weak<T>` and `sync::Weak<T>`'s methods such as `as_ptr` are now implemented for
53+
`T: ?Sized` types.][80764]
54+
55+
Stabilized APIs
56+
---------------
57+
58+
- [`Arc::decrement_strong_count`]
59+
- [`Arc::increment_strong_count`]
60+
- [`Once::call_once_force`]
61+
- [`Peekable::next_if_eq`]
62+
- [`Peekable::next_if`]
63+
- [`Seek::stream_position`]
64+
- [`array::IntoIter`]
65+
- [`panic::panic_any`]
66+
- [`ptr::addr_of!`]
67+
- [`ptr::addr_of_mut!`]
68+
- [`slice::fill_with`]
69+
- [`slice::split_inclusive_mut`]
70+
- [`slice::split_inclusive`]
71+
- [`slice::strip_prefix`]
72+
- [`slice::strip_suffix`]
73+
- [`str::split_inclusive`]
74+
- [`sync::OnceState`]
75+
- [`task::Wake`]
76+
77+
Cargo
78+
-----
79+
- [Added the `split-debuginfo` profile option to control the -Csplit-debuginfo
80+
codegen option.][cargo/9112]
81+
- [Added the `resolver` field to `Cargo.toml` to enable the new feature resolver
82+
and CLI option behavior.][cargo/8997] Version 2 of the feature resolver will try
83+
to avoid unifying features of dependencies where that unification could be unwanted.
84+
Such as using the same dependency with a `std` feature in a build scripts and
85+
proc-macros, while using the `no-std` feature in the final binary. See the
86+
[Cargo book documentation][[email protected]] for more information on the feature.
87+
88+
Rustdoc
89+
-------
90+
91+
- [Rustdoc will now include documentation for methods available from `Deref` traits.][80653]
92+
- [You can now provide a `--default-theme` flag which sets the default theme to use for
93+
documentation.][79642]
94+
95+
Various improvements to intra-doc links:
96+
97+
- [You can link to non-path primitives such as `slice`.][80181]
98+
- [You can link to associated items.][74489]
99+
- [You can now include generic parameters when linking to items, like `Vec<T>`.][76934]
100+
101+
Misc
102+
----
103+
- [You can now pass `--include-ignored` to tests (e.g. with
104+
`cargo test -- --include-ignored`) to include testing tests marked `#[ignore]`.][80053]
105+
106+
Compatibility Notes
107+
-------------------
108+
109+
- [WASI platforms no longer use the `wasm-bindgen` ABI, and instead use the wasm32 ABI.][79998]
110+
- [`rustc` no longer promotes division, modulo and indexing operations to `const` that
111+
could fail.][80579]
112+
- [The minimum version of glibc for the following platforms has been bumped to version 2.31
113+
for the distributed artifacts.][81521]
114+
- `armv5te-unknown-linux-gnueabi`
115+
- `sparc64-unknown-linux-gnu`
116+
- `thumbv7neon-unknown-linux-gnueabihf`
117+
- `armv7-unknown-linux-gnueabi`
118+
- `x86_64-unknown-linux-gnux32`
119+
120+
Internal Only
121+
-------------
122+
123+
- [Consistently avoid constructing optimized MIR when not doing codegen][80718]
124+
125+
[79135]: https://github.com/rust-lang/rust/pull/79135
126+
[74489]: https://github.com/rust-lang/rust/pull/74489
127+
[76934]: https://github.com/rust-lang/rust/pull/76934
128+
[79570]: https://github.com/rust-lang/rust/pull/79570
129+
[80181]: https://github.com/rust-lang/rust/pull/80181
130+
[79642]: https://github.com/rust-lang/rust/pull/79642
131+
[80945]: https://github.com/rust-lang/rust/pull/80945
132+
[80279]: https://github.com/rust-lang/rust/pull/80279
133+
[80053]: https://github.com/rust-lang/rust/pull/80053
134+
[79502]: https://github.com/rust-lang/rust/pull/79502
135+
[75180]: https://github.com/rust-lang/rust/pull/75180
136+
[79135]: https://github.com/rust-lang/rust/pull/79135
137+
[81521]: https://github.com/rust-lang/rust/pull/81521
138+
[80968]: https://github.com/rust-lang/rust/pull/80968
139+
[80959]: https://github.com/rust-lang/rust/pull/80959
140+
[80718]: https://github.com/rust-lang/rust/pull/80718
141+
[80653]: https://github.com/rust-lang/rust/pull/80653
142+
[80579]: https://github.com/rust-lang/rust/pull/80579
143+
[79998]: https://github.com/rust-lang/rust/pull/79998
144+
[78044]: https://github.com/rust-lang/rust/pull/78044
145+
[81455]: https://github.com/rust-lang/rust/pull/81455
146+
[80764]: https://github.com/rust-lang/rust/pull/80764
147+
[80749]: https://github.com/rust-lang/rust/pull/80749
148+
[80662]: https://github.com/rust-lang/rust/pull/80662
149+
[77885]: https://github.com/rust-lang/rust/pull/77885
150+
[cargo/8997]: https://github.com/rust-lang/cargo/pull/8997
151+
[cargo/9112]: https://github.com/rust-lang/cargo/pull/9112
152+
[[email protected]]: https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2
153+
[`Once::call_once_force`]: https://doc.rust-lang.org/stable/std/sync/struct.Once.html#method.call_once_force
154+
[`sync::OnceState`]: https://doc.rust-lang.org/stable/std/sync/struct.OnceState.html
155+
[`panic::panic_any`]: https://doc.rust-lang.org/stable/std/panic/fn.panic_any.html
156+
[`slice::strip_prefix`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.strip_prefix
157+
[`slice::strip_suffix`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.strip_prefix
158+
[`Arc::increment_strong_count`]: https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.increment_strong_count
159+
[`Arc::decrement_strong_count`]: https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.decrement_strong_count
160+
[`slice::fill_with`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.fill_with
161+
[`ptr::addr_of!`]: https://doc.rust-lang.org/nightly/std/ptr/macro.addr_of.html
162+
[`ptr::addr_of_mut!`]: https://doc.rust-lang.org/nightly/std/ptr/macro.addr_of_mut.html
163+
[`array::IntoIter`]: https://doc.rust-lang.org/nightly/std/array/struct.IntoIter.html
164+
[`slice::split_inclusive`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.split_inclusive
165+
[`slice::split_inclusive_mut`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.split_inclusive_mut
166+
[`str::split_inclusive`]: https://doc.rust-lang.org/nightly/std/primitive.str.html#method.split_inclusive
167+
[`task::Wake`]: https://doc.rust-lang.org/nightly/std/task/trait.Wake.html
168+
[`Seek::stream_position`]: https://doc.rust-lang.org/nightly/std/io/trait.Seek.html#method.stream_position
169+
[`Peekable::next_if`]: https://doc.rust-lang.org/nightly/std/iter/struct.Peekable.html#method.next_if
170+
[`Peekable::next_if_eq`]: https://doc.rust-lang.org/nightly/std/iter/struct.Peekable.html#method.next_if_eq
171+
1172
Version 1.50.0 (2021-02-11)
2173
============================
3174

Diff for: compiler/rustc_ast/src/token.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -688,13 +688,13 @@ pub enum NonterminalKind {
688688
Item,
689689
Block,
690690
Stmt,
691-
Pat2018 {
692-
/// Keep track of whether the user used `:pat2018` or `:pat` and we inferred it from the
691+
Pat2015 {
692+
/// Keep track of whether the user used `:pat2015` or `:pat` and we inferred it from the
693693
/// edition of the span. This is used for diagnostics.
694694
inferred: bool,
695695
},
696696
Pat2021 {
697-
/// Keep track of whether the user used `:pat2018` or `:pat` and we inferred it from the
697+
/// Keep track of whether the user used `:pat2015` or `:pat` and we inferred it from the
698698
/// edition of the span. This is used for diagnostics.
699699
inferred: bool,
700700
},
@@ -722,11 +722,11 @@ impl NonterminalKind {
722722
sym::stmt => NonterminalKind::Stmt,
723723
sym::pat => match edition() {
724724
Edition::Edition2015 | Edition::Edition2018 => {
725-
NonterminalKind::Pat2018 { inferred: true }
725+
NonterminalKind::Pat2015 { inferred: true }
726726
}
727727
Edition::Edition2021 => NonterminalKind::Pat2021 { inferred: true },
728728
},
729-
sym::pat2018 => NonterminalKind::Pat2018 { inferred: false },
729+
sym::pat2015 => NonterminalKind::Pat2015 { inferred: false },
730730
sym::pat2021 => NonterminalKind::Pat2021 { inferred: false },
731731
sym::expr => NonterminalKind::Expr,
732732
sym::ty => NonterminalKind::Ty,
@@ -745,9 +745,9 @@ impl NonterminalKind {
745745
NonterminalKind::Item => sym::item,
746746
NonterminalKind::Block => sym::block,
747747
NonterminalKind::Stmt => sym::stmt,
748-
NonterminalKind::Pat2018 { inferred: false } => sym::pat2018,
748+
NonterminalKind::Pat2015 { inferred: false } => sym::pat2015,
749749
NonterminalKind::Pat2021 { inferred: false } => sym::pat2021,
750-
NonterminalKind::Pat2018 { inferred: true }
750+
NonterminalKind::Pat2015 { inferred: true }
751751
| NonterminalKind::Pat2021 { inferred: true } => sym::pat,
752752
NonterminalKind::Expr => sym::expr,
753753
NonterminalKind::Ty => sym::ty,

Diff for: compiler/rustc_expand/src/mbe/macro_rules.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow {
10801080
_ => IsInFollow::No(TOKENS),
10811081
}
10821082
}
1083-
NonterminalKind::Pat2018 { .. } | NonterminalKind::Pat2021 { .. } => {
1083+
NonterminalKind::Pat2015 { .. } | NonterminalKind::Pat2021 { .. } => {
10841084
const TOKENS: &[&str] = &["`=>`", "`,`", "`=`", "`|`", "`if`", "`in`"];
10851085
match tok {
10861086
TokenTree::Token(token) => match token.kind {

Diff for: compiler/rustc_expand/src/mbe/quoted.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ pub(super) fn parse(
6363
let span = token.span.with_lo(start_sp.lo());
6464

6565
match frag.name {
66-
sym::pat2018 | sym::pat2021 => {
66+
sym::pat2015 | sym::pat2021 => {
6767
if !features.edition_macro_pats {
6868
feature_err(
6969
sess,
7070
sym::edition_macro_pats,
7171
frag.span,
72-
"`pat2018` and `pat2021` are unstable.",
72+
"`pat2015` and `pat2021` are unstable.",
7373
)
7474
.emit();
7575
}

Diff for: compiler/rustc_feature/src/active.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ declare_features! (
611611
/// Allows arbitrary expressions in key-value attributes at parse time.
612612
(active, extended_key_value_attributes, "1.50.0", Some(78835), None),
613613

614-
/// `:pat2018` and `:pat2021` macro matchers.
614+
/// `:pat2015` and `:pat2021` macro matchers.
615615
(active, edition_macro_pats, "1.51.0", Some(54883), None),
616616

617617
/// Allows const generics to have default values (e.g. `struct Foo<const N: usize = 3>(...);`).

Diff for: compiler/rustc_parse/src/parser/nonterminal.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<'a> Parser<'a> {
6161
},
6262
_ => false,
6363
},
64-
NonterminalKind::Pat2018 { .. } | NonterminalKind::Pat2021 { .. } => match token.kind {
64+
NonterminalKind::Pat2015 { .. } | NonterminalKind::Pat2021 { .. } => match token.kind {
6565
token::Ident(..) | // box, ref, mut, and other identifiers (can stricten)
6666
token::OpenDelim(token::Paren) | // tuple pattern
6767
token::OpenDelim(token::Bracket) | // slice pattern
@@ -118,9 +118,9 @@ impl<'a> Parser<'a> {
118118
return Err(self.struct_span_err(self.token.span, "expected a statement"));
119119
}
120120
},
121-
NonterminalKind::Pat2018 { .. } | NonterminalKind::Pat2021 { .. } => {
121+
NonterminalKind::Pat2015 { .. } | NonterminalKind::Pat2021 { .. } => {
122122
token::NtPat(self.collect_tokens_no_attrs(|this| match kind {
123-
NonterminalKind::Pat2018 { .. } => this.parse_pat_no_top_alt(None),
123+
NonterminalKind::Pat2015 { .. } => this.parse_pat_no_top_alt(None),
124124
NonterminalKind::Pat2021 { .. } => {
125125
this.parse_pat_allow_top_alt(None, RecoverComma::No)
126126
}

Diff for: compiler/rustc_span/src/symbol.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ symbols! {
845845
partial_ord,
846846
passes,
847847
pat,
848-
pat2018,
848+
pat2015,
849849
pat2021,
850850
path,
851851
pattern_parentheses,

Diff for: src/librustdoc/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"]
2929

3030
[dev-dependencies]
3131
expect-test = "1.0"
32+
33+
[package.metadata.rust-analyzer]
34+
rustc_private = true

Diff for: src/librustdoc/html/layout.rs

-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ crate fn render<T: Print, S: Print>(
8888
</button>\
8989
<div id=\"theme-choices\" role=\"menu\"></div>\
9090
</div>\
91-
<script src=\"{static_root_path}theme{suffix}.js\"></script>\
9291
<nav class=\"sub\">\
9392
<form class=\"search-form\">\
9493
<div class=\"search-container\">\

Diff for: src/librustdoc/html/markdown.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -690,25 +690,29 @@ crate fn find_testable_code<T: doctest::Tester>(
690690
}
691691

692692
crate struct ExtraInfo<'tcx> {
693-
hir_id: Option<HirId>,
694-
item_did: Option<DefId>,
693+
id: ExtraInfoId,
695694
sp: Span,
696695
tcx: TyCtxt<'tcx>,
697696
}
698697

698+
enum ExtraInfoId {
699+
Hir(HirId),
700+
Def(DefId),
701+
}
702+
699703
impl<'tcx> ExtraInfo<'tcx> {
700704
crate fn new(tcx: TyCtxt<'tcx>, hir_id: HirId, sp: Span) -> ExtraInfo<'tcx> {
701-
ExtraInfo { hir_id: Some(hir_id), item_did: None, sp, tcx }
705+
ExtraInfo { id: ExtraInfoId::Hir(hir_id), sp, tcx }
702706
}
703707

704708
crate fn new_did(tcx: TyCtxt<'tcx>, did: DefId, sp: Span) -> ExtraInfo<'tcx> {
705-
ExtraInfo { hir_id: None, item_did: Some(did), sp, tcx }
709+
ExtraInfo { id: ExtraInfoId::Def(did), sp, tcx }
706710
}
707711

708712
fn error_invalid_codeblock_attr(&self, msg: &str, help: &str) {
709-
let hir_id = match (self.hir_id, self.item_did) {
710-
(Some(h), _) => h,
711-
(None, Some(item_did)) => {
713+
let hir_id = match self.id {
714+
ExtraInfoId::Hir(hir_id) => hir_id,
715+
ExtraInfoId::Def(item_did) => {
712716
match item_did.as_local() {
713717
Some(item_did) => self.tcx.hir().local_def_id_to_hir_id(item_did),
714718
None => {
@@ -717,7 +721,6 @@ impl<'tcx> ExtraInfo<'tcx> {
717721
}
718722
}
719723
}
720-
(None, None) => return,
721724
};
722725
self.tcx.struct_span_lint_hir(
723726
crate::lint::INVALID_CODEBLOCK_ATTRIBUTES,

0 commit comments

Comments
 (0)