Commit Graph

208021 Commits

Author SHA1 Message Date
bors
bf286a82e2 Auto merge of #103119 - matthiaskrgr:rollup-2vb8hif, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #102857 (Add a regression test for #39137)
 - #102953 (Improve docs for `struct_lint_level` function.)
 - #103060 (rustdoc: make the help button a link to a page)
 - #103115 (Clean up anchors.goml rustdoc GUI test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-16 17:54:02 +00:00
bors
0531aab522 Auto merge of #13397 - zyctree:zyctree-patch-2, r=lnicola
fix link in syntax.md
2022-10-16 17:40:21 +00:00
zyctree
ea8b62f9b0 update link in syntax.md 2022-10-17 01:39:19 +08:00
Vadim Petrochenkov
c65f3db2d9 rustdoc: Do not expect doc(primitive) modules to always exist 2022-10-16 20:44:50 +04:00
Matthias Krüger
ae717c7f2a
Rollup merge of #103115 - GuillaumeGomez:clean-up-anchors-gui-test, r=notriddle
Clean up anchors.goml rustdoc GUI test

r? ``@notriddle``
2022-10-16 17:51:32 +02:00
Matthias Krüger
0bd24c5dc5
Rollup merge of #103060 - notriddle:notridddle/help-page, r=GuillaumeGomez
rustdoc: make the help button a link to a page

This allows you to open the help section in a new browser tab, which is a pretty reasonable thing to want for a documentation page.

Preview: http://notriddle.com/notriddle-rustdoc-demos/help-page/std/index.html
2022-10-16 17:51:31 +02:00
Matthias Krüger
d6506cc0be
Rollup merge of #102953 - WaffleLapkin:better_docs_for_decorate_param, r=RalfJung
Improve docs for `struct_lint_level` function.

r? ``@RalfJung``

Does this answer your questions?
2022-10-16 17:51:31 +02:00
Matthias Krüger
91c7d02e69
Rollup merge of #102857 - saethlin:derived-enum-hash-test, r=Mark-Simulacrum
Add a regression test for #39137

The problem in the issue has been fixed in the meantime, so since this adds a regression test I think this closes https://github.com/rust-lang/rust/issues/39137
2022-10-16 17:51:30 +02:00
zyctree
5df03c2c18 update link in syntax.md 2022-10-16 23:41:32 +08:00
Sky
a6372525ce
Clarify the possible return values of len_utf16 2022-10-16 11:06:19 -04:00
Ralf Jung
39375e14d7
fix typo 2022-10-16 16:47:55 +02:00
Takayuki Maeda
0b6fa0d418 fix own_substs ICE 2022-10-16 22:24:27 +09:00
Guillaume Gomez
e77e5f3aee Clean up anchors.goml rustdoc GUI test 2022-10-16 15:15:03 +02:00
Guillaume Gomez
29e6b2ddb8 Update browser-ui-test version to 0.12.5 2022-10-16 14:12:24 +02:00
bors
ee2d9eddb6 Auto merge of #13354 - Veykril:try-stuff, r=Veykril
feat: Diagnose some incorrect usages of the question mark operator

Trying to figure out how the type stuff in r-a works some more, I think I am doing this correct here but I am not quite sure :)
2022-10-16 11:11:08 +00:00
Lukas Wirth
381366f1dd Diagnose incorrect usages of the question mark operator 2022-10-16 12:58:24 +02:00
bors
4876693708 Auto merge of #13408 - lowr:patch/bump-chalk-0.86, r=Veykril
Bump chalk

There's a bug in current chalk that prevents us from properly supporting GATs, which is supposed to be fixed in v0.86. Note the following:
- v0.86 is only going to be released next Sunday so I'll keep this PR as draft until then.
- This doesn't compile without https://github.com/rust-lang/chalk/pull/779, which I hope will be included in v0.86. I confirmed this compiles with it locally.

