Skip to content

Commit e23dd66

Browse files
committed
Auto merge of #68474 - tmandry:rollup-6gmbet6, r=tmandry
Rollup of 10 pull requests Successful merges: - #67195 ([experiment] Add `-Z no-link` flag) - #68253 (add bare metal ARM Cortex-A targets to rustc) - #68361 (Unbreak linking with lld 9 on FreeBSD 13.0-CURRENT i386) - #68388 (Make `TooGeneric` error in WF checking a proper error) - #68409 (Micro-optimize OutputFilenames) - #68410 (Export weak symbols used by MemorySanitizer) - #68425 (Fix try-op diagnostic in E0277 for methods) - #68440 (bootstrap: update clippy subcmd decription) - #68441 (pprust: use as_deref) - #68462 (librustc_mir: don't allocate vectors where slices will do.) Failed merges: r? @ghost
2 parents d1e594f + bfac73c commit e23dd66

File tree

31 files changed

+388
-109
lines changed

31 files changed

+388
-109
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3428,6 +3428,7 @@ dependencies = [
34283428
"rustc_session",
34293429
"rustc_span",
34303430
"rustc_target",
3431+
"serialize",
34313432
"smallvec 1.0.0",
34323433
"syntax",
34333434
]

src/bootstrap/flags.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Usage: x.py <subcommand> [options] [<paths>...]
104104
Subcommands:
105105
build Compile either the compiler or libraries
106106
check Compile either the compiler or libraries, using cargo check
107-
clippy Run clippy
107+
clippy Run clippy (uses rustup/cargo-installed clippy binary)
108108
fix Run cargo fix
109109
fmt Run rustfmt
110110
test Build and run some test suites

src/ci/docker/dist-various-1/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ ENV TARGETS=$TARGETS,armebv7r-none-eabihf
160160
ENV TARGETS=$TARGETS,armv7r-none-eabi
161161
ENV TARGETS=$TARGETS,armv7r-none-eabihf
162162
ENV TARGETS=$TARGETS,thumbv7neon-unknown-linux-gnueabihf
163+
ENV TARGETS=$TARGETS,armv7a-none-eabi
163164

164165
# riscv targets currently do not need a C compiler, as compiler_builtins
165166
# doesn't currently have it enabled, and the riscv gcc compiler is not
@@ -173,6 +174,10 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
173174
CC_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \
174175
AR_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar \
175176
CXX_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++ \
177+
CC_armv7a_none_eabi=arm-none-eabi-gcc \
178+
CC_armv7a_none_eabihf=arm-none-eabi-gcc \
179+
CFLAGS_armv7a_none_eabi=-march=armv7-a \
180+
CFLAGS_armv7a_none_eabihf=-march=armv7-a+vfpv3 \
176181
CC_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-gcc \
177182
AR_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-ar \
178183
CXX_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-g++ \

src/librustc/middle/cstore.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub use rustc_session::utils::NativeLibraryKind;
2727

2828
/// Where a crate came from on the local filesystem. One of these three options
2929
/// must be non-None.
30-
#[derive(PartialEq, Clone, Debug, HashStable)]
30+
#[derive(PartialEq, Clone, Debug, HashStable, RustcEncodable, RustcDecodable)]
3131
pub struct CrateSource {
3232
pub dylib: Option<(PathBuf, PathKind)>,
3333
pub rlib: Option<(PathBuf, PathKind)>,
@@ -75,7 +75,7 @@ impl DepKind {
7575
}
7676
}
7777

