Skip to content

Commit 05b4554

Browse files
committed
Auto merge of #59741 - Centril:rollup-3us4b8q, r=Centril
Rollup of 6 pull requests Successful merges: - #58894 (Fix invalid bounds string generation in rustdoc) - #59599 (Updated RELEASES.md for 1.34.0) - #59624 (SGX target: Use linker option to avoid code CGU assignment kludge) - #59696 (Remove invalid assertion back::link::from add_upstream_rust_crates().) - #59707 (Add missing tryfrom example) - #59727 (wasi: Use shared API for preopened fds) Failed merges: r? @ghost
2 parents acd8dd6 + 8455818 commit 05b4554

File tree

19 files changed

+356
-144
lines changed

19 files changed

+356
-144
lines changed

RELEASES.md

+149
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,149 @@
1+
Version 1.34.0 (2019-04-11)
2+
==========================
3+
4+
Language
5+
--------
6+
- [You can now use `#[deprecated = "reason"]`][58166] as a shorthand for
7+
`#[deprecated(note = "reason")]`. This was previously allowed by mistake
8+
but had no effect.
9+
- [You can now accept token streams in `#[attr()]`,`#[attr[]]`, and
10+
`#[attr{}]` procedural macros.][57367]
11+
- [You can now write `extern crate self as foo;`][57407] to import your
12+
crate's root into the extern prelude.
13+
14+
15+
Compiler
16+
--------
17+
- [You can now target `riscv64imac-unknown-none-elf` and
18+
`riscv64gc-unknown-none-elf`.][58406]
19+
- [You can now enable linker plugin LTO optimisations with
20+
`-C linker-plugin-lto`.][58057] This allows rustc to compile your Rust code
21+
into LLVM bitcode allowing LLVM to perform LTO optimisations across C/C++ FFI
22+
boundaries.
23+
- [You can now target `powerpc64-unknown-freebsd`.][57809]
24+
25+
26+
Libraries
27+
---------
28+
- [The trait bounds have been removed on some of `HashMap<K, V, S>`'s and
29+
`HashSet<T, S>`'s basic methods.][58370] Most notably you no longer require
30+
the `Hash` trait to create an iterator.
31+
- [The `Ord` trait bounds have been removed on some of `BinaryHeap<T>`'s basic
32+
methods.][58421] Most notably you no longer require the `Ord` trait to create
33+
an iterator.
34+
- [The methods `overflowing_neg` and `wrapping_neg` are now `const` functions
35+
for all numeric types.][58044]
36+
- [Indexing a `str` is now generic over all types that
37+
implement `SliceIndex<str>`.][57604]
38+
- [`str::trim`, `str::trim_matches`, `str::trim_{start, end}`, and
39+
`str::trim_{start, end}_matches` are now `#[must_use]`][57106] and will
40+
produce a warning if their returning type is unused.
41+
- [The methods `checked_pow`, `saturating_pow`, `wrapping_pow`, and
42+
`overflowing_pow` are now available for all numeric types.][57873] These are
43+
equivalvent to methods such as `wrapping_add` for the `pow` operation.
44+
45+
46+
Stabilized APIs
47+
---------------
48+
49+
#### std & core
50+
* [`Any::type_id`]
51+
* [`Error::type_id`]
52+
* [`atomic::AtomicI16`]
53+
* [`atomic::AtomicI32`]
54+
* [`atomic::AtomicI64`]
55+
* [`atomic::AtomicI8`]
56+
* [`atomic::AtomicU16`]
57+
* [`atomic::AtomicU32`]
58+
* [`atomic::AtomicU64`]
59+
* [`atomic::AtomicU8`]
60+
* [`convert::Infallible`]
61+
* [`convert::TryFrom`]
62+
* [`convert::TryInto`]
63+
* [`iter::from_fn`]
64+
* [`iter::successors`]
65+
* [`num::NonZeroI128`]
66+
* [`num::NonZeroI16`]
67+
* [`num::NonZeroI32`]
68+
* [`num::NonZeroI64`]
69+
* [`num::NonZeroI8`]
70+
* [`num::NonZeroIsize`]
71+
* [`slice::sort_by_cached_key`]
72+
* [`str::escape_debug`]
73+
* [`str::escape_default`]
74+
* [`str::escape_unicode`]
75+
* [`str::split_ascii_whitespace`]
76+
77+
#### std
78+
* [`Instant::checked_add`]
79+
* [`Instant::checked_sub`]
80+
* [`SystemTime::checked_add`]
81+
* [`SystemTime::checked_sub`]
82+
83+
Cargo
84+
-----
85+
- [You can now use alternative registries to crates.io.][cargo/6654]
86+
87+
Misc
88+
----
89+
- [You can now use the `?` operator in your documentation tests without manually
90+
adding `fn main() -> Result<(), _> {}`.][56470]
91+
92+
Compatibility Notes
93+
-------------------
94+
- [`Command::before_exec` is now deprecated in favor of the
95+
unsafe method `Command::pre_exec`.][58059]
96+
- [Use of `ATOMIC_{BOOL, ISIZE, USIZE}_INIT` is now deprecated.][57425] As you
97+
can now use `const` functions in `static` variables.
98+
99+
[58370]: https://github.com/rust-lang/rust/pull/58370/
100+
[58406]: https://github.com/rust-lang/rust/pull/58406/
101+
[58421]: https://github.com/rust-lang/rust/pull/58421/
102+
[58166]: https://github.com/rust-lang/rust/pull/58166/
103+
[58044]: https://github.com/rust-lang/rust/pull/58044/
104+
[58057]: https://github.com/rust-lang/rust/pull/58057/
105+
[58059]: https://github.com/rust-lang/rust/pull/58059/
106+
[57809]: https://github.com/rust-lang/rust/pull/57809/
107+
[57873]: https://github.com/rust-lang/rust/pull/57873/
108+
[57604]: https://github.com/rust-lang/rust/pull/57604/
109+
[57367]: https://github.com/rust-lang/rust/pull/57367/
110+
[57407]: https://github.com/rust-lang/rust/pull/57407/
111+
[57425]: https://github.com/rust-lang/rust/pull/57425/
112+
[57106]: https://github.com/rust-lang/rust/pull/57106/
113+
[56470]: https://github.com/rust-lang/rust/pull/56470/
114+
[cargo/6654]: https://github.com/rust-lang/cargo/pull/6654/
115+
[`Any::type_id`]: https://doc.rust-lang.org/std/any/trait.Any.html#tymethod.type_id
116+
[`Error::type_id`]: https://doc.rust-lang.org/std/error/trait.Error.html#tymethod.type_id
117+
[`atomic::AtomicI16`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI16.html
118+
[`atomic::AtomicI32`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI32.html
119+
[`atomic::AtomicI64`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI64.html
120+
[`atomic::AtomicI8`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI8.html
121+
[`atomic::AtomicU16`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU16.html
122+
[`atomic::AtomicU32`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU32.html
123+
[`atomic::AtomicU64`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU64.html
124+
[`atomic::AtomicU8`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU8.html
125+
[`convert::Infallible`]: https://doc.rust-lang.org/std/convert/enum.Infallible.html
126+
[`convert::TryFrom`]: https://doc.rust-lang.org/std/convert/trait.TryFrom.html
127+
[`convert::TryInto`]: https://doc.rust-lang.org/std/convert/trait.TryInto.html
128+
[`iter::from_fn`]: https://doc.rust-lang.org/std/iter/fn.from_fn.html
129+
[`iter::successors`]: https://doc.rust-lang.org/std/iter/fn.successors.html
130+
[`num::NonZeroI128`]: https://doc.rust-lang.org/std/num/struct.NonZeroI128.html
131+
[`num::NonZeroI16`]: https://doc.rust-lang.org/std/num/struct.NonZeroI16.html
132+
[`num::NonZeroI32`]: https://doc.rust-lang.org/std/num/struct.NonZeroI32.html
133+
[`num::NonZeroI64`]: https://doc.rust-lang.org/std/num/struct.NonZeroI64.html
134+
[`num::NonZeroI8`]: https://doc.rust-lang.org/std/num/struct.NonZeroI8.html
135+
[`num::NonZeroIsize`]: https://doc.rust-lang.org/std/num/struct.NonZeroIsize.html
136+
[`slice::sort_by_cached_key`]: https://doc.rust-lang.org/std/slice/fn.sort_by_cached_key
137+
[`str::escape_debug`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_debug
138+
[`str::escape_default`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_default
139+
[`str::escape_unicode`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_unicode
140+
[`str::split_ascii_whitespace`]: https://doc.rust-lang.org/std/primitive.str.html#method.split_ascii_whitespace
141+
[`Instant::checked_add`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.checked_add
142+
[`Instant::checked_sub`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.checked_sub
143+
[`SystemTime::checked_add`]: https://doc.rust-lang.org/std/time/struct.SystemTime.html#method.checked_add
144+
[`SystemTime::checked_sub`]: https://doc.rust-lang.org/std/time/struct.SystemTime.html#method.checked_sub
145+
146+
1147
Version 1.33.0 (2019-02-28)
2148
==========================
3149

@@ -99,6 +245,8 @@ Stabilized APIs
99245

100246
Cargo
101247
-----
248+
- [You can now publish crates that require a feature flag to compile with
249+
`cargo publish --features` or `cargo publish --all-features`.][cargo/6453]
102250
- [Cargo should now rebuild a crate if a file was modified during the initial
103251
build.][cargo/6484]
104252

@@ -135,6 +283,7 @@ Compatibility Notes
135283
[57535]: https://github.com/rust-lang/rust/pull/57535/
136284
[57566]: https://github.com/rust-lang/rust/pull/57566/
137285
[57615]: https://github.com/rust-lang/rust/pull/57615/
286+
[cargo/6453]: https://github.com/rust-lang/cargo/pull/6453/
138287
[cargo/6484]: https://github.com/rust-lang/cargo/pull/6484/
139288
[`unix::FileExt::read_exact_at`]: https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method.read_exact_at
140289
[`unix::FileExt::write_all_at`]: https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method.write_all_at

src/ci/docker/dist-various-2/build-wasi-toolchain.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export PATH=`pwd`/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-14.04/bin:$PATH
1212
git clone https://github.com/CraneStation/wasi-sysroot
1313

1414
cd wasi-sysroot
15-
git reset --hard 320054e84f8f2440def3b1c8700cedb8fd697bf8
15+
git reset --hard e5f14be38362f1ab83302895a6e74b2ffd0e2302
1616
make -j$(nproc) INSTALL_DIR=/wasm32-unknown-wasi install
1717

1818
cd ..

src/libcore/convert.rs

+20
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,26 @@ pub trait TryInto<T>: Sized {
429429
/// When the `!` type is stablized `Infallible` and `!` will be
430430
/// equivalent.
431431
///
432+
/// `TryFrom<T>` can be implemented as follows:
433+
///
434+
/// ```
435+
/// use std::convert::TryFrom;
436+
///
437+
/// struct SuperiorThanZero(i32);
438+
///
439+
/// impl TryFrom<i32> for SuperiorThanZero {
440+
/// type Error = &'static str;
441+
///
442+
/// fn try_from(value: i32) -> Result<Self, Self::Error> {
443+
/// if value < 0 {
444+
/// Err("SuperiorThanZero only accepts value superior than zero!")
445+
/// } else {
446+
/// Ok(SuperiorThanZero(value))
447+
/// }
448+
/// }
449+
/// }
450+
/// ```
451+
///
432452
/// # Examples
433453
///
434454
/// As described, [`i32`] implements `TryFrom<i64>`:

src/librustc_codegen_llvm/back/link.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1396,10 +1396,6 @@ fn add_upstream_rust_crates(cmd: &mut dyn Linker,
13961396

13971397
// Same thing as above, but for dynamic crates instead of static crates.
13981398
fn add_dynamic_crate(cmd: &mut dyn Linker, sess: &Session, cratepath: &Path) {
1399-
// If we're performing LTO, then it should have been previously required
1400-
// that all upstream rust dependencies were available in an rlib format.
1401-
assert!(!are_upstream_rust_objects_already_included(sess));
1402-
14031399
// Just need to tell the linker about where the library lives and
14041400
// what its name is
14051401
let parent = cratepath.parent();

src/librustc_target/spec/x86_64_fortanix_unknown_sgx.rs

+9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ pub fn target() -> Result<Target, String> {
2121
"-Wl,--no-undefined-version",
2222
"-Wl,-Bsymbolic",
2323
"-Wl,--export-dynamic",
24+
// The following symbols are needed by libunwind, which is linked after
25+
// libstd. Make sure they're included in the link.
26+
"-Wl,-u,__rust_abort",
27+
"-Wl,-u,__rust_c_alloc",
28+
"-Wl,-u,__rust_c_dealloc",
29+
"-Wl,-u,__rust_print_err",
30+
"-Wl,-u,__rust_rwlock_rdlock",
31+
"-Wl,-u,__rust_rwlock_unlock",
32+
"-Wl,-u,__rust_rwlock_wrlock",
2433
];
2534

2635
const EXPORT_SYMBOLS: &[&str] = &[

src/librustc_typeck/collect.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,10 @@ fn explicit_predicates_of<'a, 'tcx>(
19181918
}
19191919
}
19201920

1921-
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
1921+
let hir_id = match tcx.hir().as_local_hir_id(def_id) {
1922+
Some(hir_id) => hir_id,
1923+
None => return tcx.predicates_of(def_id),
1924+
};
19221925
let node = tcx.hir().get_by_hir_id(hir_id);
19231926

19241927
let mut is_trait = None;

src/librustdoc/clean/auto_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
568568
(replaced.clone(), replaced.clean(self.cx))
569569
});
570570

571-
let full_generics = (&type_generics, &tcx.predicates_of(did));
571+
let full_generics = (&type_generics, &tcx.explicit_predicates_of(did));
572572
let Generics {
573573
params: mut generic_params,
574574
..

src/librustdoc/clean/blanket_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
132132
.collect();
133133

134134
let ty = self.cx.get_real_ty(def_id, def_ctor, &real_name, generics);
135-
let predicates = infcx.tcx.predicates_of(impl_def_id);
135+
let predicates = infcx.tcx.explicit_predicates_of(impl_def_id);
136136

137137
impls.push(Item {
138138
source: infcx.tcx.def_span(impl_def_id).clean(self.cx),

src/librustdoc/clean/inline.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ fn build_external_function(cx: &DocContext<'_>, did: DefId) -> clean::Function {
228228
}
229229

230230
fn build_enum(cx: &DocContext<'_>, did: DefId) -> clean::Enum {
231-
let predicates = cx.tcx.predicates_of(did);
231+
let predicates = cx.tcx.explicit_predicates_of(did);
232232

233233
clean::Enum {
234234
generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
@@ -238,7 +238,7 @@ fn build_enum(cx: &DocContext<'_>, did: DefId) -> clean::Enum {
238238
}
239239

240240
fn build_struct(cx: &DocContext<'_>, did: DefId) -> clean::Struct {
241-
let predicates = cx.tcx.predicates_of(did);
241+
let predicates = cx.tcx.explicit_predicates_of(did);
242242
let variant = cx.tcx.adt_def(did).non_enum_variant();
243243

244244
clean::Struct {
@@ -254,7 +254,7 @@ fn build_struct(cx: &DocContext<'_>, did: DefId) -> clean::Struct {
254254
}
255255

256256
fn build_union(cx: &DocContext<'_>, did: DefId) -> clean::Union {
257-
let predicates = cx.tcx.predicates_of(did);
257+
let predicates = cx.tcx.explicit_predicates_of(did);
258258
let variant = cx.tcx.adt_def(did).non_enum_variant();
259259

260260
clean::Union {
@@ -266,7 +266,7 @@ fn build_union(cx: &DocContext<'_>, did: DefId) -> clean::Union {
266266
}
267267

268268
fn build_type_alias(cx: &DocContext<'_>, did: DefId) -> clean::Typedef {
269-
let predicates = cx.tcx.predicates_of(did);
269+
let predicates = cx.tcx.explicit_predicates_of(did);
270270

271271
clean::Typedef {
272272
type_: cx.tcx.type_of(did).clean(cx),
@@ -325,7 +325,7 @@ pub fn build_impl(cx: &DocContext<'_>, did: DefId, ret: &mut Vec<clean::Item>) {
325325
}
326326
}
327327

328-
let predicates = tcx.predicates_of(did);
328+
let predicates = tcx.explicit_predicates_of(did);
329329
let (trait_items, generics) = if let Some(hir_id) = tcx.hir().as_local_hir_id(did) {
330330
match tcx.hir().expect_item_by_hir_id(hir_id).node {
331331
hir::ItemKind::Impl(.., ref gen, _, _, ref item_ids) => {

src/librustdoc/clean/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2288,7 +2288,7 @@ impl<'tcx> Clean<Item> for ty::AssociatedItem {
22882288
}
22892289
ty::AssociatedKind::Method => {
22902290
let generics = (cx.tcx.generics_of(self.def_id),
2291-
&cx.tcx.predicates_of(self.def_id)).clean(cx);
2291+
&cx.tcx.explicit_predicates_of(self.def_id)).clean(cx);
22922292
let sig = cx.tcx.fn_sig(self.def_id);
22932293
let mut decl = (self.def_id, sig).clean(cx);
22942294

@@ -2361,7 +2361,7 @@ impl<'tcx> Clean<Item> for ty::AssociatedItem {
23612361
// are actually located on the trait/impl itself, so we need to load
23622362
// all of the generics from there and then look for bounds that are
23632363
// applied to this associated type in question.
2364-
let predicates = cx.tcx.predicates_of(did);
2364+
let predicates = cx.tcx.explicit_predicates_of(did);
23652365
let generics = (cx.tcx.generics_of(did), &predicates).clean(cx);
23662366
let mut bounds = generics.where_predicates.iter().filter_map(|pred| {
23672367
let (name, self_type, trait_, bounds) = match *pred {
@@ -3069,7 +3069,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
30693069
ty::Opaque(def_id, substs) => {
30703070
// Grab the "TraitA + TraitB" from `impl TraitA + TraitB`,
30713071
// by looking up the projections associated with the def_id.
3072-
let predicates_of = cx.tcx.predicates_of(def_id);
3072+
let predicates_of = cx.tcx.explicit_predicates_of(def_id);
30733073
let substs = cx.tcx.lift(&substs).expect("Opaque lift failed");
30743074
let bounds = predicates_of.instantiate(cx.tcx, substs);
30753075
let mut regions = vec![];

src/libstd/sys/sgx/alloc.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::alloc::{GlobalAlloc, Layout, System};
1+
use crate::alloc::{self, GlobalAlloc, Layout, System};
22

33
use super::waitqueue::SpinMutex;
44

@@ -30,3 +30,17 @@ unsafe impl GlobalAlloc for System {
3030
DLMALLOC.lock().realloc(ptr, layout.size(), layout.align(), new_size)
3131
}
3232
}
33+
34+
// The following functions are needed by libunwind. These symbols are named
35+
// in pre-link args for the target specification, so keep that in sync.
36+
#[cfg(not(test))]
37+
#[no_mangle]
38+
pub unsafe extern "C" fn __rust_c_alloc(size: usize, align: usize) -> *mut u8 {
39+
alloc::alloc(Layout::from_size_align_unchecked(size, align))
40+
}
41+
42+
#[cfg(not(test))]
43+
#[no_mangle]
44+
pub unsafe extern "C" fn __rust_c_dealloc(ptr: *mut u8, size: usize, align: usize) {
45+
alloc::dealloc(ptr, Layout::from_size_align_unchecked(size, align))
46+
}

src/libstd/sys/sgx/mod.rs

+9
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,15 @@ pub unsafe fn abort_internal() -> ! {
130130
abi::usercalls::exit(true)
131131
}
132132

133+
// This function is needed by the panic runtime. The symbol is named in
134+
// pre-link args for the target specification, so keep that in sync.
135+
#[cfg(not(test))]
136+
#[no_mangle]
137+
// NB. used by both libunwind and libpanic_abort
138+
pub unsafe extern "C" fn __rust_abort() {
139+
abort_internal();
140+
}
141+
133142
pub fn hashmap_random_keys() -> (u64, u64) {
134143
fn rdrand64() -> u64 {
135144
unsafe {

0 commit comments

Comments
 (0)