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 15 pull requests #59910

Merged
merged 33 commits into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5c7a944
Add documentation on the -Z flag on the command-line arguments sectio…
Apr 3, 2019
894142d
Add back the substring test
GuillaumeGomez Apr 4, 2019
edebed9
compiletest: Improve no_prefer_dynamic docs
phansch Apr 8, 2019
9017d46
Make trait_methods_not_found use a lock
Zoxc Apr 9, 2019
3262d1e
Kill dead code dominator code.
vext01 Apr 9, 2019
757ef38
improve unknown enum variant errors
euclio Apr 8, 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
0234878
Update TRPL to use mdbook 0.2
carols10cents Apr 11, 2019
f54df44
Remove note about transmute for float bitpatterns.
solson Apr 11, 2019
ae2a68b
Fix broken links on std::boxed doc page
ollie27 Apr 9, 2019
aefc158
Update diagnostics.rs
andrewbanchich Apr 11, 2019
90d9727
Fix the link to sort_by_cached_key
cuviper Apr 11, 2019
1ced262
save-analysis: use `qpath_def` for associated types
Xanewok Apr 11, 2019
bcd263e
save-analysis: Simplify match arm for type node def
Xanewok Apr 11, 2019
59e95dd
Rollup merge of #59680 - DevQps:document-rustc-z-flag, r=cramertj
Centril Apr 12, 2019
d77b7d9
Rollup merge of #59711 - GuillaumeGomez:substring-test, r=QuietMisdre…
Centril Apr 12, 2019
2f71ecb
Rollup merge of #59806 - phansch:compiletest_docs2, r=oli-obk
Centril Apr 12, 2019
f4c8cc9
Rollup merge of #59809 - Zoxc:trait_methods_not_found, r=estebank
Centril Apr 12, 2019
ba10b13
Rollup merge of #59811 - vext01:dead-dominator-code, r=oli-obk
Centril Apr 12, 2019
484e703
Rollup merge of #59814 - ollie27:dead_boxed_links, r=QuietMisdreavus
Centril Apr 12, 2019
24ee611
Rollup merge of #59821 - euclio:unknown-enum-variants, r=davidtwco
Centril Apr 12, 2019
94b7b6a
Rollup merge of #59831 - ehuss:ordering-docs, r=kennytm
Centril Apr 12, 2019
740c9ea
Rollup merge of #59836 - andersk:nominator, r=Centril
Centril Apr 12, 2019
c852cc5
Rollup merge of #59857 - jethrogb:jb/sgx-test, r=Centril
Centril Apr 12, 2019
ef90d94
Rollup merge of #59876 - integer32llc:update-trpl-to-mdbook-0.2, r=st…
Centril Apr 12, 2019
257dbb8
Rollup merge of #59880 - solson:transmute-float, r=alexcrichton
Centril Apr 12, 2019
cb7079f
Rollup merge of #59889 - andrewbanchich:minor-text-fixes, r=estebank
Centril Apr 12, 2019
dddcd92
Rollup merge of #59891 - rust-lang:sort_by_cached_key, r=jonas-schievink
Centril Apr 12, 2019
7a8329f
Rollup merge of #59894 - Xanewok:save-assoc-ty-qpath, r=eddyb
Centril Apr 12, 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: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Compatibility Notes
[`num::NonZeroI64`]: https://doc.rust-lang.org/std/num/struct.NonZeroI64.html
[`num::NonZeroI8`]: https://doc.rust-lang.org/std/num/struct.NonZeroI8.html
[`num::NonZeroIsize`]: https://doc.rust-lang.org/std/num/struct.NonZeroIsize.html
[`slice::sort_by_cached_key`]: https://doc.rust-lang.org/std/slice/fn.sort_by_cached_key
[`slice::sort_by_cached_key`]: https://doc.rust-lang.org/std/primitive.slice.html#method.sort_by_cached_key
[`str::escape_debug`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_debug
[`str::escape_default`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_default
[`str::escape_unicode`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_unicode
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ impl Step for TheBook {
builder.ensure(Rustbook {
target,
name: INTERNER.intern_string(name.to_string()),
version: RustbookVersion::MdBook1,
version: RustbookVersion::MdBook2,
});

// building older edition redirects
Expand All @@ -286,21 +286,21 @@ impl Step for TheBook {
builder.ensure(Rustbook {
target,
name: INTERNER.intern_string(source_name),
version: RustbookVersion::MdBook1,
version: RustbookVersion::MdBook2,
});

let source_name = format!("{}/second-edition", name);
builder.ensure(Rustbook {
target,
name: INTERNER.intern_string(source_name),
version: RustbookVersion::MdBook1,
version: RustbookVersion::MdBook2,
});

let source_name = format!("{}/2018-edition", name);
builder.ensure(Rustbook {
target,
name: INTERNER.intern_string(source_name),
version: RustbookVersion::MdBook1,
version: RustbookVersion::MdBook2,
});

// build the version info page and CSS
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
2 changes: 2 additions & 0 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
//!
//! [dereferencing]: ../../std/ops/trait.Deref.html
//! [`Box`]: struct.Box.html
//! [`Global`]: ../alloc/struct.Global.html
//! [`Layout`]: ../alloc/struct.Layout.html

#![stable(feature = "rust1", since = "1.0.0")]

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
10 changes: 0 additions & 10 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,16 +737,6 @@ extern "rust-intrinsic" {
///
/// There are a few things that `transmute` is really useful for.
///
/// Getting the bitpattern of a floating point type (or, more generally,
/// type punning, when `T` and `U` aren't pointers):
///
/// ```
/// let bitpattern = unsafe {
/// std::mem::transmute::<f32, u32>(1.0)
/// };
/// assert_eq!(bitpattern, 0x3F800000);
/// ```
///
/// Turning a pointer into a function pointer. This is *not* portable to
/// machines where function pointers and data pointers have different sizes.
///
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
4 changes: 2 additions & 2 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub struct Session {
pub driver_lint_caps: FxHashMap<lint::LintId, lint::Level>,

/// `Span`s of trait methods that weren't found to avoid emitting object safety errors
pub trait_methods_not_found: OneThread<RefCell<FxHashSet<Span>>>,
pub trait_methods_not_found: Lock<FxHashSet<Span>>,
}

pub struct PerfStats {
Expand Down Expand Up @@ -1236,7 +1236,7 @@ fn build_session_(
has_global_allocator: Once::new(),
has_panic_handler: Once::new(),
driver_lint_caps,
trait_methods_not_found: OneThread::new(RefCell::new(Default::default())),
trait_methods_not_found: Lock::new(Default::default()),
};

validate_commandline_args_with_session_available(&sess);
Expand Down
47 changes: 0 additions & 47 deletions src/librustc_data_structures/graph/dominators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use super::super::indexed_vec::{Idx, IndexVec};
use super::iterate::reverse_post_order;
use super::ControlFlowGraph;

use std::fmt;

#[cfg(test)]
mod test;

Expand Down Expand Up @@ -158,48 +156,3 @@ impl<'dom, Node: Idx> Iterator for Iter<'dom, Node> {
}
}
}

pub struct DominatorTree<N: Idx> {
root: N,
children: IndexVec<N, Vec<N>>,
}

impl<Node: Idx> DominatorTree<Node> {
pub fn children(&self, node: Node) -> &[Node] {
&self.children[node]
}
}

impl<Node: Idx> fmt::Debug for DominatorTree<Node> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(
&DominatorTreeNode {
tree: self,
node: self.root,
},
fmt,
)
}
}

struct DominatorTreeNode<'tree, Node: Idx> {
tree: &'tree DominatorTree<Node>,
node: Node,
}

impl<'tree, Node: Idx> fmt::Debug for DominatorTreeNode<'tree, Node> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let subtrees: Vec<_> = self.tree
.children(self.node)
.iter()
.map(|&child| DominatorTreeNode {
tree: self.tree,
node: child,
})
.collect();
fmt.debug_tuple("")
.field(&self.node)
.field(&subtrees)
.finish()
}
}
4 changes: 2 additions & 2 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ fn usage(verbose: bool, include_unstable_options: bool) {
}
let message = "Usage: rustc [OPTIONS] INPUT";
let nightly_help = if nightly_options::is_nightly_build() {
"\n -Z help Print internal options for debugging rustc"
"\n -Z help Print unstable compiler options"
} else {
""
};
Expand Down Expand Up @@ -892,7 +892,7 @@ Available lint options:
}

