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 4 pull requests #68432

Closed
wants to merge 12 commits into from
Closed
Changes from all commits
Commits
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
14 changes: 10 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -307,7 +307,7 @@ dependencies = [
"glob",
"hex 0.4.0",
"home",
"humantime",
"humantime 2.0.0",
"ignore",
"im-rc",
"jobserver",
@@ -1013,7 +1013,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
dependencies = [
"atty",
"humantime",
"humantime 1.3.0",
"log",
"regex",
"termcolor",
@@ -1026,7 +1026,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
dependencies = [
"atty",
"humantime",
"humantime 1.3.0",
"log",
"regex",
"termcolor",
@@ -1454,6 +1454,12 @@ dependencies = [
"quick-error",
]

[[package]]
name = "humantime"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9b6c53306532d3c8e8087b44e6580e10db51a023cf9b433cea2ac38066b92da"

[[package]]
name = "hyper"
version = "0.12.31"
@@ -2647,7 +2653,7 @@ dependencies = [
"clap",
"derive_more",
"env_logger 0.6.2",
"humantime",
"humantime 1.3.0",
"lazy_static 1.3.0",
"log",
"rls-span",
5 changes: 5 additions & 0 deletions src/ci/docker/dist-various-1/Dockerfile
Original file line number Diff line number Diff line change
@@ -160,6 +160,7 @@ ENV TARGETS=$TARGETS,armebv7r-none-eabihf
ENV TARGETS=$TARGETS,armv7r-none-eabi
ENV TARGETS=$TARGETS,armv7r-none-eabihf
ENV TARGETS=$TARGETS,thumbv7neon-unknown-linux-gnueabihf
ENV TARGETS=$TARGETS,armv7a-none-eabi

# 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
@@ -173,6 +174,10 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-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++ \
CC_armv7a_none_eabi=arm-none-eabi-gcc \
CC_armv7a_none_eabihf=arm-none-eabi-gcc \
CFLAGS_armv7a_none_eabi=-march=armv7-a \
CFLAGS_armv7a_none_eabihf=-march=armv7-a+vfpv3 \
CC_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-gcc \
AR_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-ar \
CXX_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-g++ \
2 changes: 1 addition & 1 deletion src/doc/book
Submodule book updated 37 files
+1 −1 .travis.yml
+0 −142 2018-edition/Cargo.lock
+0 −36 2018-edition/Cargo.toml
+0 −201 2018-edition/LICENSE-APACHE
+0 −25 2018-edition/LICENSE-MIT
+0 −13 2018-edition/convert-quotes.sh
+0 −24 2018-edition/nostarch.sh
+0 −34 2018-edition/style-guide.md
+0 −218 2018-edition/tools/docx-to-md.xsl
+0 −104 2018-edition/tools/src/bin/concat_chapters.rs
+0 −73 2018-edition/tools/src/bin/convert_quotes.rs
+0 −243 2018-edition/tools/src/bin/lfp.rs
+0 −406 2018-edition/tools/src/bin/link2print.rs
+0 −45 2018-edition/tools/src/bin/remove_links.rs
+0 −52 2018-edition/tools/src/bin/remove_markup.rs
+4 −4 Cargo.toml
+5 −1 README.md
+0 −32 nostarch/updates.md
+0 −142 second-edition/Cargo.lock
+0 −36 second-edition/Cargo.toml
+0 −201 second-edition/LICENSE-APACHE
+0 −25 second-edition/LICENSE-MIT
+0 −13 second-edition/convert-quotes.sh
+0 −20 second-edition/doc-to-md.sh
+0 −24 second-edition/nostarch.sh
+0 −34 second-edition/style-guide.md
+0 −218 second-edition/tools/docx-to-md.xsl
+0 −104 second-edition/tools/src/bin/concat_chapters.rs
+0 −73 second-edition/tools/src/bin/convert_quotes.rs
+0 −242 second-edition/tools/src/bin/lfp.rs
+0 −406 second-edition/tools/src/bin/link2print.rs
+0 −45 second-edition/tools/src/bin/remove_links.rs
+0 −52 second-edition/tools/src/bin/remove_markup.rs
+2 −2 src/appendix-01-keywords.md
+1 −5 src/ch04-02-references-and-borrowing.md
+10 −10 src/ch20-03-graceful-shutdown-and-cleanup.md
+1 −8 tools/src/bin/remove_markup.rs
2 changes: 1 addition & 1 deletion src/doc/embedded-book
Submodule embedded-book updated 1 files
+5 −0 .gitattributes
2 changes: 1 addition & 1 deletion src/doc/reference
2 changes: 1 addition & 1 deletion src/doc/rust-by-example
48 changes: 48 additions & 0 deletions src/librustc_target/spec/armv7a_none_eabi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Generic ARMv7-A target for bare-metal code - floating point disabled
//
// This is basically the `armv7-unknown-linux-gnueabi` target with some changes
// (listed below) to bring it closer to the bare-metal `thumb` & `aarch64`
// targets:
//
// - `TargetOptions.features`: added `+strict-align`. rationale: unaligned
// memory access is disabled on boot on these cores
// - linker changed to LLD. rationale: C is not strictly needed to build
// bare-metal binaries (the `gcc` linker has the advantage that it knows where C
// libraries and crt*.o are but it's not much of an advantage here); LLD is also
// faster
// - `target_os` set to `none`. rationale: matches `thumb` targets
// - `target_{env,vendor}` set to an empty string. rationale: matches `thumb`
// targets
// - `panic_strategy` set to `abort`. rationale: matches `thumb` targets
// - `relocation-model` set to `static`; also no PIE, no relro and no dynamic
// linking. rationale: matches `thumb` targets

use super::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions};

pub fn target() -> Result<Target, String> {
let opts = TargetOptions {
linker: Some("rust-lld".to_owned()),
features: "+v7,+thumb2,+soft-float,-neon,+strict-align".to_string(),
executables: true,
relocation_model: "static".to_string(),
disable_redzone: true,
max_atomic_width: Some(64),
panic_strategy: PanicStrategy::Abort,
abi_blacklist: super::arm_base::abi_blacklist(),
emit_debug_gdb_scripts: false,
..Default::default()
};
Ok(Target {
llvm_target: "armv7a-none-eabi".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "32".to_string(),
target_c_int_width: "32".to_string(),
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: opts,
})
}
36 changes: 36 additions & 0 deletions src/librustc_target/spec/armv7a_none_eabihf.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Generic ARMv7-A target for bare-metal code - floating point enabled (assumes
// FPU is present and emits FPU instructions)
//
// This is basically the `armv7-unknown-linux-gnueabihf` target with some
// changes (list in `armv7a_none_eabi.rs`) to bring it closer to the bare-metal
// `thumb` & `aarch64` targets.

use super::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions};

pub fn target() -> Result<Target, String> {
let opts = TargetOptions {
linker: Some("rust-lld".to_owned()),
features: "+v7,+vfp3,-d32,+thumb2,-neon,+strict-align".to_string(),
executables: true,
relocation_model: "static".to_string(),
disable_redzone: true,
max_atomic_width: Some(64),
panic_strategy: PanicStrategy::Abort,
abi_blacklist: super::arm_base::abi_blacklist(),
emit_debug_gdb_scripts: false,
..Default::default()
};
Ok(Target {
llvm_target: "armv7a-none-eabihf".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "32".to_string(),
target_c_int_width: "32".to_string(),
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: opts,
})
}
4 changes: 3 additions & 1 deletion src/librustc_target/spec/i686_unknown_freebsd.rs
Original file line number Diff line number Diff line change
@@ -4,7 +4,9 @@ pub fn target() -> TargetResult {
let mut base = super::freebsd_base::opts();
base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
let pre_link_args = base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap();
pre_link_args.push("-m32".to_string());
pre_link_args.push("-Wl,-znotext".to_string());
base.stack_probes = true;

Ok(Target {
3 changes: 3 additions & 0 deletions src/librustc_target/spec/mod.rs
Original file line number Diff line number Diff line change
@@ -472,6 +472,9 @@ supported_targets! {
("thumbv8m.main-none-eabi", thumbv8m_main_none_eabi),
("thumbv8m.main-none-eabihf", thumbv8m_main_none_eabihf),

("armv7a-none-eabi", armv7a_none_eabi),
("armv7a-none-eabihf", armv7a_none_eabihf),

("msp430-none-elf", msp430_none_elf),

("aarch64-unknown-cloudabi", aarch64_unknown_cloudabi),
55 changes: 18 additions & 37 deletions src/librustc_typeck/check/_match.rs
Original file line number Diff line number Diff line change
@@ -50,30 +50,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

self.warn_arms_when_scrutinee_diverges(arms, match_src);

// Otherwise, we have to union together the types that the
// arms produce and so forth.
let scrut_diverges = self.diverges.get();
self.diverges.set(Diverges::Maybe);
// Otherwise, we have to union together the types that the arms produce and so forth.
let scrut_diverges = self.diverges.replace(Diverges::Maybe);

// rust-lang/rust#55810: Typecheck patterns first (via eager
// collection into `Vec`), so we get types for all bindings.
let all_arm_pats_diverge: Vec<_> = arms
.iter()
.map(|arm| {
let mut all_pats_diverge = Diverges::WarnedAlways;
self.diverges.set(Diverges::Maybe);
self.check_pat_top(&arm.pat, scrut_ty, Some(scrut.span), true);
all_pats_diverge &= self.diverges.get();

// As discussed with @eddyb, this is for disabling unreachable_code
// warnings on patterns (they're now subsumed by unreachable_patterns
// warnings).
match all_pats_diverge {
Diverges::Maybe => Diverges::Maybe,
Diverges::Always { .. } | Diverges::WarnedAlways => Diverges::WarnedAlways,
}
})
.collect();
// #55810: Type check patterns first so we get types for all bindings.
for arm in arms {
self.check_pat_top(&arm.pat, scrut_ty, Some(scrut.span), true);
}

// Now typecheck the blocks.
//
@@ -104,19 +87,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
CoerceMany::with_coercion_sites(coerce_first, arms)
};

let mut other_arms = vec![]; // used only for diagnostics
let mut other_arms = vec![]; // Used only for diagnostics.
let mut prior_arm_ty = None;
for (i, (arm, pats_diverge)) in arms.iter().zip(all_arm_pats_diverge).enumerate() {
for (i, arm) in arms.iter().enumerate() {
if let Some(g) = &arm.guard {
self.diverges.set(pats_diverge);
self.diverges.set(Diverges::Maybe);
match g {
hir::Guard::If(e) => {
self.check_expr_has_type_or_error(e, tcx.types.bool, |_| {})
}
};
}

self.diverges.set(pats_diverge);
self.diverges.set(Diverges::Maybe);
let arm_ty = if source_if
&& if_no_else
&& i != 0
@@ -200,16 +183,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
arms: &'tcx [hir::Arm<'tcx>],
source: hir::MatchSource,
) {
if self.diverges.get().is_always() {
use hir::MatchSource::*;
let msg = match source {
IfDesugar { .. } | IfLetDesugar { .. } => "block in `if` expression",
WhileDesugar { .. } | WhileLetDesugar { .. } => "block in `while` expression",
_ => "arm",
};
for arm in arms {
self.warn_if_unreachable(arm.body.hir_id, arm.body.span, msg);
}
use hir::MatchSource::*;
let msg = match source {
IfDesugar { .. } | IfLetDesugar { .. } => "block in `if` expression",
WhileDesugar { .. } | WhileLetDesugar { .. } => "block in `while` expression",
_ => "arm",
};
for arm in arms {
self.warn_if_unreachable(arm.body.hir_id, arm.body.span, msg);
}
}

6 changes: 2 additions & 4 deletions src/librustc_typeck/check/expr.rs
Original file line number Diff line number Diff line change
@@ -165,10 +165,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}

// Hide the outer diverging and has_errors flags.
let old_diverges = self.diverges.get();
let old_has_errors = self.has_errors.get();
self.diverges.set(Diverges::Maybe);
self.has_errors.set(false);
let old_diverges = self.diverges.replace(Diverges::Maybe);
let old_has_errors = self.has_errors.replace(false);

let ty = self.check_expr_kind(expr, expected, needs);

7 changes: 2 additions & 5 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
@@ -4429,10 +4429,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.warn_if_unreachable(stmt.hir_id, stmt.span, "statement");

// Hide the outer diverging and `has_errors` flags.
let old_diverges = self.diverges.get();
let old_has_errors = self.has_errors.get();
self.diverges.set(Diverges::Maybe);
self.has_errors.set(false);
let old_diverges = self.diverges.replace(Diverges::Maybe);
let old_has_errors = self.has_errors.replace(false);

match stmt.kind {
hir::StmtKind::Local(ref l) => {
@@ -4442,7 +4440,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
hir::StmtKind::Item(_) => {}
hir::StmtKind::Expr(ref expr) => {
// Check with expected type of `()`.

self.check_expr_has_type_or_error(&expr, self.tcx.mk_unit(), |err| {
self.suggest_semicolon_at_end(expr.span, err);
});
1 change: 1 addition & 0 deletions src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
@@ -69,6 +69,7 @@ static TARGETS: &[&str] = &[
"thumbv7neon-linux-androideabi",
"armv7-unknown-linux-gnueabi",
"armv7-unknown-linux-gnueabihf",
"armv7a-none-eabi",
"thumbv7neon-unknown-linux-gnueabihf",
"armv7-unknown-linux-musleabi",
"armv7-unknown-linux-musleabihf",