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 20 pull requests #53799

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
931eb4c
Add one more example for Cow that shows how to keep Cow in a struct
kpp Aug 6, 2018
9a3a12e
Fix review notes
kpp Aug 15, 2018
34b65db
document effect of join on memory ordering
RalfJung Aug 15, 2018
5bfb785
Review fix
kpp Aug 15, 2018
b73843f
Force-inline `shallow_resolve` at its hottest call site.
nnethercote Aug 17, 2018
3995bff
Add another PartialEq example
GuillaumeGomez Aug 21, 2018
9395a02
Fix stabilisation version for macro_vis_matcher.
jkozlowski Aug 25, 2018
1f421d6
call span_suggestion with applicability
jcpst Aug 26, 2018
26f38c0
Do not suggest dereferencing in macro
estebank Aug 26, 2018
a2722f3
readd final newline
estebank Aug 27, 2018
4570ace
save-analysis: Differentiate foreign functions and statics.
emilio Aug 18, 2018
c874e36
add llvm-readobj to llvm-tools-preview
japaric Aug 27, 2018
8486efa
fix a typo: taget_env -> target_env
oconnor663 Aug 27, 2018
1d79d8b
Fix source automatic scroll
GuillaumeGomez Aug 27, 2018
04b4c40
Fix invalid display of unstable messages
GuillaumeGomez Aug 27, 2018
f77ad5c
remove `let x = baz` which was obscuring the real error
nikomatsakis Aug 6, 2018
e6dcdee
expand keep-stage --help text
RalfJung Aug 28, 2018
31b63d0
split paragraph
RalfJung Aug 28, 2018
1311339
Fix typo in comment
dmerejkowsky Aug 28, 2018
84796cb
sort
japaric Aug 28, 2018
93f3f5b
Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere i…
eddyb Aug 18, 2018
6628d39
move file-extension based .gitignore down to src/
RalfJung Aug 28, 2018
da4febd
Add partialeq implementation for TryFromIntError type
GuillaumeGomez Aug 18, 2018
890d04d
Fix a comment in src/libcore/slice/mod.rs
tbu- Aug 29, 2018
e477a13
Replace usages of 'bad_style' with 'nonstandard_style'.
frewsxcv Aug 29, 2018
003cab2
Generalize `async_idents` to all new keywords
alexcrichton Aug 24, 2018
68d19de
Rollup merge of #51760 - GuillaumeGomez:add-another-partialeq-example…
pietroalbini Aug 29, 2018
cbaf492
Rollup merge of #53113 - kpp:more_docs_for_cow, r=GuillaumeGomez
pietroalbini Aug 29, 2018
644f8f1
Rollup merge of #53129 - nikomatsakis:issue-51172-tweak-test, r=pnkfelix
pietroalbini Aug 29, 2018
aa9a2cc
Rollup merge of #53389 - RalfJung:thread-join, r=sfackler
pietroalbini Aug 29, 2018
32de8fe
Rollup merge of #53472 - eddyb:fx-pls, r=pnkfelix
pietroalbini Aug 29, 2018
9379005
Rollup merge of #53476 - GuillaumeGomez:try-from-int-error-partial-eq…
pietroalbini Aug 29, 2018
e1e7fae
Rollup merge of #53513 - nnethercote:inline-shallow_resolve, r=varkor
pietroalbini Aug 29, 2018
bb7a4ee
Rollup merge of #53655 - jcpst:with_applicability, r=estebank
pietroalbini Aug 29, 2018
d4d380d
Rollup merge of #53685 - alexcrichton:more-keywords, r=varkor
pietroalbini Aug 29, 2018
7d60f7c
Rollup merge of #53702 - jkozlowski:correct_version_for_macro_vis_mat…
pietroalbini Aug 29, 2018
aa93a6a
Rollup merge of #53727 - estebank:incorrect-deref-suggestion, r=nikom…
pietroalbini Aug 29, 2018
1fa1f72
Rollup merge of #53732 - emilio:foreign-fn, r=nrc
pietroalbini Aug 29, 2018
ce12f32
Rollup merge of #53740 - japaric:readobj, r=alexcrichton
pietroalbini Aug 29, 2018
e1a0fe5
Rollup merge of #53743 - oconnor663:target_env, r=kennytm
pietroalbini Aug 29, 2018
406fc09
Rollup merge of #53747 - GuillaumeGomez:rustdoc-fixes, r=QuietMisdreavus
pietroalbini Aug 29, 2018
d187029
Rollup merge of #53753 - RalfJung:keep-stage, r=nikomatsakis
pietroalbini Aug 29, 2018
73fd785
Rollup merge of #53756 - dmerejkowsky:fix-comment, r=KodrAus
pietroalbini Aug 29, 2018
da82512
Rollup merge of #53768 - RalfJung:gitignore, r=nikomatsakis
pietroalbini Aug 29, 2018
475b0f1
Rollup merge of #53785 - tbu-:pr_comment, r=Mark-Simulacrum
pietroalbini Aug 29, 2018
35f9922
Rollup merge of #53786 - frewsxcv:frewsxcv-bad-style, r=Manishearth
pietroalbini Aug 29, 2018
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
46 changes: 0 additions & 46 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,49 +1,3 @@
*.a
*.aux
*.bc
*.boot
*.bz2
*.cmi
*.cmo
*.cmx
*.cp
*.cps
*.d
*.dSYM
*.def
*.diff
*.dll
*.dylib
*.elc
*.epub
*.exe
*.fn
*.html
*.kdev4
*.ky
*.ll
*.llvm
*.log
*.o
*.orig
*.out
*.patch
*.pdb
*.pdf
*.pg
*.pot
*.pyc
*.rej
*.rlib
*.rustc
*.so
*.swo
*.swp
*.tmp
*.toc
*.tp
*.vr
*.x86
*~
.#*
.DS_Store
Expand Down
46 changes: 46 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
*.a
*.aux
*.bc
*.boot
*.bz2
*.cmi
*.cmo
*.cmx
*.cp
*.cps
*.d
*.dSYM
*.def
*.diff
*.dll
*.dylib
*.elc
*.epub
*.exe
*.fn
*.html
*.kdev4
*.ky
*.ll
*.llvm
*.log
*.o
*.orig
*.out
*.patch
*.pdb
*.pdf
*.pg
*.pot
*.pyc
*.rej
*.rlib
*.rustc
*.so
*.swo
*.swp
*.tmp
*.toc
*.tp
*.vr
*.x86
3 changes: 2 additions & 1 deletion src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`"
"stage to build (indicates compiler to use/test, e.g. stage 0 uses the \
bootstrap compiler, stage 1 the stage 0 rustc artifacts, etc.)",
"N");
opts.optmulti("", "keep-stage", "stage(s) to keep without recompiling", "N");
opts.optmulti("", "keep-stage", "stage(s) to keep without recompiling \
(pass multiple times to keep e.g. both stages 0 and 1)", "N");
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
opts.optflag("h", "help", "print this help message");
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
//! Note that this module has a #[cfg(windows)] above it as none of this logic
//! is required on Unix.

#![allow(bad_style, dead_code)]
#![allow(nonstandard_style, dead_code)]

use std::env;
use std::io;
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ const LLVM_TOOLS: &[&str] = &[
"llvm-objcopy", // used to transform ELFs into binary format which flashing tools consume
"llvm-objdump", // used to disassemble programs
"llvm-profdata", // used to inspect and merge files generated by profiles
"llvm-readobj", // used to get information from ELFs/objects that the other tools don't provide
"llvm-size", // used to prints the size of the linker sections of a program
"llvm-strip", // used to discard symbols from binary files to reduce their size
];
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub fn symlink_dir(config: &Config, src: &Path, dest: &Path) -> io::Result<()> {
//
// Copied from std
#[cfg(windows)]
#[allow(bad_style)]
#[allow(nonstandard_style)]
fn symlink_dir_inner(target: &Path, junction: &Path) -> io::Result<()> {
use std::ptr;
use std::ffi::OsStr;
Expand Down
35 changes: 35 additions & 0 deletions src/liballoc/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,41 @@ impl<T> ToOwned for T
/// let mut input = Cow::from(vec![-1, 0, 1]);
/// abs_all(&mut input);
/// ```
///
/// Another example showing how to keep `Cow` in a struct:
///
/// ```
/// use std::borrow::{Cow, ToOwned};
///
/// struct Items<'a, X: 'a> where [X]: ToOwned<Owned=Vec<X>> {
/// values: Cow<'a, [X]>,
/// }
///
/// impl<'a, X: Clone + 'a> Items<'a, X> where [X]: ToOwned<Owned=Vec<X>> {
/// fn new(v: Cow<'a, [X]>) -> Self {
/// Items { values: v }
/// }
/// }
///
/// // Creates a container from borrowed values of a slice
/// let readonly = [1, 2];
/// let borrowed = Items::new((&readonly[..]).into());
/// match borrowed {
/// Items { values: Cow::Borrowed(b) } => println!("borrowed {:?}", b),
/// _ => panic!("expect borrowed value"),
/// }
///
/// let mut clone_on_write = borrowed;
/// // Mutates the data from slice into owned vec and pushes a new value on top
/// clone_on_write.values.to_mut().push(3);
/// println!("clone_on_write = {:?}", clone_on_write.values);
///
/// // The data was mutated. Let check it out.
/// match clone_on_write {
/// Items { values: Cow::Owned(_) } => println!("clone_on_write contains owned data"),
/// _ => panic!("expect owned data"),
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub enum Cow<'a, B: ?Sized + 'a>
where B: ToOwned
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc_system/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ mod platform {
}

