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

Add the wasm32-wasi-preview2 target #2

Merged
merged 5,599 commits into from
Sep 20, 2024
Merged

Add the wasm32-wasi-preview2 target #2

merged 5,599 commits into from
Sep 20, 2024

Conversation

rylev
Copy link
Owner

@rylev rylev commented Dec 19, 2023

No description provided.

library/std/src/os/mod.rs Show resolved Hide resolved
library/std/src/sys/mod.rs Outdated Show resolved Hide resolved
@@ -346,7 +346,7 @@ fn copy_self_contained_objects(
panic!("Target {:?} does not have a \"wasi-root\" key", target.triple)
})
.join("lib")
.join(target.to_string().replace("-preview1", ""));
.join(target.to_string().replace("-preview1", "").replace("-preview2", ""));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This'll want to in theroy be coordinated with @dicej's work on getting preview2 upstream with libc since the precise location of things may change

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we actually don't want to remove the -preview2 suffix here, since the directory name will be wasm32-wasi-preview2.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. This is a bit of a chicken/egg problem. The hack here gets things working with the current wasi-sdk. We'll have to figure out when the changes land in the wasi-sdk and this can be ported over.

src/doc/rustc/src/platform-support/wasm32-wasi-preview2.md Outdated Show resolved Hide resolved
library/std/src/sys/wasi_preview2/mod.rs Outdated Show resolved Hide resolved
library/std/src/os/mod.rs Outdated Show resolved Hide resolved
@rylev
Copy link
Owner Author

rylev commented Jan 4, 2024

@alexcrichton I think the review concerns have been addressed. I had to keep around the std::os::wasi module around in the wasm32-wasi-preview2 target as big chunks of the sys::wasi_preview2 module depend on it. We could break that up now, but perhaps this is best left for a future PR after this has all landed?

@alexcrichton
Copy link

Ok that makes sense yeah. How hard would it be to mark the module as unstable on preview2? I suspect not easy since there's stability annotations everywhere inside there, but if we can it'd be great to get away with perhaps marking the module unstable conditionally if that's sufficient to gate usage.

@rylev
Copy link
Owner Author

rylev commented Jan 4, 2024

Seems it was pretty straight forward using cfg_attr.

@alexcrichton do you think this might be ready to open against rust-lang/rust?

@alexcrichton
Copy link

Seems reasonable to me to open!

@rylev rylev force-pushed the wasm32-wasi-preview2 branch 4 times, most recently from 44696a8 to dcf7c7b Compare January 5, 2024 14:02
@rylev rylev force-pushed the wasm32-wasi-preview2 branch 6 times, most recently from c593fe6 to dbf55f6 Compare January 24, 2024 15:35
@rylev rylev force-pushed the wasm32-wasi-preview2 branch 2 times, most recently from 6cf131e to 8c13f81 Compare January 31, 2024 16:17
jieyouxu and others added 10 commits February 22, 2024 16:04
we don't track them when canonicalizing or when freshening,
resulting in instable caching in the old solver, and issues when
instantiating query responses in the new one.
Without doing so we use the same candidate cache entry
for `?0: Trait<?1>` and `?0: Trait<?0>`. These goals are different
and we must not use the same entry for them.
…ves, r=oli-obk

Migrate compiletest to use `ui_test`-style `//@` directives

## Preface

