Skip to content

Commit b9f1a07

Browse files
committed
Auto merge of #52229 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests Successful merges: - #51612 (NLL: fix E0594 "change to mutable ref" suggestion) - #51722 (Updated RELEASES for 1.28.0) - #52064 (Clarifying how the alignment of the struct works) - #52149 (Add #[repr(transparent)] to Atomic* types) - #52151 (Trait impl settings) - #52171 (Correct some codegen stats counter inconsistencies) - #52195 (rustc: Avoid /tmp/ in graphviz writing) Failed merges: - #52164 (use proper footnote syntax for references) r? @ghost
2 parents e5f6498 + d5c9078 commit b9f1a07

File tree

9 files changed

+177
-23
lines changed

9 files changed

+177
-23
lines changed

RELEASES.md

+145-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,146 @@
1+
Version 1.28.0 (2018-08-02)
2+
===========================
3+
4+
Language
5+
--------
6+
- [The `#[repr(transparent)]` attribute is now stable.][51562] This attribute
7+
allows a Rust newtype wrapper (`struct NewType<T>(T);`) to be represented as
8+
the inner type across Foreign Function Interface (FFI) boundaries.
9+
- [The keywords `pure`, `sizeof`, `alignof`, and `offsetof` have been unreserved
10+
and can now be used as identifiers.][51196]
11+
- [The `GlobalAlloc` trait and `#[global_allocator]` attribute are now
12+
stable.][51241] This will allow users to specify a global allocator for
13+
their program.
14+
- [Unit test functions marked with the `#[test]` attribute can now return
15+
`Result<(), E: Debug>` in addition to `()`.][51298]
16+
- [The `lifetime` specifier for `macro_rules!` is now stable.][50385] This
17+
allows macros to easily target lifetimes.
18+
19+
Compiler
20+
--------
21+
- [The `s` and `z` optimisation levels are now stable.][50265] These optimisations
22+
prioritise making smaller binary sizes. `z` is the same as `s` with the
23+
exception that it does not vectorise loops, which typically results in an even
24+
smaller binary.
25+
- [The short error format is now stable.][49546] Specified with
26+
`--error-format=short` this option will provide a more compressed output of
27+
rust error messages.
28+
- [Added a lint warning when you have duplicated `macro_export`s.][50143]
29+
- [Reduced the number of allocations in the macro parser.][50855] This can
30+
improve compile times of macro heavy crates on average by 5%.
31+
32+
Libraries
33+
---------
34+
- [Implemented `Default` for `&mut str`.][51306]
35+
- [Implemented `From<bool>` for all integer and unsigned number types.][50554]
36+
- [Implemented `Extend` for `()`.][50234]
37+
- [The `Debug` implementation of `time::Duration` should now be more easily
38+
human readable.][50364] Previously a `Duration` of one second would printed as
39+
`Duration { secs: 1, nanos: 0 }` and will now be printed as `1s`.
40+
- [Implemented `From<&String>` for `Cow<str>`, `From<&Vec<T>>` for `Cow<[T]>`,
41+
`From<Cow<CStr>>` for `CString`, `From<CString>, From<CStr>, From<&CString>`
42+
for `Cow<CStr>`, `From<OsString>, From<OsStr>, From<&OsString>` for
43+
`Cow<OsStr>`, `From<&PathBuf>` for `Cow<Path>`, and `From<Cow<Path>>`
44+
for `PathBuf`.][50170]
45+
- [Implemented `Shl` and `Shr` for `Wrapping<u128>`
46+
and `Wrapping<i128>`.][50465]
47+
- [`DirEntry::metadata` now uses `fstatat` instead of `lstat` when
48+
possible.][51050] This can provide up to a 40% speed increase.
49+
- [Improved error messages when using `format!`.][50610]
50+
51+
Stabilized APIs
52+
---------------
53+
- [`Iterator::step_by`]
54+
- [`Path::ancestors`]
55+
- [`btree_map::Entry::or_default`]
56+
- [`fmt::Alignment`]
57+
- [`hash_map::Entry::or_default`]
58+
- [`iter::repeat_with`]
59+
- [`num::NonZeroUsize`]
60+
- [`num::NonZeroU128`]
61+
- [`num::NonZeroU16`]
62+
- [`num::NonZeroU32`]
63+
- [`num::NonZeroU64`]
64+
- [`num::NonZeroU8`]
65+
- [`ops::RangeBounds`]
66+
- [`slice::SliceIndex`]
67+
- [`slice::from_mut`]
68+
- [`slice::from_ref`]
69+
- [`{Any + Send + Sync}::downcast_mut`]
70+
- [`{Any + Send + Sync}::downcast_ref`]
71+
- [`{Any + Send + Sync}::is`]
72+
73+
Cargo
74+
-----
75+
- [Cargo will now no longer allow you to publish crates with build scripts that
76+
modify the `src` directory.][cargo/5584] The `src` directory in a crate should be
77+
considered to be immutable.
78+
79+
Misc
80+
----
81+
- [The `suggestion_applicability` field in `rustc`'s json output is now
82+
stable.][50486] This will allow dev tools to check whether a code suggestion
83+
would apply to them.
84+
85+
Compatibility Notes
86+
-------------------
87+
- [Rust will no longer consider trait objects with duplicated constraints to
88+
have implementations.][51276] For example the below code will now fail
89+
to compile.
90+
```rust
91+
trait Trait {}
92+
93+
impl Trait + Send {
94+
fn test(&self) { println!("one"); } //~ ERROR duplicate definitions with name `test`
95+
}
96+
97+
impl Trait + Send + Send {
98+
fn test(&self) { println!("two"); }
99+
}
100+
```
101+
102+
[49546]: https://github.com/rust-lang/rust/pull/49546/
103+
[50143]: https://github.com/rust-lang/rust/pull/50143/
104+
[50170]: https://github.com/rust-lang/rust/pull/50170/
105+
[50234]: https://github.com/rust-lang/rust/pull/50234/
106+
[50265]: https://github.com/rust-lang/rust/pull/50265/
107+
[50364]: https://github.com/rust-lang/rust/pull/50364/
108+
[50385]: https://github.com/rust-lang/rust/pull/50385/
109+
[50465]: https://github.com/rust-lang/rust/pull/50465/
110+
[50486]: https://github.com/rust-lang/rust/pull/50486/
111+
[50554]: https://github.com/rust-lang/rust/pull/50554/
112+
[50610]: https://github.com/rust-lang/rust/pull/50610/
113+
[50855]: https://github.com/rust-lang/rust/pull/50855/
114+
[51050]: https://github.com/rust-lang/rust/pull/51050/
115+
[51196]: https://github.com/rust-lang/rust/pull/51196/
116+
[51200]: https://github.com/rust-lang/rust/pull/51200/
117+
[51241]: https://github.com/rust-lang/rust/pull/51241/
118+
[51276]: https://github.com/rust-lang/rust/pull/51276/
119+
[51298]: https://github.com/rust-lang/rust/pull/51298/
120+
[51306]: https://github.com/rust-lang/rust/pull/51306/
121+
[51562]: https://github.com/rust-lang/rust/pull/51562/
122+
[cargo/5584]: https://github.com/rust-lang/cargo/pull/5584/
123+
[`Iterator::step_by`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.step_by
124+
[`Path::ancestors`]: https://doc.rust-lang.org/std/path/struct.Path.html#method.ancestors
125+
[`btree_map::Entry::or_default`]: https://doc.rust-lang.org/std/collections/btree_map/enum.Entry.html#method.or_default
126+
[`fmt::Alignment`]: https://doc.rust-lang.org/std/fmt/enum.Alignment.html
127+
[`hash_map::Entry::or_default`]: https://doc.rust-lang.org/std/collections/btree_map/enum.Entry.html#method.or_default
128+
[`iter::repeat_with`]: https://doc.rust-lang.org/std/iter/fn.repeat_with.html
129+
[`num::NonZeroUsize`]: https://doc.rust-lang.org/std/num/struct.NonZeroUsize.html
130+
[`num::NonZeroU128`]: https://doc.rust-lang.org/std/num/struct.NonZeroU128.html
131+
[`num::NonZeroU16`]: https://doc.rust-lang.org/std/num/struct.NonZeroU16.html
132+
[`num::NonZeroU32`]: https://doc.rust-lang.org/std/num/struct.NonZeroU32.html
133+
[`num::NonZeroU64`]: https://doc.rust-lang.org/std/num/struct.NonZeroU64.html
134+
[`num::NonZeroU8`]: https://doc.rust-lang.org/std/num/struct.NonZeroU8.html
135+
[`ops::RangeBounds`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html
136+
[`slice::SliceIndex`]: https://doc.rust-lang.org/std/slice/trait.SliceIndex.html
137+
[`slice::from_mut`]: https://doc.rust-lang.org/std/slice/fn.from_mut.html
138+
[`slice::from_ref`]: https://doc.rust-lang.org/std/slice/fn.from_ref.html
139+
[`{Any + Send + Sync}::downcast_mut`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.downcast_mut-2
140+
[`{Any + Send + Sync}::downcast_ref`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.downcast_ref-2
141+
[`{Any + Send + Sync}::is`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.is-2
142+
143+
1144
Version 1.27.0 (2018-06-21)
2145
==========================
3146

@@ -188,7 +331,7 @@ Language
188331
- [Closures now implement `Copy` and/or `Clone` if all captured variables
189332
implement either or both traits.][49299]
190333
- [The inclusive range syntax e.g. `for x in 0..=10` is now stable.][47813]
191-
- [Stablise `'_`. The underscore lifetime can be used anywhere where a
334+
- [The `'_` lifetime is now stable. The underscore lifetime can be used anywhere where a
192335
lifetime can be elided.][49458]
193336
- [`impl Trait` is now stable allowing you to have abstract types in returns
194337
or in function parameters.][49255] e.g. `fn foo() -> impl Iterator<Item=u8>` or
@@ -389,7 +532,7 @@ Version 1.25.0 (2018-03-29)
389532

390533
Language
391534
--------
392-
- [Stabilised `#[repr(align(x))]`.][47006] [RFC 1358]
535+
- [The `#[repr(align(x))]` attribute is now stable.][47006] [RFC 1358]
393536
- [You can now use nested groups of imports.][47948]
394537
e.g. `use std::{fs::File, io::Read, path::{Path, PathBuf}};`
395538
- [You can now have `|` at the start of a match arm.][47947] e.g.

src/libcore/mem.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ pub fn forget<T>(t: T) {
229229
/// 2. Round up the current size to the nearest multiple of the next field's [alignment].
230230
///
231231
/// Finally, round the size of the struct to the nearest multiple of its [alignment].
232+
/// The alignment of the struct is usually the largest alignment of all its
233+
/// fields; this can be changed with the use of `repr(align(N))`.
232234
///
233235
/// Unlike `C`, zero sized structs are not rounded up to one byte in size.
234236
///
@@ -283,7 +285,8 @@ pub fn forget<T>(t: T) {
283285
/// // The size of the second field is 2, so add 2 to the size. Size is 4.
284286
/// // The alignment of the third field is 1, so add 0 to the size for padding. Size is 4.
285287
/// // The size of the third field is 1, so add 1 to the size. Size is 5.
286-
/// // Finally, the alignment of the struct is 2, so add 1 to the size for padding. Size is 6.
288+
/// // Finally, the alignment of the struct is 2 (because the largest alignment amongst its
289+
/// // fields is 2), so add 1 to the size for padding. Size is 6.
287290
/// assert_eq!(6, mem::size_of::<FieldStruct>());
288291
///
289292
/// #[repr(C)]

src/libcore/num/flt2dec/strategy/dragon.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
// except according to those terms.
1010

1111
/*!
12-
Almost direct (but slightly optimized) Rust translation of Figure 3 of [1].
12+
Almost direct (but slightly optimized) Rust translation of Figure 3 of \[1\].
1313
14-
[1] Burger, R. G. and Dybvig, R. K. 1996. Printing floating-point numbers
14+
\[1\] Burger, R. G. and Dybvig, R. K. 1996. Printing floating-point numbers
1515
quickly and accurately. SIGPLAN Not. 31, 5 (May. 1996), 108-116.
1616
*/
1717

src/libcore/num/flt2dec/strategy/grisu.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// except according to those terms.
1010

1111
/*!
12-
Rust adaptation of Grisu3 algorithm described in [1]. It uses about
12+
Rust adaptation of Grisu3 algorithm described in \[1\]. It uses about
1313
1KB of precomputed table, and in turn, it's very quick for most inputs.
1414
15-
[1] Florian Loitsch. 2010. Printing floating-point numbers quickly and
15+
\[1\] Florian Loitsch. 2010. Printing floating-point numbers quickly and
1616
accurately with integers. SIGPLAN Not. 45, 6 (June 2010), 233-243.
1717
*/
1818

src/libcore/sync/atomic.rs

+3
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ pub fn spin_loop_hint() {
124124
/// [`bool`]: ../../../std/primitive.bool.html
125125
#[cfg(target_has_atomic = "8")]
126126
#[stable(feature = "rust1", since = "1.0.0")]
127+
#[repr(transparent)]
127128
pub struct AtomicBool {
128129
v: UnsafeCell<u8>,
129130
}
@@ -147,6 +148,7 @@ unsafe impl Sync for AtomicBool {}
147148
/// This type has the same in-memory representation as a `*mut T`.
148149
#[cfg(target_has_atomic = "ptr")]
149150
#[stable(feature = "rust1", since = "1.0.0")]
151+
#[repr(transparent)]
150152
pub struct AtomicPtr<T> {
151153
p: UnsafeCell<*mut T>,
152154
}
@@ -976,6 +978,7 @@ macro_rules! atomic_int {
976978
///
977979
/// [module-level documentation]: index.html
978980
#[$stable]
981+
#[repr(transparent)]
979982
pub struct $atomic_type {
980983
v: UnsafeCell<$int_type>,
981984
}

src/librustc/infer/lexical_region_resolve/graphviz.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ use std::sync::atomic::{AtomicBool, Ordering};
3939
fn print_help_message() {
4040
println!("\
4141
-Z print-region-graph by default prints a region constraint graph for every \n\
42-
function body, to the path `/tmp/constraints.nodeXXX.dot`, where the XXX is \n\
42+
function body, to the path `constraints.nodeXXX.dot`, where the XXX is \n\
4343
replaced with the node id of the function under analysis. \n\
4444
\n\
4545
To select one particular function body, set `RUST_REGION_GRAPH_NODE=XXX`, \n\
4646
where XXX is the node id desired. \n\
4747
\n\
4848
To generate output to some path other than the default \n\
49-
`/tmp/constraints.nodeXXX.dot`, set `RUST_REGION_GRAPH=/path/desired.dot`; \n\
49+
`constraints.nodeXXX.dot`, set `RUST_REGION_GRAPH=/path/desired.dot`; \n\
5050
occurrences of the character `%` in the requested path will be replaced with\n\
5151
the node id of the function under analysis. \n\
5252
\n\
@@ -90,7 +90,7 @@ pub fn maybe_print_constraints_for<'a, 'gcx, 'tcx>(
9090
}
9191

9292
Ok(other_path) => other_path,
93-
Err(_) => "/tmp/constraints.node%.dot".to_string(),
93+
Err(_) => "constraints.node%.dot".to_string(),
9494
};
9595

9696
if output_template.is_empty() {

src/librustc_codegen_llvm/builder.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
277277
}
278278

279279
pub fn nswsub(&self, lhs: ValueRef, rhs: ValueRef) -> ValueRef {
280-
self.count_insn("nwsub");
280+
self.count_insn("nswsub");
281281
unsafe {
282282
llvm::LLVMBuildNSWSub(self.llbuilder, lhs, rhs, noname())
283283
}
@@ -291,14 +291,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
291291
}
292292

293293
pub fn fsub(&self, lhs: ValueRef, rhs: ValueRef) -> ValueRef {
294-
self.count_insn("sub");
294+
self.count_insn("fsub");
295295
unsafe {
296296
llvm::LLVMBuildFSub(self.llbuilder, lhs, rhs, noname())
297297
}
298298
}
299299

300300
pub fn fsub_fast(&self, lhs: ValueRef, rhs: ValueRef) -> ValueRef {
301-
self.count_insn("sub");
301+
self.count_insn("fsub");
302302
unsafe {
303303
let instr = llvm::LLVMBuildFSub(self.llbuilder, lhs, rhs, noname());
304304
llvm::LLVMRustSetHasUnsafeAlgebra(instr);
@@ -1315,6 +1315,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13151315
}
13161316

13171317
pub fn add_incoming_to_phi(&self, phi: ValueRef, val: ValueRef, bb: BasicBlockRef) {
1318+
self.count_insn("addincoming");
13181319
unsafe {
13191320
llvm::LLVMAddIncoming(phi, &val, &bb, 1 as c_uint);
13201321
}

src/librustdoc/html/render.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,8 @@ impl<'a> Settings<'a> {
16691669
settings: vec![
16701670
("item-declarations", "Auto-hide item declarations.", true),
16711671
("item-attributes", "Auto-hide item attributes.", true),
1672+
("trait-implementations", "Auto-hide trait implementations documentation",
1673+
true),
16721674
("go-to-only-result", "Directly go to item in search if there is only one result",
16731675
false),
16741676
],

src/librustdoc/html/static/main.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -1938,17 +1938,19 @@
19381938
if (collapse) {
19391939
toggleAllDocs(pageId, true);
19401940
}
1941-
onEach(document.getElementsByClassName("collapse-toggle"), function(e) {
1942-
// inherent impl ids are like 'impl' or impl-<number>'.
1943-
// they will never be hidden by default.
1944-
var n = e.parentNode;
1945-
if (n.id.match(/^impl(?:-\d+)?$/) === null) {
1946-
// Automatically minimize all non-inherent impls
1947-
if (collapse || hasClass(n, 'impl')) {
1948-
collapseDocs(e, "hide", pageId);
1941+
if (getCurrentValue('rustdoc-trait-implementations') !== "false") {
1942+
onEach(document.getElementsByClassName("collapse-toggle"), function(e) {
1943+
// inherent impl ids are like 'impl' or impl-<number>'.
1944+
// they will never be hidden by default.
1945+
var n = e.parentNode;
1946+
if (n.id.match(/^impl(?:-\d+)?$/) === null) {
1947+
// Automatically minimize all non-inherent impls
1948+
if (collapse || hasClass(n, 'impl')) {
1949+
collapseDocs(e, "hide", pageId);
1950+
}
19491951
}
1950-
}
1951-
});
1952+
});
1953+
}
19521954
}
19531955

19541956
var x = document.getElementById('toggle-all-docs');

0 commit comments

Comments
 (0)