#[cfg(windows)]
#[allow(bad_style)]
#[allow(nonstandard_style)]
mod platform {
use MIN_ALIGN;
use System;
Expand Down
85 changes: 84 additions & 1 deletion src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ use self::Ordering::*;
/// the same book if their ISBN matches, even if the formats differ:
///
/// ```
/// enum BookFormat { Paperback, Hardback, Ebook }
/// enum BookFormat {
/// Paperback,
/// Hardback,
/// Ebook,
/// }
///
/// struct Book {
/// isbn: i32,
/// format: BookFormat,
Expand All @@ -95,6 +100,84 @@ use self::Ordering::*;
/// assert!(b1 != b3);
/// ```
///
/// ## How can I compare two different types?
///
/// The type you can compare with is controlled by `PartialEq`'s type parameter.
/// For example, let's tweak our previous code a bit:
///
/// ```
/// enum BookFormat {
/// Paperback,
/// Hardback,
/// Ebook,
/// }
///
/// struct Book {
/// isbn: i32,
/// format: BookFormat,
/// }
///
/// impl PartialEq<BookFormat> for Book {
/// fn eq(&self, other: &BookFormat) -> bool {
/// match (&self.format, other) {
/// (BookFormat::Paperback, BookFormat::Paperback) => true,
/// (BookFormat::Hardback, BookFormat::Hardback) => true,
/// (BookFormat::Ebook, BookFormat::Ebook) => true,
/// (_, _) => false,
/// }
/// }
/// }
///
/// let b1 = Book { isbn: 3, format: BookFormat::Paperback };
///
/// assert!(b1 == BookFormat::Paperback);
/// assert!(b1 != BookFormat::Ebook);
/// ```
///
/// By changing `impl PartialEq for Book` to `impl PartialEq<BookFormat> for Book`,
/// we've changed what type we can use on the right side of the `==` operator.
/// This lets us use it in the `assert!` statements at the bottom.
///
/// You can also combine these implementations to let the `==` operator work with
/// two different types:
///
/// ```
/// enum BookFormat {
/// Paperback,
/// Hardback,
/// Ebook,
/// }
///
/// struct Book {
/// isbn: i32,
/// format: BookFormat,
/// }
///
/// impl PartialEq<BookFormat> for Book {
/// fn eq(&self, other: &BookFormat) -> bool {
/// match (&self.format, other) {
/// (&BookFormat::Paperback, &BookFormat::Paperback) => true,
/// (&BookFormat::Hardback, &BookFormat::Hardback) => true,
/// (&BookFormat::Ebook, &BookFormat::Ebook) => true,
/// (_, _) => false,
/// }
/// }
/// }
///
/// impl PartialEq for Book {
/// fn eq(&self, other: &Book) -> bool {
/// self.isbn == other.isbn
/// }
/// }
///
/// let b1 = Book { isbn: 3, format: BookFormat::Paperback };
/// let b2 = Book { isbn: 3, format: BookFormat::Ebook };
///
/// assert!(b1 == BookFormat::Paperback);
/// assert!(b1 != BookFormat::Ebook);
/// assert!(b1 == b2);
/// ```
///
/// # Examples
///
/// ```
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4323,7 +4323,7 @@ from_str_radix_int_impl! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 }

