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 10 pull requests #58728

Merged
merged 21 commits into from
Feb 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c654968
Deny the `overflowing_literals` lint for all editions
ollie27 Jan 17, 2019
46f1cc6
reduce miri code repetition like (n << amt) >> amt
kenta7777 Feb 23, 2019
e7296fd
Fix error index E0370 doctests on 32 bit platforms
ollie27 Feb 24, 2019
423ae56
reduce a code repetition like (n << amt) >> amt
kenta7777 Feb 24, 2019
4ca865e
heading # Unsafety => # Safety in stdlib docs.
Centril Feb 25, 2019
9661a81
librustc_codegen_llvm: deny(elided_lifetimes_in_paths)
Centril Feb 25, 2019
1d34f2c
librustc_codegen_ssa: deny(elided_lifetimes_in_paths)
Centril Feb 25, 2019
e8ce56f
librustc_typeck: deny(elided_lifetimes_in_paths)
Centril Feb 25, 2019
235d3ed
librustc: deny(elided_lifetimes_in_paths)
Centril Feb 25, 2019
7029094
Test that binop subtyping in rustc_typeck fixes #27949
jamwt Feb 25, 2019
6343d6b
bootstrap: deny(rust_2018_idioms)
taiki-e Feb 25, 2019
554aed6
Rollup merge of #55632 - ollie27:deny_overflowing_literals, r=Centril
Centril Feb 25, 2019
5f910fa
Rollup merge of #58687 - kenta7777:reduce-miri-code-repetition, r=oli…
Centril Feb 25, 2019
53f15f2
Rollup merge of #58690 - kenta7777:reduce-code-repetition-miri-relate…
Centril Feb 25, 2019
2019d96
Rollup merge of #58718 - Centril:doc-convention-safety, r=RalfJung
Centril Feb 25, 2019
77e2e84
Rollup merge of #58719 - Centril:deny-elided_lifetimes_in_paths, r=ol…
Centril Feb 25, 2019
2a69aec
Rollup merge of #58720 - Centril:deny-elided_lifetimes_in_paths-libru…
Centril Feb 25, 2019
d4a62a7
Rollup merge of #58722 - Centril:deny-elided_lifetimes_in_paths-libru…
Centril Feb 25, 2019
3f6d65a
Rollup merge of #58723 - Centril:deny-elided_lifetimes_in_paths-libru…
Centril Feb 25, 2019
e53fbf8
Rollup merge of #58725 - jamwt:fix-27949, r=Centril
Centril Feb 25, 2019
d6de1e9
Rollup merge of #58727 - taiki-e:deny-rust_2018_idioms-bootstrap, r=C…
Centril Feb 25, 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
24 changes: 12 additions & 12 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {

/// Primary function to execute this rule. Can call `builder.ensure()`
/// with other steps to run those.
fn run(self, builder: &Builder) -> Self::Output;
fn run(self, builder: &Builder<'_>) -> Self::Output;

/// When bootstrap is passed a set of paths, this controls whether this rule
/// will execute. However, it does not get called in a "default" context
/// when we are not passed any paths; in that case, `make_run` is called
/// directly.
fn should_run(run: ShouldRun) -> ShouldRun;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_>;

/// Builds up a "root" rule, either as a default rule or from a path passed
/// to us.
///
/// When path is `None`, we are executing in a context where no paths were
/// passed. When `./x.py build` is run, for example, this rule could get
/// called if it is in the correct list below with a path of `None`.
fn make_run(_run: RunConfig) {
fn make_run(_run: RunConfig<'_>) {
// It is reasonable to not have an implementation of make_run for rules
// who do not want to get called from the root context. This means that
// they are likely dependencies (e.g., sysroot creation) or similar, and
Expand All @@ -95,8 +95,8 @@ pub struct RunConfig<'a> {
struct StepDescription {
default: bool,
only_hosts: bool,
should_run: fn(ShouldRun) -> ShouldRun,
make_run: fn(RunConfig),
should_run: fn(ShouldRun<'_>) -> ShouldRun<'_>,
make_run: fn(RunConfig<'_>),
name: &'static str,
}

Expand Down Expand Up @@ -124,7 +124,7 @@ impl PathSet {
}
}

fn path(&self, builder: &Builder) -> PathBuf {
fn path(&self, builder: &Builder<'_>) -> PathBuf {
match self {
PathSet::Set(set) => set
.iter()
Expand All @@ -147,7 +147,7 @@ impl StepDescription {
}
}

fn maybe_run(&self, builder: &Builder, pathset: &PathSet) {
fn maybe_run(&self, builder: &Builder<'_>, pathset: &PathSet) {
if builder.config.exclude.iter().any(|e| pathset.has(e)) {
eprintln!("Skipping {:?} because it is excluded", pathset);
return;
Expand Down Expand Up @@ -183,7 +183,7 @@ impl StepDescription {
}
}

fn run(v: &[StepDescription], builder: &Builder, paths: &[PathBuf]) {
fn run(v: &[StepDescription], builder: &Builder<'_>, paths: &[PathBuf]) {
let should_runs = v
.iter()
.map(|desc| (desc.should_run)(ShouldRun::new(builder)))
Expand Down Expand Up @@ -245,7 +245,7 @@ pub struct ShouldRun<'a> {
}

impl<'a> ShouldRun<'a> {
fn new(builder: &'a Builder) -> ShouldRun<'a> {
fn new(builder: &'a Builder<'_>) -> ShouldRun<'a> {
ShouldRun {
builder,
paths: BTreeSet::new(),
Expand Down Expand Up @@ -511,7 +511,7 @@ impl<'a> Builder<'a> {
Some(help)
}

pub fn new(build: &Build) -> Builder {
pub fn new(build: &Build) -> Builder<'_> {
let (kind, paths) = match build.config.cmd {
Subcommand::Build { ref paths } => (Kind::Build, &paths[..]),
Subcommand::Check { ref paths } => (Kind::Check, &paths[..]),
Expand Down Expand Up @@ -591,11 +591,11 @@ impl<'a> Builder<'a> {
impl Step for Libdir {
type Output = Interned<PathBuf>;

fn should_run(run: ShouldRun) -> ShouldRun {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.never()
}

fn run(self, builder: &Builder) -> Interned<PathBuf> {
fn run(self, builder: &Builder<'_>) -> Interned<PathBuf> {
let compiler = self.compiler;
let config = &builder.build.config;
let lib = if compiler.stage >= 1 && config.libdir_relative().is_some() {
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,20 @@ unsafe impl<T> Send for Interned<T> {}
unsafe impl<T> Sync for Interned<T> {}

impl fmt::Display for Interned<String> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let s: &str = &*self;
f.write_str(s)
}
}

impl fmt::Debug for Interned<String> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let s: &str = &*self;
f.write_fmt(format_args!("{:?}", s))
}
}
impl fmt::Debug for Interned<PathBuf> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let s: &Path = &*self;
f.write_fmt(format_args!("{:?}", s))
}
Expand Down
3 changes: 1 addition & 2 deletions src/bootstrap/cc_detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use std::path::{Path, PathBuf};
use std::process::Command;

use build_helper::output;
use cc;

use crate::{Build, GitRepo};
use crate::config::Target;
Expand Down Expand Up @@ -157,7 +156,7 @@ fn set_compiler(cfg: &mut cc::Build,
None => return,
};
match output[i + 3..].chars().next().unwrap() {
'0' ... '6' => {}
'0' ..= '6' => {}
_ => return,
}
let alternative = format!("e{}", gnu_compiler);
Expand Down
56 changes: 36 additions & 20 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ impl Step for Std {
type Output = ();
const DEFAULT: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.all_krates("std")
}

fn make_run(run: RunConfig) {
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Std {
target: run.target,
});
}

fn run(self, builder: &Builder) {
fn run(self, builder: &Builder<'_>) {
let target = self.target;
let compiler = builder.compiler(0, builder.config.build);

Expand Down Expand Up @@ -56,11 +56,11 @@ impl Step for Rustc {
const ONLY_HOSTS: bool = true;
const DEFAULT: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.all_krates("rustc-main")
}

fn make_run(run: RunConfig) {
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Rustc {
target: run.target,
});
Expand All @@ -71,7 +71,7 @@ impl Step for Rustc {
/// This will build the compiler for a particular stage of the build using
/// the `compiler` targeting the `target` architecture. The artifacts
/// created will also be linked into the sysroot directory.
fn run(self, builder: &Builder) {
fn run(self, builder: &Builder<'_>) {
let compiler = builder.compiler(0, builder.config.build);
let target = self.target;

Expand Down Expand Up @@ -103,11 +103,11 @@ impl Step for CodegenBackend {
const ONLY_HOSTS: bool = true;
const DEFAULT: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.all_krates("rustc_codegen_llvm")
}

fn make_run(run: RunConfig) {
fn make_run(run: RunConfig<'_>) {
let backend = run.builder.config.rust_codegen_backends.get(0);
let backend = backend.cloned().unwrap_or_else(|| {
INTERNER.intern_str("llvm")
Expand All @@ -118,7 +118,7 @@ impl Step for CodegenBackend {
});
}

fn run(self, builder: &Builder) {
fn run(self, builder: &Builder<'_>) {
let compiler = builder.compiler(0, builder.config.build);
let target = self.target;
let backend = self.backend;
Expand Down Expand Up @@ -148,17 +148,17 @@ impl Step for Test {
type Output = ();
const DEFAULT: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.all_krates("test")
}

fn make_run(run: RunConfig) {
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Test {
target: run.target,
});
}

fn run(self, builder: &Builder) {
fn run(self, builder: &Builder<'_>) {
let compiler = builder.compiler(0, builder.config.build);
let target = self.target;

Expand Down Expand Up @@ -189,17 +189,17 @@ impl Step for Rustdoc {
const ONLY_HOSTS: bool = true;
const DEFAULT: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/rustdoc")
}

fn make_run(run: RunConfig) {
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Rustdoc {
target: run.target,
});
}

fn run(self, builder: &Builder) {
fn run(self, builder: &Builder<'_>) {
let compiler = builder.compiler(0, builder.config.build);
let target = self.target;

Expand Down Expand Up @@ -229,25 +229,37 @@ impl Step for Rustdoc {

/// Cargo's output path for the standard library in a given stage, compiled
/// by a particular compiler for the specified target.
pub fn libstd_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
pub fn libstd_stamp(
builder: &Builder<'_>,
compiler: Compiler,
target: Interned<String>,
) -> PathBuf {
builder.cargo_out(compiler, Mode::Std, target).join(".libstd-check.stamp")
}

/// Cargo's output path for libtest in a given stage, compiled by a particular
/// compiler for the specified target.
pub fn libtest_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
pub fn libtest_stamp(
builder: &Builder<'_>,
compiler: Compiler,
target: Interned<String>,
) -> PathBuf {
builder.cargo_out(compiler, Mode::Test, target).join(".libtest-check.stamp")
}

/// Cargo's output path for librustc in a given stage, compiled by a particular
/// compiler for the specified target.
pub fn librustc_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
pub fn librustc_stamp(
builder: &Builder<'_>,
compiler: Compiler,
target: Interned<String>,
) -> PathBuf {
builder.cargo_out(compiler, Mode::Rustc, target).join(".librustc-check.stamp")
}

/// Cargo's output path for librustc_codegen_llvm in a given stage, compiled by a particular
/// compiler for the specified target and backend.
fn codegen_backend_stamp(builder: &Builder,
fn codegen_backend_stamp(builder: &Builder<'_>,
compiler: Compiler,
target: Interned<String>,
backend: Interned<String>) -> PathBuf {
Expand All @@ -257,7 +269,11 @@ fn codegen_backend_stamp(builder: &Builder,

/// Cargo's output path for rustdoc in a given stage, compiled by a particular
/// compiler for the specified target.
pub fn rustdoc_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
pub fn rustdoc_stamp(
builder: &Builder<'_>,
compiler: Compiler,
target: Interned<String>,
) -> PathBuf {
builder.cargo_out(compiler, Mode::ToolRustc, target)
.join(".rustdoc-check.stamp")
}
Loading