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 6 pull requests #66452

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a902383
Update cc, git2, num_cpus.
ehuss Nov 9, 2019
969b741
protect creation of destructors by a mutex
stlankes Nov 12, 2019
8871731
Merge remote-tracking branch 'rust-lang/master' into hermit
stlankes Nov 12, 2019
b6d93d9
libpanic_unwind for Miri: make sure we have the SEH lang items when n…
RalfJung Nov 15, 2019
e1a87ca
Move FatalError to syntax_pos
Mark-Simulacrum Nov 14, 2019
942f0a6
Move SourceMap to syntax_pos
Mark-Simulacrum Nov 15, 2019
3f93ffc
Remove SourceMapper trait
Mark-Simulacrum Nov 15, 2019
c31a875
Move JSON emitter to rustc_errors
Mark-Simulacrum Nov 14, 2019
b8dca6c
Add --force-run-in-process unstable libtest option
tmandry Nov 14, 2019
d252ba3
Improve error message for tests with panic=abort
tmandry Nov 14, 2019
4e621a8
Add test for issue-36122
JohnTitor Nov 14, 2019
74329bf
Add test for issue-58094
JohnTitor Nov 14, 2019
564c78a
Fix test case and issue number
JohnTitor Nov 14, 2019
09f0ee5
Apply suggestion from Centril
JohnTitor Nov 14, 2019
065e1b8
more comment
RalfJung Nov 15, 2019
614abe4
Fix nll test
JohnTitor Nov 15, 2019
fd84f03
Rollup merge of #66255 - ehuss:update-cc, r=alexcrichton
Centril Nov 15, 2019
12065b1
Rollup merge of #66350 - hermitcore:hermit, r=rkruppe
Centril Nov 15, 2019
e2aa473
Rollup merge of #66407 - JohnTitor:add-ice-tests, r=Centril
Centril Nov 15, 2019
eaf7e97
Rollup merge of #66415 - tmandry:force-test-in-process, r=alexcrichton
Centril Nov 15, 2019
1724afd
Rollup merge of #66427 - Mark-Simulacrum:errors-json, r=Centril
Centril Nov 15, 2019
7761647
Rollup merge of #66441 - RalfJung:seh, r=oli-obk
Centril Nov 15, 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
22 changes: 13 additions & 9 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,13 @@ version = "0.1.0"

[[package]]
name = "cc"
version = "1.0.37"
version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d"
checksum = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8"
dependencies = [
"jobserver",
"num_cpus",
]

