Skip to content

Rollup of 11 pull requests #55095

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

Merged
merged 32 commits into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8552c61
Add initial impl of check_pat() for UnusedParens
kleimkuhler Oct 2, 2018
5217527
Share outer paren trimming logic
kleimkuhler Oct 4, 2018
46b07d6
Simply unused_parens check and add tests
kleimkuhler Oct 6, 2018
47014df
Fix Range warning and improve tests
kleimkuhler Oct 7, 2018
0e411c2
Add clarifying pattern lint comment and revert test
kleimkuhler Oct 10, 2018
3855af5
add test for #23189
euclio Oct 11, 2018
09f42dd
Add missing lifetime fragment specifier to error message.
ehuss Oct 13, 2018
af6c871
doc: make core::fmt::Error example more simple
tshepang Oct 13, 2018
12b5c7b
Don't collect to vectors where unnecessary
ljedrz Oct 13, 2018
9d3643d
Make EvalContext::step public again
bjorn3 Oct 14, 2018
8a228fd
Add comment about step being used by priroda
bjorn3 Oct 14, 2018
1b355a8
Fix incorrect link in println! documentation
Oct 14, 2018
e8ec498
clarify pointer add/sub function safety concerns
jannic Oct 14, 2018
6cc84ac
remove unnecessary emphasis in doc comment
jannic Oct 14, 2018
ac6b3f8
Deduplicate tests
sinkuu Oct 15, 2018
942a796
rustc/session: whitespace & formatting improvements
ljedrz Oct 10, 2018
675f00b
rustc/session: improve allocations
ljedrz Oct 10, 2018
0b2e9f7
rustc/session: improve common patterns
ljedrz Oct 10, 2018
e5eb538
rustc/session: use to_owned when no string conversion is needed
ljedrz Oct 10, 2018
42ae9dc
rustc/session: move consts up to improve readability
ljedrz Oct 10, 2018
e03d24e
Update rustc documentation link
juchiast Oct 15, 2018
7ba24e8
Rollup merge of #54820 - kleimkuhler:issue-54538-unused_patterns-lint…
Manishearth Oct 15, 2018
3ffb16f
Rollup merge of #54963 - ljedrz:cleanup_rustc_session, r=varkor
Manishearth Oct 15, 2018
defcb16
Rollup merge of #54991 - euclio:issue-23189, r=tmandry
Manishearth Oct 15, 2018
78765e5
Rollup merge of #55025 - ehuss:missing-lifetime-err-msg, r=petrochenkov
Manishearth Oct 15, 2018
dc87247
Rollup merge of #55047 - tshepang:simple, r=alexcrichton
Manishearth Oct 15, 2018
2e8b61d
Rollup merge of #55048 - ljedrz:begone_vecc, r=estebank
Manishearth Oct 15, 2018
8e42f01
Rollup merge of #55060 - jannic:patch-1, r=joshtriplett
Manishearth Oct 15, 2018
96ab4a8
Rollup merge of #55062 - bjorn3:ecx-step-public, r=oli-obk
Manishearth Oct 15, 2018
6993a05
Rollup merge of #55066 - iaz3:patch-1, r=sfackler
Manishearth Oct 15, 2018
4d837be
Rollup merge of #55081 - sinkuu:dedup_test, r=Manishearth
Manishearth Oct 15, 2018
562625d
Rollup merge of #55088 - juchiast:master, r=varkor
Manishearth Oct 15, 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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ are:
* Don't be afraid to ask! The Rust community is friendly and helpful.

