Commit graph

150454 commits

Author SHA1 Message Date
Aris Merchant
f2b21e2d0b Stabilize Bound::cloned() 2021-07-01 17:09:57 -07:00
bors
a435b49e86 Auto merge of #86690 - JohnTitor:rollup-4ukk4yw, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #86206 (Fix type checking of return expressions outside of function bodies)
 - #86358 (fix pretty print for `loop`)
 - #86568 (Don't dist miri or rust-analyzer on stable or beta.)
 - #86683 (⬆️ rust-analyzer)
 - #86687 (Allow anyone to set `perf-regression` label)
 - #86688 (Add a regression test for issue-65384)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-28 16:48:01 +00:00
Yuki Okushi
c5055b75a2
Rollup merge of #86688 - JohnTitor:test-65384, r=jackh726
Add a regression test for issue-65384

Closes #65384
r? `@jackh726`
2021-06-29 00:27:00 +09:00
Yuki Okushi
98808462c4
Rollup merge of #86687 - JohnTitor:perf-regression-label, r=Mark-Simulacrum
Allow anyone to set `perf-regression` label

The main purpose is to allow the triage bot to set the label: https://github.com/rust-lang/rust/pull/86617#issuecomment-868450443

r? `@Mark-Simulacrum`
2021-06-29 00:26:59 +09:00
Yuki Okushi
6cbe605570
Rollup merge of #86683 - lnicola:rust-analyzer-2021-06-28, r=jonas-schievink
⬆️ rust-analyzer
2021-06-29 00:26:58 +09:00
Yuki Okushi
daa3ceb22b
Rollup merge of #86568 - ehuss:dist-miri-stable, r=Mark-Simulacrum
Don't dist miri or rust-analyzer on stable or beta.

This prevents miri and rust-analyzer from being built for "dist" or "install" on the stable/beta channels. It is a nightly-only tool and should not be included.

Closes #86286
2021-06-29 00:26:57 +09:00
Yuki Okushi
de93434cf0
Rollup merge of #86358 - klensy:pp-loop, r=Mark-Simulacrum
fix pretty print for `loop`
2021-06-29 00:26:55 +09:00
Yuki Okushi
4afdef07d9
Rollup merge of #86206 - FabianWolff:issue-86188, r=Mark-Simulacrum
Fix type checking of return expressions outside of function bodies

This pull request fixes #86188. The problem is that the current code for type-checking `return` expressions stops if the `return` occurs outside of a function body, while the correct behavior is to continue type-checking the return value expression (otherwise an ICE happens later on because variables declared in the return value expression don't have a type).

Also, I have noticed that it is sometimes not obvious why a `return` is outside of a function body; for instance, in the example from #86188 (which currently causes an ICE):
```rust
fn main() {
    [(); return || {
        let tx;
    }]
}
```
I have changed the error message to also explain why the `return` is considered outside of the function body:
```
error[E0572]: return statement outside of function body
 --> ice0.rs:2:10
  |
1 |  / fn main() {
2 |  |     [(); return || {
  |  |__________^
3 | ||         let tx;
4 | ||     }]
  | ||_____^ the return is part of this body...
5 |  | }
  |  |_- ...not the enclosing function body
```
2021-06-29 00:26:54 +09:00
bors
17ea490310 Auto merge of #82624 - ojeda:rwlock-example-deadlock, r=JohnTitor
RWLock: Add deadlock example

Suggested in https://github.com/rust-lang/rust/pull/82596 but it was a bit too late.

`@matklad` `@azdavis` `@sfackler`
2021-06-28 09:58:06 +00:00
Yuki Okushi
16201597da
Add a regression test for issue-65384 2021-06-28 18:39:51 +09:00
Yuki Okushi
edf9375c02
Allow anyone to set perf-regression label 2021-06-28 18:17:20 +09:00
bors
451e98e7b0 Auto merge of #86684 - inquisitivecrystal:libs-tracking-issue, r=m-ou-se
Fix typo in libs tracking issue template