78-
#[derive(PartialEq, Clone, Debug)]
78+
#[derive(PartialEq, Clone, Debug, RustcEncodable, RustcDecodable)]
7979
pub enum LibSource {
8080
Some(PathBuf),
8181
MetadataOnly,
@@ -160,6 +160,7 @@ pub enum ExternCrateSource {
160160
Path,
161161
}
162162

163+
#[derive(RustcEncodable, RustcDecodable)]
163164
pub struct EncodedMetadata {
164165
pub raw_data: Vec<u8>,
165166
}

src/librustc/middle/dependency_format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub type DependencyList = Vec<Linkage>;
1919
/// This is local to the tcx, and is generally relevant to one session.
2020
pub type Dependencies = Vec<(config::CrateType, DependencyList)>;
2121

22-
#[derive(Copy, Clone, PartialEq, Debug, HashStable)]
22+
#[derive(Copy, Clone, PartialEq, Debug, HashStable, RustcEncodable, RustcDecodable)]
2323
pub enum Linkage {
2424
NotLinked,
2525
IncludedFromDylib,

src/librustc/traits/error_reporting/mod.rs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -919,17 +919,29 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
919919
report_object_safety_error(self.tcx, span, did, violations)
920920
}
921921

922-
// already reported in the query
923-
ConstEvalFailure(err) => {
924-
if let ErrorHandled::TooGeneric = err {
925-
// Silence this error, as it can be produced during intermediate steps
926-
// when a constant is not yet able to be evaluated (but will be later).
927-
return;
928-
}
929-
self.tcx.sess.delay_span_bug(
930-
span,
931-
&format!("constant in type had an ignored error: {:?}", err),
932-
);
922+
ConstEvalFailure(ErrorHandled::TooGeneric) => {
923+
// In this instance, we have a const expression containing an unevaluated
924+
// generic parameter. We have no idea whether this expression is valid or
925+
// not (e.g. it might result in an error), but we don't want to just assume
926+
// that it's okay, because that might result in post-monomorphisation time
927+
// errors. The onus is really on the caller to provide values that it can
928+
// prove are well-formed.
929+
let mut err = self
930+
.tcx
931+
.sess
932+
.struct_span_err(span, "constant expression depends on a generic parameter");
933+
// FIXME(const_generics): we should suggest to the user how they can resolve this
934+
// issue. However, this is currently not actually possible
935+
// (see https://github.com/rust-lang/rust/issues/66962#issuecomment-575907083).
936+
err.note("this may fail depending on what value the parameter takes");
937+
err
938+
}
939+
940+
// Already reported in the query.
941+
ConstEvalFailure(ErrorHandled::Reported) => {
942+
self.tcx
943+
.sess
944+
.delay_span_bug(span, &format!("constant in type had an ignored error"));
933945
return;
934946
}
935947

src/librustc/traits/error_reporting/on_unimplemented.rs

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,31 +59,45 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
5959
fn describe_enclosure(&self, hir_id: hir::HirId) -> Option<&'static str> {
6060
let hir = &self.tcx.hir();
6161
let node = hir.find(hir_id)?;
62-
if let hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, _, body_id), .. }) = &node {
63-
self.describe_generator(*body_id).or_else(|| {
62+
match &node {
63+
hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, _, body_id), .. }) => {
64+
self.describe_generator(*body_id).or_else(|| {
65+
Some(if let hir::FnHeader { asyncness: hir::IsAsync::Async, .. } = sig.header {
66+
"an async function"
67+
} else {
68+
"a function"
69+
})
70+
})
71+
}
72+
hir::Node::TraitItem(hir::TraitItem {
73+
kind: hir::TraitItemKind::Method(_, hir::TraitMethod::Provided(body_id)),
74+
..
75+
}) => self.describe_generator(*body_id).or_else(|| Some("a trait method")),
76+
hir::Node::ImplItem(hir::ImplItem {
77+
kind: hir::ImplItemKind::Method(sig, body_id),
78+
..
79+
}) => self.describe_generator(*body_id).or_else(|| {
6480
Some(if let hir::FnHeader { asyncness: hir::IsAsync::Async, .. } = sig.header {
65-
"an async function"
81+
"an async method"
6682
} else {
67-
"a function"
83+
"a method"
6884
})
69-
})
70-
} else if let hir::Node::Expr(hir::Expr {
71-
kind: hir::ExprKind::Closure(_is_move, _, body_id, _, gen_movability),
72-
..
73-
}) = &node
74-
{
75-
self.describe_generator(*body_id).or_else(|| {
85+
}),
86+
hir::Node::Expr(hir::Expr {
87+
kind: hir::ExprKind::Closure(_is_move, _, body_id, _, gen_movability),
88+
..
89+
}) => self.describe_generator(*body_id).or_else(|| {
7690
Some(if gen_movability.is_some() { "an async closure" } else { "a closure" })
77-
})
78-
} else if let hir::Node::Expr(hir::Expr { .. }) = &node {
79-
let parent_hid = hir.get_parent_node(hir_id);
80-
if parent_hid != hir_id {
81-
return self.describe_enclosure(parent_hid);
82-
} else {
83-
None
91+
}),
92+
hir::Node::Expr(hir::Expr { .. }) => {
93+
let parent_hid = hir.get_parent_node(hir_id);
94+
if parent_hid != hir_id {
95+
return self.describe_enclosure(parent_hid);
96+
} else {
97+
None
98+
}
8499
}
85-
} else {
86-
None
100+
_ => None,
87101
}
88102
}
89103

src/librustc_codegen_llvm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ rustc_incremental = { path = "../librustc_incremental" }
2828
rustc_index = { path = "../librustc_index" }
2929
rustc_llvm = { path = "../librustc_llvm" }
3030
rustc_session = { path = "../librustc_session" }
31+
rustc_serialize = { path = "../libserialize", package = "serialize" }
3132
rustc_target = { path = "../librustc_target" }
3233
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
3334
syntax = { path = "../libsyntax" }

src/librustc_codegen_llvm/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use rustc_codegen_ssa::CompiledModule;
3333
use rustc_errors::{FatalError, Handler};
3434
use std::any::Any;
3535
use std::ffi::CStr;
36+
use std::fs;
3637
use std::sync::Arc;
3738
use syntax::expand::allocator::AllocatorKind;
3839

@@ -44,6 +45,7 @@ use rustc::ty::{self, TyCtxt};
4445
use rustc::util::common::ErrorReported;
4546
use rustc_codegen_ssa::ModuleCodegen;
4647
use rustc_codegen_utils::codegen_backend::CodegenBackend;
48+
use rustc_serialize::json;
4749

4850
mod back {
4951
pub mod archive;
@@ -298,6 +300,18 @@ impl CodegenBackend for LlvmCodegenBackend {
298300
return Ok(());
299301
}
300302

303+
if sess.opts.debugging_opts.no_link {
304+
// FIXME: use a binary format to encode the `.rlink` file
305+
let rlink_data = json::encode(&codegen_results).map_err(|err| {
306+
sess.fatal(&format!("failed to encode rlink: {}", err));
307+
})?;
308+
let rlink_file = outputs.with_extension("rlink");
309+
fs::write(&rlink_file, rlink_data).map_err(|err| {
310+
sess.fatal(&format!("failed to write file {}: {}", rlink_file.display(), err));
311+
})?;
312+
return Ok(());
313+
}
314+
301315
// Run the linker on any artifacts that resulted from the LLVM run.
302316
// This should produce either a finished executable or library.
303317
sess.time("link_crate", || {

src/librustc_codegen_ssa/back/linker.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use rustc_target::spec::{LinkerFlavor, LldFlavor};
2020

2121
/// For all the linkers we support, and information they might
2222
/// need out of the shared crate context before we get rid of it.
23+
#[derive(RustcEncodable, RustcDecodable)]
2324
pub struct LinkerInfo {
2425
exports: FxHashMap<CrateType, Vec<String>>,
2526
}

0 commit comments

Comments
 (0)