Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
c4b0265
Enable some timeouts in SGX platform
mzohreva Jun 12, 2020
d7dc64b
Handle spurious wakeups in wait_timeout_sgx
mzohreva Jun 12, 2020
c5d1fcd
Allow more ui tests for SGX
mzohreva Jun 12, 2020
3442d23
Improve wait_timeout_sgx, simplify usercalls::wait
mzohreva Jun 18, 2020
c457b67
Remove unnecessary check in SGX wait usercall
mzohreva Jul 1, 2020
a18848b
Create implib for dlls when testing MinGW targets
mati865 Jun 13, 2020
177a495
Allow matching test by target and env
mati865 Jul 3, 2020
3324bc5
Remove invalid test
mati865 Jul 3, 2020
17bc07d
Fix various tests to run on windows-gnu
mati865 Jul 3, 2020
1466598
Address review comments
mzohreva Jul 11, 2020
f970632
Don't render unstable for rustc docs
tesuji Jul 15, 2020
47fea96
Remove unused CSS rules for internal rustc items
tesuji Jul 15, 2020
98ce1ce
Convert whitespaces to tabs
GuillaumeGomez Jul 15, 2020
8c6c1dd
Automatically calculate std::env::consts::ARCH.
ehuss May 21, 2020
432b4c1
Use cfg_if in libtest.
ehuss May 22, 2020
9e58908
Use cfg_if in libpanic_abort.
ehuss May 22, 2020
6e9a1de
Introduce restricted-std feature.
ehuss Jun 1, 2020
cee9f05
Tweak formatting.
ehuss Jul 7, 2020
0eb293d
Use an allow-list of platforms that support std.
ehuss Jul 7, 2020
3d44d3c
Simplify os_str_bytes cfg expression.
ehuss Jul 7, 2020
85c25ae
Move usercall_wait_timeout to abi::usercalls::wait_timeout
mzohreva Jul 15, 2020
1813ae7
Add RISC-V GNU/Linux to src/tools/build-manifest as a host platform
msizanoen1 Jul 16, 2020
78d6cb0
Add tidy checks for rustdoc css files
GuillaumeGomez Jul 15, 2020
63ffa13
Fix tidy issues
GuillaumeGomez Jul 15, 2020
03bbe9d
Clean up E0723 explanation
GuillaumeGomez Jul 16, 2020
8e92f4f
Remove unused `cx` parameter from `pathvec_std` and `path_std`.
nnethercote Jul 14, 2020
bccff14
Simplify `LifetimeBounds`.
nnethercote Jul 14, 2020
5271e98
Use get_module instead of `module_map` for `resolve_str_path_error`
jyn514 Jun 6, 2020
848a766
Use the scope of the imported variable for resolution, not the curren…
jyn514 Jun 6, 2020
69bd13f
Use DefId for modules
jyn514 Jun 7, 2020
c3d9a73
Don't panic on fake IDs
jyn514 Jun 7, 2020
20106d5
unwrap() -> expect()
jyn514 Jun 7, 2020
24c3d85
Make sure that module_id is actually a module
jyn514 Jun 7, 2020
9542e23
Add tests for basic intra-doc links
jyn514 Jun 8, 2020
99f34d8
Remove warnings
jyn514 Jun 8, 2020
e78d499
Add test for re-exports
jyn514 Jun 8, 2020
9eb6394
Add test for documenting the re-export
jyn514 Jun 8, 2020
71fe8f7
Add test for submodules in inner crate
jyn514 Jun 10, 2020
432b043
Move import to top of function
jyn514 Jun 10, 2020
769acba
#![deny(intra_doc_resolution_failure)]
jyn514 Jun 10, 2020
5f49f55
rand -> my_rand
jyn514 Jun 10, 2020
e63e5cd
Support intra-doc links on macro re-exports
jyn514 Jun 12, 2020
82b3b07
Support intra-doc links on trait and module re-exports
jyn514 Jul 11, 2020
0ad1dcd
Add more debugging
jyn514 Jul 12, 2020
8387e38
Add (broken and ignored) test for #73829
jyn514 Jul 15, 2020
c46e038
Fix invalid lint
jyn514 Jul 16, 2020
9f00808
Remove `ExtCtxt::ident_of`.
nnethercote Jul 14, 2020
002af4d
Avoid storing `SymbolStr` in a struct.
nnethercote Jul 13, 2020
f03c7f8
Add `UnsafetyViolationDetails`.
nnethercote Jul 14, 2020
a4ba181
Remove some `Symbol:as_str()` calls.
nnethercote Jul 14, 2020
d75aa7a
Rollup merge of #73101 - jyn514:rustdoc-absolute-module, r=Manishearth
Manishearth Jul 16, 2020
490d124
Rollup merge of #73269 - mzohreva:mz/sgx-wait-timeout, r=jethrogb
Manishearth Jul 16, 2020
fb08613
Rollup merge of #74009 - mati865:mingw-tests-implib, r=nikomatsakis
Manishearth Jul 16, 2020
acaf7cf
Rollup merge of #74033 - ehuss:std-compile-all-platforms, r=Mark-Simu…
Manishearth Jul 16, 2020
581a9e7
Rollup merge of #74351 - lzutao:remove-rustc-internal-compiler-warns,…
Manishearth Jul 16, 2020
2497434
Rollup merge of #74357 - nnethercote:symbol-related-improvements, r=o…
Manishearth Jul 16, 2020
a6800e3
Rollup merge of #74368 - GuillaumeGomez:css-tidy-check, r=Mark-Simula…
Manishearth Jul 16, 2020
12f3c36
Rollup merge of #74386 - msizanoen1:riscv-add-manifest-host, r=pietro…
Manishearth Jul 16, 2020
f0d35f3
Rollup merge of #74398 - GuillaumeGomez:cleanup-e0723, r=Dylan-DPC
Manishearth Jul 16, 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
2 changes: 2 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2056,6 +2056,7 @@ dependencies = [
name = "panic_abort"
version = "0.0.0"
dependencies = [
"cfg-if",
"compiler_builtins",
"core",
"libc",
Expand Down Expand Up @@ -4552,6 +4553,7 @@ dependencies = [
name = "test"
version = "0.0.0"
dependencies = [
"cfg-if",
"core",
"getopts",
"libc",
Expand Down
1 change: 1 addition & 0 deletions src/libpanic_abort/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ bench = false
doc = false

[dependencies]
cfg-if = { version = "0.1.8", features = ['rustc-dep-of-std'] }
core = { path = "../libcore" }
libc = { version = "0.2", default-features = false }
compiler_builtins = "0.1.0"
35 changes: 19 additions & 16 deletions src/libpanic_abort/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,26 @@ pub unsafe extern "C" fn __rust_panic_cleanup(_: *mut u8) -> *mut (dyn Any + Sen
pub unsafe extern "C" fn __rust_start_panic(_payload: usize) -> u32 {
abort();

#[cfg(any(unix, target_os = "cloudabi"))]
unsafe fn abort() -> ! {
libc::abort();
}

#[cfg(any(windows, all(target_arch = "wasm32", not(target_os = "emscripten"))))]
unsafe fn abort() -> ! {
core::intrinsics::abort();
}

#[cfg(any(target_os = "hermit", all(target_vendor = "fortanix", target_env = "sgx")))]
unsafe fn abort() -> ! {
// call std::sys::abort_internal
extern "C" {
pub fn __rust_abort() -> !;
cfg_if::cfg_if! {
if #[cfg(any(unix, target_os = "cloudabi"))] {
unsafe fn abort() -> ! {
libc::abort();
}
} else if #[cfg(any(target_os = "hermit",
all(target_vendor = "fortanix", target_env = "sgx")
))] {
unsafe fn abort() -> ! {
// call std::sys::abort_internal
extern "C" {
pub fn __rust_abort() -> !;
}
__rust_abort();
}
} else {
unsafe fn abort() -> ! {
core::intrinsics::abort();
}
}
__rust_abort();
}
}

Expand Down
20 changes: 16 additions & 4 deletions src/libpanic_unwind/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,33 @@ cfg_if::cfg_if! {
if #[cfg(target_os = "emscripten")] {
#[path = "emcc.rs"]
mod real_imp;
} else if #[cfg(target_arch = "wasm32")] {
#[path = "dummy.rs"]
mod real_imp;
} else if #[cfg(target_os = "hermit")] {
#[path = "hermit.rs"]
mod real_imp;
} else if #[cfg(target_env = "msvc")] {
#[path = "seh.rs"]
mod real_imp;
} else {
} else if #[cfg(any(
all(target_family = "windows", target_env = "gnu"),
target_os = "cloudabi",
target_family = "unix",
all(target_vendor = "fortanix", target_env = "sgx"),
))] {
// Rust runtime's startup objects depend on these symbols, so make them public.
#[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
pub use real_imp::eh_frame_registry::*;
#[path = "gcc.rs"]
mod real_imp;
} else {
// Targets that don't support unwinding.
// - arch=wasm32
// - os=none ("bare metal" targets)
// - os=uefi
// - nvptx64-nvidia-cuda
// - avr-unknown-unknown
// - mipsel-sony-psp
#[path = "dummy.rs"]
mod real_imp;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#![feature(in_band_lifetimes)]
#![feature(negative_impls)]
#![feature(optin_builtin_traits)]
#![feature(restricted_std)]
#![feature(rustc_attrs)]
#![feature(min_specialization)]
#![recursion_limit = "256"]
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_passes/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@ impl Visitor<'tcx> for Checker<'tcx> {
match item.kind {
hir::ItemKind::ExternCrate(_) => {
// compiler-generated `extern crate` items have a dummy span.
if item.span.is_dummy() {
// `std` is still checked for the `restricted-std` feature.
if item.span.is_dummy() && item.ident.as_str() != "std" {
return;
}

Expand Down
24 changes: 24 additions & 0 deletions src/libstd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,29 @@ fn main() {
}
println!("cargo:rustc-link-lib=c");
println!("cargo:rustc-link-lib=compiler_rt");
} else if (target.contains("sgx") && target.contains("fortanix"))
|| target.contains("hermit")
|| target.contains("l4re")
|| target.contains("redox")
|| target.contains("haiku")
|| target.contains("vxworks")
|| target.contains("wasm32")
|| target.contains("asmjs")
{
// These platforms don't have any special requirements.
} else {
// This is for Cargo's build-std support, to mark std as unstable for
// typically no_std platforms.
// This covers:
// - os=none ("bare metal" targets)
// - mipsel-sony-psp
// - nvptx64-nvidia-cuda
// - avr-unknown-unknown
// - tvos (aarch64-apple-tvos, x86_64-apple-tvos)
// - uefi (x86_64-unknown-uefi, i686-unknown-uefi)
// - JSON targets
// - Any new targets that have not been explicitly added above.
println!("cargo:rustc-cfg=feature=\"restricted-std\"");
}
println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
}
77 changes: 1 addition & 76 deletions src/libstd/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ pub mod consts {
/// - s390x
/// - sparc64
#[stable(feature = "env", since = "1.0.0")]
pub const ARCH: &str = super::arch::ARCH;
pub const ARCH: &str = env!("STD_ENV_ARCH");

/// The family of the operating system. Example value is `unix`.
///
Expand Down Expand Up @@ -966,81 +966,6 @@ pub mod consts {
pub const EXE_EXTENSION: &str = os::EXE_EXTENSION;
}

#[cfg(target_arch = "x86")]
mod arch {
pub const ARCH: &str = "x86";
}

#[cfg(target_arch = "x86_64")]
mod arch {
pub const ARCH: &str = "x86_64";
}

#[cfg(target_arch = "arm")]
mod arch {
pub const ARCH: &str = "arm";
}

#[cfg(target_arch = "aarch64")]
mod arch {
pub const ARCH: &str = "aarch64";
}

#[cfg(target_arch = "mips")]
mod arch {
pub const ARCH: &str = "mips";
}

#[cfg(target_arch = "mips64")]
mod arch {
pub const ARCH: &str = "mips64";
}

#[cfg(target_arch = "powerpc")]
mod arch {
pub const ARCH: &str = "powerpc";
}

#[cfg(target_arch = "powerpc64")]
mod arch {
pub const ARCH: &str = "powerpc64";
}

#[cfg(target_arch = "s390x")]
mod arch {
pub const ARCH: &str = "s390x";
}

#[cfg(target_arch = "sparc64")]
mod arch {
pub const ARCH: &str = "sparc64";
}

#[cfg(target_arch = "le32")]
mod arch {
pub const ARCH: &str = "le32";
}

#[cfg(target_arch = "asmjs")]
mod arch {
pub const ARCH: &str = "asmjs";
}

#[cfg(target_arch = "wasm32")]
mod arch {
pub const ARCH: &str = "wasm32";
}

#[cfg(target_arch = "hexagon")]
mod arch {
pub const ARCH: &'static str = "hexagon";
}

#[cfg(target_arch = "riscv64")]
mod arch {
pub const ARCH: &'static str = "riscv64";
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
9 changes: 8 additions & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@
//! [primitive types]: ../book/ch03-02-data-types.html
//! [rust-discord]: https://discord.gg/rust-lang

#![stable(feature = "rust1", since = "1.0.0")]
#![cfg_attr(not(feature = "restricted-std"), stable(feature = "rust1", since = "1.0.0"))]
#![cfg_attr(feature = "restricted-std", unstable(feature = "restricted_std", issue = "none"))]
#![doc(
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/",
Expand Down Expand Up @@ -554,3 +555,9 @@ include!("primitive_docs.rs");
// the rustdoc documentation for the existing keywords. Using `include!`
// because rustdoc only looks for these modules at the crate level.
include!("keyword_docs.rs");

// This is required to avoid an unstable error when `restricted-std` is not
// enabled. The use of #![feature(restricted_std)] in rustc-std-workspace-std
// is unconditional, so the unstable feature needs to be defined somewhere.
#[cfg_attr(not(feature = "restricted-std"), unstable(feature = "restricted_std", issue = "none"))]
mod __restricted_std_workaround {}
3 changes: 2 additions & 1 deletion src/libstd/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ cfg_if::cfg_if! {
mod sgx;
pub use self::sgx::*;
} else {
compile_error!("libstd doesn't compile for this platform yet");
mod unsupported;
pub use self::unsupported::*;
}
}

Expand Down
22 changes: 22 additions & 0 deletions src/libstd/sys/unsupported/alloc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use crate::alloc::{GlobalAlloc, Layout, System};

#[stable(feature = "alloc_system_type", since = "1.28.0")]
unsafe impl GlobalAlloc for System {
#[inline]
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
0 as *mut u8
}

#[inline]
unsafe fn alloc_zeroed(&self, _layout: Layout) -> *mut u8 {
0 as *mut u8
}

#[inline]
unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {}

#[inline]
unsafe fn realloc(&self, _ptr: *mut u8, _layout: Layout, _new_size: usize) -> *mut u8 {
0 as *mut u8
}
}
38 changes: 38 additions & 0 deletions src/libstd/sys/unsupported/args.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
use crate::ffi::OsString;

pub unsafe fn init(_argc: isize, _argv: *const *const u8) {}
pub unsafe fn cleanup() {}

pub struct Args {}

pub fn args() -> Args {
Args {}
}

impl Args {
pub fn inner_debug(&self) -> &[OsString] {
&[]
}
}

impl Iterator for Args {
type Item = OsString;
fn next(&mut self) -> Option<OsString> {
None
}
fn size_hint(&self) -> (usize, Option<usize>) {
(0, Some(0))
}
}

impl ExactSizeIterator for Args {
fn len(&self) -> usize {
0
}
}

impl DoubleEndedIterator for Args {
fn next_back(&mut self) -> Option<OsString> {
None
}
}
File renamed without changes.
48 changes: 48 additions & 0 deletions src/libstd/sys/unsupported/common.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
use crate::io as std_io;

pub mod memchr {
pub use core::slice::memchr::{memchr, memrchr};
}

pub use crate::sys_common::os_str_bytes as os_str;

// This is not necessarily correct. May want to consider making it part of the
// spec definition?
use crate::os::raw::c_char;

#[cfg(not(test))]
pub fn init() {}

pub fn unsupported<T>() -> std_io::Result<T> {
Err(unsupported_err())
}

pub fn unsupported_err() -> std_io::Error {
std_io::Error::new(std_io::ErrorKind::Other, "operation not supported on this platform")
}

pub fn decode_error_kind(_code: i32) -> crate::io::ErrorKind {
crate::io::ErrorKind::Other
}

pub fn abort_internal() -> ! {
core::intrinsics::abort();
}

pub fn hashmap_random_keys() -> (u64, u64) {
(1, 2)
}

// This enum is used as the storage for a bunch of types which can't actually
// exist.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
pub enum Void {}

pub unsafe fn strlen(mut s: *const c_char) -> usize {
let mut n = 0;
while *s != 0 {
n += 1;
s = s.offset(1);
}
return n;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ impl Condvar {
pub unsafe fn notify_all(&self) {}

pub unsafe fn wait(&self, _mutex: &Mutex) {
panic!("can't block with web assembly")
panic!("condvar wait not supported")
}

pub unsafe fn wait_timeout(&self, _mutex: &Mutex, _dur: Duration) -> bool {
panic!("can't block with web assembly");
panic!("condvar wait not supported");
}

#[inline]
Expand Down
Loading