Currently, the libs tracking issue template expands FCP as "final commenting period". Everywhere else, including in [the official explanation](https://rust-lang.github.io/rfcs/), it's expanded as "final comment period". That version also sounds a bit better. Accordingly, this PR changes the tracking issue template to use that version.

`@rustbot` label A-meta T-libs-api
r? `@m-ou-se`
2021-06-28 06:24:49 +00:00
Laurențiu Nicola
76a2580a2a ⬆️ rust-analyzer 2021-06-28 09:09:55 +03:00
Aris Merchant
fe54486352 Fix typo in libs tracking issue template 2021-06-27 23:00:26 -07:00
bors
d08a4718a9 Auto merge of #85876 - jeanlucthumm:master, r=GuillaumeGomez
Add `go_to_first` query param to jump to first result

Fixes #84214

Note that while the issue initially wanted to navigate to an entry on exact match, the discussion settled on using a query parameter (`&go_to_first=true`) instead, regardless of exact or partial match.

Demonstration is attached

https://user-images.githubusercontent.com/4934853/120258768-7ff28980-c247-11eb-8c8f-1a2ceb242788.mp4
2021-06-28 03:43:39 +00:00
bors
345530412f Auto merge of #85909 - cjgillot:alloc-kind-query, r=Aaron1011
Make allocator_kind a query.

Part of #85153

r? `@Aaron1011`
2021-06-28 01:20:01 +00:00
bors
3e9d7ecf78 Auto merge of #86589 - JohnTitor:add-triangle-to-summary, r=jsha
Show triangle on the "Details" disclosure element in all cases

Re-submission of #82805, fixes the style issue by applying the same margin as `<p>`.

<details><summary>Before</summary>

![before 1](https://user-images.githubusercontent.com/25030997/123215032-e4c99880-d502-11eb-9ccc-6df58f3a6b0b.png)
![before 2](https://user-images.githubusercontent.com/25030997/123215035-e5622f00-d502-11eb-9275-6c6dfcfdf72e.png)
</details>

<details><summary>After</summary>

![after 1](https://user-images.githubusercontent.com/25030997/123215037-e5fac580-d502-11eb-9b49-c99d1eafb1b4.png)
![after 2](https://user-images.githubusercontent.com/25030997/123215040-e5fac580-d502-11eb-8afc-ab713d3dc658.png)
</details>

r? `@GuillaumeGomez`
2021-06-27 22:57:34 +00:00
bors
e8cb1a4a56 Auto merge of #85359 - lrh2000:reserved-prefixes, r=nikomatsakis
Reserve prefixed identifiers and literals (RFC 3101)

This PR denies any identifiers immediately followed by one of three tokens `"`, `'` or `#`, which is stricter than the requirements of RFC 3101 but may be necessary according to the discussion at [Zulip].

[Zulip]: https://rust-lang.zulipchat.com/#narrow/stream/268952-edition-2021/topic/reserved.20prefixes/near/238470099

The tracking issue #84599 says we'll add a feature gate named `reserved_prefixes`, but I don't think I can do this because it is impossible for the lexer to know whether a feature is enabled or not. I guess determining the behavior by the edition information should be enough.

Fixes #84599
2021-06-27 20:33:25 +00:00
bors
a4f832b275 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`
2021-06-27 18:10:35 +00:00
Jean-Luc Thumm
6c5c0a5853 Add Website features page to rustdoc book 2021-06-27 11:08:23 -07:00
Jean-Luc Thumm
68e3c49cdf Add go_to_first boolean query param to immeidately jump to the first search result 2021-06-27 10:59:53 -07:00
bors
9cdb2d3d59 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.
2021-06-27 15:45:29 +00:00
bors
49ba9361d8 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
2021-06-27 13:19:48 +00:00
Albin Hedman
4aa1267cbb
Update and bless tests for const read out of bounds 2021-06-27 14:24:49 +02:00
Albin Hedman
c0125532ea
Update and bless tests for copy intrinsic 2021-06-27 13:48:01 +02:00
Albin Hedman
56c78b2f59
Fix the test copy-intrinsic 2021-06-27 12:05:22 +02:00
Albin Hedman
3a894e38fb
Bring back tests removed in 'Revert PRs 81238 and 82967 (which made copy and copy_nonoverlapping' 5f6016f125 2021-06-27 12:05:21 +02:00
Albin Hedman
4b64baff67
Bless out_of_bounds_read test 2021-06-27 12:05:20 +02:00
Albin Hedman
22fe76d97d
Add reference to tracking issue #86302 for const_ptr_write 2021-06-27 12:05:19 +02:00
Albin Hedman
1aa032f506
Add reference to issue for const_intrinsic_copy in ptr::write 2021-06-27 12:05:19 +02:00
Albin Hedman
7de63be56d
Revert "With the revert of PR 83091, swap is not a const fn anymore."
This reverts commit 34deda3cc2.
2021-06-27 12:05:18 +02:00
Albin Hedman
38e9538122
Revert "Remove tests that were also added in PR 79684."
This reverts commit e118a2cbf1.
2021-06-27 12:05:18 +02:00
Albin Hedman
6c890bb969
Revert "Revert tests added by PR 81167."
This reverts commit cebfcd3256.
2021-06-27 12:05:17 +02:00
Albin Hedman
5fbb1354ce
Revert "Revert effects of PRs 81167 and 83091."
This reverts commit 9d96b0ed8c.
2021-06-27 12:05:16 +02:00
Yuki Okushi
14413ad539
Add FIXME comment 2021-06-27 16:18:52 +09:00
bors
543ab99640 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.
2021-06-27 06:58:07 +00:00
Jonas Schievink
b3fbfe474b Make fmt::Arguments::as_str unstably const 2021-06-27 03:54:06 +02:00
bors
a5b7511a6c 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.
2021-06-27 00:15:49 +00:00
Mara Bos
f6dd1378f0 Update reserved prefixes test for new edition lint wording. 2021-06-26 20:49:29 +00:00
Fabian Wolff
e8ebf98742 Reorder some lines in unpretty-expr-fn-arg.rs 2021-06-26 22:43:27 +02:00
Fabian Wolff
a8b57723d4 Use Option::map() instead of if let 2021-06-26 22:26:26 +02:00
bors
a1411de9de 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](0149bc4e7e) 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.
2021-06-26 19:20:41 +00:00
Manuel Drehwald
abdd24a040 Remove dropping of loaded plugins and better debug info 2021-06-26 19:30:09 +02:00
bors
3ddb78a346 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
2021-06-26 16:13:52 +00:00
lrh2000
e9fc942b4d Use FutureIncompatibilityReason to denote edition 2021-06-26 23:40:07 +08:00
Mara Bos
2bcd663100 Add reserved_prefixe tests for macros from different editions. 2021-06-26 23:11:14 +08:00
Mara Bos
7490305e13 No reserved_prefix suggestion in proc macro call_site. 2021-06-26 23:11:14 +08:00
Mara Bos
c7f7c2efe0 Add quote!() example to reserved_prefix lint test. 2021-06-26 23:11:14 +08:00
Mara Bos
0eeeebc990 Rename 'bad prefix' to 'unknown prefix'. 2021-06-26 23:11:14 +08:00
Mara Bos
d40be0fc64 Check the span's edition for the reserved prefixes. 2021-06-26 23:11:13 +08:00