Two breaking changes from v0.84:
- `TypeFolder` has been split into `TypeFolder` and `FallibleTypeFolder` (https://github.com/rust-lang/chalk/pull/772)
- `ProjectionTy::self_type_parameter()` has been removed (https://github.com/rust-lang/chalk/pull/778)
2022-10-16 10:57:23 +00:00
Ryo Yoshida
310a72bf47
Bump chalk to 0.86
Two breaking changes:
- `TypeFolder` has been split into `TypeFolder` and `FallibleTypeFolder`
- `ProjectionTy::self_type_parameter()` has been removed
2022-10-16 19:23:34 +09:00
bors
8be3ce9056 Auto merge of #102334 - compiler-errors:rpitit-substs-issue, r=cjgillot
Fix subst issues with return-position `impl Trait` in trait

1. Fix an issue where we were rebase impl substs onto trait method substs, instead of trait substs
2. Fix an issue where early-bound regions aren't being mapped correctly for RPITIT hidden types

Fixes #102301
Fixes #102310
Fixes #102334
Fixes #102918
2022-10-16 10:10:44 +00:00
bors
8406380b5a Auto merge of #13421 - rust-lang:Veykril-patch-1, r=Veykril
Update guide.md to reflect support for proc-macros
2022-10-16 09:52:16 +00:00
Lukas Wirth
88d0efc243
Update guide.md to reflect support for proc-macros 2022-10-16 11:52:01 +02:00
bors
c09151c619 Auto merge of #13402 - HKalbasi:patch-1, r=Veykril
Cast runnableEnv items to string

fix #13390

An alternative approach could be raising an error if there is non string values.
2022-10-16 09:20:38 +00:00
bors
8267966180 Auto merge of #13420 - volsa:master, r=Veykril
fix: Ignore auto-import assist on parameter names

Fixes #13105; before & after

https://user-images.githubusercontent.com/29666622/195999489-0474c93a-b2bf-41c4-b7da-a4242a8082d8.mov

https://user-images.githubusercontent.com/29666622/195999571-605ee09c-bc6f-4ee5-bfe4-73e37254c647.mov
2022-10-16 08:42:24 +00:00
Ralf Jung
ddd5e983d1 PhantomData: inline a macro that is used only once 2022-10-16 10:37:51 +02:00
bors
11432fe952 Auto merge of #102080 - yanchen4791:issue-99824-fix, r=cjgillot
Fix missing explanation of where the borrowed reference is used when the same borrow occurs multiple times due to loop iterations

Fix #99824.

Problem of the issue:
If a borrow occurs in a loop, the borrowed reference could be invalidated at the same place at next iteration of the loop. When this happens, the point where the borrow occurs is the same as the intervening point that might invalidate the reference in the loop. This causes a problem for the current code finding the point where the resulting reference is used, so that the explanation of the cause will be missing. As the second point of "explain all errors in terms of three points" (see [leveraging intuition framing errors in terms of points"](https://rust-lang.github.io/rfcs/2094-nll.html#leveraging-intuition-framing-errors-in-terms-of-points), this explanation is very helpful for user to understand the error.

In the current implementation, the searching region for finding the location where the borrowed reference is used is limited to between the place where the borrow occurs and the place where the reference is invalidated. If those two places happen to be the same, which indicates that the borrow and invalidation occur at the same place in a loop, the search will fail.

One solution to the problem is when these two places are the same,  find the terminator of the loop, and then use the location of the loop terminator instead of the location of the borrow for the region to find the place where the borrowed reference is used.
2022-10-16 07:40:56 +00:00
bors
e928a4656f Auto merge of #103105 - JohnTitor:rollup-x4ivrix, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #101717 (Add documentation about the memory layout of `UnsafeCell<T>`)
 - #102023 (Add MaybeUninit array transpose From impls)
 - #103033 (Update pkg-config)
 - #103080 (pretty: fix to print some lifetimes on HIR pretty-print)
 - #103082 (Surround type with backticks)
 - #103088 (Fix settings page)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-16 04:54:29 +00:00
Michael Howell
834448163d rustdoc: make help button a no-op when on help page 2022-10-15 21:45:59 -07:00
Yuki Okushi
66a2bba309
Rollup merge of #103088 - GuillaumeGomez:fix-settings-page, r=notriddle
Fix settings page

Thanks to https://github.com/rust-lang/rust/pull/103060, I discovered that the settings page was badly rendered. This PR fixes it.

Before:
![Screenshot from 2022-10-15 16-02-41](https://user-images.githubusercontent.com/3050060/195990668-42e0b16b-3146-4864-b822-6f6a80fb77a5.png)

After:
![Screenshot from 2022-10-15 16-02-31](https://user-images.githubusercontent.com/3050060/195990664-20f967df-8989-4336-bca9-be52baab8e81.png)

r? ```@notriddle```
2022-10-16 11:41:14 +09:00
Yuki Okushi
b495c122e8
Rollup merge of #103082 - gimbles:patch-1, r=cjgillo
Surround type with backticks

Very smol PR. :)
2022-10-16 11:41:14 +09:00
Yuki Okushi
d08f4a6464
Rollup merge of #103080 - ohno418:fix-hir-pretty-print-lifetimes, r=cjgillot
pretty: fix to print some lifetimes on HIR pretty-print

HIR pretty-printer doesn't seem to print some lifetimes in types. This PR fixes that.

Closes https://github.com/rust-lang/rust/issues/85089
2022-10-16 11:41:13 +09:00
Yuki Okushi
3c0ea4af8b
Rollup merge of #103033 - alyssais:pkg-config, r=joshtriplett
Update pkg-config

I'd like to be able to cross-compile rustc in a scenario where it'd be really helpful to have cd3ccca7c3.  I've done some test builds of the compiler on x86_64 linux, targeting x86_64 linux and aarch64 linux.
2022-10-16 11:41:13 +09:00
Yuki Okushi
166f664037
Rollup merge of #102023 - SUPERCILEX:maybeuninit-transpose, r=scottmcm
Add MaybeUninit array transpose From impls

See discussion in https://github.com/rust-lang/rust/pull/101179 and https://github.com/rust-lang/rust/issues/96097. I believe this solution offers the simplest implementation with minimal future API regret.

`@RalfJung` mind doing a correctness review?
2022-10-16 11:41:12 +09:00
Yuki Okushi
cbc0a73c95
Rollup merge of #101717 - Pointerbender:unsafecell-memory-layout, r=Amanieu
Add documentation about the memory layout of `UnsafeCell<T>`

The documentation for `UnsafeCell<T>` currently does not make any promises about its memory layout. This PR adds this documentation, namely that the memory layout of `UnsafeCell<T>` is the same as the memory layout of its inner `T`.

# Use case
Without this layout promise, the following cast would not be legally possible:

```rust
fn example<T>(ptr: *mut T) -> *const UnsafeCell<T> {
  ptr as *const UnsafeCell<T>
}
```

A use case where this can come up involves FFI. If Rust receives a pointer over a FFI boundary which provides shared read-write access (with some form of custom synchronization), and this pointer is managed by some Rust struct with lifetime `'a`, then it would greatly simplify its (internal) API and safety contract if a `&'a UnsafeCell<T>` can be created from a raw FFI pointer `*mut T`. A lot of safety checks can be done when receiving the pointer for the first time through FFI (non-nullness, alignment, initialize uninit bytes, etc.) and these properties can then be encoded into the `&UnsafeCell<T>` type. Without this documentation guarantee, this is not legal today outside of the standard library.

# Caveats
Casting in the opposite direction is still not valid, even with this documentation change:

```rust
fn example2<T>(ptr: &UnsafeCell<T>) -> &mut T {
  let t = ptr as *const UnsafeCell<T> as *mut T;
  unsafe { &mut *t }
}
```

This is because the only legal way to obtain a mutable pointer to the contents of the shared reference is through [`UnsafeCell::get`](https://doc.rust-lang.org/std/cell/struct.UnsafeCell.html#method.get) and [`UnsafeCell::raw_get`](https://doc.rust-lang.org/std/cell/struct.UnsafeCell.html#method.raw_get). Although there might be a desire to also make this legal at some point in the future, that part is outside the scope of this PR. Also see this relevant [Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/transmuting.20.26.20-.3E.20.26mut).

# Alternatives
Instead of adding a new documentation promise, it's also possible to add a new method to `UnsafeCell<T>` with signature `pub fn from_ptr_bikeshed(ptr: *mut T) -> *const UnsafeCell<T>` which indirectly only allows one-way casting to `*const UnsafeCell<T>`.
2022-10-16 11:41:12 +09:00
bors
75dbd5b8c3 Auto merge of #102931 - camsteffen:inline-overlapping-impls, r=cjgillot
Make `overlapping_impls` not generic

Trying to win back perf from #101632.
2022-10-16 02:05:30 +00:00
Alex Saveau
393434c29e
Add MaybeUninit array transpose impls
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-10-15 15:57:19 -07:00
bors
ddc7fd9837 Auto merge of #100579 - joboet:sync_mutex_everywhere, r=thomcc
std: use `sync::Mutex` for internal statics

Since `sync::Mutex` is now `const`-constructible, it can be used for internal statics, removing the need for `sys_common::StaticMutex`. This adds some extra allocations on platforms which need to box their mutexes (currently SGX and some UNIX), but these will become unnecessary with the lock improvements tracked in #93740.

I changed the program argument implementation on Hermit, it does not need `Mutex` but can use atomics like some UNIX systems (ping `@mkroening` `@stlankes).`
2022-10-15 22:49:30 +00:00
Scott McMurray
5b9a02a87d More slice::partition_point examples 2022-10-15 14:03:56 -07:00
Vadim Petrochenkov
f767f2297d resolve: Shadow erroneous glob imports with erroneous single imports 2022-10-16 00:10:16 +04:00
Michael Howell
65f501e10f rustdoc: add test cases for links inside the help popover 2022-10-15 12:06:16 -07:00
Michael Howell
f0371d1238 rustdoc: update test cases for .sidebar-title -> .sidebar-elems h3 2022-10-15 11:53:53 -07:00
Michael Howell
6f59981a7a rustdoc: fix Ctrl-Click on help and settings links 2022-10-15 11:45:27 -07:00
Michael Howell
ae4ad9adb6 rustdoc: make the help button a link to a page
This allows you to open the help section in a new browser tab, which is a
pretty reasonable thing to want for a documentation page.
2022-10-15 11:38:42 -07:00
Michael Howell
e9b2922804 rustdoc: remove unused HTML class sidebar-title
Since 6a5f8b1aef, this class is no
longer styled.
2022-10-15 11:24:49 -07:00
Michael Goulet
4259f33305 typos 2022-10-15 17:49:32 +00:00
Michael Goulet
e994de803d Equate full fn signatures to infer all region variables 2022-10-15 17:46:05 +00:00
Michael Goulet
cb20758257 Add test 2022-10-15 17:46:04 +00:00
Michael Goulet
c1aa9bf849 Fix subst issues with RPITIT 2022-10-15 17:46:03 +00:00
Volkan Sagcan
dd4d3f0a09 fix #13105: Ignore auto-import assist on parameter names 2022-10-15 18:00:32 +02:00
philipp
4854e37dbc Documentation BTreeMap::append's behavior for already existing keys 2022-10-15 17:47:07 +02:00
Camille GILLOT
16e22e143d Mark derived StructuralEq as automatically derived. 2022-10-15 15:16:32 +00:00