Commit Graph

239265 Commits

Author SHA1 Message Date
Michael Howell
acc74c085d rustdoc: update book with info on type bindings 2023-11-19 18:54:36 -07:00
Michael Howell
63c50712f4 rustdoc-search: add support for associated types 2023-11-19 18:54:36 -07:00
bors
4f3da903a4 Auto merge of #116828 - compiler-errors:nightlyify-rustc_type_ir, r=jackh726
Begin to abstract `rustc_type_ir` for rust-analyzer

This adds the "nightly" feature which is used by the compiler, and falls back to more simple implementations when that is not active.

r? `@lcnr` or `@jackh726`
2023-11-19 22:55:15 +00:00
Tomasz Miąsko
525a64fa81 Use let else to reduce indentation 2023-11-19 22:55:31 +01:00
bors
9a66e4471f Auto merge of #117683 - estebank:priv-builder-sugg, r=cjgillot
When encountering struct fn call literal with private fields, suggest all builders

When encountering code like `Box(42)`, suggest `Box::new(42)` and *all* other associated functions that return `-> Box<T>`.

Add a way to give pre-sorted suggestions.
2023-11-19 20:58:16 +00:00
Michael Goulet
488dcb7af3 Ignore but do not assume region obligations from unifying headers in negative coherence 2023-11-19 19:20:02 +00:00
Michael Goulet
8f267e2b87 Make regionck care about placeholders in outlives components 2023-11-19 19:12:20 +00:00
Antoni Boucher
326f24172a Pass TyCtxt by value 2023-11-19 14:04:40 -05:00
bors
d19980e1ce Auto merge of #117500 - RalfJung:aggregate-abi, r=davidtwco
Ensure sanity of all computed ABIs

