Commit graph

168103 commits

Author SHA1 Message Date
Vadim Petrochenkov f2b7fa4847 ast: Introduce some traits to get AST node properties generically
And use them to avoid constructing some artificial `Nonterminal` tokens during expansion
2022-05-11 12:43:27 +03:00
Guillaume Gomez dd6bb09133 Ensure that the settings CSS is loaded on the settings page 2022-05-11 11:29:21 +02:00
Guillaume Gomez 92482cabaa Remove unused CSS settings rules 2022-05-11 11:27:13 +02:00
Guillaume Gomez 84615e868b Add missing CSS file for settings page 2022-05-11 11:27:00 +02:00
Laurențiu Nicola 145bb1f64b ⬆️ rust-analyzer 2022-05-11 12:26:06 +03:00
bors f296b9a32a Auto merge of #96933 - ehuss:update-books, r=ehuss
Update books

## nomicon

9 commits in c7d8467ca9158da58ef295ae65dbf00a308752d9..10d40c59a581c66d8ecd29ad18d410bf97ed524d
2022-04-06 14:26:54 +0900 to 2022-05-07 10:45:07 +0900
- Introducing init/uninit before its use (rust-lang/nomicon#355)
- Change will to would to discuss what don't occur (rust-lang/nomicon#361)
- State that pop for length 1 is an example (rust-lang/nomicon#360)
- Correct a sentence that didn't seem to be proper (rust-lang/nomicon#358)
- Indicate that C reference are C reference (rust-lang/nomicon#357)
- Introduce and avoid dropck (rust-lang/nomicon#353)
- Rephrase improperly reduced borrows introduction (rust-lang/nomicon#352)
- Two lifetime clarification (rust-lang/nomicon#350)
- "UB" vs "Undefined Behavior" (rust-lang/nomicon#349)

## reference

9 commits in b5f6c2362baf932db9440fbfcb509b309237ee85..8e36971959ff238b5aa2575fbc7a2e09e1313e82
2022-04-10 19:19:51 -0700 to 2022-05-09 17:20:59 -0700
- Stop saying that const functions cannot use 'extern' (rust-lang/reference#1207)
- Moved the option variant imports (rust-lang/reference#1208)
- #[must_use] on traits also affects trait objects (rust-lang/reference#1203)
- Don't use PathPattern in RangePattern bounds (rust-lang/reference#1204)
- Inline assembly: Add kreg0 register class (rust-lang/reference#1205)
- Fix crate_type attribute examples (rust-lang/reference#1201)
- Say that that the default function return type is the unit type (rust-lang/reference#1199)
- Clarify guarantees provided by repr(packed) (rust-lang/reference#1163)
- Document the Termination trait for main() and test functions (rust-lang/reference#1194)

## book

43 commits in de0dbffc5812fd885700874e8d258dd334733ac4..d9415b7cbfcb4b24062683f429bd0ff535396362
2022-04-18 19:29:45 -0400 to 2022-05-09 09:10:44 -0400
- Update ch09-02-recoverable-errors-with-result.md
- Added missing be 2
- Added missing be
- Move hardcoded string into status_line to be consistent
- Fix trailing space
- Propagate tech review edits back to src
- Change "semantics" to "mechanics"; when referring to compiler behavior, rather than syntax.
- Propagate some edits to ch4 snapshot
- Suggestions from tech review
- Propagate edits to src
- Propagate edits back to nostarch version
- Clarify sentences about lock types. Fixes rust-lang/book#2937.
- Edits to edits to chapter 16
- Edits from nostarch for chapter 16
- Propagate nostarch edits back to src
- Add words to dictionary
- Propagating edits back to the nostarch snapshot
- Small wording change. Fixes rust-lang/book#3112.
- Clarify the kind of manual cleanup meant here
- Edits to edits to chapter 15
- Edits from nostarch
- Add missing word
- Improve sentence structure
- fix unidiomatic new functions in chapter 15
- Propagate nostarch ch14 to src
- Update a link and the -p publishing instructions
- Actually, I don't think we need to show the command output here
- Edits to edits to chapter 14
- Update manual regeneration instructions
- Reflect the addition of the -p flag in Cargo 1.56 in chapter 14
- Change polarity and names of variables in env var section
- Propagate nostarch edits back to ch 12
- Change environment variable and field name to perhaps be less confusing
- Responses to nostarch edits
- Merge remote-tracking branch 'origin/ch13'
- Fix rust-lang/book#3002 use noplayground with common.rs
- Propagate ch3 edits to src
- Updating chapter 3 to use new println style
- Specify loop label format. Fixes rust-lang/book#3105.
- Clarify function definition must be in an accessible scope. Fixes rust-lang/book#3003
- Addressing tech review comments, propagating other changes
- Comments from tech review
- Chapter 3, section 2 - Add explicit type annotation to example of scalar type char.

## rust-by-example

6 commits in 44a80e8d8bfc5881c9bd69a2cb3a570776ee4181..e9f93cfcf410bc092c9107b8a41a82f144c761f2
2022-04-19 07:46:28 -0300 to 2022-05-08 18:24:06 -0300
- Add empty slice example (rust-lang/rust-by-example#1538)
- Enhancement/print (rust-lang/rust-by-example#1536)
- Update cast.md (rust-lang/rust-by-example#1521)
- Update iter_any.md (rust-lang/rust-by-example#1522)
- Update tuples.md (rust-lang/rust-by-example#1524)
- fix indent in fs.md (rust-lang/rust-by-example#1535)

## rustc-dev-guide

8 commits in 043e60f4f191651e9f8bf52fa32df14defbb23d9..0c02acdb6f48f03907a02ea8e537c3272b4fde9f
2022-04-20 18:57:49 +0900 to 2022-05-10 09:45:31 -0300
- Update overview.md (rust-lang/rustc-dev-guide#1351)
- Update date references on parallel-rustc (rust-lang/rustc-dev-guide#1348)
- mention `WithOptConstParam` (rust-lang/rustc-dev-guide#1346)
- Fix format (rust-lang/rustc-dev-guide#1349)
- correct type of SubstsRef (rust-lang/rustc-dev-guide#1347)
- Document ErrorGuaranteed (rust-lang/rustc-dev-guide#1316)
- Edit "What the compiler does to your code" (rust-lang/rustc-dev-guide#1306)
- Update some date refs
2022-05-11 08:48:11 +00:00
Ralf Jung 831bd96967 rustc_log: add env var to set verbose entry/exit behavior 2022-05-11 09:14:31 +02:00
bors ee6eaabdd4 Auto merge of #96931 - JohnTitor:rollup-3um8o4j, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #96543 (Remove hacks in `make_token_stream`.)
 - #96887 (rustdoc: correct path to type alias methods)
 - #96896 (Add regression test for #68408)
 - #96900 (Fix js error)
 - #96903 (Use lifetimes on type-alias-impl-trait used in function signatures to infer output type lifetimes)
 - #96916 (simplify length count)
 - #96925 (Fix issue #95151)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-11 06:29:04 +00:00
Camille GILLOT 6cfe52c094 Gracefully fail to resolve associated items instead of delay_span_bug. 2022-05-11 08:28:02 +02:00
Eric Huss 7aa2b36bdc Update books 2022-05-10 22:27:45 -07:00
Dan Gohman 0a39e5ad36 Fix incorrect mentions of OwnedFd and BorrowedFd in Windows docs. 2022-05-10 21:56:51 -07:00
Sébastien Marie 42f8e1f879 to_timespec could be unused by some targets 2022-05-11 04:51:09 +00:00
Sébastien Marie 3cadc11d83 avoid using both Some() and ? on linux/android/freebsd code 2022-05-11 04:50:48 +00:00
Sébastien Marie f75d02d669 openbsd: convert futex timeout managment to Timespec usage 2022-05-11 04:50:23 +00:00
Dan Gohman 2bb7fdb8e1 Also document that as_raw_handle may return NULL. 2022-05-10 21:42:30 -07:00
Dan Gohman 4ce68c13bf Clarify what values BorrowedHandle, OwnedHandle etc. can hold.
Clarify that when `BorrowedHandle`, `OwnedHandle`, or `HandleOrNull`
hold the value `-1`, it always means the current process handle, and not
`INVALID_HANDLE_VALUE`.
2022-05-10 21:25:48 -07:00
Yuki Okushi 514b585757
Rollup merge of #96925 - c410-f3r:z-errors, r=JohnTitor
Fix issue #95151

Fixes  #95151

Nothing special here, just a test for a thing that used to ICE.
2022-05-11 13:16:35 +09:00
Yuki Okushi 304c116b40
Rollup merge of #96916 - matthiaskrgr:simpl_count, r=compiler-errors
simplify length count
2022-05-11 13:16:34 +09:00
Yuki Okushi 17a735b69a
Rollup merge of #96903 - oli-obk:opaque_type_lifetime_constraints, r=compiler-errors
Use lifetimes on type-alias-impl-trait used in function signatures to infer output type lifetimes

fixes https://github.com/rust-lang/rust/issues/96564

TLDR:

```rust
fn execute(ty: Ty<'_>) -> &str { todo!() }
```

(`Ty` being a type alias impl trait) used to produce the following error before this PR

```
error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types
 --> src/lib.rs:4:27
  |
4 | fn execute(ty: Ty<'_>) -> &str { todo!() }
  |                           ^^^^
  |
  = note: lifetimes appearing in an associated type are not considered constrained
```
2022-05-11 13:16:34 +09:00
Yuki Okushi 95b2d37a39
Rollup merge of #96900 - GuillaumeGomez:fix-js-error, r=notriddle
Fix js error

On the source code pages, we get a JS error:

![Screenshot from 2022-05-10 16-26-53](https://user-images.githubusercontent.com/3050060/167656292-51e0b0e9-6b0c-4f94-82e0-dd8fb77adf52.png)

It's fixed in the first commit. The second one is removing an unused CSS rule and the third one is a little cleanup of a GUI test.

cc ``@jsha``
r? ``@notriddle``
2022-05-11 13:16:33 +09:00
Yuki Okushi 7bf795bc65
Rollup merge of #96896 - JohnTitor:issue-68408, r=compiler-errors
Add regression test for #68408

Closes https://github.com/rust-lang/rust/issues/68408
2022-05-11 13:16:32 +09:00
Yuki Okushi ed9faeedda
Rollup merge of #96887 - notriddle:notriddle/as-raw-fd, r=jsha
rustdoc: correct path to type alias methods

Fixes #83991
2022-05-11 13:16:31 +09:00
Yuki Okushi 81c0a2d96c
Rollup merge of #96543 - nnethercote:rm-make_token_stream-hacks, r=Aaron1011
Remove hacks in `make_token_stream`.

`make_tokenstream` has three commented hacks, and a comment at the top
referring to #67062. These hacks have no observable effect, at least as judged
by running the test suite. The hacks were added in #82608, with an explanation
[here](https://github.com/rust-lang/rust/pull/82608#issuecomment-812877329). It
appears that one of the following is true: (a) they never did anything useful,
(b) they do something useful but we have no test coverage for them, or (c)
something has changed in the meantime that means they are no longer necessary.

This commit removes the hacks and the comments, in the hope that (b) is not
true.

r? `@Aaron1011`
2022-05-11 13:16:30 +09:00
bors b862b438db Auto merge of #96888 - Aaron1011:fake-borrow-no-sort, r=petrochenkov
Use `FxIndexSet` to avoid sorting fake borrows

This fixes #96449, but I haven't yet been able to
make the reproducer work using `#[cfg]` attributes,
so we can't use the 'revision' infra to write a test

The previous implementation relied on sorting by `PlaceRef`.
This requires sorting by a `DefId`, which uses untracked state
(see #93315)
2022-05-11 04:09:45 +00:00
Ayrton 3d5b1eeb75 Fix e_flags for 32-bit MIPS targets in generated object file
In #95604 the compiler started generating a temporary symbols.o which is added
to the linker invocation. This object file has an `e_flags` which may be invalid
for 32-bit MIPS targets. Even though symbols.o doesn't contain code, linking
    with [lld fails](https://github.com/llvm/llvm-project/blob/main/lld/ELF/Arch/MipsArchTree.cpp#L79) with
```
rust-lld: error: foo-cgu.0.rcgu.o: ABI 'o32' is incompatible with target ABI 'n64'
```
because it omits the ABI bits (EF_MIPS_ABI_O32) so lld assumes it's using the
N64 ABI. This breaks linking on nightly for the out-of-tree [psx
target](https://github.com/ayrtonm/psx-sdk-rs/issues/9), the builtin
mipsel-sony-psp target (cc @overdrivenpotato) and any other 32-bit MIPS
target using lld.

This PR sets the ABI in `e_flags` to O32 since that's the only ABI for 32-bit
MIPS that LLVM supports. It also sets other `e_flags` bits based on the target.
I had to bump the object crate version since some of these constants were [added
recently](https://github.com/gimli-rs/object/pull/433). I'm not sure if this
PR needs a test, but I can confirm that it fixes the linking issue on both
targets I mentioned.
2022-05-10 22:48:19 -04:00
bors 532be942dd Auto merge of #96375 - jyn514:bootstrap-submodules, r=Mark-Simulacrum
Fix running bootstrap tests on a fresh clone

In #96303, I changed the tests not to manage submodules, with the main
goal of avoiding a clone for llvm-project. Unfortunately, there are some tests
which depend on submodules - I didn't notice locally because they were already checked out for me,
and CI doesn't use submodule handling at all. Fresh clones, however, were impacted:
```
failures:

---- builder::tests::defaults::doc_default stdout ----
thread 'main' panicked at 'fs::read_dir(builder.src.join(&relative_path).join("redirects")) failed with No such file or directory (os error 2)', src/bootstrap/doc.rs:232:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- builder::tests::dist::dist_only_cross_host stdout ----
thread 'main' panicked at 'fs::read_to_string(&toml_file_name) failed with No such file or directory (os error 2)', src/bootstrap/lib.rs:1314:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

Try and get the best of both worlds by only checking out the submodules actually used in tests.
2022-05-11 00:41:50 +00:00
Nicholas Nethercote 3cd8e9866d Remove some unnecessary invisible delimiter checks.
These seem to have no useful effect... they don't seem useful from a
code inspection point of view, and they affect anything in the test
suite.
2022-05-11 10:14:49 +10:00
Michael Howell 9dc5ac8c4b
Ignore order
This isn't an ordering test really, anyway...
2022-05-10 16:42:48 -07:00
Joshua Nelson 212fc2134d Fix running bootstrap tests on a fresh clone
In #96303, I changed the tests not to manage submodules, with the main
goal of avoiding a clone for llvm-project. Unfortunately, there are some tests
which depend on submodules - I didn't notice locally because they were already checked out for me,
and CI doesn't use submodule handling at all. Fresh clones, however, were impacted:
```
failures:

---- builder::tests::defaults::doc_default stdout ----
thread 'main' panicked at 'fs::read_dir(builder.src.join(&relative_path).join("redirects")) failed with No such file or directory (os error 2)', src/bootstrap/doc.rs:232:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- builder::tests::dist::dist_only_cross_host stdout ----
thread 'main' panicked at 'fs::read_to_string(&toml_file_name) failed with No such file or directory (os error 2)', src/bootstrap/lib.rs:1314:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

Try and get the best of both worlds by only checking out the submodules actually used in tests.
2022-05-10 18:13:54 -05:00
Caio aea3b22b06 Fix issue #95151 2022-05-10 18:29:35 -03:00
bors ecd44958e0 Auto merge of #96232 - sunfishcode:sunfishcode/io-safety-const-fns, r=joshtriplett
Make `BorrowedFd::borrow_raw` a const fn.

Making `BorrowedFd::borrow_raw` a const fn allows it to be used to
create a constant `BorrowedFd<'static>` holding constants such as
`AT_FDCWD`. This will allow [`rustix::fs::cwd`] to become a const fn.

For consistency, make similar changes to `BorrowedHandle::borrow_raw`
and `BorrowedSocket::borrow_raw`.

[`rustix::fs::cwd`]: https://docs.rs/rustix/latest/rustix/fs/fn.cwd.html

r? `@joshtriplett`
2022-05-10 21:19:19 +00:00
Matthias Krüger e2dc3967fa simplify length count 2022-05-10 20:42:45 +02:00
bors fee75fbe11 Auto merge of #96905 - jyn514:revert-96803-faster-assemble, r=Mark-Simulacrum
Revert "Make "Assemble stage1 compiler" orders of magnitude faster"

Reverts rust-lang/rust#96803. This caused `llvm-tools-nightly` to fail when installing with `rustup-toolchain-install-master` because of the presence of symlinks. I'm not sure how the symlinks got in there, but revert the PR for now while I figure it out.

r? `@Mark-Simulacrum` cc `@RalfJung`
2022-05-10 18:26:31 +00:00
est31 493af0b54f Also allow unused macro rules in stdarch 2022-05-10 19:53:22 +02:00
Michael Howell 6257bd2f4e rustdoc: clean up method path index
This removes a special case that doesn't seem to do anything
any more.
2022-05-10 08:59:59 -07:00
Joshua Nelson 89e0c29489
Revert "Make "Assemble stage1 compiler" orders of magnitude faster" 2022-05-10 10:58:52 -05:00
bors d4c364347c Auto merge of #96904 - JohnTitor:rollup-f1sz5x0, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #96717 (Handle mismatched generic param kinds in trait impls betterly)
 - #96725 (Expose process windows_process_extensions_main_thread_handle on Windows)
 - #96849 (Move some tests to more reasonable places)
 - #96861 (Use Rust 2021 prelude in std itself.)
 - #96879 (rustdoc: search result ranking fix)
 - #96882 (Don't subst an AdtDef with its own substs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-10 15:58:17 +00:00
Yuki Okushi c5f2c4476e
Rollup merge of #96882 - jackh726:no-subst, r=oli-obk
Don't subst an AdtDef with its own substs
2022-05-11 00:09:36 +09:00
Yuki Okushi d34915f691
Rollup merge of #96879 - notriddle:notriddle/search-ranking, r=GuillaumeGomez
rustdoc: search result ranking fix

# Before

![image](https://user-images.githubusercontent.com/1593513/167477286-91049761-67f9-4a73-8fb7-09dbb19ca76c.png)

# After

![image](https://user-images.githubusercontent.com/1593513/167477345-6733bc0f-4bb2-4625-9f7f-094031e36414.png)
2022-05-11 00:09:35 +09:00
Yuki Okushi 7274447c36
Rollup merge of #96861 - m-ou-se:std-use-prelude-2021, r=joshtriplett
Use Rust 2021 prelude in std itself.
2022-05-11 00:09:34 +09:00
Yuki Okushi ac97727528
Rollup merge of #96849 - c410-f3r:z-errors, r=petrochenkov
Move some tests to more reasonable places

cc https://github.com/rust-lang/rust/issues/73494
r? `@petrochenkov`
2022-05-11 00:09:33 +09:00
Yuki Okushi f689f6582c
Rollup merge of #96725 - nico-abram:win_tid, r=ChrisDenton
Expose process windows_process_extensions_main_thread_handle on Windows

~~I did not find any tests in 7d3e03666a/library/std/src/sys/windows/process/tests.rs that actually launch processes, so I haven't added tests for this.~~ I ran the following locally, to check that it works as expected:
```rs
#![feature(windows_process_extensions_main_thread_handle)]

fn main() {
    use std::os::windows::process::{ChildExt, CommandExt};
    const CREATE_SUSPENDED: u32 = 0x00000004;

    let proc = std::process::Command::new("cmd")
        .args(["/C", "echo hello"])
        .creation_flags(CREATE_SUSPENDED)
        .spawn()
        .unwrap();

    extern "system" {
        fn ResumeThread(_: *mut std::ffi::c_void) -> u32;
    }
    unsafe {
        ResumeThread(proc.main_thread_handle());
    }

    let output = proc.wait_with_output().unwrap();
    let str_output = std::str::from_utf8(&output.stdout[..]).unwrap();
    println!("{}", str_output);
}

```

Without the feature attribute it wouldn't compile, and commenting the `ResumeThread` line makes it hang forever, showing that it works.

Trakcing issue https://github.com/rust-lang/rust/issues/96723
2022-05-11 00:09:32 +09:00
Yuki Okushi 77030b7825
Rollup merge of #96717 - BoxyUwU:gats_const_param_types_mismatch_err, r=lcnr
Handle mismatched generic param kinds in trait impls betterly

- Check that generic params on a generic associated type are the same as in the trait definition
- Check that const generics are not used in place of type generics (and the other way round too)

r? `@lcnr`
2022-05-11 00:09:31 +09:00
Oli Scherer d63f82e1ef Use lifetimes on type-alias-impl-trait used in function signatures to infer output type lifetimes 2022-05-10 14:50:31 +00:00
Guillaume Gomez fe4fa53fa8 Clean up rustdoc GUI test 2022-05-10 16:42:34 +02:00
Guillaume Gomez f9fc7ef097 Remove unused CSS rule 2022-05-10 16:40:32 +02:00
Guillaume Gomez f82b3a16d5 Fix JS error in source code pages 2022-05-10 16:40:14 +02:00
Collin Baker b2316c1a88 Add test skip support
libtest already supports a "--skip SUBSTRING" arg which excludes any
test names matching SUBSTRING.

This adds a "--skip" argument to compiletest and bootstrap which is
forwarded to libtest.
2022-05-10 10:29:48 -04:00
bors eead58e75b Auto merge of #96736 - oli-obk:tait_missing_wf_check, r=davidtwco
Check hidden types for well formedness at the definition site instead of only at the opaque type itself

work towards #90409 . We'll need to look into closure and generator bodies of closures and generators nested inside the hidden type in order to fix that. In hindsight this PR is not necessary for that, but it may be a bit easier with it and we'll get better diagnostics from it on its own.
2022-05-10 13:39:43 +00:00
Ralf Jung 761077e19e fmt 2022-05-10 14:38:00 +02:00