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 #72877

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7750357
Return early to avoid ICE
JohnTitor May 30, 2020
2d4b09a
[AVR] Add AVR platform support
shepmaster May 6, 2016
a42bf5a
[AVR] Fix debug printing of function pointers
dylanmckay Jun 8, 2019
208adf9
[AVR] Add required references for AVR to the parser test suites
dylanmckay Mar 3, 2020
94a94d7
[AVR] Raise and link to a tracking issue for the `avr-interrupt` call…
dylanmckay Mar 3, 2020
717268c
[AVR] Re-bless the UI tests
dylanmckay Mar 4, 2020
737c342
[AVR] Update the compiletest library to recognize AVR as a 16-bit target
dylanmckay Mar 5, 2020
94ece5e
[AVR] Re-bless the 'test/ui/symbol-names' tests
dylanmckay Mar 5, 2020
cd890ff
[AVR] Remove AVR-specific logic from libstd
dylanmckay Apr 1, 2020
6260bc4
[AVR] Rename the 'none_base' target spec module to 'freestanding_base'
dylanmckay Apr 1, 2020
491bf8c
[AVR] Update ABI type classification logic to match the the AVR-Clang…
dylanmckay May 17, 2020
f6dfbbb
On recursive ADT, provide indirection structured suggestion
estebank May 29, 2020
c209040
review comments: only suggest one substitution
estebank May 31, 2020
5707838
validate basic sanity for TerminatorKind
RalfJung May 31, 2020
e07e424
replace DUMMY_SP by proper span
RalfJung May 31, 2020
9a4bdbf
more checks for SwitchInt
RalfJung May 31, 2020
f793c0b
always print MIR Location when validator finds a problem
RalfJung May 31, 2020
717fd66
Make `SourceMap` available for early debug-printing of `Span`s
Aaron1011 May 26, 2020
aa5d29f
bump Miri, update for cargo-miri being a separate project
RalfJung May 31, 2020
f019526
Rollup merge of #69478 - avr-rust:avr-support-upstream, r=jonas-schie…
RalfJung Jun 1, 2020
54ca0f2
Rollup merge of #72618 - Aaron1011:feature/early-sourcemap, r=petroch…
RalfJung Jun 1, 2020
ceb26de
Rollup merge of #72740 - estebank:recursive-indirection, r=matthewjasper
RalfJung Jun 1, 2020
11c0fbb
Rollup merge of #72775 - JohnTitor:await-sugg, r=estebank
RalfJung Jun 1, 2020
412910e
Rollup merge of #72779 - RalfJung:miri, r=oli-obk
RalfJung Jun 1, 2020
6e916b7
Rollup merge of #72810 - RalfJung:mir-terminate-sanity, r=jonas-schie…
RalfJung Jun 1, 2020
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
25 changes: 16 additions & 9 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,19 @@ dependencies = [
"winapi 0.3.8",
]

[[package]]
name = "cargo-miri"
version = "0.1.0"
dependencies = [
"cargo_metadata 0.9.1",
"directories",
"rustc-workspace-hack",
"rustc_version",
"serde",
"serde_json",
"vergen",
]

[[package]]
name = "cargo-platform"
version = "0.1.1"
Expand Down Expand Up @@ -2220,22 +2233,17 @@ name = "miri"
version = "0.1.0"
dependencies = [
"byteorder",
"cargo_metadata 0.9.1",
"colored",
"compiletest_rs",
"directories",
"env_logger 0.7.1",
"getrandom",
"hex 0.4.0",
"libc",
"log",
"num-traits",
"rand 0.7.3",
"rustc-workspace-hack",
"rustc_version",
"serde",
"serde_json",
"shell-escape",
"vergen",
]

[[package]]
Expand Down Expand Up @@ -5555,13 +5563,12 @@ checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"

