Skip to content

Commit

Permalink
Auto merge of #60683 - Centril:rollup-p05qh5d, r=Centril
Browse files Browse the repository at this point in the history
Rollup of 8 pull requests

Successful merges:

 - #59348 (Clean up and add tests for slice drop shims)
 - #60188 (Identify when a stmt could have been parsed as an expr)
 - #60234 (std: Derive `Default` for `io::Cursor`)
 - #60618 (Comment ext::tt::transcribe)
 - #60648 (Skip codegen for one UI test with long file path)
 - #60671 (remove unneeded `extern crate`s from build tools)
 - #60675 (Remove the old await! macro)
 - #60676 (Fix async desugaring providing wrong input to procedural macros.)

Failed merges:

r? @ghost
  • Loading branch information
bors committed May 10, 2019
2 parents adcd4aa + 45b0945 commit 03bd2f6
Show file tree
Hide file tree
Showing 59 changed files with 818 additions and 294 deletions.
76 changes: 36 additions & 40 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ num_cpus = "1.0"
getopts = "0.2.19"
cc = "1.0.35"
libc = "0.2"
serde = "1.0.8"
serde_derive = "1.0.8"
serde = { version = "1.0.8", features = ["derive"] }
serde_json = "1.0.2"
toml = "0.4"
lazy_static = "0.2"
lazy_static = "1.3.0"
time = "0.1"
petgraph = "0.4.13"

Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use std::path::{Path, PathBuf};
use std::process::Command;
use std::time::{Duration, Instant};

use build_helper::t;