fn describe_debug_flags() {
println!("\nAvailable debug options:\n");
println!("\nAvailable options:\n");
print_flag_list("-Z", config::DB_OPTIONS);
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2307,10 +2307,10 @@ let q = *p;
```

Here, the expression `&foo()` is borrowing the expression
`foo()`. As `foo()` is call to a function, and not the name of
`foo()`. As `foo()` is a call to a function, and not the name of
a variable, this creates a **temporary** -- that temporary stores
the return value from `foo()` so that it can be borrowed.
So you might imagine that `let p = bar(&foo())` is equivalent
You could imagine that `let p = bar(&foo());` is equivalent
to this:

```compile_fail,E0597
Expand Down
24 changes: 4 additions & 20 deletions src/librustc_save_analysis/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use rustc::middle::cstore::ExternCrate;
use rustc::session::config::{CrateType, Input, OutputType};
use rustc::ty::{self, DefIdTree, TyCtxt};
use rustc::{bug, span_bug};
use rustc_typeck::hir_ty_to_ty;
use rustc_codegen_utils::link::{filename_for_metadata, out_filename};
use rustc_data_structures::sync::Lrc;

Expand Down Expand Up @@ -648,6 +647,10 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
Node::Pat(&hir::Pat {
node: hir::PatKind::TupleStruct(ref qpath, ..),
..
}) |
Node::Ty(&hir::Ty {
node: hir::TyKind::Path(ref qpath),
..
}) => {
let hir_id = self.tcx.hir().node_to_hir_id(id);
self.tables.qpath_def(qpath, hir_id)
Expand All @@ -658,25 +661,6 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
..
}) => HirDef::Local(self.tcx.hir().hir_to_node_id(canonical_id)),

