Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #63148

Merged
merged 20 commits into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2534b28
Add doc links to liballoc crate page
czipperz Jul 7, 2019
f6906ba
use gloabl variable 'environ' to pass environments to rtpSpawn
bpangWR Jul 29, 2019
873b361
Add a test for std::any::type_name() as a const fn
TankhouseAle Jul 30, 2019
4a3d41d
Add the necessary changes to any.rs
TankhouseAle Jul 30, 2019
dcc4b99
Turn INCOMPLETE_FEATURES into a lint.
Centril Jul 29, 2019
8a90173
Allow 'incomplete_features' in libcore/alloc.
Centril Jul 29, 2019
24a178e
--bless tests due to INCOMPLETE_FEATURES being a lint.
Centril Jul 29, 2019
969a374
Subslice patterns: Test passing static & dynamic semantics.
Centril Jul 30, 2019
7589319
Unsupport the await!(..) macro.
Centril Jul 2, 2019
581f2cb
Adjust tests. wrt. await_macro being removed.
Centril Jul 2, 2019
99c4a94
Update error_codes re. await_macro removal.
Centril Jul 6, 2019
b21f0a3
Pacify tidy, the merciless.
Centril Jul 24, 2019
c599fcc
Updated RELEASES.md for 1.37.0
XAMPPRocky Jul 13, 2019
d8280fa
Rollup merge of #62293 - Centril:remove-await-macro, r=cramertj
Centril Jul 30, 2019
9fb8f1b
Rollup merge of #62469 - czipperz:liballoc-add-doc-links, r=Guillaume…
Centril Jul 30, 2019
dbf54ad
Rollup merge of #63095 - Centril:incomplete-features-lint, r=varkor
Centril Jul 30, 2019
cdf9758
Rollup merge of #63117 - BaoshanPang:bugfix, r=alexcrichton
Centril Jul 30, 2019
c088890
Rollup merge of #63123 - TankhouseAle:const-fn-type-name-any, r=oli-obk
Centril Jul 30, 2019
d871645
Rollup merge of #63129 - Centril:subslice-pat-statdyn, r=oli-obk
Centril Jul 30, 2019
0924ac7
Rollup merge of #63147 - Mark-Simulacrum:XAMPPRocky-master, r=Mark-Si…
Centril Jul 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 119 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,121 @@
Version 1.37.0 (2019-08-15)
==========================

Language
--------
- `#[must_use]` will now warn if the type is contained in a [tuple][61100],
[`Box`][62228], or an [array][62235] and unused.
- [You can now use the `cfg` and `cfg_attr` attributes on
generic parameters.][61547]
- [You can now use enum variants through type alias.][61682] e.g. You can
write the following:
```rust
type MyOption = Option<u8>;

fn increment_or_zero(x: MyOption) -> u8 {
match x {
MyOption::Some(y) => y + 1,
MyOption::None => 0,
}
}
```
- [You can now use `_` as an identifier for consts.][61347] e.g. You can write
`const _: u32 = 5;`.
- [You can now use `#[repr(align(X)]` on enums.][61229]
- [The `?`/_"Kleene"_ macro operator is now available in the
2015 edition.][60932]

Compiler
--------
- [You can now enable Profile-Guided Optimization with the `-C profile-generate`
and `-C profile-use` flags.][61268] For more information on how to use profile
guided optimization, please refer to the [rustc book][rustc-book-pgo].
- [The `rust-lldb` wrapper script should now work again.][61827]

Libraries
---------
- [`mem::MaybeUninit<T>` is now ABI-compatible with `T`.][61802]

Stabilized APIs
---------------
- [`BufReader::buffer`]
- [`BufWriter::buffer`]
- [`Cell::from_mut`]
- [`Cell<[T]>::as_slice_of_cells`][`Cell<slice>::as_slice_of_cells`]
- [`DoubleEndedIterator::nth_back`]
- [`Option::xor`]
- [`Wrapping::reverse_bits`]
- [`i128::reverse_bits`]
- [`i16::reverse_bits`]
- [`i32::reverse_bits`]
- [`i64::reverse_bits`]
- [`i8::reverse_bits`]
- [`isize::reverse_bits`]
- [`slice::copy_within`]
- [`u128::reverse_bits`]
- [`u16::reverse_bits`]
- [`u32::reverse_bits`]
- [`u64::reverse_bits`]
- [`u8::reverse_bits`]
- [`usize::reverse_bits`]