use crate::cache::{Cache, Interned, INTERNER};
use crate::check;
use crate::compile;
Expand Down Expand Up @@ -1308,6 +1310,8 @@ mod __test {
use crate::config::Config;
use std::thread;

use pretty_assertions::assert_eq;

fn configure(host: &[&str], target: &[&str]) -> Config {
let mut config = Config::default_opts();
// don't save toolstates
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use std::path::{Path, PathBuf};
use std::sync::Mutex;
use std::cmp::{PartialOrd, Ord, Ordering};

use lazy_static::lazy_static;

use crate::builder::Step;

pub struct Interned<T>(usize, PhantomData<*const T>);
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use std::fs;
use std::io::{self, ErrorKind};
use std::path::Path;

use build_helper::t;

use crate::Build;

pub fn clean(build: &Build, all: bool) {
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ use std::path::{Path, PathBuf};
use std::process::{Command, Stdio, exit};
use std::str;

use build_helper::{output, mtime, up_to_date};
use build_helper::{output, mtime, t, up_to_date};
use filetime::FileTime;
use serde::Deserialize;
use serde_json;

use crate::dist;
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ use std::path::{Path, PathBuf};
use std::process;
use std::cmp;

use build_helper::t;
use num_cpus;
use toml;
use serde::Deserialize;
use crate::cache::{INTERNER, Interned};
use crate::flags::Flags;
pub use crate::flags::Subcommand;
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::io::Write;
use std::path::{PathBuf, Path};
use std::process::{Command, Stdio};

use build_helper::output;
use build_helper::{output, t};

use crate::{Compiler, Mode, LLVM_TOOLS};
use crate::channel;
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::io;
use std::path::{PathBuf, Path};

use crate::Mode;
use build_helper::up_to_date;
use build_helper::{t, up_to_date};

use crate::util::symlink_dir;
use crate::builder::{Builder, Compiler, RunConfig, ShouldRun, Step};
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use std::fs;
use std::path::{Path, PathBuf, Component};
use std::process::Command;

use build_helper::t;

use crate::dist::{self, pkgname, sanitize_sh, tmpdir};

use crate::builder::{Builder, RunConfig, ShouldRun, Step};
Expand Down
15 changes: 3 additions & 12 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,6 @@
#![feature(core_intrinsics)]
#![feature(drain_filter)]

#[macro_use]
extern crate build_helper;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate lazy_static;

#[cfg(test)]
#[macro_use]
extern crate pretty_assertions;

use std::cell::{RefCell, Cell};
use std::collections::{HashSet, HashMap};
use std::env;
Expand All @@ -134,7 +123,9 @@ use std::os::unix::fs::symlink as symlink_file;
#[cfg(windows)]
use std::os::windows::fs::symlink_file;

use build_helper::{run_silent, run_suppressed, try_run_silent, try_run_suppressed, output, mtime};
use build_helper::{
mtime, output, run_silent, run_suppressed, t, try_run_silent, try_run_suppressed,
};
use filetime::FileTime;

use crate::util::{exe, libdir, OutputFolder, CiEnv};
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::path::PathBuf;
use std::collections::HashSet;

use build_helper::output;
use serde::Deserialize;
use serde_json;

use crate::{Build, Crate};
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::fs::{self, File};
use std::path::{Path, PathBuf};
use std::process::Command;

use build_helper::output;
use build_helper::{output, t};
use cmake;
use cc;

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::fs;
use std::path::PathBuf;
use std::process::Command;

use build_helper::output;
use build_helper::{output, t};

use crate::Build;

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::iter;
use std::path::{Path, PathBuf};
use std::process::Command;

use build_helper::{self, output};
use build_helper::{self, output, t};

use crate::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step};
use crate::cache::{Interned, INTERNER};
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use std::path::PathBuf;
use std::process::{Command, exit};
use std::collections::HashSet;

use build_helper::t;

use crate::Mode;
use crate::Compiler;
use crate::builder::{Step, RunConfig, ShouldRun, Builder};
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/toolstate.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use serde::{Deserialize, Serialize};

#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "kebab-case")]
/// Whether a tool can be compiled, tested or neither
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use std::path::{Path, PathBuf};
use std::process::Command;
use std::time::{SystemTime, Instant};

use build_helper::t;

use crate::config::Config;
use crate::builder::Builder;

Expand Down
44 changes: 11 additions & 33 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ use errors::Applicability;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::indexed_vec::IndexVec;
use rustc_data_structures::thin_vec::ThinVec;
use rustc_data_structures::sync::Lrc;

use std::collections::{BTreeSet, BTreeMap};
use std::mem;
Expand All @@ -59,10 +58,10 @@ use syntax::attr;
use syntax::ast;
use syntax::ast::*;
use syntax::errors;
use syntax::ext::hygiene::{Mark, SyntaxContext};
use syntax::ext::hygiene::Mark;
use syntax::print::pprust;
use syntax::ptr::P;
use syntax::source_map::{self, respan, CompilerDesugaringKind, Spanned};
use syntax::source_map::{respan, CompilerDesugaringKind, Spanned};
use syntax::std_inject;
use syntax::symbol::{keywords, Symbol};
use syntax::tokenstream::{TokenStream, TokenTree};
Expand Down Expand Up @@ -854,27 +853,6 @@ impl<'a> LoweringContext<'a> {
Ident::with_empty_ctxt(Symbol::gensym(s))
}

/// Reuses the span but adds information like the kind of the desugaring and features that are
/// allowed inside this span.
fn mark_span_with_reason(
&self,
reason: CompilerDesugaringKind,
span: Span,
allow_internal_unstable: Option<Lrc<[Symbol]>>,
) -> Span {
let mark = Mark::fresh(Mark::root());
mark.set_expn_info(source_map::ExpnInfo {
call_site: span,
def_site: Some(span),
format: source_map::CompilerDesugaring(reason),
allow_internal_unstable,
allow_internal_unsafe: false,
local_inner_macros: false,
edition: source_map::hygiene::default_edition(),
});
span.with_ctxt(SyntaxContext::empty().apply_mark(mark))
}

fn with_anonymous_lifetime_mode<R>(
&mut self,
anonymous_lifetime_mode: AnonymousLifetimeMode,
Expand Down Expand Up @@ -1162,7 +1140,7 @@ impl<'a> LoweringContext<'a> {
attrs: ThinVec::new(),
};

let unstable_span = self.mark_span_with_reason(
let unstable_span = self.sess.source_map().mark_span_with_reason(
CompilerDesugaringKind::Async,
span,
Some(vec![
Expand Down Expand Up @@ -1569,7 +1547,7 @@ impl<'a> LoweringContext<'a> {
// desugaring that explicitly states that we don't want to track that.
// Not tracking it makes lints in rustc and clippy very fragile as
// frequently opened issues show.
let exist_ty_span = self.mark_span_with_reason(
let exist_ty_span = self.sess.source_map().mark_span_with_reason(
CompilerDesugaringKind::ExistentialReturnType,
span,
None,
Expand Down Expand Up @@ -2443,7 +2421,7 @@ impl<'a> LoweringContext<'a> {
) -> hir::FunctionRetTy {
let span = output.span();

let exist_ty_span = self.mark_span_with_reason(
let exist_ty_span = self.sess.source_map().mark_span_with_reason(
CompilerDesugaringKind::Async,
span,
None,
Expand Down Expand Up @@ -4179,7 +4157,7 @@ impl<'a> LoweringContext<'a> {
}),
ExprKind::TryBlock(ref body) => {
self.with_catch_scope(body.id, |this| {
let unstable_span = this.mark_span_with_reason(
let unstable_span = this.sess.source_map().mark_span_with_reason(
CompilerDesugaringKind::TryBlock,
body.span,
Some(vec![
Expand Down Expand Up @@ -4612,7 +4590,7 @@ impl<'a> LoweringContext<'a> {
// expand <head>
let mut head = self.lower_expr(head);
let head_sp = head.span;
let desugared_span = self.mark_span_with_reason(
let desugared_span = self.sess.source_map().mark_span_with_reason(
CompilerDesugaringKind::ForLoop,
head_sp,
None,
Expand Down Expand Up @@ -4773,15 +4751,15 @@ impl<'a> LoweringContext<'a> {
// return Try::from_error(From::from(err)),
// }

let unstable_span = self.mark_span_with_reason(
let unstable_span = self.sess.source_map().mark_span_with_reason(
CompilerDesugaringKind::QuestionMark,
e.span,
Some(vec![
Symbol::intern("try_trait")
].into()),
);
let try_span = self.sess.source_map().end_point(e.span);
let try_span = self.mark_span_with_reason(
let try_span = self.sess.source_map().mark_span_with_reason(
CompilerDesugaringKind::QuestionMark,
try_span,
Some(vec![
Expand Down Expand Up @@ -5566,12 +5544,12 @@ impl<'a> LoweringContext<'a> {
);
self.sess.abort_if_errors();
}
let span = self.mark_span_with_reason(
let span = self.sess.source_map().mark_span_with_reason(
CompilerDesugaringKind::Await,
await_span,
None,
);
let gen_future_span = self.mark_span_with_reason(
let gen_future_span = self.sess.source_map().mark_span_with_reason(
CompilerDesugaringKind::Await,
await_span,
Some(vec![Symbol::intern("gen_future")].into()),
Expand Down
Loading

0 comments on commit 03bd2f6

Please sign in to comment.