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 11 pull requests #120496

Merged
merged 27 commits into from
Jan 30, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a984193
Deduplicate more sized errors on call exprs
estebank Jan 24, 2024
e23937c
adapt test for v0 symbol mangling
krasimirgg Jan 24, 2024
f68741b
Stop checking `err_count` in macro_rules validity checking
oli-obk Jan 25, 2024
f6f0e04
Remove an unused error count check
oli-obk Jan 25, 2024
646c8fc
Statically ensure an error is reported in report_arg_errors
oli-obk Jan 25, 2024
2b60e56
Statically ensure report_selection_error actually reports an error
oli-obk Jan 25, 2024
3042da0
Remove has_errors check in builtin macro parsing
oli-obk Jan 25, 2024
054e1e3
Track ErrorGuaranteed instead of conjuring it from thin air
oli-obk Jan 25, 2024
9199742
Revert "Add the wasm32-wasi-preview2 target"
fmease Jan 28, 2024
6837b81
Fix some `Arc` allocator leaks
Nemo157 Jan 28, 2024
492df34
Supress unhelpful diagnostics for unresolved top level attributes
chenyukang Jan 27, 2024
6468d44
Improve error message when `cargo build` is used to build the compiler
Noratrieb Jan 29, 2024
96e6cfa
Improve display of crate name when hovered
GuillaumeGomez Jan 29, 2024
b4efe07
Remove some unnecessary check logic for lang items in HIR typeck
compiler-errors Jan 29, 2024
bf4de3a
Remove `raw_os_nonzero` feature.
reitermarkus Jan 24, 2024
ad526d8
add missing potential_query_instability for keys and values in hashmap
chenyukang Jan 30, 2024
efff267
Rollup merge of #117906 - GuillaumeGomez:improve-crate-name-hover, r=…
GuillaumeGomez Jan 30, 2024
ee2e9e1
Rollup merge of #118533 - chenyukang:yukang-fix-118455, r=petrochenkov
GuillaumeGomez Jan 30, 2024
0a4fd52
Rollup merge of #120293 - estebank:issue-102629, r=nnethercote
GuillaumeGomez Jan 30, 2024
4f4ceef
Rollup merge of #120295 - reitermarkus:remove-ffi-nonzero, r=dtolnay
GuillaumeGomez Jan 30, 2024
6a1d34f
Rollup merge of #120310 - krasimirgg:jan-v0-sym, r=Mark-Simulacrum
GuillaumeGomez Jan 30, 2024
b28e6f1
Rollup merge of #120342 - oli-obk:track_errors6, r=nnethercote
GuillaumeGomez Jan 30, 2024
d10f33a
Rollup merge of #120434 - fmease:revert-speeder, r=petrochenkov
GuillaumeGomez Jan 30, 2024
a5aa355
Rollup merge of #120445 - Nemo157:arc-plug, r=Mark-Simulacrum
GuillaumeGomez Jan 30, 2024
399b81f
Rollup merge of #120475 - Nilstrieb:cargo-build-my-a-, r=michaelwoeri…
GuillaumeGomez Jan 30, 2024
f3f1472
Rollup merge of #120476 - compiler-errors:lang-items-yeet, r=Nilstrieb
GuillaumeGomez Jan 30, 2024
27bc496
Rollup merge of #120485 - chenyukang:yukang-add-query-instability-che…
GuillaumeGomez Jan 30, 2024
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
Prev Previous commit
Next Next commit
Revert "Add the wasm32-wasi-preview2 target"
This reverts commit 31ecf34.