[[package]]
name = "cfg-if"
Expand Down Expand Up @@ -1255,9 +1259,9 @@ dependencies = [

[[package]]
name = "git2"
version = "0.10.0"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327d698f86a7ebdfeb86a4238ccdb004828939d3a3555b6ead679541d14e36c0"
checksum = "39f27186fbb5ec67ece9a56990292bc5aed3c3fc51b9b07b0b52446b1dfb4a82"
dependencies = [
"bitflags",
"libc",
Expand Down Expand Up @@ -1785,9 +1789,9 @@ dependencies = [

[[package]]
name = "libgit2-sys"
version = "0.9.0"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c2078aec6f4b16d1b89f6a72e4f6eb1e75ffa85312023291e89c6d3087bc8fb"
checksum = "a30f8637eb59616ee3b8a00f6adff781ee4ddd8343a615b8238de756060cc1b3"
dependencies = [
"cc",
"libc",
Expand Down Expand Up @@ -2228,9 +2232,9 @@ checksum = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"

[[package]]
name = "num_cpus"
version = "1.8.0"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30"
checksum = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
dependencies = [
"libc",
]
Expand Down Expand Up @@ -3130,7 +3134,6 @@ dependencies = [
"backtrace",
"bitflags",
"byteorder",
"cc",
"chalk-engine",
"fmt_macros",
"graphviz",
Expand Down Expand Up @@ -4439,6 +4442,7 @@ version = "0.0.0"
dependencies = [
"arena",
"cfg-if",
"log",
"rustc_data_structures",
"rustc_index",
"rustc_macros",
Expand Down
10 changes: 9 additions & 1 deletion src/ci/docker/dist-various-1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ ENV TARGETS=$TARGETS,armv7r-none-eabi
ENV TARGETS=$TARGETS,armv7r-none-eabihf
ENV TARGETS=$TARGETS,thumbv7neon-unknown-linux-gnueabihf

# riscv targets currently do not need a C compiler, as compiler_builtins
# doesn't currently have it enabled, and the riscv gcc compiler is not
# installed.
ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \
CC_mips64el_unknown_linux_muslabi64=mips64el-linux-gnuabi64-gcc \
Expand All @@ -143,7 +146,12 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc \
CC_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \
AR_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar \
CXX_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++
CXX_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++ \
CC_riscv32i_unknown_none_elf=false \
CC_riscv32imc_unknown_none_elf=false \
CC_riscv32imac_unknown_none_elf=false \
CC_riscv64imac_unknown_none_elf=false \
CC_riscv64gc_unknown_none_elf=false

ENV RUST_CONFIGURE_ARGS \
--musl-root-armv5te=/musl-armv5te \
Expand Down
5 changes: 5 additions & 0 deletions src/libpanic_unwind/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ cfg_if::cfg_if! {
if #[cfg(miri)] {
#[path = "miri.rs"]
mod imp;
// On MSVC we need the SEH lang items as well...
// This should match the conditions of the `seh.rs` import below.
#[cfg(all(target_env = "msvc", not(target_arch = "aarch64")))]
#[allow(unused)]
mod seh;
} else if #[cfg(target_os = "emscripten")] {
#[path = "emcc.rs"]
mod imp;
Expand Down
4 changes: 0 additions & 4 deletions src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ path = "lib.rs"
doctest = false

[dependencies]
# Prevent cc from upgrading all the way to 1.0.46,
# which fails the build (see e.g. #65445.)
cc = "=1.0.37"

arena = { path = "../libarena" }
bitflags = "1.2.1"
fmt_macros = { path = "../libfmt_macros" }
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use errors::emitter::HumanReadableErrorType;
use errors::annotate_snippet_emitter_writer::{AnnotateSnippetEmitterWriter};
use syntax::edition::Edition;
use syntax::feature_gate::{self, AttributeType};
use syntax::json::JsonEmitter;
use errors::json::JsonEmitter;
use syntax::source_map;
use syntax::sess::{ParseSess, ProcessCfgMod};
use syntax::symbol::Symbol;
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_codegen_ssa/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_fs_util::link_or_copy;
use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::Lrc;
use rustc_errors::{Handler, Level, FatalError, DiagnosticId, SourceMapperDyn};
use rustc_errors::{Handler, Level, FatalError, DiagnosticId};
use syntax_pos::source_map::SourceMap;
use rustc_errors::emitter::{Emitter};
use rustc_target::spec::MergeFunctions;
use syntax::attr;
Expand Down Expand Up @@ -1679,7 +1680,7 @@ impl Emitter for SharedEmitter {
}
drop(self.sender.send(SharedEmitterMessage::AbortIfErrors));
}
fn source_map(&self) -> Option<&Lrc<SourceMapperDyn>> {
fn source_map(&self) -> Option<&Lrc<SourceMap>> {
None
}
}
Expand Down
11 changes: 6 additions & 5 deletions src/librustc_errors/annotate_snippet_emitter_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
//! [annotate_snippets]: https://docs.rs/crate/annotate-snippets/

use syntax_pos::{SourceFile, MultiSpan, Loc};
use syntax_pos::source_map::SourceMap;
use crate::{
Level, CodeSuggestion, Diagnostic, Emitter,
SourceMapperDyn, SubDiagnostic, DiagnosticId
SubDiagnostic, DiagnosticId
};
use crate::emitter::FileWithAnnotatedLines;
use rustc_data_structures::sync::Lrc;
Expand All @@ -20,7 +21,7 @@ use annotate_snippets::formatter::DisplayListFormatter;

/// Generates diagnostics using annotate-snippet
pub struct AnnotateSnippetEmitterWriter {
source_map: Option<Lrc<SourceMapperDyn>>,
source_map: Option<Lrc<SourceMap>>,
/// If true, hides the longer explanation text
short_message: bool,
/// If true, will normalize line numbers with `LL` to prevent noise in UI test diffs.
Expand Down Expand Up @@ -49,7 +50,7 @@ impl Emitter for AnnotateSnippetEmitterWriter {
&suggestions);
}

fn source_map(&self) -> Option<&Lrc<SourceMapperDyn>> {
fn source_map(&self) -> Option<&Lrc<SourceMap>> {
self.source_map.as_ref()
}

Expand All @@ -61,7 +62,7 @@ impl Emitter for AnnotateSnippetEmitterWriter {
/// Collects all the data needed to generate the data structures needed for the
/// `annotate-snippets` library.
struct DiagnosticConverter<'a> {
source_map: Option<Lrc<SourceMapperDyn>>,
source_map: Option<Lrc<SourceMap>>,
level: Level,
message: String,
code: Option<DiagnosticId>,
Expand Down Expand Up @@ -168,7 +169,7 @@ impl<'a> DiagnosticConverter<'a> {

impl AnnotateSnippetEmitterWriter {
pub fn new(
source_map: Option<Lrc<SourceMapperDyn>>,
source_map: Option<Lrc<SourceMap>>,
short_message: bool,
external_macro_backtrace: bool,
) -> Self {
Expand Down
25 changes: 13 additions & 12 deletions src/librustc_errors/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
use Destination::*;

use syntax_pos::{SourceFile, Span, MultiSpan};
use syntax_pos::source_map::SourceMap;

use crate::{
Level, CodeSuggestion, Diagnostic, SubDiagnostic, pluralize,
SuggestionStyle, SourceMapper, SourceMapperDyn, DiagnosticId,
SuggestionStyle, DiagnosticId,
};
use crate::Level::Error;
use crate::snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, StyledString, Style};
Expand Down Expand Up @@ -49,7 +50,7 @@ impl HumanReadableErrorType {
pub fn new_emitter(
self,
dst: Box<dyn Write + Send>,
source_map: Option<Lrc<SourceMapperDyn>>,
source_map: Option<Lrc<SourceMap>>,
teach: bool,
terminal_width: Option<usize>,
external_macro_backtrace: bool,
Expand Down Expand Up @@ -192,7 +193,7 @@ pub trait Emitter {
true
}

fn source_map(&self) -> Option<&Lrc<SourceMapperDyn>>;
fn source_map(&self) -> Option<&Lrc<SourceMap>>;

/// Formats the substitutions of the primary_span
///
Expand Down Expand Up @@ -271,7 +272,7 @@ pub trait Emitter {
// point directly at <*macros>. Since these are often difficult to read, this
// will change the span to point at the use site.
fn fix_multispans_in_std_macros(&self,
source_map: &Option<Lrc<SourceMapperDyn>>,
source_map: &Option<Lrc<SourceMap>>,
span: &mut MultiSpan,
children: &mut Vec<SubDiagnostic>,
level: &Level,
Expand Down Expand Up @@ -311,7 +312,7 @@ pub trait Emitter {
// <*macros>. Since these locations are often difficult to read, we move these Spans from
// <*macros> to their corresponding use site.
fn fix_multispan_in_std_macros(&self,
source_map: &Option<Lrc<SourceMapperDyn>>,
source_map: &Option<Lrc<SourceMap>>,
span: &mut MultiSpan,
always_backtrace: bool) -> bool {
let sm = match source_map {
Expand Down Expand Up @@ -397,7 +398,7 @@ pub trait Emitter {
}

impl Emitter for EmitterWriter {
fn source_map(&self) -> Option<&Lrc<SourceMapperDyn>> {
fn source_map(&self) -> Option<&Lrc<SourceMap>> {
self.sm.as_ref()
}

Expand Down Expand Up @@ -428,7 +429,7 @@ impl Emitter for EmitterWriter {
pub struct SilentEmitter;

impl Emitter for SilentEmitter {
fn source_map(&self) -> Option<&Lrc<SourceMapperDyn>> { None }
fn source_map(&self) -> Option<&Lrc<SourceMap>> { None }
fn emit_diagnostic(&mut self, _: &Diagnostic) {}
}

Expand Down Expand Up @@ -476,7 +477,7 @@ impl ColorConfig {
/// Handles the writing of `HumanReadableErrorType::Default` and `HumanReadableErrorType::Short`
pub struct EmitterWriter {
dst: Destination,
sm: Option<Lrc<SourceMapperDyn>>,
sm: Option<Lrc<SourceMap>>,
short_message: bool,
teach: bool,
ui_testing: bool,
Expand All @@ -495,7 +496,7 @@ pub struct FileWithAnnotatedLines {
impl EmitterWriter {
pub fn stderr(
color_config: ColorConfig,
source_map: Option<Lrc<SourceMapperDyn>>,
source_map: Option<Lrc<SourceMap>>,
short_message: bool,
teach: bool,
terminal_width: Option<usize>,
Expand All @@ -515,7 +516,7 @@ impl EmitterWriter {

pub fn new(
dst: Box<dyn Write + Send>,
source_map: Option<Lrc<SourceMapperDyn>>,
source_map: Option<Lrc<SourceMap>>,
short_message: bool,
teach: bool,
colored: bool,
Expand Down Expand Up @@ -1685,7 +1686,7 @@ impl FileWithAnnotatedLines {
/// This helps us quickly iterate over the whole message (including secondary file spans)
pub fn collect_annotations(
msp: &MultiSpan,
source_map: &Option<Lrc<SourceMapperDyn>>
source_map: &Option<Lrc<SourceMap>>
) -> Vec<FileWithAnnotatedLines> {
fn add_annotation_to_file(file_vec: &mut Vec<FileWithAnnotatedLines>,
file: Lrc<SourceFile>,
Expand Down Expand Up @@ -2067,7 +2068,7 @@ impl<'a> Drop for WritableDst<'a> {
}

/// Whether the original and suggested code are visually similar enough to warrant extra wording.
pub fn is_case_difference(sm: &dyn SourceMapper, suggested: &str, sp: Span) -> bool {
pub fn is_case_difference(sm: &SourceMap, suggested: &str, sp: Span) -> bool {
// FIXME: this should probably be extended to also account for `FO0` → `FOO` and unicode.
let found = sm.span_to_snippet(sp).unwrap();
let ascii_confusables = &['c', 'f', 'i', 'k', 'o', 's', 'u', 'v', 'w', 'x', 'y', 'z'];
Expand Down
20 changes: 10 additions & 10 deletions src/libsyntax/json.rs → src/librustc_errors/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

// FIXME: spec the JSON output properly.

use crate::source_map::{SourceMap, FilePathMapping};
use syntax_pos::source_map::{SourceMap, FilePathMapping};

use errors::registry::Registry;
use errors::{SubDiagnostic, CodeSuggestion, SourceMapper, SourceMapperDyn};
use errors::{DiagnosticId, Applicability};
use errors::emitter::{Emitter, HumanReadableErrorType};
use crate::registry::Registry;
use crate::{SubDiagnostic, CodeSuggestion};
use crate::{DiagnosticId, Applicability};
use crate::emitter::{Emitter, HumanReadableErrorType};

use syntax_pos::{MacroBacktrace, Span, SpanLabel, MultiSpan};
use rustc_data_structures::sync::{self, Lrc};
use rustc_data_structures::sync::Lrc;
use std::io::{self, Write};
use std::path::Path;
use std::vec;
Expand All @@ -31,7 +31,7 @@ mod tests;
pub struct JsonEmitter {
dst: Box<dyn Write + Send>,
registry: Option<Registry>,
sm: Lrc<dyn SourceMapper + sync::Send + sync::Sync>,
sm: Lrc<SourceMap>,
pretty: bool,
ui_testing: bool,
json_rendered: HumanReadableErrorType,
Expand Down Expand Up @@ -92,7 +92,7 @@ impl JsonEmitter {
}

impl Emitter for JsonEmitter {
fn emit_diagnostic(&mut self, diag: &errors::Diagnostic) {
fn emit_diagnostic(&mut self, diag: &crate::Diagnostic) {
let data = Diagnostic::from_errors_diagnostic(diag, self);
let result = if self.pretty {
writeln!(&mut self.dst, "{}", as_pretty_json(&data))
Expand All @@ -116,7 +116,7 @@ impl Emitter for JsonEmitter {
}
}

fn source_map(&self) -> Option<&Lrc<SourceMapperDyn>> {
fn source_map(&self) -> Option<&Lrc<SourceMap>> {
Some(&self.sm)
}

Expand Down Expand Up @@ -212,7 +212,7 @@ struct ArtifactNotification<'a> {
}

impl Diagnostic {
fn from_errors_diagnostic(diag: &errors::Diagnostic,
fn from_errors_diagnostic(diag: &crate::Diagnostic,
je: &JsonEmitter)
-> Diagnostic {
let sugg = diag.suggestions.iter().map(|sugg| {
Expand Down
14 changes: 10 additions & 4 deletions src/libsyntax/json/tests.rs → src/librustc_errors/json/tests.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use super::*;

use crate::json::JsonEmitter;
use crate::source_map::{FilePathMapping, SourceMap};
use crate::with_default_globals;
use syntax_pos::source_map::{FilePathMapping, SourceMap};

use errors::emitter::{ColorConfig, HumanReadableErrorType};
use errors::Handler;
use crate::emitter::{ColorConfig, HumanReadableErrorType};
use crate::Handler;
use rustc_serialize::json::decode;
use syntax_pos::{BytePos, Span};

Expand Down Expand Up @@ -40,6 +39,13 @@ impl<T: Write> Write for Shared<T> {
}
}

fn with_default_globals(f: impl FnOnce()) {
let globals = syntax_pos::Globals::new(syntax_pos::edition::DEFAULT_EDITION);
syntax_pos::GLOBALS.set(&globals, || {
syntax_pos::GLOBALS.set(&globals, f)
})
}

/// Test the span yields correct positions in JSON.
fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) {
let expected_output = TestData { spans: vec![expected_output] };
Expand Down
Loading