Skip to content

Commit c6a6105

Browse files
committed
Auto merge of rust-lang#79104 - m-ou-se:rollup-v74492y, r=m-ou-se
Rollup of 11 pull requests Successful merges: - rust-lang#74989 (Implement `Index` and `IndexMut` for arrays) - rust-lang#76339 (Test structural matching for all range types) - rust-lang#77691 (Rename/Deprecate LayoutErr in favor of LayoutError) - rust-lang#78364 (Update RELEASES.md for 1.48.0) - rust-lang#78678 (Add tests and improve rendering of cfgs on traits) - rust-lang#78714 (Simplify output capturing) - rust-lang#78769 (Remove unneeded lifetimes in array/mod.rs) - rust-lang#78903 (BTreeMap: test chaotic ordering & other bits & bobs) - rust-lang#79032 (improve type const mismatch errors) - rust-lang#79061 (Make all rustdoc functions and structs crate-private) - rust-lang#79087 (Update E0744 about control flow in `const` contexts to accurately describe when the error is triggered and why) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents f5230fb + e6b6c8e commit c6a6105

File tree

107 files changed

+1863
-1609
lines changed

Some content is hidden

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

107 files changed

+1863
-1609
lines changed

RELEASES.md

+141
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,143 @@
1+
Version 1.48.0 (2020-11-19)
2+
==========================
3+
4+
Language
5+
--------
6+
7+
- [The `unsafe` keyword is now syntactically permitted on modules.][75857] This
8+
is still rejected *semantically*, but can now be parsed by procedural macros.
9+
10+
Compiler
11+
--------
12+
- [Stabilised the `-C link-self-contained=<yes|no>` compiler flag.][76158] This tells
13+
`rustc` whether to link its own C runtime and libraries or to rely on a external
14+
linker to find them. (Supported only on `windows-gnu`, `linux-musl`, and `wasi` platforms.)
15+
- [You can now use `-C target-feature=+crt-static` on `linux-gnu` targets.][77386]
16+
Note: If you're using cargo you must explicitly pass the `--target` flag.
17+
- [Added tier 2\* support for `aarch64-unknown-linux-musl`.][76420]
18+
19+
\* Refer to Rust's [platform support page][forge-platform-support] for more
20+
information on Rust's tiered platform support.
21+
22+
Libraries
23+
---------
24+
- [`io::Write` is now implemented for `&ChildStdin` `&Sink`, `&Stdout`,
25+
and `&Stderr`.][76275]
26+
- [All arrays of any length now implement `TryFrom<Vec<T>>`.][76310]
27+
- [The `matches!` macro now supports having a trailing comma.][74880]
28+
- [`Vec<A>` now implements `PartialEq<[B]>` where `A: PartialEq<B>`.][74194]
29+
- [The `RefCell::{replace, replace_with, clone}` methods now all use `#[track_caller]`.][77055]
30+
31+
Stabilized APIs
32+
---------------
33+
- [`slice::as_ptr_range`]
34+
- [`slice::as_mut_ptr_range`]
35+
- [`VecDeque::make_contiguous`]
36+
- [`future::pending`]
37+
- [`future::ready`]
38+
39+
The following previously stable methods are now `const fn`'s:
40+
41+
- [`Option::is_some`]
42+
- [`Option::is_none`]
43+
- [`Option::as_ref`]
44+
- [`Result::is_ok`]
45+
- [`Result::is_err`]
46+
- [`Result::as_ref`]
47+
- [`Ordering::reverse`]
48+
- [`Ordering::then`]
49+
50+
Cargo
51+
-----
52+
53+
Rustdoc
54+
-------
55+
- [You can now link to items in `rustdoc` using the intra-doc link
56+
syntax.][74430] E.g. ``/// Uses [`std::future`]`` will automatically generate
57+
a link to `std::future`'s documentation. See ["Linking to items by
58+
name"][intradoc-links] for more information.
59+
- [You can now specify `#[doc(alias = "<alias>")]` on items to add search aliases
60+
when searching through `rustdoc`'s UI.][75740]
61+
62+
Compatibility Notes
63+
-------------------
64+
- [Promotion of references to `'static` lifetime inside `const fn` now follows the
65+
same rules as inside a `fn` body.][75502] In particular, `&foo()` will not be
66+
promoted to `'static` lifetime any more inside `const fn`s.
67+
- [Associated type bindings on trait objects are now verified to meet the bounds
68+
declared on the trait when checking that they implement the trait.][27675]
69+
- [When trait bounds on associated types or opaque types are ambiguous, the
70+
compiler no longer makes an arbitrary choice on which bound to use.][54121]
71+
- [Fixed recursive nonterminals not being expanded in macros during
72+
pretty-print/reparse check.][77153] This may cause errors if your macro wasn't
73+
correctly handling recursive nonterminal tokens.
74+
- [`&mut` references to non zero-sized types are no longer promoted.][75585]
75+
- [`rustc` will now warn if you use attributes like `#[link_name]` or `#[cold]`
76+
in places where they have no effect.][73461]
77+
- [Updated `_mm256_extract_epi8` and `_mm256_extract_epi16` signatures in
78+
`arch::{x86, x86_64}` to return `i32` to match the vendor signatures.][73166]
79+
- [`mem::uninitialized` will now panic if any inner types inside a struct or enum
80+
disallow zero-initialization.][71274]
81+
- [`#[target_feature]` will now error if used in a place where it has no effect.][78143]
82+
- [Foreign exceptions are now caught by `catch_unwind` and will cause an abort.][70212]
83+
Note: This behaviour is not guaranteed and is still considered undefined behaviour,
84+
see the [`catch_unwind`] documentation for further information.
85+
86+
87+
88+
Internal Only
89+
-------------
90+
These changes provide no direct user facing benefits, but represent significant
91+
improvements to the internals and overall performance of rustc and
92+
related tools.
93+
94+
- [Building `rustc` from source now uses `ninja` by default over `make`.][74922]
95+
You can continue building with `make` by setting `ninja=false` in
96+
your `config.toml`.
97+
- [cg_llvm: `fewer_names` in `uncached_llvm_type`][76030]
98+
- [Made `ensure_sufficient_stack()` non-generic][76680]
99+
100+
[78143]: https://github.com/rust-lang/rust/issues/78143
101+
[76680]: https://github.com/rust-lang/rust/pull/76680/
102+
[76030]: https://github.com/rust-lang/rust/pull/76030/
103+
[70212]: https://github.com/rust-lang/rust/pull/70212/
104+
[27675]: https://github.com/rust-lang/rust/issues/27675/
105+
[54121]: https://github.com/rust-lang/rust/issues/54121/
106+
[71274]: https://github.com/rust-lang/rust/pull/71274/
107+
[77386]: https://github.com/rust-lang/rust/pull/77386/
108+
[77153]: https://github.com/rust-lang/rust/pull/77153/
109+
[77055]: https://github.com/rust-lang/rust/pull/77055/
110+
[76275]: https://github.com/rust-lang/rust/pull/76275/
111+
[76310]: https://github.com/rust-lang/rust/pull/76310/
112+
[76420]: https://github.com/rust-lang/rust/pull/76420/
113+
[76158]: https://github.com/rust-lang/rust/pull/76158/
114+
[75857]: https://github.com/rust-lang/rust/pull/75857/
115+
[75585]: https://github.com/rust-lang/rust/pull/75585/
116+
[75740]: https://github.com/rust-lang/rust/pull/75740/
117+
[75502]: https://github.com/rust-lang/rust/pull/75502/
118+
[74880]: https://github.com/rust-lang/rust/pull/74880/
119+
[74922]: https://github.com/rust-lang/rust/pull/74922/
120+
[74430]: https://github.com/rust-lang/rust/pull/74430/
121+
[74194]: https://github.com/rust-lang/rust/pull/74194/
122+
[73461]: https://github.com/rust-lang/rust/pull/73461/
123+
[73166]: https://github.com/rust-lang/rust/pull/73166/
124+
[intradoc-links]: https://doc.rust-lang.org/rustdoc/linking-to-items-by-name.html
125+
[`catch_unwind`]: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html
126+
[`Option::is_some`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.is_some
127+
[`Option::is_none`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.is_none
128+
[`Option::as_ref`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.as_ref
129+
[`Result::is_ok`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.is_ok
130+
[`Result::is_err`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.is_err
131+
[`Result::as_ref`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.as_ref
132+
[`Ordering::reverse`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.reverse
133+
[`Ordering::then`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.then
134+
[`slice::as_ptr_range`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_ptr_range
135+
[`slice::as_mut_ptr_range`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_mut_ptr_range
136+
[`VecDeque::make_contiguous`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.make_contiguous
137+
[`future::pending`]: https://doc.rust-lang.org/std/future/fn.pending.html
138+
[`future::ready`]: https://doc.rust-lang.org/std/future/fn.ready.html
139+
140+
1141
Version 1.47.0 (2020-10-08)
2142
==========================
3143

@@ -90,6 +230,7 @@ Compatibility Notes
90230

91231
Internal Only
92232
--------
233+
93234
- [Improved default settings for bootstrapping in `x.py`.][73964] You can read details about this change in the ["Changes to `x.py` defaults"](https://blog.rust-lang.org/inside-rust/2020/08/30/changes-to-x-py-defaults.html) post on the Inside Rust blog.
94235

95236
[1.47.0-cfg]: https://docs.microsoft.com/en-us/windows/win32/secbp/control-flow-guard
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
A control-flow expression was used inside a const context.
1+
An unsupported expression was used inside a const context.
22

33
Erroneous code example:
44

@@ -12,12 +12,15 @@ const _: i32 = {
1212
};
1313
```
1414

15-
At the moment, `if` and `match`, as well as the looping constructs `for`,
16-
`while`, and `loop`, are forbidden inside a `const`, `static`, or `const fn`.
15+
At the moment, `for` loops, `.await`, and the `Try` operator (`?`) are forbidden
16+
inside a `const`, `static`, or `const fn`.
1717

18-
This will be allowed at some point in the future, but the implementation is not
19-
yet complete. See the tracking issue for [conditionals] or [loops] in a const
20-
context for the current status.
18+
This may be allowed at some point in the future, but the implementation is not
19+
yet complete. See the tracking issues for [`async`] and [`?`] in `const fn`, and
20+
(to support `for` loops in `const fn`) the tracking issues for [`impl const
21+
Trait for Ty`] and [`&mut T`] in `const fn`.
2122

22-
[conditionals]: https://github.com/rust-lang/rust/issues/49146
23-
[loops]: https://github.com/rust-lang/rust/issues/52000
23+
[`async`]: https://github.com/rust-lang/rust/issues/69431
24+
[`?`]: https://github.com/rust-lang/rust/issues/74935
25+
[`impl const Trait for Ty`]: https://github.com/rust-lang/rust/issues/67792
26+
[`&mut T`]: https://github.com/rust-lang/rust/issues/57349

compiler/rustc_hir/src/hir.rs

+8
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,14 @@ impl GenericArg<'_> {
282282
GenericArg::Const(_) => "constant",
283283
}
284284
}
285+
286+
pub fn short_descr(&self) -> &'static str {
287+
match self {
288+
GenericArg::Lifetime(_) => "lifetime",
289+
GenericArg::Type(_) => "type",
290+
GenericArg::Const(_) => "const",
291+
}
292+
}
285293
}
286294

287295
#[derive(Debug, HashStable_Generic)]

compiler/rustc_interface/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(bool_to_option)]
22
#![feature(box_syntax)]
3-
#![feature(set_stdio)]
3+
#![feature(internal_output_capture)]
44
#![feature(nll)]
55
#![feature(generator_trait)]
66
#![feature(generators)]

compiler/rustc_interface/src/util.rs

+3-22
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use rustc_span::symbol::{sym, Symbol};
2525
use smallvec::SmallVec;
2626
use std::env;
2727
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
28-
use std::io::{self, Write};
28+
use std::io;
2929
use std::lazy::SyncOnceCell;
3030
use std::mem;
3131
use std::ops::DerefMut;
@@ -106,21 +106,6 @@ fn get_stack_size() -> Option<usize> {
106106
env::var_os("RUST_MIN_STACK").is_none().then_some(STACK_SIZE)
107107
}
108108

109-
struct Sink(Arc<Mutex<Vec<u8>>>);
110-
impl Write for Sink {
111-
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
112-
Write::write(&mut *self.0.lock().unwrap(), data)
113-
}
114-
fn flush(&mut self) -> io::Result<()> {
115-
Ok(())
116-
}
117-
}
118-
impl io::LocalOutput for Sink {
119-
fn clone_box(&self) -> Box<dyn io::LocalOutput> {
120-
Box::new(Self(self.0.clone()))
121-
}
122-
}
123-
124109
/// Like a `thread::Builder::spawn` followed by a `join()`, but avoids the need
125110
/// for `'static` bounds.
126111
#[cfg(not(parallel_compiler))]
@@ -163,9 +148,7 @@ pub fn setup_callbacks_and_run_in_thread_pool_with_globals<F: FnOnce() -> R + Se
163148

164149
let main_handler = move || {
165150
rustc_span::with_session_globals(edition, || {
166-
if let Some(stderr) = stderr {
167-
io::set_panic(Some(box Sink(stderr.clone())));
168-
}
151+
io::set_output_capture(stderr.clone());
169152
f()
170153
})
171154
};
@@ -203,9 +186,7 @@ pub fn setup_callbacks_and_run_in_thread_pool_with_globals<F: FnOnce() -> R + Se
203186
// on the new threads.
204187
let main_handler = move |thread: rayon::ThreadBuilder| {
205188
rustc_span::SESSION_GLOBALS.set(session_globals, || {
206-
if let Some(stderr) = stderr {
207-
io::set_panic(Some(box Sink(stderr.clone())));
208-
}
189+
io::set_output_capture(stderr.clone());
209190
thread.run()
210191
})
211192
};

0 commit comments

Comments
 (0)