Node::Ty(ty) => if let hir::Ty {
node: hir::TyKind::Path(ref qpath),
..
} = *ty
{
match *qpath {
hir::QPath::Resolved(_, ref path) => path.def,
hir::QPath::TypeRelative(..) => {
let ty = hir_ty_to_ty(self.tcx, ty);
if let ty::Projection(proj) = ty.sty {
return HirDef::AssociatedTy(proj.item_def_id);
}
HirDef::Err
}
}
} else {
HirDef::Err
},

_ => HirDef::Err,
}
}
Expand Down
21 changes: 13 additions & 8 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1362,27 +1362,32 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
let msg = format!("expected type, found variant `{}`", assoc_ident);
tcx.sess.span_err(span, &msg);
} else if qself_ty.is_enum() {
// Report as incorrect enum variant rather than ambiguous type.
let mut err = tcx.sess.struct_span_err(
span,
&format!("no variant `{}` on enum `{}`", &assoc_ident.as_str(), qself_ty),
assoc_ident.span,
&format!("no variant `{}` in enum `{}`", assoc_ident, qself_ty),
);
// Check if it was a typo.

let adt_def = qself_ty.ty_adt_def().expect("enum is not an ADT");
if let Some(suggested_name) = find_best_match_for_name(
adt_def.variants.iter().map(|variant| &variant.ident.name),
&assoc_ident.as_str(),
None,
) {
err.span_suggestion(
span,
"did you mean",
format!("{}::{}", qself_ty, suggested_name),
assoc_ident.span,
"there is a variant with a similar name",
suggested_name.to_string(),
Applicability::MaybeIncorrect,
);
} else {
err.span_label(span, "unknown variant");
err.span_label(span, format!("variant not found in `{}`", qself_ty));
}

if let Some(sp) = tcx.hir().span_if_local(adt_def.did) {
let sp = tcx.sess.source_map().def_span(sp);
err.span_label(sp, format!("variant `{}` not found here", assoc_ident));
}

err.emit();
} else if !qself_ty.references_error() {
// Don't print `TyErr` to the user.
Expand Down
Loading