]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #86445 - sexxi-goose:box_fix, r=nikomatsakis
bors [Sun, 27 Jun 2021 18:10:35 +0000 (18:10 +0000)]
Auto merge of #86445 - sexxi-goose:box_fix, r=nikomatsakis

2229: Capture box completely in move closures

Even if the content from box is used in a sharef-ref context,
we capture the box entirerly.

This is motivated by:
1) We only capture data that is on the stack.
2) Capturing data from within the box might end up moving more data than
the user anticipated.

Closes https://github.com/rust-lang/project-rfc-2229/issues/50

r? `@nikomatsakis`

3 years agoAuto merge of #86655 - jonas-schievink:const-arguments-as-str, r=kennytm
bors [Sun, 27 Jun 2021 15:45:29 +0000 (15:45 +0000)]
Auto merge of #86655 - jonas-schievink:const-arguments-as-str, r=kennytm

Make `fmt::Arguments::as_str` unstably const

Motivation: mostly to move "panic!() in const contexts" forward, making use of `as_str` was mentioned in https://github.com/rust-lang/rust/issues/85194#issuecomment-852345377 and seems like the simplest way forward.

3 years agoAuto merge of #86295 - usbalbin:revert_revert_of_constness, r=RalfJung
bors [Sun, 27 Jun 2021 13:19:48 +0000 (13:19 +0000)]
Auto merge of #86295 - usbalbin:revert_revert_of_constness, r=RalfJung

Revert revert of constness in #86003

Re-constify `mem::swap`, `mem::replace`, `ptr::write` which were marked as not `const` in #86003

Once the checks pass, this should solve #86236

3 years agoUpdate and bless tests for const read out of bounds
Albin Hedman [Sun, 27 Jun 2021 12:24:49 +0000 (14:24 +0200)]
Update and bless tests for const read out of bounds

3 years agoUpdate and bless tests for copy intrinsic
Albin Hedman [Sun, 27 Jun 2021 11:48:01 +0000 (13:48 +0200)]
Update and bless tests for copy intrinsic

3 years agoFix the test copy-intrinsic
Albin Hedman [Tue, 15 Jun 2021 17:22:31 +0000 (19:22 +0200)]
Fix the test copy-intrinsic

3 years agoBring back tests removed in 'Revert PRs 81238 and 82967 (which made copy and copy_non...
Albin Hedman [Tue, 15 Jun 2021 14:47:31 +0000 (16:47 +0200)]
Bring back tests removed in 'Revert PRs 81238 and 82967 (which made copy and copy_nonoverlapping' 5f6016f1259142de7ab1f186f412fa3ca26607a8

3 years agoBless out_of_bounds_read test
Albin Hedman [Mon, 14 Jun 2021 18:47:54 +0000 (20:47 +0200)]
Bless out_of_bounds_read test

3 years agoAdd reference to tracking issue #86302 for const_ptr_write
Albin Hedman [Mon, 14 Jun 2021 17:58:34 +0000 (19:58 +0200)]
Add reference to tracking issue #86302 for const_ptr_write

3 years agoAdd reference to issue for const_intrinsic_copy in ptr::write
Albin Hedman [Mon, 14 Jun 2021 17:39:02 +0000 (19:39 +0200)]
Add reference to issue for const_intrinsic_copy in ptr::write

3 years agoRevert "With the revert of PR 83091, `swap` is not a `const fn` anymore."
Albin Hedman [Mon, 14 Jun 2021 15:35:29 +0000 (17:35 +0200)]
Revert "With the revert of PR 83091, `swap` is not a `const fn` anymore."

This reverts commit 34deda3cc250c2607a68cda75fe256f43b110fdc.

3 years agoRevert "Remove tests that were also added in PR 79684."
Albin Hedman [Mon, 14 Jun 2021 15:32:51 +0000 (17:32 +0200)]
Revert "Remove tests that were also added in PR 79684."

This reverts commit e118a2cbf1e590cb5a7586ad01c6c3431c2b4f48.

3 years agoRevert "Revert tests added by PR 81167."
Albin Hedman [Mon, 14 Jun 2021 15:30:12 +0000 (17:30 +0200)]
Revert "Revert tests added by PR 81167."

This reverts commit cebfcd3256a6ec8655f0d9f45426d6f42a92da9c.

3 years agoRevert "Revert effects of PRs 81167 and 83091."
Albin Hedman [Mon, 14 Jun 2021 15:29:22 +0000 (17:29 +0200)]
Revert "Revert effects of PRs 81167 and 83091."

This reverts commit 9d96b0ed8c0f37bc09e737e1ab5880e8f5dd43f2.

3 years agoAuto merge of #85448 - nanguye2496:nanguye2496/debuginfo_tests, r=Mark-Simulacrum
bors [Sun, 27 Jun 2021 06:58:07 +0000 (06:58 +0000)]
Auto merge of #85448 - nanguye2496:nanguye2496/debuginfo_tests, r=Mark-Simulacrum

Add debug info tests for range, fix-sized array, and cell types

This PR add several debug info tests to guarantee that the displays of fixed sized arrays, range types, cell types, threads, locks, and mutexes in CDB are correct.