[[package]]
name = "vergen"
version = "3.0.4"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aba5e34f93dc7051dfad05b98a18e9156f27e7b431fe1d2398cb6061c0a1dba"
checksum = "4ce50d8996df1f85af15f2cd8d33daae6e479575123ef4314a51a70a230739cb"
dependencies = [
"bitflags",
"chrono",
"failure",
]

[[package]]
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ members = [
"src/tools/rls",
"src/tools/rustfmt",
"src/tools/miri",
"src/tools/miri/cargo-miri",
"src/tools/rustdoc-themes",
"src/tools/unicode-table-generator",
"src/tools/expand-yaml-anchors",
Expand Down
2 changes: 1 addition & 1 deletion config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
# the same format as above, but since these targets are experimental, they are
# not built by default and the experimental Rust compilation targets that depend
# on them will not work unless the user opts in to building them.
#experimental-targets = ""
#experimental-targets = "AVR"

# Cap the number of parallel linker invocations when compiling LLVM.
# This can be useful when building LLVM with debug info, which significantly
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,12 @@ impl<'a> Builder<'a> {
tool::Rls,
tool::Rustdoc,
tool::Clippy,
tool::CargoClippy,
native::Llvm,
native::Sanitizers,
tool::Rustfmt,
tool::Miri,
tool::CargoMiri,
native::Lld
),
Kind::Check | Kind::Clippy | Kind::Fix | Kind::Format => {
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl Step for Llvm {

let llvm_exp_targets = match builder.config.llvm_experimental_targets {
Some(ref s) => s,
None => "",
None => "AVR",
};

let assertions = if builder.config.llvm_assertions { "ON" } else { "OFF" };
Expand Down
15 changes: 11 additions & 4 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,12 @@ impl Step for Miri {

let miri =
builder.ensure(tool::Miri { compiler, target: self.host, extra_features: Vec::new() });
if let Some(miri) = miri {
let cargo_miri = builder.ensure(tool::CargoMiri {
compiler,
target: self.host,
extra_features: Vec::new(),
});
if let (Some(miri), Some(_cargo_miri)) = (miri, cargo_miri) {
let mut cargo = builder.cargo(compiler, Mode::ToolRustc, host, "install");
cargo.arg("xargo");
// Configure `cargo install` path. cargo adds a `bin/`.
Expand All @@ -378,14 +383,16 @@ impl Step for Miri {
Mode::ToolRustc,
host,
"run",
"src/tools/miri",
"src/tools/miri/cargo-miri",
SourceType::Submodule,
&[],
);
cargo.arg("--bin").arg("cargo-miri").arg("--").arg("miri").arg("setup");
cargo.arg("--").arg("miri").arg("setup");

// Tell `cargo miri setup` where to find the sources.
cargo.env("XARGO_RUST_SRC", builder.src.join("src"));
// Tell it where to find Miri.
cargo.env("MIRI", &miri);
// Debug things.
cargo.env("RUST_BACKTRACE", "1");
// Overwrite bootstrap's `rustc` wrapper overwriting our flags.
Expand Down Expand Up @@ -437,7 +444,7 @@ impl Step for Miri {
// miri tests need to know about the stage sysroot
cargo.env("MIRI_SYSROOT", miri_sysroot);
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
cargo.env("MIRI_PATH", miri);
cargo.env("MIRI", miri);

cargo.arg("--").args(builder.config.cmd.test_args());

Expand Down
4 changes: 3 additions & 1 deletion src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,14 @@ macro_rules! tool_extended {
}
}

// Note: tools need to be also added to `Builder::get_step_descriptions` in `build.rs`
// to make `./x.py build <tool>` work.
tool_extended!((self, builder),
Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {};
CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", {};
Clippy, clippy, "src/tools/clippy", "clippy-driver", {};
Miri, miri, "src/tools/miri", "miri", {};
CargoMiri, miri, "src/tools/miri", "cargo-miri", {};
CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", {};
Rls, rls, "src/tools/rls", "rls", {
builder.ensure(Clippy {
compiler: self.compiler,
Expand Down
14 changes: 12 additions & 2 deletions src/libcore/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1345,14 +1345,24 @@ macro_rules! fnptr_impls_safety_abi {
#[stable(feature = "fnptr_impls", since = "1.4.0")]
impl<Ret, $($Arg),*> fmt::Pointer for $FnTy {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Pointer::fmt(&(*self as *const ()), f)
// HACK: The intermediate cast as usize is required for AVR
// so that the address space of the source function pointer
// is preserved in the final function pointer.
//
// https://github.com/avr-rust/rust/issues/143
fmt::Pointer::fmt(&(*self as usize as *const ()), f)
}
}

#[stable(feature = "fnptr_impls", since = "1.4.0")]
impl<Ret, $($Arg),*> fmt::Debug for $FnTy {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Pointer::fmt(&(*self as *const ()), f)
// HACK: The intermediate cast as usize is required for AVR
// so that the address space of the source function pointer
// is preserved in the final function pointer.
//
// https://github.com/avr-rust/rust/issues/143
fmt::Pointer::fmt(&(*self as usize as *const ()), f)
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/librustc_ast_passes/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ impl<'a> PostExpansionVisitor<'a> {
"amdgpu-kernel ABI is experimental and subject to change"
);
}
"avr-interrupt" | "avr-non-blocking-interrupt" => {
gate_feature_post!(
&self,
abi_avr_interrupt,
span,
"avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change"
);
}
"efiapi" => {
gate_feature_post!(
&self,
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_codegen_llvm/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ impl<'tcx> FnAbiLlvmExt<'tcx> for FnAbi<'tcx, Ty<'tcx>> {
match self.conv {
Conv::C | Conv::Rust => llvm::CCallConv,
Conv::AmdGpuKernel => llvm::AmdGpuKernel,
Conv::AvrInterrupt => llvm::AvrInterrupt,
Conv::AvrNonBlockingInterrupt => llvm::AvrNonBlockingInterrupt,
Conv::ArmAapcs => llvm::ArmAapcsCallConv,
Conv::Msp430Intr => llvm::Msp430Intr,
Conv::PtxKernel => llvm::PtxKernel,
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_codegen_llvm/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ pub enum CallConv {
X86_64_Win64 = 79,
X86_VectorCall = 80,
X86_Intr = 83,
AvrNonBlockingInterrupt = 84,
AvrInterrupt = 85,
AmdGpuKernel = 91,
}

Expand Down
23 changes: 23 additions & 0 deletions src/librustc_errors/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,29 @@ impl Diagnostic {
self
}

pub fn multipart_suggestions(
&mut self,
msg: &str,
suggestions: Vec<Vec<(Span, String)>>,
applicability: Applicability,
) -> &mut Self {
self.suggestions.push(CodeSuggestion {
substitutions: suggestions
.into_iter()
.map(|suggestion| Substitution {
parts: suggestion
.into_iter()
.map(|(span, snippet)| SubstitutionPart { snippet, span })
.collect(),
})
.collect(),
msg: msg.to_owned(),
style: SuggestionStyle::ShowCode,
applicability,
});
self
}

/// Prints out a message with for a multipart suggestion without showing the suggested code.
///
/// This is intended to be used for suggestions that are obvious in what the changes need to
Expand Down
13 changes: 13 additions & 0 deletions src/librustc_errors/diagnostic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,19 @@ impl<'a> DiagnosticBuilder<'a> {
self
}

pub fn multipart_suggestions(
&mut self,
msg: &str,
suggestions: Vec<Vec<(Span, String)>>,
applicability: Applicability,
) -> &mut Self {
if !self.0.allow_suggestions {
return self;
}
self.0.diagnostic.multipart_suggestions(msg, suggestions, applicability);
self
}

pub fn tool_only_multipart_suggestion(
&mut self,
msg: &str,
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_feature/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,9 @@ declare_features! (
/// No longer treat an unsafe function as an unsafe block.
(active, unsafe_block_in_unsafe_fn, "1.45.0", Some(71668), None),

/// Allows `extern "avr-interrupt" fn()` and `extern "avr-non-blocking-interrupt" fn()`.
(active, abi_avr_interrupt, "1.45.0", Some(69664), None),

// -------------------------------------------------------------------------
// feature-group-end: actual feature gates
// -------------------------------------------------------------------------
Expand Down
24 changes: 13 additions & 11 deletions src/librustc_interface/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,19 @@ pub fn run_compiler_in_existing_thread_pool<R>(
override_queries: config.override_queries,
};

let r = {
let _sess_abort_error = OnDrop(|| {
compiler.sess.finish_diagnostics(registry);
});

f(&compiler)
};

let prof = compiler.sess.prof.clone();
prof.generic_activity("drop_compiler").run(move || drop(compiler));
r
rustc_span::with_source_map(compiler.sess.parse_sess.clone_source_map(), move || {
let r = {
let _sess_abort_error = OnDrop(|| {
compiler.sess.finish_diagnostics(registry);
});

f(&compiler)
};

let prof = compiler.sess.prof.clone();
prof.generic_activity("drop_compiler").run(move || drop(compiler));
r
})
}

pub fn run_compiler<R: Send>(mut config: Config, f: impl FnOnce(&Compiler) -> R + Send) -> R {
Expand Down
1 change: 1 addition & 0 deletions src/librustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ fn main() {
"arm",
"aarch64",
"amdgpu",
"avr",
"mips",
"powerpc",
"systemz",
Expand Down
8 changes: 8 additions & 0 deletions src/librustc_llvm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ pub fn initialize_available_targets() {
LLVMInitializeAMDGPUAsmPrinter,
LLVMInitializeAMDGPUAsmParser
);
init_target!(
llvm_component = "avr",
LLVMInitializeAVRTargetInfo,
LLVMInitializeAVRTarget,
LLVMInitializeAVRTargetMC,
LLVMInitializeAVRAsmPrinter,
LLVMInitializeAVRAsmParser
);
init_target!(
llvm_component = "mips",
LLVMInitializeMipsTargetInfo,
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_middle/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2529,6 +2529,8 @@ where
Msp430Interrupt => Conv::Msp430Intr,
X86Interrupt => Conv::X86Intr,
AmdGpuKernel => Conv::AmdGpuKernel,
AvrInterrupt => Conv::AvrInterrupt,
AvrNonBlockingInterrupt => Conv::AvrNonBlockingInterrupt,

// These API constants ought to be more specific...
Cdecl => Conv::C,
Expand Down
10 changes: 9 additions & 1 deletion src/librustc_middle/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,15 @@ impl<'tcx> ty::TyS<'tcx> {
// Find non representable fields with their spans
fold_repr(def.all_fields().map(|field| {
let ty = field.ty(tcx, substs);
let span = tcx.hir().span_if_local(field.did).unwrap_or(sp);
let span = match field
.did
.as_local()
.map(|id| tcx.hir().as_local_hir_id(id))
.and_then(|id| tcx.hir().find(id))
{
Some(hir::Node::Field(field)) => field.ty.span,
_ => sp,
};
match is_type_structurally_recursive(
tcx,
span,
Expand Down
8 changes: 7 additions & 1 deletion src/librustc_mir/interpret/terminator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
self.go_to_block(target_block);
}

Call { ref func, ref args, destination, ref cleanup, .. } => {
Call {
ref func,
ref args,
destination,
ref cleanup,
from_hir_call: _from_hir_call,
} => {
let old_stack = self.frame_idx();
let old_loc = self.frame().loc;
let func = self.eval_operand(func, None)?;
Expand Down
Loading