There's an on-going effort to rewrite parts of or the entirety of compiletest
(<rust-lang/compiler-team#536>). A step towards this involve migrating
compiletest tests to use the [`ui_test`](https://github.com/oli-obk/ui_test) framework, which
involves changing compiletest directives in `// <directive-name>` style to `ui_test`
`//@ <directive-name>` style (rust-lang/compiler-team#512).

This PR aims to implement the directive-style change from `//` to `//`@`` for the remaining
non-"ui" test suite tests.

## Key Changes

1. All `tests/` tests now use `//`@`` directives.
2. Compiletest only accepts `//`@`` and issues an error if an old-style directive is detected.
3. `// ignore-tidy` and `// ignore-tidy-*` are considered tidy directives and are ignored by
   compiletest header parsing.

## Diff Generation

The diff is generated by:

- Collecting directives from `tests/` via hijacking compiletest to emit successfully parsed
  directive lines.
- Using a migration tool
  (<https://github.com/jieyouxu/compiletest-ui_test-header-migration/tree/master>) to replace
  `//` directives in compiletest tests with `//`@`.`

### Reproduction Steps

0. Delete the temporary file `$RUSTC_REPO_PATH/build/<target_triple>/test/__directive_lines.txt`,
   if the collection script was previously ran.
1. Use the <https://github.com/jieyouxu/rust/tree/collect-test-directives> collect-test-directives
   script, which outputs a temporary file recording headers occuring in each compiletest test.
   - You need to checkout this branch: `git checkout collect-test-directives`.
   - This needs to be rebased on latest master to ensure up-to-date test directives can be collected.
   - You need to run `./x test` on each of the `test/*` subfolders once:

        ```bash
        ./x test tests/assembly/ --stage 1 --force-rerun
        ./x test tests/codegen/ --stage 1 --force-rerun
        ./x test tests/codegen-units/ --stage 1 --force-rerun
        ./x test tests/coverage/ --stage 1 --force-rerun
        ./x test tests/coverage-run-rustdoc/ --stage 1 --force-rerun
        ./x test tests/debuginfo/ --stage 1 --force-rerun
        ./x test tests/incremental/ --stage 1 --force-rerun
        ./x test tests/mir-opt/ --stage 1 --force-rerun
        ./x test tests/pretty/ --stage 1 --force-rerun
        ./x test tests/run-make/ --stage 1 --force-rerun
        ./x test tests/run-make-fulldeps/ --stage 1 --force-rerun
        ./x test tests/run-pass-valgrind/ --stage 1 --force-rerun
        ./x test tests/rustdoc/ --stage 1 --force-rerun
        TARGET=<target-triple> ./x test tests/rustdoc-gui/ --stage 1 --force-rerun
        ./x test tests/rustdoc-js/ --stage 1 --force-rerun
        ./x test tests/rustdoc-js-std/ --stage 1 --force-rerun
        ./x test tests/rustdoc-json/ --stage 1 --force-rerun
        ./x test tests/rustdoc-ui/ --stage 1 --force-rerun
        ./x test tests/ui/ --stage 1 --force-rerun
        ./x test tests/ui-fulldeps/ --stage 1 --force-rerun
        ```

2. Checkout the `migrate-compiletest-directives` branch.
3. Run the migration tool <https://github.com/jieyouxu/compiletest-ui_test-header-migration>.
4. Check that the migration at least does not cause test failures if you change compiletest to
   accept `//`@`` directives only. This is also required if the test outputs somehow need to be
   blessed.
   - `RUSTC_TEST_FAIL_FAST=1 ./x test tests/<secondary-directory>  --stage 1 --bless`
5. Confirm that there is no difference after running the migration tool when you are on the
   `migrate-compiletest-directives` branch.

## Follow Up Work

- [ ] Adjust rustc-dev-guide docs for compiletest directives (this time for all the other suites and modes). <rust-lang/rustc-dev-guide#1895>.
…lcnr

No need to `validate_alias_bound_self_from_param_env` in `assemble_alias_bound_candidates`

We already fully normalize the self type before we reach `assemble_alias_bound_candidates`, so there's no reason to double check that a projection is truly rigid by checking param-env bounds.

I think this is also blocked on us making sure to always normalize opaques: rust-lang#120549.

r? lcnr
jieyouxu and others added 22 commits February 26, 2024 19:32
Fix race between block initialization and receiver disconnection

Port of crossbeam-rs/crossbeam#1084. Closes rust-lang#121582.
… r=oli-obk

remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsics

`@Amanieu` `@workingjubilee` I don't think there is any reason these need to be "special"? The [original RFC](https://rust-lang.github.io/rfcs/1199-simd-infrastructure.html) indicated eventually making them stable, but I think that is no longer the plan, so seems to me like we can clean this up a bit.

Blocked on rust-lang/stdarch#1538, rust-lang#121542.
rename 'try' intrinsic to 'catch_unwind'

The intrinsic has nothing to do with `try` blocks, and corresponds to the stable `catch_unwind` function, so this makes a lot more sense IMO.

Also rename Miri's special function while we are at it, to reflect the level of abstraction it works on: it's an unwinding mechanism, on which Rust implements panics.
Update books

## rust-lang/book

1 commits in 71352deb20727b4dda9ebfe8182709d5bf17dfea..19c40bfd2d57641d962f3119a1c343355f1b3c5e
2024-02-19 20:39:35 UTC to 2024-02-19 20:39:35 UTC

- Rust upgrades (rust-lang/book#3844)

## rust-lang/edition-guide

3 commits in 76bd48a273a0e0413a3bf22c699112d41497b99e..e1eead1181a691e56299294d5f1d62fe7a26d317
2024-02-24 21:15:28 UTC to 2024-02-17 21:44:36 UTC

- Rename static_mut_refs (rust-lang/edition-guide#293)
- Add 2024 prelude (rust-lang/edition-guide#292)
- Add some more initial stub docs for 2024. (rust-lang/edition-guide#291)

## rust-lang/reference

5 commits in 8227666de13f6e7bb32dea9dc42e841adb5ce4b7..3417f866932cb1c09c6be0f31d2a02ee01b4b95d
2024-02-25 19:37:14 UTC to 2024-02-15 13:28:59 UTC

- Document `target_abi` (rust-lang/reference#1446)
- Add `rust-toolchain.toml` and revise README (rust-lang/reference#1474)
- Clarify semantics of the various pointer to pointer casts (rust-lang/reference#1451)
- Update aarch64 target feature docs to match LLVM (rust-lang/reference#1470)
- Fix grammar for TypePathFn (rust-lang/reference#1281)

## rust-lang/rust-by-example

4 commits in e188d5d466f7f3ff9f1d518393235f4fe951be46..57f1e708f5d5850562bc385aaf610e6af14d6ec8
2024-02-24 18:31:19 UTC to 2024-02-14 13:06:53 UTC

- bug: fix typo (rust-lang/rust-by-example#1822)
- Fix typo in attribute.md (rust-lang/rust-by-example#1818)
- Add Japanese translation (rust-lang/rust-by-example#1794)
- Remove unused .travis.yml file (rust-lang/rust-by-example#1816)

## rust-lang/rustc-dev-guide

9 commits in 1f30cc7cca9a3433bc1872abdc98960b36c21ca0..7b0ef5b0bea5e3ce3b9764aa5754a60e2cc05c52
2024-02-22 19:15:52 UTC to 2024-02-13 12:13:06 UTC

- Update compiletest directives to be in `ui_test` style `//`@`` (rust-lang/rustc-dev-guide#1895)
- Add notes on tweak rust-analyzer.check.overrideCommand (rust-lang/rustc-dev-guide#1890)
- Fix more links (rust-lang/rustc-dev-guide#1884)
- Remove references to -Z ast-json and -Z ast-json-noexpand (rust-lang/rustc-dev-guide#1893)
- Specify ui test suite directives and add note on ignore-tidy directives (rust-lang/rustc-dev-guide#1892)
- Update docs about ui tests now using `//`@`` headers (rust-lang/rustc-dev-guide#1885)
- Make git rebase commands more bulletproof (rust-lang/rustc-dev-guide#1889)
- updating-llvm.md: command does not work (rust-lang/rustc-dev-guide#1887)
- fix update llvm build command (rust-lang/rustc-dev-guide#1886)
… r=Nilstrieb

Update Vec and String `{from,into}_raw_parts`-family docs

- Fix documentation argument order to match the code argument order for consistency.
- Add return argument description for `{Vec,String}::into_raw_parts` to match their `from*` counterparts.
Properly emit `expected ;` on `#[attr] expr`

Fixes rust-lang#121647

See rust-lang#118182, rust-lang#120586

---
r? estebank
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#121598 (rename 'try' intrinsic to 'catch_unwind')
 - rust-lang#121639 (Update books)
 - rust-lang#121648 (Update Vec and String `{from,into}_raw_parts`-family docs)
 - rust-lang#121651 (Properly emit `expected ;` on `#[attr] expr`)

r? `@ghost`
`@rustbot` modify labels: rollup
…etime_a, r=nnethercote

Remove useless lifetime of ArchiveBuilder

`trait ArchiveBuilder<'a>` has a seemingly useless lifetime a, so I remove it. If this is intentional, please reject this PR.

```rust
pub trait ArchiveBuilder<'a> {
    fn add_file(&mut self, path: &Path);

    fn add_archive(
        &mut self,
        archive: &Path,
        skip: Box<dyn FnMut(&str) -> bool + 'static>,
    ) -> io::Result<()>;

    fn build(self: Box<Self>, output: &Path) -> bool;
}
```
The existing code calls a function that returns `Result<_,
ErrorGuaranteed>`, and then calls `span_delayed_bug` pointlessly in the
`Err` case.
I find the function much easier to read this way. Thanks to @kadiwa4 for
the suggestion.
…_ribs`.

`Resolver::report_error` always emits (this commit makes that clearer),
so the `span_delayed_bug` is unnecessary.
By returning error guarantees from a few functions it relies on.
By storing error guarantees in `RegionErrors`.
To make them more concise and similar to each other.
…tants, r=Nilstrieb

syms for legacy numeric constants diag items

Missed these in rust-lang#121272 and rust-lang#121361, woops.

For rust-lang/rust-clippy#12312

r? `@Nilstrieb`
i586_unknown_netbsd: use inline stack probes

This is one of the last two targets still using "call" stack probes.

I don't believe that this target uses call stack probes for any particular reason--inline stack probes are used on [`i686_unknown_netbsd`](https://github.com/rust-lang/rust/blob/b362939be16f9324dd9e6e36e22b606020068d75/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs#L8), suggesting they work on netbsd; and on [`i586_unknown_linux_gnu`](https://github.com/rust-lang/rust/blob/b362939be16f9324dd9e6e36e22b606020068d75/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs#L4) (via the base [`i686_unknown_linux_gnu`](https://github.com/rust-lang/rust/blob/b362939be16f9324dd9e6e36e22b606020068d75/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs#L9)), suggesting they work with `cpu = "pentium"`.

...although I don't have a netbsd system to test this on.

(cc `@he32)`
Delayed bug audit

I went through all the calls to `delayed_bug` and `span_delayed_bug` and found a few places where they could be avoided.

r? `@compiler-errors`
@rylev rylev force-pushed the wasm32-wasi-preview2 branch 5 times, most recently from dee295f to 5144e61 Compare February 27, 2024 15:13
@rylev rylev merged commit ef32456 into master Sep 20, 2024
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.