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 16 pull requests #59885

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
438f6b0
Fix lifetime on LocalInternedString::get function
Zoxc Mar 16, 2019
5ea959d
Convert symbols to strings for pretty printing
Zoxc Mar 16, 2019
e65c0ed
Properly parse '--extern-private' with name and path
Aaron1011 Mar 21, 2019
3344ca7
Combine 'Extern' and 'ExternPrivate'
Aaron1011 Mar 25, 2019
591e503
Fix tidy
Aaron1011 Mar 25, 2019
9ebc97a
Fix tests
Aaron1011 Apr 1, 2019
1907367
Ensure that exact matches come first in rustdoc search
GuillaumeGomez Apr 1, 2019
7f033b5
Improve formatting
Aaron1011 Apr 2, 2019
3c1446d
describe_enum_variant: Reduce code duplication
tmandry Apr 2, 2019
5c7a944
Add documentation on the -Z flag on the command-line arguments sectio…
Apr 3, 2019
968ea1c
Mark variables captured by reference as mutable correctly
matthewjasper Apr 4, 2019
894142d
Add back the substring test
GuillaumeGomez Apr 4, 2019
ec2a144
Add discr_index to multi-variant layouts
tmandry Apr 2, 2019
6d062a1
Use a proc macro to declare preallocated symbols
Zoxc Apr 3, 2019
907ad61
Make check_name generic
Zoxc Apr 5, 2019
f442fd1
Move some function from cg_llvm/back/link.rs to cg_ssa/back/link.rs
bjorn3 Mar 30, 2019
38524a9
Move some filename constants to cg_ssa
bjorn3 Mar 30, 2019
d082400
Make link functions generic over archive builder
bjorn3 Mar 30, 2019
7ecca38
Remove get_reloc_model and target_cpu dependency from most of link.rs
bjorn3 Mar 30, 2019
2f25075
Move almost all of cg_llvm/back/link.rs to cg_ssa
bjorn3 Mar 30, 2019
ba48f6c
Remove cg_llvm/back/link.rs
bjorn3 Mar 30, 2019
9814dc8
Move cg_llvm/debuginfo/type_names.rs to cg_ssa
bjorn3 Mar 30, 2019
c922dec
Tidy
bjorn3 Mar 30, 2019
da5f1bf
Move new_public to 'tess' module
Aaron1011 Apr 7, 2019
ef33748
Refactor structure of ExternEntry
Aaron1011 Apr 7, 2019
278efd1
Update rustdoc to new ExternEntry format
Aaron1011 Apr 7, 2019
edebed9
compiletest: Improve no_prefer_dynamic docs
phansch Apr 8, 2019
01be78d
Add Waker::wake_by_ref and make Waker::wake consume the Waker
cramertj Apr 5, 2019
6786fa7
Rename Waker::new_unchecked to Waker::from_raw
cramertj Apr 5, 2019
7d3eba3
Fix ExternEntry test
Aaron1011 Apr 9, 2019
59c8a18
Ensure the symbols are pure strings
Zoxc Apr 9, 2019
86a3b9d
Move modules outside the proc macro
Zoxc Apr 9, 2019
30a86cf
Use colon for keyword defs
Zoxc Apr 9, 2019
3262d1e
Kill dead code dominator code.
vext01 Apr 9, 2019
757ef38
improve unknown enum variant errors
euclio Apr 8, 2019
eb15d2f
Derive Default for ExternEntry
Aaron1011 Apr 9, 2019
3e01901
Remove strange formatting in `Ordering` docs.
ehuss Apr 9, 2019
3826493
std::ops::Div examples: correct nominator to numerator
andersk Apr 10, 2019
7acfa45
Updated the documentation, now claiming the -Z is associated to unsta…
Apr 10, 2019
cdeb745
Updated the description of -Z in the rustc book.
Apr 10, 2019
e2d1d66
SGX target: fix cfg(test) build
Apr 10, 2019
fa3b1c3
Rollup merge of #59227 - Zoxc:fix-get, r=eddyb
cramertj Apr 11, 2019
2f9f15b
Rollup merge of #59335 - Aaron1011:fix/extern-priv-final, r=petrochenkov
cramertj Apr 11, 2019
ef896aa
Rollup merge of #59564 - bjorn3:move_link_to_cg_ssa, r=eddyb
cramertj Apr 11, 2019
a5d5f8d
Rollup merge of #59622 - GuillaumeGomez:improve-one-char-search, r=Qu…
cramertj Apr 11, 2019
5130fd6
Rollup merge of #59651 - tmandry:discr-index, r=eddyb
cramertj Apr 11, 2019
e4950c7
Rollup merge of #59655 - Zoxc:symbols, r=petrochenkov
cramertj Apr 11, 2019
37cb3ee
Rollup merge of #59680 - DevQps:document-rustc-z-flag, r=cramertj
cramertj Apr 11, 2019
c9e320d
Rollup merge of #59708 - matthewjasper:double-closure-unused-mut, r=p…
cramertj Apr 11, 2019
b9a99b9
Rollup merge of #59711 - GuillaumeGomez:substring-test, r=QuietMisdre…
cramertj Apr 11, 2019
33fc12a
Rollup merge of #59733 - cramertj:wake-by-ref, r=withoutboats
cramertj Apr 11, 2019
5ca16c6
Rollup merge of #59806 - phansch:compiletest_docs2, r=oli-obk
cramertj Apr 11, 2019
546af18
Rollup merge of #59811 - vext01:dead-dominator-code, r=oli-obk
cramertj Apr 11, 2019
0fa4ce7
Rollup merge of #59821 - euclio:unknown-enum-variants, r=davidtwco
cramertj Apr 11, 2019
e40fa0d
Rollup merge of #59831 - ehuss:ordering-docs, r=kennytm
cramertj Apr 11, 2019
d951a91
Rollup merge of #59836 - andersk:nominator, r=Centril
cramertj Apr 11, 2019
3215b70
Rollup merge of #59857 - jethrogb:jb/sgx-test, r=Centril
cramertj Apr 11, 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
2 changes: 2 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2613,6 +2613,7 @@ dependencies = [
"serialize 0.0.0",
"syntax 0.0.0",
"syntax_pos 0.0.0",
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
Expand Down Expand Up @@ -3374,6 +3375,7 @@ dependencies = [
"arena 0.0.0",
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_data_structures 0.0.0",
"rustc_macros 0.1.0",
"scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serialize 0.0.0",
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down
7 changes: 7 additions & 0 deletions src/doc/rustc/src/command-line-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ This flag will set which lints should be set to the [deny level](lints/levels.ht

This flag will set which lints should be set to the [forbid level](lints/levels.html#forbid).

## `-Z`: set unstable options

This flag will allow you to set unstable options of rustc. In order to set multiple options,
the -Z flag can be used multiple times. For example: `rustc -Z verbose -Z time`.
Specifying options with -Z is only available on nightly. To view all available options
run: `rustc -Z help`.

## `--cap-lints`: set the most restrictive lint level

This flag lets you 'cap' lints, for more, [see here](lints/levels.html#capping-lints).
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,13 @@ pub struct AssertParamIsEq<T: Eq + ?Sized> { _field: ::marker::PhantomData<T> }
#[derive(Clone, Copy, PartialEq, Debug, Hash)]
#[stable(feature = "rust1", since = "1.0.0")]
pub enum Ordering {
/// An ordering where a compared value is less [than another].
/// An ordering where a compared value is less than another.
#[stable(feature = "rust1", since = "1.0.0")]
Less = -1,
/// An ordering where a compared value is equal [to another].
/// An ordering where a compared value is equal to another.
#[stable(feature = "rust1", since = "1.0.0")]
Equal = 0,
/// An ordering where a compared value is greater [than another].
/// An ordering where a compared value is greater than another.
#[stable(feature = "rust1", since = "1.0.0")]
Greater = 1,
}
Expand Down
28 changes: 14 additions & 14 deletions src/libcore/ops/arith.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,21 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// // derive `Eq` and `PartialEq`.
/// #[derive(Debug, Eq, PartialEq)]
/// struct Rational {
/// nominator: usize,
/// numerator: usize,
/// denominator: usize,
/// }
///
/// impl Rational {
/// fn new(nominator: usize, denominator: usize) -> Self {
/// fn new(numerator: usize, denominator: usize) -> Self {
/// if denominator == 0 {
/// panic!("Zero is an invalid denominator!");
/// }
///
/// // Reduce to lowest terms by dividing by the greatest common
/// // divisor.
/// let gcd = gcd(nominator, denominator);
/// let gcd = gcd(numerator, denominator);
/// Rational {
/// nominator: nominator / gcd,
/// numerator: numerator / gcd,
/// denominator: denominator / gcd,
/// }
/// }
Expand All @@ -245,9 +245,9 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// type Output = Self;
///
/// fn mul(self, rhs: Self) -> Self {
/// let nominator = self.nominator * rhs.nominator;
/// let numerator = self.numerator * rhs.numerator;
/// let denominator = self.denominator * rhs.denominator;
/// Rational::new(nominator, denominator)
/// Rational::new(numerator, denominator)
/// }
/// }
///
Expand Down Expand Up @@ -340,21 +340,21 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// // derive `Eq` and `PartialEq`.
/// #[derive(Debug, Eq, PartialEq)]
/// struct Rational {
/// nominator: usize,
/// numerator: usize,
/// denominator: usize,
/// }
///
/// impl Rational {
/// fn new(nominator: usize, denominator: usize) -> Self {
/// fn new(numerator: usize, denominator: usize) -> Self {
/// if denominator == 0 {
/// panic!("Zero is an invalid denominator!");
/// }
///
/// // Reduce to lowest terms by dividing by the greatest common
/// // divisor.
/// let gcd = gcd(nominator, denominator);
/// let gcd = gcd(numerator, denominator);
/// Rational {
/// nominator: nominator / gcd,
/// numerator: numerator / gcd,
/// denominator: denominator / gcd,
/// }
/// }
Expand All @@ -365,13 +365,13 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// type Output = Self;
///
/// fn div(self, rhs: Self) -> Self::Output {
/// if rhs.nominator == 0 {
/// if rhs.numerator == 0 {
/// panic!("Cannot divide by zero-valued `Rational`!");
/// }
///
/// let nominator = self.nominator * rhs.denominator;
/// let denominator = self.denominator * rhs.nominator;
/// Rational::new(nominator, denominator)
/// let numerator = self.numerator * rhs.denominator;
/// let denominator = self.denominator * rhs.numerator;
/// Rational::new(numerator, denominator)
/// }
/// }
///
Expand Down
60 changes: 49 additions & 11 deletions src/libcore/task/wake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,18 @@ pub struct RawWakerVTable {
/// This function will be called when `wake` is called on the [`Waker`].
/// It must wake up the task associated with this [`RawWaker`].
///
/// The implemention of this function must not consume the provided data
/// pointer.
/// The implementation of this function must make sure to release any
/// resources that are associated with this instance of a [`RawWaker`] and
/// associated task.
wake: unsafe fn(*const ()),

/// This function will be called when `wake_by_ref` is called on the [`Waker`].
/// It must wake up the task associated with this [`RawWaker`].
///
/// This function is similar to `wake`, but must not consume the provided data
/// pointer.
wake_by_ref: unsafe fn(*const ()),

/// This function gets called when a [`RawWaker`] gets dropped.
///
/// The implementation of this function must make sure to release any
Expand All @@ -85,8 +93,8 @@ pub struct RawWakerVTable {
}

impl RawWakerVTable {
/// Creates a new `RawWakerVTable` from the provided `clone`, `wake`, and
/// `drop` functions.
/// Creates a new `RawWakerVTable` from the provided `clone`, `wake`,
/// `wake_by_ref`, and `drop` functions.
///
/// # `clone`
///
Expand All @@ -103,7 +111,16 @@ impl RawWakerVTable {
/// This function will be called when `wake` is called on the [`Waker`].
/// It must wake up the task associated with this [`RawWaker`].
///
/// The implemention of this function must not consume the provided data
/// The implementation of this function must make sure to release any
/// resources that are associated with this instance of a [`RawWaker`] and
/// associated task.
///
/// # `wake_by_ref`
///
/// This function will be called when `wake_by_ref` is called on the [`Waker`].
/// It must wake up the task associated with this [`RawWaker`].
///
/// This function is similar to `wake`, but must not consume the provided data
/// pointer.
///
/// # `drop`
Expand All @@ -120,11 +137,13 @@ impl RawWakerVTable {
pub const fn new(
clone: unsafe fn(*const ()) -> RawWaker,
wake: unsafe fn(*const ()),
wake_by_ref: unsafe fn(*const ()),
drop: unsafe fn(*const ()),
) -> Self {
Self {
clone,
wake,
wake_by_ref,
drop,
}
}
Expand Down Expand Up @@ -187,14 +206,33 @@ unsafe impl Sync for Waker {}
impl Waker {
/// Wake up the task associated with this `Waker`.
#[inline]
pub fn wake(&self) {
pub fn wake(self) {
// The actual wakeup call is delegated through a virtual function call
// to the implementation which is defined by the executor.
let wake = self.waker.vtable.wake;
let data = self.waker.data;

// SAFETY: This is safe because `Waker::new_unchecked` is the only way
// Don't call `drop` -- the waker will be consumed by `wake`.
crate::mem::forget(self);

// SAFETY: This is safe because `Waker::from_raw` is the only way
// to initialize `wake` and `data` requiring the user to acknowledge
// that the contract of `RawWaker` is upheld.
unsafe { (self.waker.vtable.wake)(self.waker.data) }
unsafe { (wake)(data) };
}

/// Wake up the task associated with this `Waker` without consuming the `Waker`.
///
/// This is similar to `wake`, but may be slightly less efficient in the case
/// where an owned `Waker` is available. This method should be preferred to
/// calling `waker.clone().wake()`.
#[inline]
pub fn wake_by_ref(&self) {
// The actual wakeup call is delegated through a virtual function call
// to the implementation which is defined by the executor.

// SAFETY: see `wake`
unsafe { (self.waker.vtable.wake_by_ref)(self.waker.data) }
}

/// Returns `true` if this `Waker` and another `Waker` have awoken the same task.
Expand All @@ -215,7 +253,7 @@ impl Waker {
/// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld.
/// Therefore this method is unsafe.
#[inline]
pub unsafe fn new_unchecked(waker: RawWaker) -> Waker {
pub unsafe fn from_raw(waker: RawWaker) -> Waker {
Waker {
waker,
}
Expand All @@ -226,7 +264,7 @@ impl Clone for Waker {
#[inline]
fn clone(&self) -> Self {
Waker {
// SAFETY: This is safe because `Waker::new_unchecked` is the only way
// SAFETY: This is safe because `Waker::from_raw` is the only way
// to initialize `clone` and `data` requiring the user to acknowledge
// that the contract of [`RawWaker`] is upheld.
waker: unsafe { (self.waker.vtable.clone)(self.waker.data) },
Expand All @@ -237,7 +275,7 @@ impl Clone for Waker {
impl Drop for Waker {
#[inline]
fn drop(&mut self) {
// SAFETY: This is safe because `Waker::new_unchecked` is the only way
// SAFETY: This is safe because `Waker::from_raw` is the only way
// to initialize `drop` and `data` requiring the user to acknowledge
// that the contract of `RawWaker` is upheld.
unsafe { (self.waker.vtable.drop)(self.waker.data) }
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/hir/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ impl<'a> State<'a> {
}
hir::ItemKind::GlobalAsm(ref ga) => {
self.head(visibility_qualified(&item.vis, "global asm"))?;
self.s.word(ga.asm.as_str().get())?;
self.s.word(ga.asm.as_str().to_string())?;
self.end()?
}
hir::ItemKind::Ty(ref ty, ref generics) => {
Expand Down Expand Up @@ -1591,7 +1591,7 @@ impl<'a> State<'a> {
if ident.is_raw_guess() {
self.s.word(format!("r#{}", ident.name))?;
} else {
self.s.word(ident.as_str().get())?;
self.s.word(ident.as_str().to_string())?;
}
self.ann.post(self, AnnNode::Name(&ident.name))
}
Expand Down Expand Up @@ -1998,7 +1998,7 @@ impl<'a> State<'a> {
self.commasep(Inconsistent, &decl.inputs, |s, ty| {
s.ibox(indent_unit)?;
if let Some(arg_name) = arg_names.get(i) {
s.s.word(arg_name.as_str().get())?;
s.s.word(arg_name.as_str().to_string())?;
s.s.word(":")?;
s.s.space()?;
} else if let Some(body_id) = body_id {
Expand Down
1 change: 1 addition & 0 deletions src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ pub trait CrateStore {

// "queries" used in resolve that aren't tracked for incremental compilation
fn crate_name_untracked(&self, cnum: CrateNum) -> Symbol;
fn crate_is_private_dep_untracked(&self, cnum: CrateNum) -> bool;
fn crate_disambiguator_untracked(&self, cnum: CrateNum) -> CrateDisambiguator;
fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh;
fn extern_mod_stmt_cnum_untracked(&self, emod_id: ast::NodeId) -> Option<CrateNum>;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/lib_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::ty::TyCtxt;
use crate::hir::intravisit::{self, NestedVisitorMap, Visitor};
use syntax::symbol::Symbol;
use syntax::ast::{Attribute, MetaItem, MetaItemKind};
use syntax_pos::Span;
use syntax_pos::{Span, symbols};
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
use rustc_macros::HashStable;
use errors::DiagnosticId;
Expand Down Expand Up @@ -51,12 +51,12 @@ impl<'a, 'tcx> LibFeatureCollector<'a, 'tcx> {
}

fn extract(&self, attr: &Attribute) -> Option<(Symbol, Option<Symbol>, Span)> {
let stab_attrs = vec!["stable", "unstable", "rustc_const_unstable"];
let stab_attrs = [symbols::stable, symbols::unstable, symbols::rustc_const_unstable];

// Find a stability attribute (i.e., `#[stable (..)]`, `#[unstable (..)]`,
// `#[rustc_const_unstable (..)]`).
if let Some(stab_attr) = stab_attrs.iter().find(|stab_attr| {
attr.check_name(stab_attr)
attr.check_name(**stab_attr)
}) {
let meta_item = attr.meta();
if let Some(MetaItem { node: MetaItemKind::List(ref metas), .. }) = meta_item {
Expand Down
Loading