It also updates CDB tests for slices in pretty-std.rs after string visualization in WinDbg is fixed by this PR: #81898.

3 years agoMake `fmt::Arguments::as_str` unstably const
Jonas Schievink [Sun, 27 Jun 2021 01:54:06 +0000 (03:54 +0200)]
Make `fmt::Arguments::as_str` unstably const

3 years agoAuto merge of #86645 - FabianWolff:issue-82328, r=LeSeulArtichaut
bors [Sun, 27 Jun 2021 00:15:49 +0000 (00:15 +0000)]
Auto merge of #86645 - FabianWolff:issue-82328, r=LeSeulArtichaut

Fix ICE with `-Zunpretty=hir,typed`

This PR fixes #82328. The `-Zunpretty=hir,typed` pretty-printer maintains an `Option` with type-checking results and sets the `Option` to `Some` when entering a body. However, this leads to an ICE if an expression occurs in a function signature (i.e. outside of a body), such as `128` in
```rust
fn foo(-128..=127: i8) {}
```
This PR fixes the ICE by checking (if necessary) whether the expression's owner has a body, and retrieving type-checking results for that on the fly.

3 years agoReorder some lines in `unpretty-expr-fn-arg.rs`
Fabian Wolff [Sat, 26 Jun 2021 20:43:27 +0000 (22:43 +0200)]
Reorder some lines in `unpretty-expr-fn-arg.rs`

3 years agoUse `Option::map()` instead of `if let`
Fabian Wolff [Sat, 26 Jun 2021 20:26:26 +0000 (22:26 +0200)]
Use `Option::map()` instead of `if let`

3 years agoAuto merge of #86267 - ZuseZ4:master, r=nagisa
bors [Sat, 26 Jun 2021 19:20:41 +0000 (19:20 +0000)]
Auto merge of #86267 - ZuseZ4:master, r=nagisa

Allow loading of llvm plugins on nightly

