Skip to content

Commit ed2c0f0

Browse files
committed
Auto merge of #48146 - Mark-Simulacrum:beta-next, r=alexcrichton
[beta] Release notes, dist with time crate, and #48092 Backports of - #48092 - #48013 - #47286 - #48144
2 parents 03f456d + 17d0d6a commit ed2c0f0

File tree

12 files changed

+282
-75
lines changed

12 files changed

+282
-75
lines changed

RELEASES.md

+114
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,117 @@
1+
Version 1.24.0 (2018-02-15)
2+
==========================
3+
4+
Language
5+
--------
6+
- [External `sysv64` ffi is now available.][46528]
7+
eg. `extern "sysv64" fn foo () {}`
8+
9+
Compiler
10+
--------
11+
- [rustc now uses 16 codegen units by default for release builds.][46910]
12+
For the fastest builds, utilize `codegen-units=1`.
13+
- [Added `armv4t-unknown-linux-gnueabi` target.][47018]
14+
- [Add `aarch64-unknown-openbsd` support][46760]
15+
16+
Libraries
17+
---------
18+
- [`str::find::<char>` now uses memchr.][46735] This should lead to a 10x
19+
improvement in performance in the majority of cases.
20+
- [`OsStr`'s `Debug` implementation is now lossless and consistent
21+
with Windows.][46798]
22+
- [`time::{SystemTime, Instant}` now implement `Hash`.][46828]
23+
- [impl `From<bool>` for `AtomicBool`][46293]
24+
- [impl `From<{CString, &CStr}>` for `{Arc<CStr>, Rc<CStr>}`][45990]
25+
- [impl `From<{OsString, &OsStr}>` for `{Arc<OsStr>, Rc<OsStr>}`][45990]
26+
- [impl `From<{PathBuf, &Path}>` for `{Arc<Path>, Rc<Path>}`][45990]
27+
- [float::from_bits now just uses transmute.][46012] This provides
28+
some optimisations from LLVM.
29+
- [Copied `AsciiExt` methods onto `char`][46077]
30+
- [Remove `T: Sized` requirement on `ptr::is_null()`][46094]
31+
- [impl `From<RecvError>` for `{TryRecvError, RecvTimeoutError}`][45506]
32+
- [Optimised `f32::{min, max}` to generate more efficent x86 assembly][47080]
33+
- [`[u8]::contains` now uses memchr which provides a 3x speed improvement][46713]
34+
35+
Stabilized APIs
36+
---------------
37+
- [`RefCell::replace`]
38+
- [`RefCell::swap`]
39+
- [`atomic::spin_loop_hint`]
40+
41+
The following functions can now be used in a constant expression.
42+
eg. `let buffer: [u8; size_of::<usize>()];`, `static COUNTER: AtomicUsize = AtomicUsize::new(1);`
43+
44+
- [`AtomicBool::new`][46287]
45+
- [`AtomicUsize::new`][46287]
46+
- [`AtomicIsize::new`][46287]
47+
- [`AtomicPtr::new`][46287]
48+
- [`Cell::new`][46287]
49+
- [`{integer}::min_value`][46287]
50+
- [`{integer}::max_value`][46287]
51+
- [`mem::size_of`][46287]
52+
- [`mem::align_of`][46287]
53+
- [`ptr::null`][46287]
54+
- [`ptr::null_mut`][46287]
55+
- [`RefCell::new`][46287]
56+
- [`UnsafeCell::new`][46287]
57+
58+
Cargo
59+
-----
60+
- [Added a `workspace.default-members` config that
61+
overrides implied `--all` in virtual workspaces.][cargo/4743]
62+
- [Enable incremental by default on development builds.][cargo/4817] Also added
63+
configuration keys to `Cargo.toml` and `.cargo/config` to disable on a
64+
per-project or global basis respectively.
65+
66+
Misc
67+
----
68+
69+
Compatibility Notes
70+
-------------------
71+
- [Floating point types `Debug` impl now always prints a decimal point.][46831]
72+
- [`Ipv6Addr` now rejects superfluous `::`'s in IPv6 addresses][46671] This is
73+
in accordance with IETF RFC 4291 §2.2.
74+
- [Unwinding will no longer go past FFI boundaries, and will instead abort.][46833]
75+
- [`Formatter::flags` method is now deprecated.][46284] The `sign_plus`,
76+
`sign_minus`, `alternate`, and `sign_aware_zero_pad` should be used instead.
77+
- [Leading zeros in tuple struct members is now an error][47084]
78+
- [`column!()` macro is one-based instead of zero-based][46977]
79+
- [`fmt::Arguments` can no longer be shared across threads][45198]
80+
- [Access to `#[repr(packed)]` struct fields is now unsafe][44884]
81+
82+
[44884]: https://github.com/rust-lang/rust/pull/44884
83+
[45198]: https://github.com/rust-lang/rust/pull/45198
84+
[45506]: https://github.com/rust-lang/rust/pull/45506
85+
[45904]: https://github.com/rust-lang/rust/pull/45904
86+
[45990]: https://github.com/rust-lang/rust/pull/45990
87+
[46012]: https://github.com/rust-lang/rust/pull/46012
88+
[46077]: https://github.com/rust-lang/rust/pull/46077
89+
[46094]: https://github.com/rust-lang/rust/pull/46094
90+
[46284]: https://github.com/rust-lang/rust/pull/46284
91+
[46287]: https://github.com/rust-lang/rust/pull/46287
92+
[46293]: https://github.com/rust-lang/rust/pull/46293
93+
[46528]: https://github.com/rust-lang/rust/pull/46528
94+
[46671]: https://github.com/rust-lang/rust/pull/46671
95+
[46713]: https://github.com/rust-lang/rust/pull/46713
96+
[46735]: https://github.com/rust-lang/rust/pull/46735
97+
[46749]: https://github.com/rust-lang/rust/pull/46749
98+
[46760]: https://github.com/rust-lang/rust/pull/46760
99+
[46798]: https://github.com/rust-lang/rust/pull/46798
100+
[46828]: https://github.com/rust-lang/rust/pull/46828
101+
[46831]: https://github.com/rust-lang/rust/pull/46831
102+
[46833]: https://github.com/rust-lang/rust/pull/46833
103+
[46910]: https://github.com/rust-lang/rust/pull/46910
104+
[46977]: https://github.com/rust-lang/rust/pull/46977
105+
[47018]: https://github.com/rust-lang/rust/pull/47018
106+
[47080]: https://github.com/rust-lang/rust/pull/47080
107+
[47084]: https://github.com/rust-lang/rust/pull/47084
108+
[cargo/4743]: https://github.com/rust-lang/cargo/pull/4743
109+
[cargo/4817]: https://github.com/rust-lang/cargo/pull/4817
110+
[`RefCell::replace`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.replace
111+
[`RefCell::swap`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.swap
112+
[`atomic::spin_loop_hint`]: https://doc.rust-lang.org/std/sync/atomic/fn.spin_loop_hint.html
113+
114+
1115
Version 1.23.0 (2018-01-04)
2116
==========================
3117

src/Cargo.lock

+34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ serde_derive = "1.0.8"
4141
serde_json = "1.0.2"
4242
toml = "0.4"
4343
lazy_static = "0.2"
44+
time = "0.1"

src/bootstrap/dist.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use builder::{Builder, RunConfig, ShouldRun, Step};
3333
use compile;
3434
use tool::{self, Tool};
3535
use cache::{INTERNER, Interned};
36+
use time;
3637

3738
pub fn pkgname(build: &Build, component: &str) -> String {
3839
if component == "cargo" {
@@ -436,8 +437,7 @@ impl Step for Rustc {
436437
t!(fs::create_dir_all(image.join("share/man/man1")));
437438
let man_src = build.src.join("src/doc/man");
438439
let man_dst = image.join("share/man/man1");
439-
let date_output = output(Command::new("date").arg("+%B %Y"));
440-
let month_year = date_output.trim();
440+
let month_year = t!(time::strftime("%B %Y", &time::now()));
441441
// don't use our `bootstrap::util::{copy, cp_r}`, because those try
442442
// to hardlink, and we don't want to edit the source templates
443443
for entry_result in t!(fs::read_dir(man_src)) {
@@ -447,7 +447,7 @@ impl Step for Rustc {
447447
t!(fs::copy(&page_src, &page_dst));
448448
// template in month/year and version number
449449
replace_in_file(&page_dst,
450-
&[("<INSERT DATE HERE>", month_year),
450+
&[("<INSERT DATE HERE>", &month_year),
451451
("<INSERT VERSION HERE>", channel::CFG_RELEASE_NUM)]);
452452
}
453453

src/bootstrap/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ extern crate cc;
130130
extern crate getopts;
131131
extern crate num_cpus;
132132
extern crate toml;
133+
extern crate time;
133134

134135
#[cfg(unix)]
135136
extern crate libc;

src/librustc/mir/tcx.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,8 @@ impl<'tcx> Rvalue<'tcx> {
182182
if let ty::TyAdt(adt_def, _) = ty.sty {
183183
adt_def.repr.discr_type().to_ty(tcx)
184184
} else {
185-
// Undefined behaviour, bug for now; may want to return something for
186-
// the `discriminant` intrinsic later.
187-
bug!("Rvalue::Discriminant on Place of type {:?}", ty);
185+
// This can only be `0`, for now, so `u8` will suffice.
186+
tcx.types.u8
188187
}
189188
}
190189
Rvalue::NullaryOp(NullOp::Box, t) => tcx.mk_box(t),

src/librustc_mir/build/matches/mod.rs

+16
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
3838
-> BlockAnd<()> {
3939
let discriminant_place = unpack!(block = self.as_place(block, discriminant));
4040

41+
// Matching on a `discriminant_place` with an uninhabited type doesn't
42+
// generate any memory reads by itself, and so if the place "expression"
43+
// contains unsafe operations like raw pointer dereferences or union
44+
// field projections, we wouldn't know to require an `unsafe` block
45+
// around a `match` equivalent to `std::intrinsics::unreachable()`.
46+
// See issue #47412 for this hole being discovered in the wild.
47+
//
48+
// HACK(eddyb) Work around the above issue by adding a dummy inspection
49+
// of `discriminant_place`, specifically by applying `Rvalue::Discriminant`
50+
// (which will work regardless of type) and storing the result in a temp.
51+
let dummy_source_info = self.source_info(span);
52+
let dummy_access = Rvalue::Discriminant(discriminant_place.clone());
53+
let dummy_ty = dummy_access.ty(&self.local_decls, self.hir.tcx());
54+
let dummy_temp = self.temp(dummy_ty, dummy_source_info.span);
55+
self.cfg.push_assign(block, dummy_source_info, &dummy_temp, dummy_access);
56+
4157
let mut arm_blocks = ArmBlocks {
4258
blocks: arms.iter()
4359
.map(|_| self.cfg.start_new_block())

src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn main() {
7272
{
7373
let mut e = Baz::X(2);
7474
let _e0 = e.x();
75-
match e {
75+
match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
7676
Baz::X(value) => value
7777
//[ast]~^ ERROR cannot use `e.0` because it was mutably borrowed
7878
//[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed
@@ -110,7 +110,7 @@ fn main() {
110110
{
111111
let mut e = Box::new(Baz::X(3));
112112
let _e0 = e.x();
113-
match *e {
113+
match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
114114
Baz::X(value) => value
115115
//[ast]~^ ERROR cannot use `e.0` because it was mutably borrowed
116116
//[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed
@@ -127,25 +127,25 @@ fn main() {
127127
{
128128
let mut v = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
129129
let _v = &mut v;
130-
match v {
130+
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
131131
&[x, _, .., _, _] => println!("{}", x),
132132
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
133133
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
134134
_ => panic!("other case"),
135135
}
136-
match v {
136+
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
137137
&[_, x, .., _, _] => println!("{}", x),
138138
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
139139
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
140140
_ => panic!("other case"),
141141
}
142-
match v {
142+
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
143143
&[_, _, .., x, _] => println!("{}", x),
144144
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
145145
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
146146
_ => panic!("other case"),
147147
}
148-
match v {
148+
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
149149
&[_, _, .., _, x] => println!("{}", x),
150150
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
151151
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
@@ -156,25 +156,25 @@ fn main() {
156156
{
157157
let mut v = &[1, 2, 3, 4, 5];
158158
let _v = &mut v;
159-
match v {
159+
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
160160
&[x..] => println!("{:?}", x),
161161
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
162162
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
163163
_ => panic!("other case"),
164164
}
165-
match v {
165+
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
166166
&[_, x..] => println!("{:?}", x),
167167
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
168168
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
169169
_ => panic!("other case"),
170170
}
171-
match v {
171+
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
172172
&[x.., _] => println!("{:?}", x),
173173
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
174174
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
175175
_ => panic!("other case"),
176176
}
177-
match v {
177+
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
178178
&[_, x.., _] => println!("{:?}", x),
179179
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
180180
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
@@ -187,7 +187,7 @@ fn main() {
187187

188188
let mut e = E::A(3);
189189
let _e = &mut e;
190-
match e {
190+
match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
191191
E::A(ref ax) =>
192192
//[ast]~^ ERROR cannot borrow `e.0` as immutable because `e` is also borrowed as mutable
193193
//[mir]~^^ ERROR cannot borrow `e.0` as immutable because it is also borrowed as mutable
@@ -205,14 +205,14 @@ fn main() {
205205
struct S { x: F, y: (u32, u32), };
206206
let mut s = S { x: F { x: 1, y: 2}, y: (999, 998) };
207207
let _s = &mut s;
208-
match s {
208+
match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
209209
S { y: (ref y0, _), .. } =>
210210
//[ast]~^ ERROR cannot borrow `s.y.0` as immutable because `s` is also borrowed as mutable
211211
//[mir]~^^ ERROR cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
212212
println!("y0: {:?}", y0),
213213
_ => panic!("other case"),
214214
}
215-
match s {
215+
match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
216216
S { x: F { y: ref x0, .. }, .. } =>
217217
//[ast]~^ ERROR cannot borrow `s.x.y` as immutable because `s` is also borrowed as mutable
218218
//[mir]~^^ ERROR cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
@@ -263,7 +263,7 @@ fn main() {
263263
struct F {x: u32, y: u32};
264264
let mut v = &[F{x: 1, y: 2}, F{x: 3, y: 4}];
265265
let _v = &mut v;
266-
match v {
266+
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
267267
&[_, F {x: ref xf, ..}] => println!("{}", xf),
268268
//[mir]~^ ERROR cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
269269
// No errors in AST

src/test/compile-fail/borrowck/borrowck-match-already-borrowed.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ enum Foo {
1919
fn match_enum() {
2020
let mut foo = Foo::B;
2121
let p = &mut foo;
22-
let _ = match foo {
22+
let _ = match foo { //[mir]~ ERROR [E0503]
2323
Foo::B => 1, //[mir]~ ERROR [E0503]
2424
_ => 2,
2525
Foo::A(x) => x //[ast]~ ERROR [E0503]
@@ -31,7 +31,7 @@ fn match_enum() {
3131
fn main() {
3232
let mut x = 1;
3333
let _x = &mut x;
34-
let _ = match x {
34+
let _ = match x { //[mir]~ ERROR [E0503]
3535
x => x + 1, //[ast]~ ERROR [E0503]
3636
//[mir]~^ ERROR [E0503]
3737
y => y + 2, //[ast]~ ERROR [E0503]

0 commit comments

Comments
 (0)