[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/about-this-guide.html
[gdfrustc]: http://manishearth.github.io/rust-internals-docs/rustc/
[gdfrustc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/
[gsearchdocs]: https://www.google.com/search?q=site:doc.rust-lang.org+your+query+here
[rif]: http://internals.rust-lang.org
[rr]: https://doc.rust-lang.org/book/README.html
Expand Down
5 changes: 2 additions & 3 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ pub type Result = result::Result<(), Error>;
/// use std::fmt::{self, write};
///
/// let mut output = String::new();
/// match write(&mut output, format_args!("Hello {}!", "world")) {
/// Err(fmt::Error) => panic!("An error occurred"),
/// _ => (),
/// if let Err(fmt::Error) = write(&mut output, format_args!("Hello {}!", "world")) {
/// panic!("An error occurred");
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ impl<T: ?Sized> *const T {
/// Behavior:
///
/// * Both the starting and resulting pointer must be either in bounds or one
/// byte past the end of *the same* allocated object.
/// byte past the end of the same allocated object.
///
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
///
Expand Down Expand Up @@ -1255,7 +1255,7 @@ impl<T: ?Sized> *const T {
/// Behavior:
///
/// * Both the starting and resulting pointer must be either in bounds or one
/// byte past the end of an allocated object.
/// byte past the end of the same allocated object.
///
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
///
Expand Down Expand Up @@ -1312,7 +1312,7 @@ impl<T: ?Sized> *const T {
/// Behavior:
///
/// * Both the starting and resulting pointer must be either in bounds or one
/// byte past the end of an allocated object.
/// byte past the end of the same allocated object.
///
/// * The computed offset cannot exceed `isize::MAX` **bytes**.
///
Expand Down Expand Up @@ -1657,7 +1657,7 @@ impl<T: ?Sized> *mut T {
/// Behavior:
///
/// * Both the starting and resulting pointer must be either in bounds or one
/// byte past the end of *the same* allocated object.
/// byte past the end of the same allocated object.
///
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
///
Expand Down Expand Up @@ -1893,7 +1893,7 @@ impl<T: ?Sized> *mut T {
/// Behavior:
///
/// * Both the starting and resulting pointer must be either in bounds or one
/// byte past the end of an allocated object.
/// byte past the end of the same allocated object.
///
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
///
Expand Down Expand Up @@ -1950,7 +1950,7 @@ impl<T: ?Sized> *mut T {
/// Behavior:
///
/// * Both the starting and resulting pointer must be either in bounds or one
/// byte past the end of an allocated object.
/// byte past the end of the same allocated object.
///
/// * The computed offset cannot exceed `isize::MAX` **bytes**.
///
Expand Down
5 changes: 1 addition & 4 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ use util::nodemap::{DefIdMap, NodeMap};

use std::collections::BTreeMap;
use std::fmt::Debug;
use std::iter;
use std::mem;
use smallvec::SmallVec;
use syntax::attr;
Expand Down Expand Up @@ -3888,9 +3887,7 @@ impl<'a> LoweringContext<'a> {
.collect::<P<[hir::Field]>>();

let is_unit = fields.is_empty();
let struct_path = iter::once("ops")
.chain(iter::once(path))
.collect::<Vec<_>>();
let struct_path = ["ops", path];
let struct_path = self.std_path(e.span, &struct_path, None, is_unit);
let struct_path = hir::QPath::Resolved(None, P(struct_path));

Expand Down
214 changes: 99 additions & 115 deletions src/librustc/session/config.rs

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions src/librustc/session/filesearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl<'a> FileSearch<'a> {
F: FnMut(&Path, PathKind)
{
let mut visited_dirs = FxHashSet::default();

visited_dirs.reserve(self.search_paths.paths.len() + 1);
for (path, kind) in self.search_paths.iter(self.kind) {
f(path, kind);
visited_dirs.insert(path.to_path_buf());
Expand Down Expand Up @@ -160,7 +160,7 @@ pub fn get_or_default_sysroot() -> PathBuf {
match env::current_exe() {
Ok(exe) => {
match canonicalize(Some(exe)) {
Some(mut p) => { p.pop(); p.pop(); return p; },
Some(mut p) => { p.pop(); p.pop(); p },
None => bug!("can't determine value for sysroot")
}
}
Expand All @@ -175,25 +175,25 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> {
// to lib64/lib32. This would be more foolproof by basing the sysroot off
// of the directory where librustc is located, rather than where the rustc
// binary is.
//If --libdir is set during configuration to the value other than
// If --libdir is set during configuration to the value other than
// "lib" (i.e. non-default), this value is used (see issue #16552).

match option_env!("CFG_LIBDIR_RELATIVE") {
Some(libdir) if libdir != "lib" => return libdir.into(),
_ => if sysroot.join(PRIMARY_LIB_DIR).join(RUST_LIB_DIR).exists() {
return PRIMARY_LIB_DIR.into();
} else {
return SECONDARY_LIB_DIR.into();
}
}

#[cfg(target_pointer_width = "64")]
const PRIMARY_LIB_DIR: &'static str = "lib64";

#[cfg(target_pointer_width = "32")]
const PRIMARY_LIB_DIR: &'static str = "lib32";

const SECONDARY_LIB_DIR: &'static str = "lib";

match option_env!("CFG_LIBDIR_RELATIVE") {
Some(libdir) if libdir != "lib" => libdir.into(),
_ => if sysroot.join(PRIMARY_LIB_DIR).join(RUST_LIB_DIR).exists() {
PRIMARY_LIB_DIR.into()
} else {
SECONDARY_LIB_DIR.into()
}
}
}

// The name of rustc's own place to organize libraries.
Expand Down
50 changes: 19 additions & 31 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,8 @@ impl Session {
match self.opts.maybe_sysroot {
Some(ref sysroot) => sysroot,
None => self.default_sysroot
.as_ref()
.expect("missing sysroot and default_sysroot in Session"),
.as_ref()
.expect("missing sysroot and default_sysroot in Session"),
}
}
pub fn target_filesearch(&self, kind: PathKind) -> filesearch::FileSearch<'_> {
Expand All @@ -727,14 +727,8 @@ impl Session {
pub fn set_incr_session_load_dep_graph(&self, load: bool) {
let mut incr_comp_session = self.incr_comp_session.borrow_mut();

match *incr_comp_session {
IncrCompSession::Active {
ref mut load_dep_graph,
..
} => {
*load_dep_graph = load;
}
_ => {}
if let IncrCompSession::Active { ref mut load_dep_graph, .. } = *incr_comp_session {
*load_dep_graph = load;
}
}

Expand Down Expand Up @@ -872,9 +866,9 @@ impl Session {
/// This expends fuel if applicable, and records fuel if applicable.
pub fn consider_optimizing<T: Fn() -> String>(&self, crate_name: &str, msg: T) -> bool {
let mut ret = true;
match self.optimization_fuel_crate {
Some(ref c) if c == crate_name => {
assert!(self.query_threads() == 1);
if let Some(ref c) = self.optimization_fuel_crate {
if c == crate_name {
assert_eq!(self.query_threads(), 1);
let fuel = self.optimization_fuel_limit.get();
ret = fuel != 0;
if fuel == 0 && !self.out_of_fuel.get() {
Expand All @@ -884,14 +878,12 @@ impl Session {
self.optimization_fuel_limit.set(fuel - 1);
}
}
_ => {}
}
match self.print_fuel_crate {
Some(ref c) if c == crate_name => {
assert!(self.query_threads() == 1);
if let Some(ref c) = self.print_fuel_crate {
if c == crate_name {
assert_eq!(self.query_threads(), 1);
self.print_fuel.set(self.print_fuel.get() + 1);
}
_ => {}
}
ret
}
Expand Down Expand Up @@ -1108,14 +1100,11 @@ pub fn build_session_(
source_map: Lrc<source_map::SourceMap>,
) -> Session {
let host_triple = TargetTriple::from_triple(config::host_triple());
let host = match Target::search(&host_triple) {
Ok(t) => t,
Err(e) => {
span_diagnostic
.fatal(&format!("Error loading host specification: {}", e))
.raise();
}
};
let host = Target::search(&host_triple).unwrap_or_else(|e|
span_diagnostic
.fatal(&format!("Error loading host specification: {}", e))
.raise()
);
let target_cfg = config::build_target_config(&sopts, &span_diagnostic);

let p_s = parse::ParseSess::with_span_handler(span_diagnostic, source_map);
Expand All @@ -1135,12 +1124,11 @@ pub fn build_session_(
let print_fuel_crate = sopts.debugging_opts.print_fuel.clone();
let print_fuel = LockCell::new(0);

let working_dir = match env::current_dir() {
Ok(dir) => dir,
Err(e) => p_s.span_diagnostic
let working_dir = env::current_dir().unwrap_or_else(|e|
p_s.span_diagnostic
.fatal(&format!("Current directory is invalid: {}", e))
.raise(),
};
.raise()
);
let working_dir = file_path_mapping.map_prefix(working_dir);

let cgu_reuse_tracker = if sopts.debugging_opts.query_dep_graph {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/session/search_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use session::{early_error, config};

#[derive(Clone, Debug)]
pub struct SearchPaths {
paths: Vec<(PathKind, PathBuf)>,
crate paths: Vec<(PathKind, PathBuf)>,
}

pub struct Iter<'a> {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,7 @@ pub fn build_output_filenames(
.crate_name
.clone()
.or_else(|| attr::find_crate_name(attrs).map(|n| n.to_string()))
.unwrap_or_else(|| input.filestem());
.unwrap_or_else(|| input.filestem().to_owned());

OutputFilenames {
out_directory: dirpath,
Expand Down
Loading