Based on a discussion in  #82734 / with `@wsmoses.`
Mainly moves [this](https://github.com/wsmoses/rust/commit/0149bc4e7e596005c665b132877abebe5258a0f6) behind a -Z flag, so it can only be used on nightly,
as requested by `@nagisa` in https://github.com/rust-lang/rust/issues/82734#issuecomment-835863940

This change allows loading of llvm plugins like Enzyme.
Right now it also requires a shared library LLVM build of rustc for symbol resolution.

```rust
// test.rs
extern { fn __enzyme_autodiff(_: usize, ...) -> f64; }

fn square(x : f64) -> f64 {
   return x * x;
}

fn main() {
   unsafe {
      println!("Hello, world {} {}!", square(3.0), __enzyme_autodiff(square as usize, 3.0));
   }
}
```
```
./rustc test.rs -Z llvm-plugins="./LLVMEnzyme-12.so" -C passes="enzyme"
./test
Hello, world 9 6!
```

I will try to figure out how to simplify the usage and get this into stable in a later iteration,
but having this on nightly will already help testing further steps.

3 years agoRemove dropping of loaded plugins and better debug info
Manuel Drehwald [Sat, 26 Jun 2021 17:30:09 +0000 (19:30 +0200)]
Remove dropping of loaded plugins and better debug info

3 years agoAuto merge of #86449 - Stupremee:render-self-cast-in-type-bound, r=GuillaumeGomez
bors [Sat, 26 Jun 2021 16:13:52 +0000 (16:13 +0000)]
Auto merge of #86449 - Stupremee:render-self-cast-in-type-bound, r=GuillaumeGomez

rustdoc: Render `<Self as X>::Y` type casts properly across crate bounds

My last PR that introduced the type casting did not work for cross-crate re-exported traits, which is fixed in this PR.

Fully resolves #85454

3 years agoFix ICE with `-Zunpretty=hir,typed` when an expression occurs in a function signature
Fabian Wolff [Sat, 26 Jun 2021 14:05:53 +0000 (16:05 +0200)]
Fix ICE with `-Zunpretty=hir,typed` when an expression occurs in a function signature

3 years agoAuto merge of #85682 - m-ou-se:array-into-iter-2, r=nikomatsakis
bors [Sat, 26 Jun 2021 13:33:04 +0000 (13:33 +0000)]
Auto merge of #85682 - m-ou-se:array-into-iter-2, r=nikomatsakis

Update array_into_iter lint for 1.53 and edition changes.

This updates the array_into_iter lint for Rust 1.53 and the edition changes.

See https://github.com/rust-lang/rust/issues/84513

r? `@estebank`

3 years agoFix array-into-iter tests.
Mara Bos [Fri, 25 Jun 2021 17:26:31 +0000 (17:26 +0000)]
Fix array-into-iter tests.

3 years agoRemove issue-78660-cap-lints-future-compat test.
Mara Bos [Thu, 10 Jun 2021 14:48:26 +0000 (14:48 +0000)]
Remove issue-78660-cap-lints-future-compat test.

3 years agoAdd test for suggestion of array_into_iter in for loop.
Mara Bos [Tue, 25 May 2021 17:15:48 +0000 (19:15 +0200)]
Add test for suggestion of array_into_iter in for loop.

3 years agoBetter suggestion for array_into_iter in for loop.
Mara Bos [Tue, 25 May 2021 17:15:27 +0000 (19:15 +0200)]
Better suggestion for array_into_iter in for loop.

3 years agoUpdate tests for updated array_into_iter lint.
Mara Bos [Tue, 25 May 2021 15:56:19 +0000 (17:56 +0200)]
Update tests for updated array_into_iter lint.

3 years agoAdd new suggestion to array_into_iter lint.
Mara Bos [Tue, 25 May 2021 15:13:15 +0000 (17:13 +0200)]
Add new suggestion to array_into_iter lint.

3 years agoChange wording on array_into_iter lint for 1.53 and edition changes.
Mara Bos [Tue, 25 May 2021 15:12:45 +0000 (17:12 +0200)]
Change wording on array_into_iter lint for 1.53 and edition changes.

3 years agoAuto merge of #84814 - Stupremee:properly-render-hrtbs, r=GuillaumeGomez
bors [Sat, 26 Jun 2021 10:52:16 +0000 (10:52 +0000)]
Auto merge of #84814 - Stupremee:properly-render-hrtbs, r=GuillaumeGomez

Properly render HRTBs

```rust
pub fn test<T>()
where
    for<'a> &'a T: Iterator,
{}
```

This will now render properly including the `for<'a>`
![image](https://user-images.githubusercontent.com/39732259/116808426-fe6ce600-ab38-11eb-9452-f33f554fbb8e.png)

I do not know if this covers all cases, it only covers everything that I could think of that includes `for` and lifetimes in where bounds.
Also someone need to mentor me on how to add a proper rustdoc test for this.

Resolves #78482

3 years agoAuto merge of #86586 - Smittyvb:https-everywhere, r=petrochenkov
bors [Sat, 26 Jun 2021 08:24:31 +0000 (08:24 +0000)]
Auto merge of #86586 - Smittyvb:https-everywhere, r=petrochenkov

Use HTTPS links where possible

While looking at #86583, I wondered how many other (insecure) HTTP links were in `rustc`. This changes most other `http` links to `https`. While most of the links are in comments or documentation, there are a few other HTTP links that are used by CI that are changed to HTTPS.

Notes:
- I didn't change any to or in licences
- Some links don't support HTTPS :(
- Some `http` links were dead, in those cases I upgraded them to their new places (all of which used HTTPS)

3 years agoAuto merge of #86637 - ehuss:spellings, r=dtolnay
bors [Sat, 26 Jun 2021 05:09:27 +0000 (05:09 +0000)]
Auto merge of #86637 - ehuss:spellings, r=dtolnay

Fix a few misspellings.

3 years agoAuto merge of #86622 - FabianWolff:issue-83475, r=jonas-schievink
bors [Sat, 26 Jun 2021 02:28:45 +0000 (02:28 +0000)]
Auto merge of #86622 - FabianWolff:issue-83475, r=jonas-schievink

Check that `#[cmse_nonsecure_entry]` is applied to a function definition

This PR fixes #83475. The compiler currently neglects to check whether `#[cmse_nonsecure_entry]` is applied to a function (and not, say, a struct) definition, leading to an ICE later on when the type checker attempts to retrieve the function signature. I have fixed this problem by adding an appropriate check to the `check_attr` pass, so that an error is reported instead of an ICE.

3 years agoAuto merge of #86015 - jyn514:revert-revert, r=Mark-Simulacrum
bors [Fri, 25 Jun 2021 23:47:56 +0000 (23:47 +0000)]
Auto merge of #86015 - jyn514:revert-revert, r=Mark-Simulacrum

Move LLVM submodule updates back to native.rs

Time to find more bugs!

The first commit is a straight revert of https://github.com/rust-lang/rust/pull/85647, the second is a fix for https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/x.2Epy.20always.20updates.20LLVM.20submodule/near/240113320 and https://github.com/rust-lang/rust/pull/82653#issuecomment-846755631. I haven't been able to replicate https://github.com/rust-lang/rust/pull/82653#issuecomment-849013698.

3 years agoDownload the GCC sources insecurely
Smitty [Fri, 25 Jun 2021 21:15:36 +0000 (17:15 -0400)]
Download the GCC sources insecurely

This is needed as they are built on a long-outdated Debian version. :(

3 years agoAdd debug info tests for range, fix-sized array, and cell types.
Nam Nguyen [Tue, 30 Mar 2021 17:43:39 +0000 (10:43 -0700)]
Add debug info tests for range, fix-sized array, and cell types.

3 years agoAuto merge of #86599 - Amanieu:asm_raw, r=nagisa
bors [Fri, 25 Jun 2021 20:44:28 +0000 (20:44 +0000)]
Auto merge of #86599 - Amanieu:asm_raw, r=nagisa

Add a "raw" option for asm! which ignores format string specifiers

This is useful when including raw assembly snippets using `include_str!`.

3 years agoFix a few misspellings.
Eric Huss [Fri, 25 Jun 2021 20:18:56 +0000 (13:18 -0700)]
Fix a few misspellings.

3 years agoAuto merge of #86627 - JohnTitor:rollup-ey29pc1, r=JohnTitor
bors [Fri, 25 Jun 2021 18:16:37 +0000 (18:16 +0000)]
Auto merge of #86627 - JohnTitor:rollup-ey29pc1, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #86330 (Change how edition based future compatibility warnings are handled)
 - #86513 (Rustdoc: Do not list impl when trait has doc(hidden))
 - #86592 (Use `#[non_exhaustive]` where appropriate)
 - #86608 (chore(rustdoc): remove unused members of RenderType)
 - #86624 (Update compiler-builtins)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoCheck that `#[cmse_nonsecure_entry]` is applied to a function definition
Fabian Wolff [Fri, 25 Jun 2021 13:36:38 +0000 (15:36 +0200)]
Check that `#[cmse_nonsecure_entry]` is applied to a function definition

3 years agoRollup merge of #86624 - jethrogb:update-compiler_builtins, r=Amanieu
Yuki Okushi [Fri, 25 Jun 2021 15:42:14 +0000 (00:42 +0900)]
Rollup merge of #86624 - jethrogb:update-compiler_builtins, r=Amanieu

Update compiler-builtins

r? ``@Amanieu``

3 years agoRollup merge of #86608 - notriddle:notriddle/cleanup-rustdoc, r=jyn514
Yuki Okushi [Fri, 25 Jun 2021 15:42:13 +0000 (00:42 +0900)]
Rollup merge of #86608 - notriddle:notriddle/cleanup-rustdoc, r=jyn514

chore(rustdoc): remove unused members of RenderType

PR #86561 removes the only place the `generics` member is read. This PR does even more cleanup.

3 years agoRollup merge of #86592 - jhpratt:non_exhaustive, r=JohnTitor
Yuki Okushi [Fri, 25 Jun 2021 15:42:12 +0000 (00:42 +0900)]
Rollup merge of #86592 - jhpratt:non_exhaustive, r=JohnTitor

Use `#[non_exhaustive]` where appropriate

Due to the std/alloc split, it is not possible to make `alloc::collections::TryReserveError::AllocError` non-exhaustive without having an unstable, doc-hidden method to construct (which negates the benefits from `#[non_exhaustive]`).

`@rustbot` label +C-cleanup +T-libs +S-waiting-on-review

3 years agoRollup merge of #86513 - fee1-dead:cross-crate-doc-hidden, r=danielhenrymantilla
Yuki Okushi [Fri, 25 Jun 2021 15:42:10 +0000 (00:42 +0900)]
Rollup merge of #86513 - fee1-dead:cross-crate-doc-hidden, r=danielhenrymantilla

Rustdoc: Do not list impl when trait has doc(hidden)

Fixes #86448.

3 years agoRollup merge of #86330 - rylev:update-fcw-handling, r=nikomatsakis
Yuki Okushi [Fri, 25 Jun 2021 15:42:06 +0000 (00:42 +0900)]
Rollup merge of #86330 - rylev:update-fcw-handling, r=nikomatsakis

Change how edition based future compatibility warnings are handled

This fixes https://github.com/rust-lang/rust/issues/85894 by updating how future compatibility lints work. This makes it more apparent that future compatibility warnings can happen for several different reasons.

For now `FutureCompatibilityReasons` are limited to three reasons, but we can easily add more.

This also updates the generated warning for FCW's that signal code that will error in a future edition. This makes the diagnostics between FCWs at edition boundaries more distinct from those not happening at an edition boundary.

r? ``@m-ou-se``

3 years agoAuto merge of #85603 - ogoffart:fix-uninhabited-enum-branching-pass, r=wesleywiser
bors [Fri, 25 Jun 2021 15:35:47 +0000 (15:35 +0000)]
Auto merge of #85603 - ogoffart:fix-uninhabited-enum-branching-pass, r=wesleywiser

Fix uninhabited enum branching pass

when the discriminant is taken with some projection.

3 years agoUpdate compiler-builtins
Jethro Beekman [Fri, 25 Jun 2021 14:00:57 +0000 (16:00 +0200)]
Update compiler-builtins

3 years agoFix clippy test
Ryan Levick [Fri, 25 Jun 2021 13:29:14 +0000 (15:29 +0200)]
Fix clippy test

3 years agoFix new broken tests
Ryan Levick [Thu, 24 Jun 2021 14:45:19 +0000 (16:45 +0200)]
Fix new broken tests

3 years agoFix new lints
Ryan Levick [Wed, 23 Jun 2021 13:52:28 +0000 (15:52 +0200)]
Fix new lints

3 years agoAdd back missing doc
Ryan Levick [Thu, 17 Jun 2021 17:36:49 +0000 (19:36 +0200)]
Add back missing doc

3 years agoAddress PR feedback
Ryan Levick [Wed, 16 Jun 2021 12:27:44 +0000 (14:27 +0200)]
Address PR feedback

3 years agoChange how edition based future compatibility warnings are handled
Ryan Levick [Tue, 15 Jun 2021 15:16:21 +0000 (17:16 +0200)]
Change how edition based future compatibility warnings are handled

3 years agoAuto merge of #86583 - dns2utf8:use_https, r=pietroalbini
bors [Fri, 25 Jun 2021 12:20:17 +0000 (12:20 +0000)]
Auto merge of #86583 - dns2utf8:use_https, r=pietroalbini

Use https for sourceforge during CI

I saw that we use http during CI opening up the CI process to on the wire tampering.

based on #86573

r? `@pietroalbini`

3 years agoAuto merge of #86505 - JohnTitor:fix-86483, r=jackh726
bors [Fri, 25 Jun 2021 09:28:17 +0000 (09:28 +0000)]
Auto merge of #86505 - JohnTitor:fix-86483, r=jackh726

Do not panic in `return_type_impl_trait`

Fixes #86483

3 years agoFetch expat from github because the project switched
Stefan Schindler [Wed, 23 Jun 2021 20:01:18 +0000 (22:01 +0200)]
Fetch expat from github because the project switched

3 years agoUse https for sourceforge during CI
Stefan Schindler [Wed, 23 Jun 2021 19:20:19 +0000 (21:20 +0200)]
Use https for sourceforge during CI

3 years agoAuto merge of #86151 - scottmcm:simple-hash-of, r=joshtriplett
bors [Fri, 25 Jun 2021 06:47:30 +0000 (06:47 +0000)]
Auto merge of #86151 - scottmcm:simple-hash-of, r=joshtriplett

Add `BuildHasher::hash_one` as unstable

Inspired by https://github.com/rust-lang/rust/pull/86140/files#diff-246941135168fbc44fce120385ee9c3156e08a1c3e2697985b56dcb8d728eedeR2416, where I wanted to write a quick test for a `Hash` implementation and it took more of a dance than I'd hoped.

It looks like this would be handy in hashtable implementations, too -- a quick look at hashbrown found two places where it needs to do the same dance:
https://github.com/rust-lang/hashbrown/blob/6302512a8a514fe5bd442464ebcd78139c82e1e2/src/map.rs#L247-L270

I wanted to get a "seems plausible" from a libs member before making a tracking issue, so random-sampling the intersection of highfive and governance gave me...
r? `@joshtriplett`

(As always, bikeshed away!  And let me know if I missed something obvious again that I should have used instead.)

3 years agoRenamed test and added test for same crate
Deadbeef [Fri, 25 Jun 2021 06:08:06 +0000 (14:08 +0800)]
Renamed test and added test for same crate

3 years agoAuto merge of #85640 - bjorn3:custom_ice_hook, r=jackh726
bors [Fri, 25 Jun 2021 04:06:32 +0000 (04:06 +0000)]
Auto merge of #85640 - bjorn3:custom_ice_hook, r=jackh726

Allow changing the bug report url for the ice hook

cc https://github.com/bjorn3/rustc_codegen_cranelift/issues/1174

3 years agofixup! 2229: Capture box completely in move closures
Aman Arora [Tue, 22 Jun 2021 05:58:17 +0000 (01:58 -0400)]
fixup! 2229: Capture box completely in move closures

fixup! 2229: Capture box completely in move closures

3 years agoAuto merge of #86574 - m-ou-se:or-pattern-lint-fix, r=petrochenkov
bors [Fri, 25 Jun 2021 01:23:16 +0000 (01:23 +0000)]
Auto merge of #86574 - m-ou-se:or-pattern-lint-fix, r=petrochenkov

Don't lint :pat when re-parsing a macro from another crate.

`compile_macro` is used both when compiling the original definition in the crate that defines it, and to compile the macro when loading it when compiling a crate that uses it. We should only emit lints in the first case.

This adds a `is_definition: bool` to pass this information in, so we don't warn about things that only concern the definition site.

Fixes #86567

3 years ago2229: Capture box completely in move closures
Aman Arora [Fri, 18 Jun 2021 20:35:10 +0000 (16:35 -0400)]
2229: Capture box completely in move closures

Even if the content from box is used in a sharef-ref context,
we capture the box entirerly.

This is motivated by:
1) We only capture data that is on the stack.
2) Capturing data from within the box might end up moving more data than
the user anticipated.

3 years agochore(rustdoc): remove unused members of RenderType
Michael Howell [Thu, 24 Jun 2021 19:53:35 +0000 (12:53 -0700)]
chore(rustdoc): remove unused members of RenderType

Commit e629381653bb3579f0cea0b256e391edef5e8dbb removes the only place
these members variables are actually read.

3 years agoAuto merge of #86272 - nagisa:nagisa/tidy-llvm-components, r=Mark-Simulacrum
bors [Thu, 24 Jun 2021 22:42:26 +0000 (22:42 +0000)]
Auto merge of #86272 - nagisa:nagisa/tidy-llvm-components, r=Mark-Simulacrum

tidy: verify that test revisions with --target have associated needs-llvm-components directives

This ensures that people who tend to write `--target` `#[no_core]` tests don't miss specifying the `needs-llvm-components` directive. This is necessary for the test suite to pass when LLVM is compiled with a subset of components enabled.

While here I also took the opportunity to implement a more fine-grained handling of the ignore directives, so that they are evaluated for each revision, rather than for the entire test. With this even if people have `arm` component disabled, only the revision that depends on the arm component will not run.

Fixes https://github.com/rust-lang/rust/issues/82405

3 years agoAdd a "raw" option for asm! which ignores format string specifiers
Amanieu d'Antras [Thu, 24 Jun 2021 15:25:44 +0000 (16:25 +0100)]
Add a "raw" option for asm! which ignores format string specifiers

3 years agoDon't lint :pat when re-parsing a macro from another crate.
Mara Bos [Wed, 23 Jun 2021 14:07:32 +0000 (14:07 +0000)]
Don't lint :pat when re-parsing a macro from another crate.

3 years agocompiletest: ignore tests on a per-revision basis
Simonas Kazlauskas [Sun, 13 Jun 2021 19:06:11 +0000 (22:06 +0300)]
compiletest: ignore tests on a per-revision basis

Otherwise something that ought to seemingly work like `//[x86]
needs-llvm-components: x86` or `//[nll_beyond]should-fail` do not get
evaluated properly.

3 years agoRe-Annotate the tests with needs-llvm-components
Simonas Kazlauskas [Sun, 13 Jun 2021 18:19:39 +0000 (21:19 +0300)]
Re-Annotate the tests with needs-llvm-components

Doesn't work though, because compiletest doesn't process ignores on a
per-revision manner.

3 years agotidy: tests with --target need llvm components
Simonas Kazlauskas [Sun, 13 Jun 2021 15:56:13 +0000 (18:56 +0300)]
tidy: tests with --target need llvm components

Herein we verify that all of the tests that specify a `--target`
compile-flag, are also annotated with the minimal set of required llvm
components necessary to run that test.

3 years agoAuto merge of #85651 - dns2utf8:rustdoc_flexbox, r=GuillaumeGomez
bors [Thu, 24 Jun 2021 20:01:39 +0000 (20:01 +0000)]
Auto merge of #85651 - dns2utf8:rustdoc_flexbox, r=GuillaumeGomez

rustdoc: staggered layout for module contents on mobile

This PR adds the container `<item-table>` with its two children `<item-left>` and `<item-right>`.
It uses grid-layout on desktop and flexbox on mobile to make better use of the available space.

Additionally it allows to share parts of the CSS with the search function.

* Demo: https://data.estada.ch/rustdoc-nightly_126561cb3_2021-05-25/generic_array/index.html
* Related: #85540

## Desktop
![grafik](https://user-images.githubusercontent.com/739070/119416896-2be62300-bce4-11eb-9555-792b859ab611.png)

## Mobile
![grafik](https://user-images.githubusercontent.com/739070/119416934-44563d80-bce4-11eb-9e77-70a72edcc487.png)

r? `@GuillaumeGomez` `@jsha`

3 years agoAuto merge of #86467 - ChrisDenton:win-env-clear, r=JohnTitor
bors [Thu, 24 Jun 2021 17:37:29 +0000 (17:37 +0000)]
Auto merge of #86467 - ChrisDenton:win-env-clear, r=JohnTitor

Windows: Fix `Command::env_clear` so it works if no variables are set

Previously, it would error unless at least one new environment variable was added. The missing null presumably meant that Windows was reading random memory in that case.

See: [CreateProcessW](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw) (scroll down to `lpEnvironment`). Essentially the environment block is a null terminated list of null terminated strings and an empty list is `\0\0` and not `\0`.

EDIT: Oh, [CreateEnvironmentBlock](https://docs.microsoft.com/en-gb/windows/win32/api/userenv/nf-userenv-createenvironmentblock) states this much more explicitly.

Fixes #31259

3 years agoAuto merge of #85427 - ehuss:fix-use-placement, r=jackh726
bors [Thu, 24 Jun 2021 14:56:28 +0000 (14:56 +0000)]
Auto merge of #85427 - ehuss:fix-use-placement, r=jackh726

Fix use placement for suggestions near main.

This fixes an edge case for the suggestion to add a `use`. When running with `--test`, the `main` function will be annotated with an `#[allow(dead_code)]` attribute. The `UsePlacementFinder` would end up using the dummy span of that synthetic attribute. If there are top-level inner attributes, this would place the `use` in the wrong position. The solution here is to ignore attributes with dummy spans.

In the process of working on this, I discovered that the `use_suggestion_placement` test was broken. `UsePlacementFinder` is unaware of active attributes. Attributes like `#[derive]` don't exist in the AST since they are removed. Fixing that is difficult, since the AST does not retain enough information. I considered trying to place the `use` towards the top of the module after any `extern crate` items, but I couldn't find a way to get a span for the start of a module block (the `mod` span starts at the `mod` keyword, and it seems tricky to find the spot just after the opening bracket and past inner attributes). For now, I just put some comments about the issue. This appears to have been a known issue in #44215 where the test for it was introduced, and the fix seemed to be deferred to later.

3 years agoMigrate from custom elements to divs with classes to be compatible with safari
Stefan Schindler [Thu, 17 Jun 2021 22:33:42 +0000 (00:33 +0200)]
Migrate from custom elements to divs with classes to be compatible with safari

3 years agoHide Crate Version on narrow Screens
Stefan Schindler [Wed, 16 Jun 2021 20:24:02 +0000 (22:24 +0200)]
Hide Crate Version on narrow Screens

3 years agoFixing the test rustdoc by ignoring `*[@id="module-item"]//following-sibling::item...
Stefan Schindler [Wed, 16 Jun 2021 14:16:11 +0000 (16:16 +0200)]
Fixing the test rustdoc by ignoring `*[@id="module-item"]//following-sibling::item-right` relationship and rustdoc-gui

3 years agoImplement Desktop and Mobile version with gridlayout
Stefan Schindler [Mon, 24 May 2021 22:36:36 +0000 (00:36 +0200)]
Implement Desktop and Mobile version with gridlayout

* implement sans-serif #85621

3 years agoTest that `env_clear` works on Windows
Chris Denton [Thu, 24 Jun 2021 08:32:24 +0000 (09:32 +0100)]
Test that `env_clear` works on Windows

3 years agoUse `hash_one` to simplify some other doctests
Scott McMurray [Thu, 24 Jun 2021 08:30:08 +0000 (01:30 -0700)]
Use `hash_one` to simplify some other doctests

3 years agoAdd tracking issue and rename to hash_one
Scott McMurray [Wed, 9 Jun 2021 05:07:14 +0000 (22:07 -0700)]
Add tracking issue and rename to hash_one

3 years agoAdd `BuildHasher::hash_of` as unstable
Scott McMurray [Tue, 8 Jun 2021 20:52:57 +0000 (13:52 -0700)]
Add `BuildHasher::hash_of` as unstable

3 years agoUse `#[non_exhaustive]` where appropriate
Jacob Pratt [Thu, 24 Jun 2021 08:16:11 +0000 (04:16 -0400)]
Use `#[non_exhaustive]` where appropriate

Due to the std/alloc split, it is not possible to make
`alloc::collections::TryReserveError::AllocError` non-exhaustive without
having an unstable, doc-hidden method to construct (which negates the
benefits from `#[non_exhaustive]`.

3 years agoAuto merge of #86279 - JohnTitor:transparent-zero-size-fields, r=nikomatsakis
bors [Thu, 24 Jun 2021 07:29:59 +0000 (07:29 +0000)]
Auto merge of #86279 - JohnTitor:transparent-zero-size-fields, r=nikomatsakis

Permit zero non-zero-field on transparent types

Fixes #77841

This makes the transparent fields meet the below:
> * A `repr(transparent)` type `T` must meet the following rules:
>   * It may have any number of 1-ZST fields
>   * In addition, it may have at most one other field of type U

r? `@nikomatsakis`

3 years agoPrefer "allow list" structure to check a type
Yuki Okushi [Thu, 24 Jun 2021 05:59:43 +0000 (14:59 +0900)]
Prefer "allow list" structure to check a type

3 years agoRename function name in comments
Yuki Okushi [Thu, 24 Jun 2021 05:21:50 +0000 (14:21 +0900)]
Rename function name in comments

3 years agoDo not panic in `return_type_impl_trait`
Yuki Okushi [Mon, 21 Jun 2021 05:53:50 +0000 (14:53 +0900)]
Do not panic in `return_type_impl_trait`

3 years agoAuto merge of #86588 - JohnTitor:rollup-ibgjbkf, r=JohnTitor
bors [Thu, 24 Jun 2021 04:48:46 +0000 (04:48 +0000)]
Auto merge of #86588 - JohnTitor:rollup-ibgjbkf, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #86137 (Error code cleanup and enforce checks)
 - #86296 (Add documentation for various THIR structs)
 - #86415 (Document associativity of iterator folds.)
 - #86533 (Support lowercase error codes in `--explain`)
 - #86536 (Edition 2021 enables disjoint capture)
 - #86560 (Update cargo)
 - #86561 (chore(rustdoc): Remove unused impl block)
 - #86566 (Use `use_verbose` for `mir::Constant`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #86566 - fee1-dead:mir-pretty-print, r=oli-obk
Yuki Okushi [Thu, 24 Jun 2021 04:47:39 +0000 (13:47 +0900)]
Rollup merge of #86566 - fee1-dead:mir-pretty-print, r=oli-obk

Use `use_verbose` for `mir::Constant`

Fixes #79799.

3 years agoRollup merge of #86561 - notriddle:notriddle/cleanup-rustdoc, r=jyn514
Yuki Okushi [Thu, 24 Jun 2021 04:47:38 +0000 (13:47 +0900)]
Rollup merge of #86561 - notriddle:notriddle/cleanup-rustdoc, r=jyn514

chore(rustdoc): Remove unused impl block

3 years agoRollup merge of #86560 - ehuss:update-cargo, r=ehuss
Yuki Okushi [Thu, 24 Jun 2021 04:47:37 +0000 (13:47 +0900)]
Rollup merge of #86560 - ehuss:update-cargo, r=ehuss

Update cargo

This also updates `opener` used in bootstrap (to try to keep dependencies unified).

18 commits in 44456677b5d1d82fe981c955dc5c67734b31f340..9233aa06c801801cff75df65df718d70905a235e
2021-06-12 18:00:01 +0000 to 2021-06-22 21:32:55 +0000
- Detect incorrectly named cargo.toml (rust-lang/cargo#9607)
- Unify weak and namespaced features. (rust-lang/cargo#9574)
- Change `rustc-cdylib-link-arg` error to a warning. (rust-lang/cargo#9563)
- Updates to future-incompatible reporting. (rust-lang/cargo#9606)
- Add a compatibility notice for diesel and the new resolver. (rust-lang/cargo#9602)
- Don't allow config env to modify vars set by cargo (rust-lang/cargo#9579)
- Disambiguate is_symlink. (rust-lang/cargo#9604)
- Update opener requirement from 0.4 to 0.5 (rust-lang/cargo#9583)
- Avoid quadratic complexity when splitting output into lines (rust-lang/cargo#9586)
- Bump to 0.56.0, update changelog (rust-lang/cargo#9597)
- Fix dep-info files including non-local build script paths. (rust-lang/cargo#9596)
- Relax doc collision error. (rust-lang/cargo#9595)
- Handle "jobs = 0" case in cargo config files (rust-lang/cargo#9584)
- Enhancements to testsuite error output. (rust-lang/cargo#9589)
- Fix typo (rust-lang/cargo#9590)
- Enable support for fix --edition for 2021. (rust-lang/cargo#9588)
- Add more details for installing git repository errors (rust-lang/cargo#9582)
- More information for links conflicting (rust-lang/cargo#9568)

3 years agoRollup merge of #86536 - sexxi-goose:edition, r=nikomatsakis
Yuki Okushi [Thu, 24 Jun 2021 04:47:36 +0000 (13:47 +0900)]
Rollup merge of #86536 - sexxi-goose:edition, r=nikomatsakis

Edition 2021 enables disjoint capture

First part for https://github.com/rust-lang/project-rfc-2229/issues/43

3 years agoRollup merge of #86533 - inquisitivecrystal:lower-case-error-explain, r=petrochenkov
Yuki Okushi [Thu, 24 Jun 2021 04:47:35 +0000 (13:47 +0900)]
Rollup merge of #86533 - inquisitivecrystal:lower-case-error-explain, r=petrochenkov

Support lowercase error codes in `--explain`

This enables `rustc --explain` to accept a lowercase error code. Thus, for instance, `rustc --explain e0573` would be valid after this change, where before a user would have needed to do `rustc --explain E0573`. Although the upper case form of an error code is canonical, the user may prefer the easier-to-type lowercase form, and there's nothing to be gained by forcing them to type the upper case version.

Resolves #86518.

3 years agoRollup merge of #86415 - Kmeakin:iterator-associativity-docs, r=dtolnay
Yuki Okushi [Thu, 24 Jun 2021 04:47:34 +0000 (13:47 +0900)]
Rollup merge of #86415 - Kmeakin:iterator-associativity-docs, r=dtolnay

Document associativity of iterator folds.

Document the associativity of `Iterator::fold` and
`DoubleEndedIterator::rfold` and add examples demonstrating this.
Add links to direct users to the fold of the opposite associativity.

3 years agoRollup merge of #86296 - LeSeulArtichaut:thir-doc, r=nikomatsakis
Yuki Okushi [Thu, 24 Jun 2021 04:47:33 +0000 (13:47 +0900)]
Rollup merge of #86296 - LeSeulArtichaut:thir-doc, r=nikomatsakis

Add documentation for various THIR structs

Helps with rust-lang/project-thir-unsafeck#6.
r? `@nikomatsakis`

3 years agoRollup merge of #86137 - GuillaumeGomez:error-code-cleanup, r=Mark-Simulacrum
Yuki Okushi [Thu, 24 Jun 2021 04:47:26 +0000 (13:47 +0900)]
Rollup merge of #86137 - GuillaumeGomez:error-code-cleanup, r=Mark-Simulacrum

Error code cleanup and enforce checks

Fixes #86097.

It now checks if an error code is unused, and if so, will report an error if the error code wasn't commented out in the `error_codes.rs` file. It also checks that the constant used in the tidy check is up-to-date.

r? `@Mark-Simulacrum`

3 years agoPoint to the updated version of some dead links
Smitty [Wed, 23 Jun 2021 23:36:51 +0000 (19:36 -0400)]
Point to the updated version of some dead links

3 years agoHandle windows paths as well
Guillaume Gomez [Wed, 23 Jun 2021 21:56:16 +0000 (23:56 +0200)]
Handle windows paths as well

3 years agoAuto merge of #86138 - FabianWolff:issue-85871, r=nikomatsakis
bors [Wed, 23 Jun 2021 21:35:46 +0000 (21:35 +0000)]
Auto merge of #86138 - FabianWolff:issue-85871, r=nikomatsakis

Check whether the closure's owner is an ADT in thir-unsafeck

This pull request fixes #85871. The code in `rustc_mir_build/src/check_unsafety.rs` incorrectly assumes that a closure's owner always has a body, but only functions, closures, and constants have bodies, whereas a closure can also appear inside a struct or enum:
```rust
struct S {
    arr: [(); match || 1 { _ => 42 }]
}

enum E {
    A([(); { || 1; 42 }])
}
```
This pull request fixes the resulting ICE by checking whether the closure's owner is an ADT and only deferring to `thir_check_unsafety(owner)` if it isn't.