/// The error type returned when a checked integral type conversion fails.
#[unstable(feature = "try_from", issue = "33417")]
#[derive(Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct TryFromIntError(());

impl TryFromIntError {
Expand Down
7 changes: 1 addition & 6 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@
// The library infrastructure for slices is fairly messy. There's
// a lot of stuff defined here. Let's keep it clean.
//
// Since slices don't support inherent methods; all operations
// on them are defined on traits, which are then re-exported from
// the prelude for convenience. So there are a lot of traits here.
//
// The layout of this file is thus:
//
// * Slice-specific 'extension' traits and their implementations. This
// is where most of the slice API resides.
// * Inherent methods. This is where most of the slice API resides.
// * Implementations of a few common traits with important slice ops.
// * Definitions of a bunch of iterators.
// * Free functions.
Expand Down
2 changes: 1 addition & 1 deletion src/libpanic_unwind/seh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
//! [win64]: http://msdn.microsoft.com/en-us/library/1eyas8tf.aspx
//! [llvm]: http://llvm.org/docs/ExceptionHandling.html#background-on-windows-exceptions

#![allow(bad_style)]
#![allow(nonstandard_style)]
#![allow(private_no_mangle_fns)]

use alloc::boxed::Box;
Expand Down
2 changes: 1 addition & 1 deletion src/libpanic_unwind/seh64_gnu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! Unwinding implementation of top of native Win64 SEH,
//! however the unwind handler data (aka LSDA) uses GCC-compatible encoding.

#![allow(bad_style)]
#![allow(nonstandard_style)]
#![allow(private_no_mangle_fns)]

use alloc::boxed::Box;
Expand Down
2 changes: 1 addition & 1 deletion src/libpanic_unwind/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![allow(bad_style)]
#![allow(nonstandard_style)]
#![allow(dead_code)]
#![cfg(windows)]

Expand Down
7 changes: 4 additions & 3 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ use hir::GenericArg;
use lint::builtin::{self, PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
ELIDED_LIFETIMES_IN_PATHS};
use middle::cstore::CrateStore;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::indexed_vec::IndexVec;
use rustc_data_structures::small_vec::OneVector;
use rustc_data_structures::thin_vec::ThinVec;
use session::Session;
use util::common::FN_OUTPUT_NAME;
use util::nodemap::{DefIdMap, NodeMap};

use std::collections::{BTreeMap, HashSet};
use std::collections::BTreeMap;
use std::fmt::Debug;
use std::iter;
use std::mem;
Expand Down Expand Up @@ -1342,7 +1343,7 @@ impl<'a> LoweringContext<'a> {
exist_ty_id: NodeId,
collect_elided_lifetimes: bool,
currently_bound_lifetimes: Vec<hir::LifetimeName>,
already_defined_lifetimes: HashSet<hir::LifetimeName>,
already_defined_lifetimes: FxHashSet<hir::LifetimeName>,
output_lifetimes: Vec<hir::GenericArg>,
output_lifetime_params: Vec<hir::GenericParam>,
}
Expand Down Expand Up @@ -1476,7 +1477,7 @@ impl<'a> LoweringContext<'a> {
exist_ty_id,
collect_elided_lifetimes: true,
currently_bound_lifetimes: Vec::new(),
already_defined_lifetimes: HashSet::new(),
already_defined_lifetimes: FxHashSet::default(),
output_lifetimes: Vec::new(),
output_lifetime_params: Vec::new(),
};
Expand Down
10 changes: 9 additions & 1 deletion src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
self.resolve_type_vars_if_possible(t).to_string()
}

pub fn shallow_resolve(&self, typ: Ty<'tcx>) -> Ty<'tcx> {
// We have this force-inlined variant of shallow_resolve() for the one
// callsite that is extremely hot. All other callsites use the normal
// variant.
#[inline(always)]
pub fn inlined_shallow_resolve(&self, typ: Ty<'tcx>) -> Ty<'tcx> {
match typ.sty {
ty::Infer(ty::TyVar(v)) => {
// Not entirely obvious: if `typ` is a type variable,
Expand Down Expand Up @@ -1157,6 +1161,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
}

pub fn shallow_resolve(&self, typ: Ty<'tcx>) -> Ty<'tcx> {
self.inlined_shallow_resolve(typ)
}

pub fn resolve_type_vars_if_possible<T>(&self, value: &T) -> T
where T: TypeFoldable<'tcx>
{
Expand Down
Loading