This moves the ABI sanity assertions from the codegen backend to the ABI computation logic. Sadly, due to past mistakes, we [have to](https://github.com/rust-lang/rust/pull/117351#issuecomment-1788495503) be able to compute a sane ABI for nonsensical function types like `extern "C" fn(str) -> str`.  So to make the sanity check pass we first need to make all ABI adjustment deal with unsized types... and we have no shared infrastructure for those adjustments, so that's a bunch of copy-paste. At least we have assertions failing loudly when one accidentally sets a different mode for an unsized argument.

To achieve this, this re-lands the parts of https://github.com/rust-lang/rust/pull/80594 that got reverted in https://github.com/rust-lang/rust/pull/81388.  To avoid breaking wasm ABI again, that ABI now explicitly opts-in to the (wrong, broken) ABI that we currently keep for backwards compatibility. That's still better than having *every* ABI use the wrong broken default!

Cc `@bjorn3`
Fixes https://github.com/rust-lang/rust/issues/115845
2023-11-19 18:42:20 +00:00
Antoni Boucher
fa696af987 Merge commit '2e8386e9fb3506cef991d04f8b3bc78f9a0c2630' into subtree-update_cg_gcc_2023-11-17 2023-11-19 13:42:13 -05:00
Ben Kimock
0ec82fa9d3 tag-gc -> provenance-gc 2023-11-19 13:29:02 -05:00
Ben Kimock
0d0a41789f Expand Miri's BorTag GC to a Provenance GC 2023-11-19 13:29:02 -05:00
Esteban Küber
ac56b06b44 fix rebase 2023-11-19 18:07:22 +00:00
Esteban Küber
b0d7ccb133 fmt 2023-11-19 17:50:47 +00:00
Esteban Küber
a519c9b6b7 review comments 2023-11-19 17:50:47 +00:00
Esteban Küber
4d16171f56 Account for number of arguments in suggestion 2023-11-19 17:50:47 +00:00
Esteban Küber
00265f0cc0 fix tidy 2023-11-19 17:50:47 +00:00
Esteban Küber
69edf8e784 Suggest Default::default() for struct literals with private fields 2023-11-19 17:50:47 +00:00
Esteban Küber
be0958f5ab Suggest builder functions on struct literal with private fields 2023-11-19 17:50:47 +00:00
Esteban Küber
1dfec45dc9 Remove unnecessary .collect() 2023-11-19 17:50:47 +00:00
Esteban Küber
987155f35d Suggest using builder on curly brace struct called as fn 2023-11-19 17:50:46 +00:00
Esteban Küber
12a8bb8d9b Do not suggest struct literal when fields are private 2023-11-19 17:50:46 +00:00
Esteban Küber
e0e379b6fd Add test for public struct with private fields 2023-11-19 17:50:46 +00:00
Esteban Küber
a4f47de7ff On private tuple struct, suggest Default::default when possible 2023-11-19 17:50:46 +00:00
Esteban Küber
f1ae02f4bd Don't sort span_suggestions, leave that to caller 2023-11-19 17:50:45 +00:00
Esteban Küber
42aa1273b0 When encountering struct fn call literal with private fields, suggest all builders
When encountering code like `Box(42)`, suggest `Box::new(42)` and *all*
other associated functions that return `-> Box<T>`.
2023-11-19 17:47:41 +00:00
Nilstrieb
13959bf376 Avoid iterating over hashmaps in astconv 2023-11-19 17:45:02 +01:00
bors
290fc68f2d Auto merge of #117888 - notriddle:notriddle/releases, r=Mark-Simulacrum
doc: add release notes to standalone doc bundle

Preview: http://notriddle.com/rustdoc-html-demo-5/release-notes/releases.html

This is a workaround for #101714 on top of being a useful addition in its own right. It is intended to change the "canonical URL" for viewing the release notes from GitHub, which is relatively slow, to a pre-rendered HTML file that loads from the same CDN as the standard library docs. It also means you get a copy of the release notes when installing the rust-docs with rustup.
2023-11-19 16:44:55 +00:00
Nilstrieb
5e32da567e Add documentation for some queries 2023-11-19 17:26:24 +01:00
Nilstrieb
251e75ced6 Explicitly unset $CARGO for compiletest
Some UI tests trigger behavior in rustc where it reads $CARGO and changes behavior if it exists.
To make the tests work that rely on it not being set, make sure it is not set.

By default, this is not set, but people may do weird hacks
that cause it to be set.
2023-11-19 17:05:49 +01:00
Ralf Jung
c7b8dd4e93 make_direct_deprecated: dont overwrite already set attributes 2023-11-19 16:03:07 +01:00
Michael Howell
0bf77206ad Fix outdated doc comment on Releases doc build step 2023-11-19 08:01:17 -07:00
bors
27794f95fd Auto merge of #118024 - notriddle:notriddle/search-speed, r=GuillaumeGomez
rustdoc-search: optimize unifyFunctionTypes

Final profile output:
https://notriddle.com/rustdoc-html-demo-5/profile-4/index.html

This PR contains three commits that improve performance of this hot inner loop: reduces the number of allocations, a fast path for the 1-element basic query case, and reconstructing the multi-element query case to use recursion instead of an explicit `backtracking` array. It also adds new test cases that I found while working on this.

r? `@GuillaumeGomez`
2023-11-19 14:47:08 +00:00
antoyo
2e8386e9fb
Merge pull request #387 from rust-lang/sync_from_rust_2023_11_17
Sync from rust 2023/11/17
2023-11-19 09:28:06 -05:00
The 8472
f34e7f4768 Don't set cmsg fields in msghdr if we have no cmsg to send 2023-11-19 15:19:47 +01:00
Ralf Jung
cfb47ca5df disable csky test on CI 2023-11-19 15:01:33 +01:00
bors
097261f241 Auto merge of #118054 - max-niederman:pinned-must-use, r=Nilstrieb
Lint pinned `#[must_use]` pointers (in particular, `Box<T>` where `T` is `#[must_use]`) in `unused_must_use`.

Fixes: #111458

This is motivated by a common async/await pattern:

```rs
fn foo() -> Pin<Box<dyn Future<Output = i32>>> {
    Box::pin(async { 42 })
}

// call `foo`, but forget to await the result
foo();
```

Unlike with `async fn` or return position `impl Future`, this does not currently warn the user that the `Future` is unused.

To fix this, I've extended the `unused_must_use` lint to catch `Pin<P>`, where `P` must be used. In particular, this applies to `Pin<Box<T>>`, where `T` must be used. I'm not sure if there are other pointers where this applies, but I can't think of any situation the user wouldn't want to be warned.
2023-11-19 12:23:59 +00:00
bors
10a98e8bff Auto merge of #118051 - GuillaumeGomez:cleanup-rustdoc, r=notriddle
Remove unneeded `unknown` variable and `Symbol` creation when iterating over items in rustdoc rendering

I realized that we were creating a `Symbol` but never actually used it since we check that `item.name` is always `Some()`.

r? `@notriddle`
2023-11-19 09:40:47 +00:00
bors
d0474fba92 Auto merge of #117807 - RalfJung:raw-str-slice, r=davidtwco
patterns: don't ice when encountering a raw str slice

Fixes https://github.com/rust-lang/rust/issues/117806
2023-11-19 07:44:43 +00:00
bors
7d0e1bca0f Auto merge of #117364 - BlackHoleFox:farewell-bitcode-no-remorse, r=davidtwco
Remove legacy bitcode defaults from all Apple specs

Xcode 14 [deprecated bitcode with warnings](https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations) and now [Xcode 15 has dropped it completely](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Deprecations). `rustc` should follow what the platform tooling is doing as well since it just increases binary sizes for no gain at this point.

`cc` made a [similar change last month](https://github.com/rust-lang/cc-rs/pull/812).

Two things show this should have minimal impact:
- Apple has stopped accepting apps built with versions of Xcode (<14) that generate bitcode
- The app store has been stripping bitcode off IPA releases for over 2 years now.

I didn't nuke all the bitcode changes added in https://github.com/rust-lang/rust/pull/71970/ since maybe another target in the future could need mandatory bitcode embedding.

Staticlibs built for iOS still link correctly with XCode 15 against a test app when using a compiler built from this branch.

cc `@thomcc` `@keith`
2023-11-19 05:35:08 +00:00
Max Niederman
c5ed7b0ead
add test for pinned must_use pointers 2023-11-18 21:01:02 -08:00
Max Niederman
173b950311
catch pinned must_use types in unused_must_use 2023-11-18 20:04:50 -08:00
bors
d052f6fde6 Auto merge of #117895 - mzohreva:mz/fix-sgx-backtrace, r=Mark-Simulacrum
Adjust frame IP in backtraces relative to image base for SGX target

This is followup to https://github.com/rust-lang/backtrace-rs/pull/566.

The backtraces printed by `panic!` or generated by `std::backtrace::Backtrace` in SGX target are not usable. The frame addresses need to be relative to image base address so they can be used for symbol resolution. Here's an example panic backtrace generated before this change:

```
$ cargo r --target x86_64-fortanix-unknown-sgx
...
stack backtrace:
   0:     0x7f8fe401d3a5 - <unknown>
   1:     0x7f8fe4034780 - <unknown>
   2:     0x7f8fe401c5a3 - <unknown>
   3:     0x7f8fe401d1f5 - <unknown>
   4:     0x7f8fe401e6f6 - <unknown>
```
Here's the same panic after this change:
```
$ cargo +stage1 r --target x86_64-fortanix-unknown-sgx
stack backtrace:
   0:            0x198bf - <unknown>
   1:            0x3d181 - <unknown>
   2:            0x26164 - <unknown>
   3:            0x19705 - <unknown>
   4:            0x1ef36 - <unknown>
```
cc `@jethrogb` and `@workingjubilee`
2023-11-19 03:00:18 +00:00
bors
0d3dfb5296 Auto merge of #117868 - ferrocene:pa-omit-git-hash, r=Mark-Simulacrum
Set `CFG_OMIT_GIT_HASH=1` during builds when `omit-git-hash` is enabled

This environment variable will allow tools like Cargo to disable their own detection when `omit-git-hash` is set to `true`.

I created this PR because of https://github.com/rust-lang/cargo/pull/12968. There is not a dependency between the two PRs, they can land in any order. They just won't do anything until both of them are merged into the repo.
2023-11-19 01:05:22 +00:00
Michael Howell
a3d90036c5 Do not call dry_run twice
Co-authored-by: Onur Özkan <onurozkan.dev@outlook.com>
2023-11-18 16:21:44 -07:00
Michael Howell
d82b3748d5 rustdoc-search: switch to recursive backtracking
This is significantly faster, because

- It allows the one-element fast path to kick in on multi-
  element queries.
- It constructs intermediate data structures more lazily
  than the old system did.

It's measurably faster than the old algo even without the fast path, but
that fast path still helps significantly.
2023-11-18 16:12:43 -07:00
bors
ea6b131132 Auto merge of #117813 - onur-ozkan:simplify-download-ci-llvm-option, r=Mark-Simulacrum
deprecate `if-available` value of `download-ci-llvm`

This PR deprecates the use of the `if-available` value for `download-ci-llvm` since `if-unchanged` serves the same purpose when no changes are detected. In cases where changes are present, it is assumed that compiling LLVM is acceptable (otherwise, why make changes there?).

This was probably missing in the #110087 issue before.

cc `@RalfJung`
2023-11-18 23:02:12 +00:00
Guillaume Gomez
1e55fc1243 Remove unneeded unknown variable and Symbol creation when iterating over items in rustdoc rendering 2023-11-18 23:05:30 +01:00
bors
4cb3beec86 Auto merge of #118046 - TaKO8Ki:rollup-6jdgwe5, r=TaKO8Ki
Rollup of 5 pull requests

Successful merges:

 - #116750 (Add Seek::seek_relative)
 - #117110 (Suggest field typo through derefs)
 - #117961 (Add `x suggest` entries for testing `mir-opt` and `coverage`)
 - #118020 (Fix links to `From<{OwnedHandle, OwnedFd}> for std::process::Child{Stdin, Stdout, Stderr}` in 1.74 release notes)
 - #118034 (bump few deps to fix unsoundness and drop few dup deps)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-18 21:03:01 +00:00
Takayuki Maeda
62e71fada6
Rollup merge of #118034 - klensy:dep-up-18-11-23, r=Mark-Simulacrum
bump few deps to fix unsoundness and drop few dup deps

jsondocck: bump jsonpath to 0.3, dropping few dup dependencies
changes: https://github.com/freestrings/jsonpath/compare/v0.2.6...v0.3.0

self_cell: bump to 0.10.3 due to RUSTSEC-2023-0070
https://rustsec.org/advisories/RUSTSEC-2023-0070.html https://github.com/Voultapher/self_cell/issues/49

bump h2 to 0.3.22, dropping few dup crate versions
https://github.com/hyperium/h2/blob/v0.3.22/CHANGELOG.md
2023-11-19 04:14:42 +09:00