Co-authored-by: Ryan Levick <[email protected]>
fmease and rylev committed Jan 28, 2024
commit 9199742339b64dcc3aeaaf474156b593c93607fb
1 change: 0 additions & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
@@ -1799,7 +1799,6 @@ symbols! {
warn,
wasm_abi,
wasm_import_module,
wasm_preview2,
wasm_target_feature,
while_let,
windows,
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
@@ -1574,7 +1574,6 @@ supported_targets! {
("wasm32-unknown-emscripten", wasm32_unknown_emscripten),
("wasm32-unknown-unknown", wasm32_unknown_unknown),
("wasm32-wasi", wasm32_wasi),
("wasm32-wasi-preview2", wasm32_wasi_preview2),
("wasm32-wasi-preview1-threads", wasm32_wasi_preview1_threads),
("wasm64-unknown-unknown", wasm64_unknown_unknown),

Original file line number Diff line number Diff line change
@@ -72,12 +72,11 @@
//! best we can with this target. Don't start relying on too much here unless
//! you know what you're getting in to!

use crate::spec::{base, crt_objects, cvs, Cc, LinkSelfContainedDefault, LinkerFlavor, Target};
use crate::spec::{base, crt_objects, Cc, LinkSelfContainedDefault, LinkerFlavor, Target};

pub fn target() -> Target {
let mut options = base::wasm::options();

options.families = cvs!["wasm", "wasi"];
options.os = "wasi".into();

options.add_pre_link_args(
64 changes: 0 additions & 64 deletions compiler/rustc_target/src/spec/targets/wasm32_wasi_preview2.rs

This file was deleted.

3 changes: 0 additions & 3 deletions library/std/src/os/mod.rs
Original file line number Diff line number Diff line change
@@ -85,9 +85,6 @@ pub mod linux;
#[cfg(any(target_os = "wasi", doc))]
pub mod wasi;

#[cfg(any(all(target_os = "wasi", target_env = "preview2"), doc))]
pub mod wasi_preview2;

// windows
#[cfg(not(all(
doc,
3 changes: 1 addition & 2 deletions library/std/src/os/wasi/mod.rs
Original file line number Diff line number Diff line change
@@ -28,8 +28,7 @@
//! [`OsStr`]: crate::ffi::OsStr
//! [`OsString`]: crate::ffi::OsString

#![cfg_attr(not(target_env = "preview2"), stable(feature = "rust1", since = "1.0.0"))]
#![cfg_attr(target_env = "preview2", unstable(feature = "wasm_preview2", issue = "none"))]
#![stable(feature = "rust1", since = "1.0.0")]
#![deny(unsafe_op_in_unsafe_fn)]
#![doc(cfg(target_os = "wasi"))]

5 changes: 0 additions & 5 deletions library/std/src/os/wasi_preview2/mod.rs

This file was deleted.

3 changes: 0 additions & 3 deletions library/std/src/sys/pal/mod.rs
Original file line number Diff line number Diff line change
@@ -40,9 +40,6 @@ cfg_if::cfg_if! {
} else if #[cfg(target_os = "wasi")] {
mod wasi;
pub use self::wasi::*;
} else if #[cfg(all(target_os = "wasi", target_env = "preview2"))] {
mod wasi_preview2;
pub use self::wasi_preview2::*;
} else if #[cfg(target_family = "wasm")] {
mod wasm;
pub use self::wasm::*;
123 changes: 0 additions & 123 deletions library/std/src/sys/pal/wasi/helpers.rs

This file was deleted.

132 changes: 123 additions & 9 deletions library/std/src/sys/pal/wasi/mod.rs
Original file line number Diff line number Diff line change
@@ -14,6 +14,9 @@
//! compiling for wasm. That way it's a compile time error for something that's
//! guaranteed to be a runtime error!

use crate::io as std_io;
use crate::mem;

#[path = "../unix/alloc.rs"]
pub mod alloc;
pub mod args;
@@ -69,12 +72,123 @@ cfg_if::cfg_if! {
mod common;
pub use common::*;

mod helpers;
// These exports are listed individually to work around Rust's glob import
// conflict rules. If we glob export `helpers` and `common` together, then
// the compiler complains about conflicts.
pub use helpers::abort_internal;
pub use helpers::decode_error_kind;
use helpers::err2io;
pub use helpers::hashmap_random_keys;
pub use helpers::is_interrupted;
#[inline]
pub fn is_interrupted(errno: i32) -> bool {
errno == wasi::ERRNO_INTR.raw().into()
}

pub fn decode_error_kind(errno: i32) -> std_io::ErrorKind {
use std_io::ErrorKind;

let Ok(errno) = u16::try_from(errno) else {
return ErrorKind::Uncategorized;
};

macro_rules! match_errno {
($($($errno:ident)|+ => $errkind:ident),*, _ => $wildcard:ident $(,)?) => {
match errno {
$(e if $(e == ::wasi::$errno.raw())||+ => ErrorKind::$errkind),*,
_ => ErrorKind::$wildcard,
}
};
}

match_errno! {
ERRNO_2BIG => ArgumentListTooLong,
ERRNO_ACCES => PermissionDenied,
ERRNO_ADDRINUSE => AddrInUse,
ERRNO_ADDRNOTAVAIL => AddrNotAvailable,
ERRNO_AFNOSUPPORT => Unsupported,
ERRNO_AGAIN => WouldBlock,
// ALREADY => "connection already in progress",
// BADF => "bad file descriptor",
// BADMSG => "bad message",
ERRNO_BUSY => ResourceBusy,
// CANCELED => "operation canceled",
// CHILD => "no child processes",
ERRNO_CONNABORTED => ConnectionAborted,
ERRNO_CONNREFUSED => ConnectionRefused,
ERRNO_CONNRESET => ConnectionReset,
ERRNO_DEADLK => Deadlock,
// DESTADDRREQ => "destination address required",
ERRNO_DOM => InvalidInput,
// DQUOT => /* reserved */,
ERRNO_EXIST => AlreadyExists,
// FAULT => "bad address",
ERRNO_FBIG => FileTooLarge,
ERRNO_HOSTUNREACH => HostUnreachable,
// IDRM => "identifier removed",
// ILSEQ => "illegal byte sequence",
// INPROGRESS => "operation in progress",
ERRNO_INTR => Interrupted,
ERRNO_INVAL => InvalidInput,
ERRNO_IO => Uncategorized,
// ISCONN => "socket is connected",
ERRNO_ISDIR => IsADirectory,
ERRNO_LOOP => FilesystemLoop,
// MFILE => "file descriptor value too large",
ERRNO_MLINK => TooManyLinks,
// MSGSIZE => "message too large",
// MULTIHOP => /* reserved */,
ERRNO_NAMETOOLONG => InvalidFilename,
ERRNO_NETDOWN => NetworkDown,
// NETRESET => "connection aborted by network",
ERRNO_NETUNREACH => NetworkUnreachable,
// NFILE => "too many files open in system",
// NOBUFS => "no buffer space available",
ERRNO_NODEV => NotFound,
ERRNO_NOENT => NotFound,
// NOEXEC => "executable file format error",
// NOLCK => "no locks available",
// NOLINK => /* reserved */,
ERRNO_NOMEM => OutOfMemory,
// NOMSG => "no message of the desired type",
// NOPROTOOPT => "protocol not available",
ERRNO_NOSPC => StorageFull,
ERRNO_NOSYS => Unsupported,
ERRNO_NOTCONN => NotConnected,
ERRNO_NOTDIR => NotADirectory,
ERRNO_NOTEMPTY => DirectoryNotEmpty,
// NOTRECOVERABLE => "state not recoverable",
// NOTSOCK => "not a socket",
ERRNO_NOTSUP => Unsupported,
// NOTTY => "inappropriate I/O control operation",
ERRNO_NXIO => NotFound,
// OVERFLOW => "value too large to be stored in data type",
// OWNERDEAD => "previous owner died",
ERRNO_PERM => PermissionDenied,
ERRNO_PIPE => BrokenPipe,
// PROTO => "protocol error",
ERRNO_PROTONOSUPPORT => Unsupported,
// PROTOTYPE => "protocol wrong type for socket",
// RANGE => "result too large",
ERRNO_ROFS => ReadOnlyFilesystem,
ERRNO_SPIPE => NotSeekable,
ERRNO_SRCH => NotFound,
// STALE => /* reserved */,
ERRNO_TIMEDOUT => TimedOut,
ERRNO_TXTBSY => ResourceBusy,
ERRNO_XDEV => CrossesDevices,
ERRNO_NOTCAPABLE => PermissionDenied,
_ => Uncategorized,
}
}

pub fn abort_internal() -> ! {
unsafe { libc::abort() }
}

pub fn hashmap_random_keys() -> (u64, u64) {
let mut ret = (0u64, 0u64);
unsafe {
let base = &mut ret as *mut (u64, u64) as *mut u8;
let len = mem::size_of_val(&ret);
wasi::random_get(base, len).expect("random_get failure");
}
return ret;
}

#[inline]
fn err2io(err: wasi::Errno) -> std_io::Error {
std_io::Error::from_raw_os_error(err.raw().into())
}
78 changes: 0 additions & 78 deletions library/std/src/sys/pal/wasi_preview2/mod.rs

This file was deleted.

7 changes: 2 additions & 5 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
@@ -367,13 +367,10 @@ fn copy_self_contained_objects(
let srcdir = builder
.wasi_root(target)
.unwrap_or_else(|| {
panic!(
"Target {:?} does not have a \"wasi-root\" key in Config.toml",
target.triple
)
panic!("Target {:?} does not have a \"wasi-root\" key", target.triple)
})
.join("lib")
.join(target.to_string().replace("-preview1", "").replace("-preview2", ""));
.join(target.to_string().replace("-preview1", ""));
for &obj in &["libc.a", "crt1-command.o", "crt1-reactor.o"] {
copy_and_stamp(
builder,
2 changes: 1 addition & 1 deletion src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &str, Option<&[&'static str]>)] = &[
(Some(Mode::Std), "no_sync", None),
(Some(Mode::Std), "backtrace_in_libstd", None),
/* Extra values not defined in the built-in targets yet, but used in std */
(Some(Mode::Std), "target_env", Some(&["libnx", "preview2"])),
(Some(Mode::Std), "target_env", Some(&["libnx"])),
// (Some(Mode::Std), "target_os", Some(&[])),
// #[cfg(bootstrap)] zkvm
(Some(Mode::Std), "target_os", Some(&["zkvm"])),
1 change: 0 additions & 1 deletion src/doc/rustc/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -59,7 +59,6 @@
- [*-unknown-openbsd](platform-support/openbsd.md)
- [\*-unknown-uefi](platform-support/unknown-uefi.md)
- [wasm32-wasi-preview1-threads](platform-support/wasm32-wasi-preview1-threads.md)
- [wasm32-wasi-preview2](platform-support/wasm32-wasi-preview2.md)
- [wasm64-unknown-unknown](platform-support/wasm64-unknown-unknown.md)
- [\*-win7-windows-msvc](platform-support/win7-windows-msvc.md)
- [x86_64-fortanix-unknown-sgx](platform-support/x86_64-fortanix-unknown-sgx.md)
1 change: 0 additions & 1 deletion src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
@@ -360,7 +360,6 @@ target | std | host | notes
`thumbv7a-pc-windows-msvc` | ? | |
`thumbv7a-uwp-windows-msvc` | ✓ | |
`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode ARMv7-A Linux with NEON, MUSL
[`wasm32-wasi-preview2`](platform-support/wasm32-wasi-preview2.md) | ✓ | | WebAssembly
[`wasm64-unknown-unknown`](platform-support/wasm64-unknown-unknown.md) | ? | | WebAssembly
`x86_64-apple-ios-macabi` | ✓ | | Apple Catalyst on x86_64
[`x86_64-apple-tvos`](platform-support/apple-tvos.md) | ? | | x86 64-bit tvOS
30 changes: 0 additions & 30 deletions src/doc/rustc/src/platform-support/wasm32-wasi-preview2.md

This file was deleted.

3 changes: 0 additions & 3 deletions tests/assembly/targets/targets-elf.rs
Original file line number Diff line number Diff line change
@@ -489,9 +489,6 @@
// revisions: wasm64_unknown_unknown
// [wasm64_unknown_unknown] compile-flags: --target wasm64-unknown-unknown
// [wasm64_unknown_unknown] needs-llvm-components: webassembly
// revisions: wasm32_wasi_preview2
// [wasm32_wasi_preview2] compile-flags: --target wasm32-wasi-preview2
// [wasm32_wasi_preview2] needs-llvm-components: webassembly
// revisions: x86_64_fortanix_unknown_sgx
// [x86_64_fortanix_unknown_sgx] compile-flags: --target x86_64-fortanix-unknown-sgx
// [x86_64_fortanix_unknown_sgx] needs-llvm-components: x86
4 changes: 2 additions & 2 deletions tests/ui/check-cfg/well-known-values.stderr
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
LL | target_env = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `target_env` are: ``, `eabihf`, `gnu`, `gnueabihf`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `preview2`, `psx`, `relibc`, `sgx`, `uclibc`
= note: expected values for `target_env` are: ``, `eabihf`, `gnu`, `gnueabihf`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `psx`, `relibc`, `sgx`, `uclibc`
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
@@ -134,7 +134,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
LL | target_family = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `target_family` are: `unix`, `wasi`, `wasm`, `windows`
= note: expected values for `target_family` are: `unix`, `wasm`, `windows`
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`