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 7 pull requests #71951

Merged
merged 19 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4d3cf5b
use new interface to create threads on HermitCore
stlankes Apr 26, 2020
2c43746
use nicer code style to define DEFAULT_MIN_STACK_SIZE
stlankes Apr 27, 2020
9bcf409
x.py: Give a more helpful error message if curl isn't installed
jyn514 May 3, 2020
9c93b88
Export dataflow impls by name
ecstatic-morse May 4, 2020
095d1fd
Import dataflow impls via the `impls` submodule
ecstatic-morse May 4, 2020
32d1a4b
Use -fvisibility=hidden for libunwind
petrhosek May 5, 2020
7db74be
Ignore SGX on a few ui tests
mzohreva May 6, 2020
5087c1a
Add comment for `Ord` implementation for array
ldm0 May 6, 2020
9907ad6
Define UB in float-to-int casts to saturate
Mark-Simulacrum Apr 18, 2020
0dbce10
Pull in miri test cases
Mark-Simulacrum Apr 18, 2020
d4f31b4
Fixup tests to test both const-eval and runtime
Mark-Simulacrum Apr 19, 2020
f63b8bf
Remove warning about UB
Mark-Simulacrum Apr 21, 2020
14d608f
Rollup merge of #71269 - Mark-Simulacrum:sat-float-casts, r=nikic
Dylan-DPC May 6, 2020
a6a7c75
Rollup merge of #71591 - hermitcore:thread_create, r=hanna-kruppe
Dylan-DPC May 6, 2020
538a353
Rollup merge of #71819 - jyn514:check-for-tools, r=Mark-Simulacrum
Dylan-DPC May 6, 2020
d30988e
Rollup merge of #71893 - ecstatic-morse:dataflow-impls-import, r=jona…
Dylan-DPC May 6, 2020
c366b27
Rollup merge of #71929 - petrhosek:unwind-visibility, r=tmandry
Dylan-DPC May 6, 2020
4422cb7
Rollup merge of #71937 - mzohreva:mz/ui-tests-ignore-sgx, r=nikomatsakis
Dylan-DPC May 6, 2020
fbb4ccb
Rollup merge of #71944 - ldm0:arrordhint, r=sfackler
Dylan-DPC May 6, 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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1375,9 +1375,9 @@ dependencies = [

[[package]]
name = "hermit-abi"
version = "0.1.10"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e"
checksum = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4"
dependencies = [
"compiler_builtins",
"libc",
Expand Down
48 changes: 25 additions & 23 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def _download(path, url, probably_big, verbose, exception):
option = "-#"
else:
option = "-s"
require(["curl", "--version"])
run(["curl", option,
"-y", "30", "-Y", "10", # timeout if speed is < 10 bytes/sec for > 30 seconds
"--connect-timeout", "30", # timeout if cannot connect within 30 seconds
Expand Down Expand Up @@ -143,6 +144,21 @@ def run(args, verbose=False, exception=False, **kwargs):
sys.exit(err)


def require(cmd, exit=True):
'''Run a command, returning its output.
On error,
If `exit` is `True`, exit the process.
Otherwise, return None.'''
try:
return subprocess.check_output(cmd).strip()
except (subprocess.CalledProcessError, OSError) as exc:
if not exit:
return None
print("error: unable to run `{}`: {}".format(' '.join(cmd), exc))
print("Please make sure it's installed and in the path.")
sys.exit(1)


def stage0_data(rust_root):
"""Build a dictionary from stage0.txt"""
nightlies = os.path.join(rust_root, "src/stage0.txt")
Expand All @@ -164,16 +180,12 @@ def format_build_time(duration):
def default_build_triple():
"""Build triple as in LLVM"""
default_encoding = sys.getdefaultencoding()
try:
ostype = subprocess.check_output(
['uname', '-s']).strip().decode(default_encoding)
cputype = subprocess.check_output(
['uname', '-m']).strip().decode(default_encoding)
except (subprocess.CalledProcessError, OSError):
if sys.platform == 'win32':
return 'x86_64-pc-windows-msvc'
err = "uname not found"
sys.exit(err)
required = not sys.platform == 'win32'
ostype = require(["uname", "-s"], exit=required).decode(default_encoding)
cputype = require(['uname', '-m'], exit=required).decode(default_encoding)

if ostype is None or cputype is None:
return 'x86_64-pc-windows-msvc'

# The goal here is to come up with the same triple as LLVM would,
# at least for the subset of platforms we're willing to target.
Expand Down Expand Up @@ -203,12 +215,7 @@ def default_build_triple():
# output from that option is too generic for our purposes (it will
# always emit 'i386' on x86/amd64 systems). As such, isainfo -k
# must be used instead.
try:
cputype = subprocess.check_output(
['isainfo', '-k']).strip().decode(default_encoding)
except (subprocess.CalledProcessError, OSError):
err = "isainfo not found"
sys.exit(err)
cputype = require(['isainfo', '-k']).decode(default_encoding)
elif ostype.startswith('MINGW'):
# msys' `uname` does not print gcc configuration, but prints msys
# configuration. so we cannot believe `uname -m`:
Expand Down Expand Up @@ -766,13 +773,8 @@ def update_submodules(self):
default_encoding = sys.getdefaultencoding()

# check the existence and version of 'git' command
try:
git_version_output = subprocess.check_output(['git', '--version'])
git_version_str = git_version_output.strip().split()[2].decode(default_encoding)
self.git_version = distutils.version.LooseVersion(git_version_str)
except (subprocess.CalledProcessError, OSError):
print("error: `git` is not found, please make sure it's installed and in the path.")
sys.exit(1)
git_version_str = require(['git', '--version']).split()[2].decode(default_encoding)
self.git_version = distutils.version.LooseVersion(git_version_str)

slow_submodules = self.get_toml('fast-submodules') == "false"
start_time = time()
Expand Down
1 change: 1 addition & 0 deletions src/libcore/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ where
}
}

/// Implements comparison of arrays lexicographically.
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord, const N: usize> Ord for [T; N]
where
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/mir/rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ fn cast_float_to_int<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
) -> Bx::Value {
let fptosui_result = if signed { bx.fptosi(x, int_ty) } else { bx.fptoui(x, int_ty) };

if !bx.cx().sess().opts.debugging_opts.saturating_float_casts {
if let Some(false) = bx.cx().sess().opts.debugging_opts.saturating_float_casts {
return fptosui_result;
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_interface/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ fn test_debugging_options_tracking_hash() {
tracked!(sanitizer, Some(Sanitizer::Address));
tracked!(sanitizer_memory_track_origins, 2);
tracked!(sanitizer_recover, vec![Sanitizer::Address]);
tracked!(saturating_float_casts, true);
tracked!(saturating_float_casts, Some(true));
tracked!(share_generics, Some(true));
tracked!(show_span, Some(String::from("abc")));
tracked!(src_hash_algorithm, Some(SourceFileHashAlgorithm::Sha1));
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_mir/borrow_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ use std::mem;
use std::rc::Rc;

use crate::dataflow;
use crate::dataflow::impls::{
Borrows, EverInitializedPlaces, MaybeInitializedPlaces, MaybeUninitializedPlaces,
};
use crate::dataflow::indexes::{BorrowIndex, InitIndex, MoveOutIndex, MovePathIndex};
use crate::dataflow::move_paths::{InitLocation, LookupResult, MoveData, MoveError};
use crate::dataflow::Borrows;
use crate::dataflow::EverInitializedPlaces;
use crate::dataflow::MoveDataParamEnv;
use crate::dataflow::{Analysis, BorrowckFlowState as Flows, BorrowckResults};
use crate::dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
use crate::transform::MirSource;

use self::diagnostics::{AccessKind, RegionName};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/nll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use std::str::FromStr;
use self::mir_util::PassWhere;
use polonius_engine::{Algorithm, Output};

use crate::dataflow::impls::MaybeInitializedPlaces;
use crate::dataflow::move_paths::{InitKind, InitLocation, MoveData};
use crate::dataflow::MaybeInitializedPlaces;
use crate::dataflow::ResultsCursor;
use crate::transform::MirSource;
use crate::util as mir_util;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/type_check/liveness/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use rustc_middle::mir::{Body, Local};
use rustc_middle::ty::{RegionVid, TyCtxt};
use std::rc::Rc;

use crate::dataflow::impls::MaybeInitializedPlaces;
use crate::dataflow::move_paths::MoveData;
use crate::dataflow::MaybeInitializedPlaces;
use crate::dataflow::ResultsCursor;

use crate::borrow_check::{
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/type_check/liveness/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use rustc_trait_selection::traits::query::type_op::outlives::DropckOutlives;
use rustc_trait_selection::traits::query::type_op::TypeOp;
use std::rc::Rc;

use crate::dataflow::impls::MaybeInitializedPlaces;
use crate::dataflow::indexes::MovePathIndex;
use crate::dataflow::move_paths::{HasMoveData, MoveData};
use crate::dataflow::MaybeInitializedPlaces;
use crate::dataflow::ResultsCursor;

use crate::borrow_check::{
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ use rustc_trait_selection::traits::query::type_op::custom::CustomTypeOp;
use rustc_trait_selection::traits::query::{Fallible, NoSolution};
use rustc_trait_selection::traits::{self, ObligationCause, PredicateObligations};

use crate::dataflow::impls::MaybeInitializedPlaces;
use crate::dataflow::move_paths::MoveData;
use crate::dataflow::MaybeInitializedPlaces;
use crate::dataflow::ResultsCursor;
use crate::transform::{
check_consts::ConstCx,
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_mir/dataflow/impls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ use super::on_lookup_result_bits;
use crate::dataflow::drop_flag_effects;

mod borrowed_locals;
pub(super) mod borrows;
mod liveness;
mod storage_liveness;

pub use self::borrowed_locals::*;
pub use self::borrowed_locals::{MaybeBorrowedLocals, MaybeMutBorrowedLocals};
pub use self::borrows::Borrows;
pub use self::liveness::MaybeLiveLocals;
pub use self::storage_liveness::*;

pub(super) mod borrows;
pub use self::storage_liveness::{MaybeRequiresStorage, MaybeStorageLive};

/// `MaybeInitializedPlaces` tracks all places that might be
/// initialized upon reaching a particular point in the control flow
Expand Down
7 changes: 1 addition & 6 deletions src/librustc_mir/dataflow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@ pub use self::framework::{
BottomValue, Engine, Forward, GenKill, GenKillAnalysis, Results, ResultsCursor,
ResultsRefCursor, ResultsVisitor,
};
pub use self::impls::{
borrows::Borrows, DefinitelyInitializedPlaces, EverInitializedPlaces, MaybeBorrowedLocals,
MaybeInitializedPlaces, MaybeLiveLocals, MaybeMutBorrowedLocals, MaybeRequiresStorage,
MaybeStorageLive, MaybeUninitializedPlaces,
};

use self::move_paths::MoveData;

pub mod drop_flag_effects;
mod framework;
mod impls;
pub mod impls;
pub mod move_paths;

pub(crate) mod indexes {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/check_consts/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use super::qualifs::{self, CustomEq, HasMutInterior, NeedsDrop};
use super::resolver::FlowSensitiveAnalysis;
use super::{is_lang_panic_fn, ConstCx, ConstKind, Qualif};
use crate::const_eval::{is_const_fn, is_unstable_const_fn};
use crate::dataflow::MaybeMutBorrowedLocals;
use crate::dataflow::impls::MaybeMutBorrowedLocals;
use crate::dataflow::{self, Analysis};

// We are using `MaybeMutBorrowedLocals` as a proxy for whether an item may have been mutated
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/elaborate_drops.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::dataflow;
use crate::dataflow::impls::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
use crate::dataflow::move_paths::{LookupResult, MoveData, MovePathIndex};
use crate::dataflow::on_lookup_result_bits;
use crate::dataflow::MoveDataParamEnv;
use crate::dataflow::{on_all_children_bits, on_all_drop_children_bits};
use crate::dataflow::{Analysis, ResultsCursor};
use crate::dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
use crate::transform::{MirPass, MirSource};
use crate::util::elaborate_drops::{elaborate_drop, DropFlagState, Unwind};
use crate::util::elaborate_drops::{DropElaborator, DropFlagMode, DropStyle};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/transform/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
//! For generators with state 1 (returned) and state 2 (poisoned) it does nothing.
//! Otherwise it drops all the values in scope at the last suspension point.

use crate::dataflow::{self, Analysis};
use crate::dataflow::{
use crate::dataflow::impls::{
MaybeBorrowedLocals, MaybeLiveLocals, MaybeRequiresStorage, MaybeStorageLive,
};
use crate::dataflow::{self, Analysis};
use crate::transform::no_landing_pads::no_landing_pads;
use crate::transform::simplify;
use crate::transform::{MirPass, MirSource};
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_mir/transform/rustc_peek.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use rustc_index::bit_set::BitSet;
use rustc_middle::mir::{self, Body, Local, Location};
use rustc_middle::ty::{self, Ty, TyCtxt};

use crate::dataflow::impls::{
DefinitelyInitializedPlaces, MaybeInitializedPlaces, MaybeLiveLocals, MaybeMutBorrowedLocals,
MaybeUninitializedPlaces,
};
use crate::dataflow::move_paths::{HasMoveData, MoveData};
use crate::dataflow::move_paths::{LookupResult, MovePathIndex};
use crate::dataflow::MaybeMutBorrowedLocals;
use crate::dataflow::MoveDataParamEnv;
use crate::dataflow::{Analysis, Results, ResultsCursor};
use crate::dataflow::{
DefinitelyInitializedPlaces, MaybeInitializedPlaces, MaybeLiveLocals, MaybeUninitializedPlaces,
};

pub struct SanityCheck;

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_session/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -938,9 +938,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"enable origins tracking in MemorySanitizer"),
sanitizer_recover: Vec<Sanitizer> = (vec![], parse_sanitizer_list, [TRACKED],
"enable recovery for selected sanitizers"),
saturating_float_casts: bool = (false, parse_bool, [TRACKED],
saturating_float_casts: Option<bool> = (None, parse_opt_bool, [TRACKED],
"make float->int casts UB-free: numbers outside the integer type's range are clipped to \
the max/min integer respectively, and NaN is mapped to 0 (default: no)"),
the max/min integer respectively, and NaN is mapped to 0 (default: yes)"),
save_analysis: bool = (false, parse_bool, [UNTRACKED],
"write syntax and type analysis (in JSON format) information, in \
addition to normal output (default: no)"),
Expand Down
7 changes: 0 additions & 7 deletions src/librustc_typeck/check/demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -909,13 +909,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
cast_suggestion,
Applicability::MaybeIncorrect, // lossy conversion
);
err.warn(
"if the rounded value cannot be represented by the target \
integer type, including `Inf` and `NaN`, casting will cause \
undefined behavior \
(see issue #10184 <https://github.com/rust-lang/rust/issues/10184> \
for more information)",
);
}
true
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dlmalloc = { version = "0.1", features = ['rustc-dep-of-std'] }
fortanix-sgx-abi = { version = "0.3.2", features = ['rustc-dep-of-std'] }

[target.'cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_os = "hermit"))'.dependencies]
hermit-abi = { version = "0.1.10", features = ['rustc-dep-of-std'] }
hermit-abi = { version = "0.1.12", features = ['rustc-dep-of-std'] }

[target.wasm32-wasi.dependencies]
wasi = { version = "0.9.0", features = ['rustc-dep-of-std'], default-features = false }
Expand Down
13 changes: 6 additions & 7 deletions src/libstd/sys/hermit/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,24 @@ pub struct Thread {
unsafe impl Send for Thread {}
unsafe impl Sync for Thread {}

pub const DEFAULT_MIN_STACK_SIZE: usize = 262144;
pub const DEFAULT_MIN_STACK_SIZE: usize = 1 << 20;

impl Thread {
pub unsafe fn new_with_coreid(
_stack: usize,
stack: usize,
p: Box<dyn FnOnce()>,
core_id: isize,
) -> io::Result<Thread> {
let p = Box::into_raw(box p);
let mut tid: Tid = u32::MAX;
let ret = abi::spawn(
&mut tid as *mut Tid,
let tid = abi::spawn2(
thread_start,
&*p as *const _ as *const u8 as usize,
p as usize,
abi::Priority::into(abi::NORMAL_PRIO),
stack,
core_id,
);

return if ret != 0 {
return if tid == 0 {
// The thread failed to start and as a result p was not consumed. Therefore, it is
// safe to reconstruct the box so that it gets deallocated.
drop(Box::from_raw(p));
Expand Down
1 change: 1 addition & 0 deletions src/libunwind/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ mod llvm_libunwind {
cfg.flag("-fno-rtti");
cfg.flag("-fstrict-aliasing");
cfg.flag("-funwind-tables");
cfg.flag("-fvisibility=hidden");
}

let mut unwind_sources = vec![
Expand Down
12 changes: 6 additions & 6 deletions src/test/codegen/unchecked-float-casts.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// compile-flags: -C no-prepopulate-passes
// This file tests that we don't generate any code for saturation when using the
// unchecked intrinsics.

// This file tests that we don't generate any code for saturation if
// -Z saturating-float-casts is not enabled.
// compile-flags: -C opt-level=3

#![crate_type = "lib"]

Expand All @@ -12,7 +12,7 @@ pub fn f32_to_u32(x: f32) -> u32 {
// CHECK-NOT: fcmp
// CHECK-NOT: icmp
// CHECK-NOT: select
x as u32
unsafe { x.to_int_unchecked() }
}

// CHECK-LABEL: @f32_to_i32
Expand All @@ -22,7 +22,7 @@ pub fn f32_to_i32(x: f32) -> i32 {
// CHECK-NOT: fcmp
// CHECK-NOT: icmp
// CHECK-NOT: select
x as i32
unsafe { x.to_int_unchecked() }
}

#[no_mangle]
Expand All @@ -31,5 +31,5 @@ pub fn f64_to_u16(x: f64) -> u16 {
// CHECK-NOT: fcmp
// CHECK-NOT: icmp
// CHECK-NOT: select
x as u16
unsafe { x.to_int_unchecked() }
}
1 change: 1 addition & 0 deletions src/test/ui/eprint-on-tls-drop.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// run-pass
// ignore-emscripten no processes
// ignore-sgx no processes

use std::cell::RefCell;
use std::env;
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/issues/issue-15487.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![allow(unused_attributes)]
// ignore-windows
// ignore-wasm32-bare no libs to link
// ignore-sgx no libs to link

#![feature(link_args)]

Expand Down
Loading