Skip to content

Commit acf8af9

Browse files
committed
Auto merge of #63148 - Centril:rollup-t813bxw, r=Centril
Rollup of 7 pull requests Successful merges: - #62293 (Unsupport the `await!(future)` macro) - #62469 (Add doc links to liballoc crate page) - #63095 (Turn `INCOMPLETE_FEATURES` into lint) - #63117 (Use global variable 'environ' to pass environments to rtpSpawn) - #63123 (`const fn`-ify `std::any::type_name` as laid out in #63084) - #63129 (Subslice patterns: Test passing static & dynamic semantics.) - #63147 (Updated RELEASES.md for 1.37.0) Failed merges: r? @ghost
2 parents dddb7fc + 0924ac7 commit acf8af9

File tree

90 files changed

+668
-452
lines changed

Some content is hidden

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

90 files changed

+668
-452
lines changed

RELEASES.md

+119-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,121 @@
1+
Version 1.37.0 (2019-08-15)
2+
==========================
3+
4+
Language
5+
--------
6+
- `#[must_use]` will now warn if the type is contained in a [tuple][61100],
7+
[`Box`][62228], or an [array][62235] and unused.
8+
- [You can now use the `cfg` and `cfg_attr` attributes on
9+
generic parameters.][61547]
10+
- [You can now use enum variants through type alias.][61682] e.g. You can
11+
write the following:
12+
```rust
13+
type MyOption = Option<u8>;
14+
15+
fn increment_or_zero(x: MyOption) -> u8 {
16+
match x {
17+
MyOption::Some(y) => y + 1,
18+
MyOption::None => 0,
19+
}
20+
}
21+
```
22+
- [You can now use `_` as an identifier for consts.][61347] e.g. You can write
23+
`const _: u32 = 5;`.
24+
- [You can now use `#[repr(align(X)]` on enums.][61229]
25+
- [The `?`/_"Kleene"_ macro operator is now available in the
26+
2015 edition.][60932]
27+
28+
Compiler
29+
--------
30+
- [You can now enable Profile-Guided Optimization with the `-C profile-generate`
31+
and `-C profile-use` flags.][61268] For more information on how to use profile
32+
guided optimization, please refer to the [rustc book][rustc-book-pgo].
33+
- [The `rust-lldb` wrapper script should now work again.][61827]
34+
35+
Libraries
36+
---------
37+
- [`mem::MaybeUninit<T>` is now ABI-compatible with `T`.][61802]
38+
39+
Stabilized APIs
40+
---------------
41+
- [`BufReader::buffer`]
42+
- [`BufWriter::buffer`]
43+
- [`Cell::from_mut`]
44+
- [`Cell<[T]>::as_slice_of_cells`][`Cell<slice>::as_slice_of_cells`]
45+
- [`DoubleEndedIterator::nth_back`]
46+
- [`Option::xor`]
47+
- [`Wrapping::reverse_bits`]
48+
- [`i128::reverse_bits`]
49+
- [`i16::reverse_bits`]
50+
- [`i32::reverse_bits`]
51+
- [`i64::reverse_bits`]
52+
- [`i8::reverse_bits`]
53+
- [`isize::reverse_bits`]
54+
- [`slice::copy_within`]
55+
- [`u128::reverse_bits`]
56+
- [`u16::reverse_bits`]
57+
- [`u32::reverse_bits`]
58+
- [`u64::reverse_bits`]
59+
- [`u8::reverse_bits`]
60+
- [`usize::reverse_bits`]
61+
62+
Cargo
63+
-----
64+
- [`Cargo.lock` files are now included by default when publishing executable crates
65+
with executables.][cargo/7026]
66+
- [You can now specify `default-run="foo"` in `[package]` to specify the
67+
default executable to use for `cargo run`.][cargo/7056]
68+
69+
Misc
70+
----
71+
72+
Compatibility Notes
73+
-------------------
74+
- [Using `...` for inclusive range patterns will now warn by default.][61342]
75+
Please transition your code to using the `..=` syntax for inclusive
76+
ranges instead.
77+
- [Using a trait object without the `dyn` will now warn by default.][61203]
78+
Please transition your code to use `dyn Trait` for trait objects instead.
79+
80+
[62228]: https://github.com/rust-lang/rust/pull/62228/
81+
[62235]: https://github.com/rust-lang/rust/pull/62235/
82+
[61802]: https://github.com/rust-lang/rust/pull/61802/
83+
[61827]: https://github.com/rust-lang/rust/pull/61827/
84+
[61547]: https://github.com/rust-lang/rust/pull/61547/
85+
[61682]: https://github.com/rust-lang/rust/pull/61682/
86+
[61268]: https://github.com/rust-lang/rust/pull/61268/
87+
[61342]: https://github.com/rust-lang/rust/pull/61342/
88+
[61347]: https://github.com/rust-lang/rust/pull/61347/
89+
[61100]: https://github.com/rust-lang/rust/pull/61100/
90+
[61203]: https://github.com/rust-lang/rust/pull/61203/
91+
[61229]: https://github.com/rust-lang/rust/pull/61229/
92+
[60932]: https://github.com/rust-lang/rust/pull/60932/
93+
[cargo/7026]: https://github.com/rust-lang/cargo/pull/7026/
94+
[cargo/7056]: https://github.com/rust-lang/cargo/pull/7056/
95+
[`BufReader::buffer`]: https://doc.rust-lang.org/std/io/struct.BufReader.html#method.buffer
96+
[`BufWriter::buffer`]: https://doc.rust-lang.org/std/io/struct.BufWriter.html#method.buffer
97+
[`Cell::from_mut`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.from_mut
98+
[`Cell<slice>::as_slice_of_cells`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.as_slice_of_cells
99+
[`DoubleEndedIterator::nth_back`]: https://doc.rust-lang.org/std/iter/trait.DoubleEndedIterator.html#method.nth_back
100+
[`Option::xor`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.xor
101+
[`RefCell::try_borrow_unguarded`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.try_borrow_unguarded
102+
[`Wrapping::reverse_bits`]: https://doc.rust-lang.org/std/num/struct.Wrapping.html#method.reverse_bits
103+
[`i128::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i128.html#method.reverse_bits
104+
[`i16::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i16.html#method.reverse_bits
105+
[`i32::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i32.html#method.reverse_bits
106+
[`i64::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i64.html#method.reverse_bits
107+
[`i8::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i8.html#method.reverse_bits
108+
[`isize::reverse_bits`]: https://doc.rust-lang.org/std/primitive.isize.html#method.reverse_bits
109+
[`slice::copy_within`]: https://doc.rust-lang.org/std/primitive.slice.html#method.copy_within
110+
[`u128::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u128.html#method.reverse_bits
111+
[`u16::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u16.html#method.reverse_bits
112+
[`u32::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u32.html#method.reverse_bits
113+
[`u64::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u64.html#method.reverse_bits
114+
[`u8::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u8.html#method.reverse_bits
115+
[`usize::reverse_bits`]: https://doc.rust-lang.org/std/primitive.usize.html#method.reverse_bits
116+
[rustc-book-pgo]: https://doc.rust-lang.org/rustc/profile-guided-optimization.html
117+
118+
1119
Version 1.36.0 (2019-07-04)
2120
==========================
3121

@@ -39,7 +157,7 @@ Stabilized APIs
39157
- [`mem::MaybeUninit`]
40158
- [`pointer::align_offset`]
41159
- [`future::Future`]
42-
- [`task::Context`]
160+
- [`task::Context`]
43161
- [`task::RawWaker`]
44162
- [`task::RawWakerVTable`]
45163
- [`task::Waker`]

src/liballoc/lib.rs

+20-13
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@
1010
//!
1111
//! ## Boxed values
1212
//!
13-
//! The [`Box`](boxed/index.html) type is a smart pointer type. There can
14-
//! only be one owner of a `Box`, and the owner can decide to mutate the
15-
//! contents, which live on the heap.
13+
//! The [`Box`] type is a smart pointer type. There can only be one owner of a
14+
//! [`Box`], and the owner can decide to mutate the contents, which live on the
15+
//! heap.
1616
//!
1717
//! This type can be sent among threads efficiently as the size of a `Box` value
1818
//! is the same as that of a pointer. Tree-like data structures are often built
1919
//! with boxes because each node often has only one owner, the parent.
2020
//!
2121
//! ## Reference counted pointers
2222
//!
23-
//! The [`Rc`](rc/index.html) type is a non-threadsafe reference-counted pointer
24-
//! type intended for sharing memory within a thread. An `Rc` pointer wraps a
25-
//! type, `T`, and only allows access to `&T`, a shared reference.
23+
//! The [`Rc`] type is a non-threadsafe reference-counted pointer type intended
24+
//! for sharing memory within a thread. An [`Rc`] pointer wraps a type, `T`, and
25+
//! only allows access to `&T`, a shared reference.
2626
//!
27-
//! This type is useful when inherited mutability (such as using `Box`) is too
28-
//! constraining for an application, and is often paired with the `Cell` or
29-
//! `RefCell` types in order to allow mutation.
27+
//! This type is useful when inherited mutability (such as using [`Box`]) is too
28+
//! constraining for an application, and is often paired with the [`Cell`] or
29+
//! [`RefCell`] types in order to allow mutation.
3030
//!
3131
//! ## Atomically reference counted pointers
3232
//!
33-
//! The [`Arc`](sync/index.html) type is the threadsafe equivalent of the `Rc`
34-
//! type. It provides all the same functionality of `Rc`, except it requires
35-
//! that the contained type `T` is shareable. Additionally, `Arc<T>` is itself
36-
//! sendable while `Rc<T>` is not.
33+
//! The [`Arc`] type is the threadsafe equivalent of the [`Rc`] type. It
34+
//! provides all the same functionality of [`Rc`], except it requires that the
35+
//! contained type `T` is shareable. Additionally, [`Arc<T>`][`Arc`] is itself
36+
//! sendable while [`Rc<T>`][`Rc`] is not.
3737
//!
3838
//! This type allows for shared access to the contained data, and is often
3939
//! paired with synchronization primitives such as mutexes to allow mutation of
@@ -49,6 +49,12 @@
4949
//!
5050
//! The [`alloc`](alloc/index.html) module defines the low-level interface to the
5151
//! default global allocator. It is not compatible with the libc allocator API.
52+
//!
53+
//! [`Arc`]: sync/index.html
54+
//! [`Box`]: boxed/index.html
55+
//! [`Cell`]: ../core/cell/index.html
56+
//! [`Rc`]: rc/index.html
57+
//! [`RefCell`]: ../core/cell/index.html
5258
5359
#![allow(unused_attributes)]
5460
#![stable(feature = "alloc", since = "1.36.0")]
@@ -63,6 +69,7 @@
6369
#![warn(missing_debug_implementations)]
6470
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
6571
#![allow(explicit_outlives_requirements)]
72+
#![cfg_attr(not(bootstrap), allow(incomplete_features))]
6673

6774
#![cfg_attr(not(test), feature(generator_trait))]
6875
#![cfg_attr(test, feature(test))]

src/libcore/any.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ impl TypeId {
468468
/// The current implementation uses the same infrastructure as compiler
469469
/// diagnostics and debuginfo, but this is not guaranteed.
470470
#[stable(feature = "type_name", since = "1.38.0")]
471-
pub fn type_name<T: ?Sized>() -> &'static str {
471+
#[rustc_const_unstable(feature = "const_type_name")]
472+
pub const fn type_name<T: ?Sized>() -> &'static str {
472473
#[cfg(bootstrap)]
473474
unsafe {
474475
intrinsics::type_name::<T>()

src/libcore/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#![warn(missing_debug_implementations)]
6464
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
6565
#![allow(explicit_outlives_requirements)]
66+
#![cfg_attr(not(bootstrap), allow(incomplete_features))]
6667

6768
#![feature(allow_internal_unstable)]
6869
#![feature(arbitrary_self_types)]

src/librustc/error_codes.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2088,11 +2088,11 @@ generator can be constructed.
20882088
Erroneous code example:
20892089
20902090
```edition2018,compile-fail,E0698
2091-
#![feature(futures_api, async_await, await_macro)]
2091+
#![feature(async_await)]
20922092
async fn bar<T>() -> () {}
20932093
20942094
async fn foo() {
2095-
await!(bar()); // error: cannot infer type for `T`
2095+
bar().await; // error: cannot infer type for `T`
20962096
}
20972097
```
20982098
@@ -2101,12 +2101,12 @@ To fix this you must bind `T` to a concrete type such as `String`
21012101
so that a generator can then be constructed:
21022102
21032103
```edition2018
2104-
#![feature(futures_api, async_await, await_macro)]
2104+
#![feature(async_await)]
21052105
async fn bar<T>() -> () {}
21062106
21072107
async fn foo() {
2108-
await!(bar::<String>());
2109-
// ^^^^^^^^ specify type explicitly
2108+
bar::<String>().await;
2109+
// ^^^^^^^^ specify type explicitly
21102110
}
21112111
```
21122112
"##,

src/librustc/hir/lowering.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4685,7 +4685,7 @@ impl<'a> LoweringContext<'a> {
46854685
})
46864686
})
46874687
}
4688-
ExprKind::Await(_origin, ref expr) => self.lower_await(e.span, expr),
4688+
ExprKind::Await(ref expr) => self.lower_await(e.span, expr),
46894689
ExprKind::Closure(
46904690
capture_clause, asyncness, movability, ref decl, ref body, fn_decl_span
46914691
) => {

src/librustc_lint/builtin.rs

+34-3
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ use lint::{LintPass, LateLintPass, EarlyLintPass, EarlyContext};
3333
use rustc::util::nodemap::FxHashSet;
3434

3535
use syntax::tokenstream::{TokenTree, TokenStream};
36-
use syntax::ast;
36+
use syntax::ast::{self, Expr};
3737
use syntax::ptr::P;
38-
use syntax::ast::Expr;
3938
use syntax::attr::{self, HasAttrs, AttributeTemplate};
4039
use syntax::source_map::Spanned;
4140
use syntax::edition::Edition;
42-
use syntax::feature_gate::{AttributeGate, AttributeType};
41+
use syntax::feature_gate::{self, AttributeGate, AttributeType};
4342
use syntax::feature_gate::{Stability, deprecated_attributes};
4443
use syntax_pos::{BytePos, Span, SyntaxContext};
4544
use syntax::symbol::{Symbol, kw, sym};
@@ -1831,3 +1830,35 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements {
18311830
}
18321831
}
18331832
}
1833+
1834+
declare_lint! {
1835+
pub INCOMPLETE_FEATURES,
1836+
Warn,
1837+
"incomplete features that may function improperly in some or all cases"
1838+
}
1839+
1840+
declare_lint_pass!(
1841+
/// Check for used feature gates in `INCOMPLETE_FEATURES` in `feature_gate.rs`.
1842+
IncompleteFeatures => [INCOMPLETE_FEATURES]
1843+
);
1844+
1845+
impl EarlyLintPass for IncompleteFeatures {
1846+
fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
1847+
let features = cx.sess.features_untracked();
1848+
features.declared_lang_features
1849+
.iter().map(|(name, span, _)| (name, span))
1850+
.chain(features.declared_lib_features.iter().map(|(name, span)| (name, span)))
1851+
.filter(|(name, _)| feature_gate::INCOMPLETE_FEATURES.iter().any(|f| name == &f))
1852+
.for_each(|(name, &span)| {
1853+
cx.struct_span_lint(
1854+
INCOMPLETE_FEATURES,
1855+
span,
1856+
&format!(
1857+
"the feature `{}` is incomplete and may cause the compiler to crash",
1858+
name,
1859+
)
1860+
)
1861+
.emit();
1862+
});
1863+
}
1864+
}

src/librustc_lint/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ macro_rules! early_lint_passes {
9797
DeprecatedAttr: DeprecatedAttr::new(),
9898
WhileTrue: WhileTrue,
9999
NonAsciiIdents: NonAsciiIdents,
100+
IncompleteFeatures: IncompleteFeatures,
100101
]);
101102
)
102103
}

src/libstd/sys/vxworks/process/process_vxworks.rs

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::io::{self, Error, ErrorKind};
2-
use libc::{self, c_int};
2+
use libc::{self, c_int, c_char};
33
use libc::{RTP_ID};
4-
4+
use crate::sys;
55
use crate::sys::cvt;
66
use crate::sys::process::rtp;
77
use crate::sys::process::process_common::*;
@@ -16,8 +16,6 @@ impl Command {
1616
use crate::sys::{cvt_r};
1717
const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX";
1818

19-
let envp = self.capture_env();
20-
2119
if self.saw_nul() {
2220
return Err(io::Error::new(ErrorKind::InvalidInput,
2321
"nul byte found in provided data"));
@@ -54,19 +52,10 @@ impl Command {
5452
t!(cvt(libc::chdir(cwd.as_ptr())));
5553
}
5654

57-
// let envp = envp.map(|c| c.as_ptr())
58-
// .unwrap_or(*sys::os::environ() as *const _);
59-
// FIXME: https://github.com/rust-lang/rust/issues/61993
60-
let envp_empty = CStringArray::with_capacity(0);
61-
let envp = match envp {
62-
Some(x) => x,
63-
None => envp_empty,
64-
};
65-
let envp = envp.as_ptr();
6655
let ret = rtp::rtpSpawn(
6756
self.get_argv()[0], // executing program
6857
self.get_argv().as_ptr() as *const _, // argv
69-
envp as *const _, // environment variable pointers
58+
*sys::os::environ() as *const *const c_char,
7059
100 as c_int, // initial priority
7160
0x16000, // initial stack size. 0 defaults
7261
// to 0x4000 in 32 bit and 0x8000 in 64 bit

src/libsyntax/ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ pub enum ExprKind {
11781178
/// preexisting defs.
11791179
Async(CaptureBy, NodeId, P<Block>),
11801180
/// An await expression (`my_future.await`).
1181-
Await(AwaitOrigin, P<Expr>),
1181+
Await(P<Expr>),
11821182

11831183
/// A try block (`try { ... }`).
11841184
TryBlock(P<Block>),

0 commit comments

Comments
 (0)