Cargo
-----
- [`Cargo.lock` files are now included by default when publishing executable crates
with executables.][cargo/7026]
- [You can now specify `default-run="foo"` in `[package]` to specify the
default executable to use for `cargo run`.][cargo/7056]

Misc
----

Compatibility Notes
-------------------
- [Using `...` for inclusive range patterns will now warn by default.][61342]
Please transition your code to using the `..=` syntax for inclusive
ranges instead.
- [Using a trait object without the `dyn` will now warn by default.][61203]
Please transition your code to use `dyn Trait` for trait objects instead.

[62228]: https://github.com/rust-lang/rust/pull/62228/
[62235]: https://github.com/rust-lang/rust/pull/62235/
[61802]: https://github.com/rust-lang/rust/pull/61802/
[61827]: https://github.com/rust-lang/rust/pull/61827/
[61547]: https://github.com/rust-lang/rust/pull/61547/
[61682]: https://github.com/rust-lang/rust/pull/61682/
[61268]: https://github.com/rust-lang/rust/pull/61268/
[61342]: https://github.com/rust-lang/rust/pull/61342/
[61347]: https://github.com/rust-lang/rust/pull/61347/
[61100]: https://github.com/rust-lang/rust/pull/61100/
[61203]: https://github.com/rust-lang/rust/pull/61203/
[61229]: https://github.com/rust-lang/rust/pull/61229/
[60932]: https://github.com/rust-lang/rust/pull/60932/
[cargo/7026]: https://github.com/rust-lang/cargo/pull/7026/
[cargo/7056]: https://github.com/rust-lang/cargo/pull/7056/
[`BufReader::buffer`]: https://doc.rust-lang.org/std/io/struct.BufReader.html#method.buffer
[`BufWriter::buffer`]: https://doc.rust-lang.org/std/io/struct.BufWriter.html#method.buffer
[`Cell::from_mut`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.from_mut
[`Cell<slice>::as_slice_of_cells`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.as_slice_of_cells
[`DoubleEndedIterator::nth_back`]: https://doc.rust-lang.org/std/iter/trait.DoubleEndedIterator.html#method.nth_back
[`Option::xor`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.xor
[`RefCell::try_borrow_unguarded`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.try_borrow_unguarded
[`Wrapping::reverse_bits`]: https://doc.rust-lang.org/std/num/struct.Wrapping.html#method.reverse_bits
[`i128::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i128.html#method.reverse_bits
[`i16::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i16.html#method.reverse_bits
[`i32::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i32.html#method.reverse_bits
[`i64::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i64.html#method.reverse_bits
[`i8::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i8.html#method.reverse_bits
[`isize::reverse_bits`]: https://doc.rust-lang.org/std/primitive.isize.html#method.reverse_bits
[`slice::copy_within`]: https://doc.rust-lang.org/std/primitive.slice.html#method.copy_within
[`u128::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u128.html#method.reverse_bits
[`u16::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u16.html#method.reverse_bits
[`u32::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u32.html#method.reverse_bits
[`u64::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u64.html#method.reverse_bits
[`u8::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u8.html#method.reverse_bits
[`usize::reverse_bits`]: https://doc.rust-lang.org/std/primitive.usize.html#method.reverse_bits
[rustc-book-pgo]: https://doc.rust-lang.org/rustc/profile-guided-optimization.html


Version 1.36.0 (2019-07-04)
==========================

Expand Down Expand Up @@ -39,7 +157,7 @@ Stabilized APIs
- [`mem::MaybeUninit`]
- [`pointer::align_offset`]
- [`future::Future`]
- [`task::Context`]
- [`task::Context`]
- [`task::RawWaker`]
- [`task::RawWakerVTable`]
- [`task::Waker`]
Expand Down
33 changes: 20 additions & 13 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@
//!
//! ## Boxed values
//!
//! The [`Box`](boxed/index.html) type is a smart pointer type. There can
//! only be one owner of a `Box`, and the owner can decide to mutate the
//! contents, which live on the heap.
//! The [`Box`] type is a smart pointer type. There can only be one owner of a
//! [`Box`], and the owner can decide to mutate the contents, which live on the
//! heap.
//!
//! This type can be sent among threads efficiently as the size of a `Box` value
//! is the same as that of a pointer. Tree-like data structures are often built
//! with boxes because each node often has only one owner, the parent.
//!
//! ## Reference counted pointers
//!
//! The [`Rc`](rc/index.html) type is a non-threadsafe reference-counted pointer
//! type intended for sharing memory within a thread. An `Rc` pointer wraps a
//! type, `T`, and only allows access to `&T`, a shared reference.
//! The [`Rc`] type is a non-threadsafe reference-counted pointer type intended
//! for sharing memory within a thread. An [`Rc`] pointer wraps a type, `T`, and
//! only allows access to `&T`, a shared reference.
//!
//! This type is useful when inherited mutability (such as using `Box`) is too
//! constraining for an application, and is often paired with the `Cell` or
//! `RefCell` types in order to allow mutation.
//! This type is useful when inherited mutability (such as using [`Box`]) is too
//! constraining for an application, and is often paired with the [`Cell`] or
//! [`RefCell`] types in order to allow mutation.
//!
//! ## Atomically reference counted pointers
//!
//! The [`Arc`](sync/index.html) type is the threadsafe equivalent of the `Rc`
//! type. It provides all the same functionality of `Rc`, except it requires
//! that the contained type `T` is shareable. Additionally, `Arc<T>` is itself
//! sendable while `Rc<T>` is not.
//! The [`Arc`] type is the threadsafe equivalent of the [`Rc`] type. It
//! provides all the same functionality of [`Rc`], except it requires that the
//! contained type `T` is shareable. Additionally, [`Arc<T>`][`Arc`] is itself
//! sendable while [`Rc<T>`][`Rc`] is not.
//!
//! This type allows for shared access to the contained data, and is often
//! paired with synchronization primitives such as mutexes to allow mutation of
Expand All @@ -49,6 +49,12 @@
//!
//! The [`alloc`](alloc/index.html) module defines the low-level interface to the
//! default global allocator. It is not compatible with the libc allocator API.
//!
//! [`Arc`]: sync/index.html
//! [`Box`]: boxed/index.html
//! [`Cell`]: ../core/cell/index.html
//! [`Rc`]: rc/index.html
//! [`RefCell`]: ../core/cell/index.html

#![allow(unused_attributes)]
#![stable(feature = "alloc", since = "1.36.0")]
Expand All @@ -63,6 +69,7 @@
#![warn(missing_debug_implementations)]
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
#![allow(explicit_outlives_requirements)]
#![cfg_attr(not(bootstrap), allow(incomplete_features))]

#![cfg_attr(not(test), feature(generator_trait))]
#![cfg_attr(test, feature(test))]
Expand Down
3 changes: 2 additions & 1 deletion src/libcore/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@ impl TypeId {
/// The current implementation uses the same infrastructure as compiler
/// diagnostics and debuginfo, but this is not guaranteed.
#[stable(feature = "type_name", since = "1.38.0")]
pub fn type_name<T: ?Sized>() -> &'static str {
#[rustc_const_unstable(feature = "const_type_name")]
pub const fn type_name<T: ?Sized>() -> &'static str {
#[cfg(bootstrap)]
unsafe {
intrinsics::type_name::<T>()
Expand Down
1 change: 1 addition & 0 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
#![warn(missing_debug_implementations)]
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
#![allow(explicit_outlives_requirements)]
#![cfg_attr(not(bootstrap), allow(incomplete_features))]

#![feature(allow_internal_unstable)]
#![feature(arbitrary_self_types)]
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2088,11 +2088,11 @@ generator can be constructed.
Erroneous code example:

```edition2018,compile-fail,E0698
#![feature(futures_api, async_await, await_macro)]
#![feature(async_await)]
async fn bar<T>() -> () {}

async fn foo() {
await!(bar()); // error: cannot infer type for `T`
bar().await; // error: cannot infer type for `T`
}
```

Expand All @@ -2101,12 +2101,12 @@ To fix this you must bind `T` to a concrete type such as `String`
so that a generator can then be constructed:

```edition2018
#![feature(futures_api, async_await, await_macro)]
#![feature(async_await)]
async fn bar<T>() -> () {}

async fn foo() {
await!(bar::<String>());
// ^^^^^^^^ specify type explicitly
bar::<String>().await;
// ^^^^^^^^ specify type explicitly
}
```
"##,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4685,7 +4685,7 @@ impl<'a> LoweringContext<'a> {
})
})
}
ExprKind::Await(_origin, ref expr) => self.lower_await(e.span, expr),
ExprKind::Await(ref expr) => self.lower_await(e.span, expr),
ExprKind::Closure(
capture_clause, asyncness, movability, ref decl, ref body, fn_decl_span
) => {
Expand Down
37 changes: 34 additions & 3 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ use lint::{LintPass, LateLintPass, EarlyLintPass, EarlyContext};
use rustc::util::nodemap::FxHashSet;

use syntax::tokenstream::{TokenTree, TokenStream};
use syntax::ast;
use syntax::ast::{self, Expr};
use syntax::ptr::P;
use syntax::ast::Expr;
use syntax::attr::{self, HasAttrs, AttributeTemplate};
use syntax::source_map::Spanned;
use syntax::edition::Edition;
use syntax::feature_gate::{AttributeGate, AttributeType};
use syntax::feature_gate::{self, AttributeGate, AttributeType};
use syntax::feature_gate::{Stability, deprecated_attributes};
use syntax_pos::{BytePos, Span, SyntaxContext};
use syntax::symbol::{Symbol, kw, sym};
Expand Down Expand Up @@ -1831,3 +1830,35 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements {
}
}
}

declare_lint! {
pub INCOMPLETE_FEATURES,
Warn,
"incomplete features that may function improperly in some or all cases"
}

declare_lint_pass!(
/// Check for used feature gates in `INCOMPLETE_FEATURES` in `feature_gate.rs`.
IncompleteFeatures => [INCOMPLETE_FEATURES]
);

impl EarlyLintPass for IncompleteFeatures {
fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
let features = cx.sess.features_untracked();
features.declared_lang_features
.iter().map(|(name, span, _)| (name, span))
.chain(features.declared_lib_features.iter().map(|(name, span)| (name, span)))
.filter(|(name, _)| feature_gate::INCOMPLETE_FEATURES.iter().any(|f| name == &f))
.for_each(|(name, &span)| {
cx.struct_span_lint(
INCOMPLETE_FEATURES,
span,
&format!(
"the feature `{}` is incomplete and may cause the compiler to crash",
name,
)
)
.emit();
});
}
}
1 change: 1 addition & 0 deletions src/librustc_lint/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ macro_rules! early_lint_passes {
DeprecatedAttr: DeprecatedAttr::new(),
WhileTrue: WhileTrue,
NonAsciiIdents: NonAsciiIdents,
IncompleteFeatures: IncompleteFeatures,
]);
)
}
Expand Down
17 changes: 3 additions & 14 deletions src/libstd/sys/vxworks/process/process_vxworks.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::io::{self, Error, ErrorKind};
use libc::{self, c_int};
use libc::{self, c_int, c_char};
use libc::{RTP_ID};

use crate::sys;
use crate::sys::cvt;
use crate::sys::process::rtp;
use crate::sys::process::process_common::*;
Expand All @@ -16,8 +16,6 @@ impl Command {
use crate::sys::{cvt_r};
const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX";

let envp = self.capture_env();

if self.saw_nul() {
return Err(io::Error::new(ErrorKind::InvalidInput,
"nul byte found in provided data"));
Expand Down Expand Up @@ -54,19 +52,10 @@ impl Command {
t!(cvt(libc::chdir(cwd.as_ptr())));
}

// let envp = envp.map(|c| c.as_ptr())
// .unwrap_or(*sys::os::environ() as *const _);
// FIXME: https://github.com/rust-lang/rust/issues/61993
let envp_empty = CStringArray::with_capacity(0);
let envp = match envp {
Some(x) => x,
None => envp_empty,
};
let envp = envp.as_ptr();
let ret = rtp::rtpSpawn(
self.get_argv()[0], // executing program
self.get_argv().as_ptr() as *const _, // argv
envp as *const _, // environment variable pointers
*sys::os::environ() as *const *const c_char,
100 as c_int, // initial priority
0x16000, // initial stack size. 0 defaults
// to 0x4000 in 32 bit and 0x8000 in 64 bit
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ pub enum ExprKind {
/// preexisting defs.
Async(CaptureBy, NodeId, P<Block>),
/// An await expression (`my_future.await`).
Await(AwaitOrigin, P<Expr>),
Await(P<Expr>),

/// A try block (`try { ... }`).
TryBlock(P<Block>),
Expand Down
Loading