Commit Graph

249807 Commits

Author SHA1 Message Date
dependabot[bot]
64c12e665b
Bump follow-redirects from 1.15.4 to 1.15.6 in /editors/code
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-16 06:57:29 +00:00
bors
ee03bd0581 Auto merge of #16851 - lnicola:ubuntu-20.04, r=lnicola
internal: Build releases on Ubuntu 20.04

Closes #16793
2024-03-16 06:45:16 +00:00
bors
7aa1de7ed8 Auto merge of #122559 - ForsakenHarmony:hrmny/update-llvm, r=nikic
Update LLVM submodule

LLVM version `18.1.1` + additional fixes.

Fixes https://github.com/Amanieu/corosensei/issues/23.
Fixes https://github.com/rust-lang/rust/issues/122252.
Fixes https://github.com/rust-lang/rust/issues/121996.
Fixes https://github.com/rust-lang/rust/issues/121960.
2024-03-16 06:35:05 +00:00
bors
c563f2ee79 Auto merge of #122371 - oli-obk:visit_nested_body, r=tmiasko
Stop walking the bodies of statics for reachability, and evaluate them instead

cc `@saethlin` `@RalfJung`

cc #119214

This reuses the `DefIdVisitor` from `rustc_privacy`, because they basically try to do the same thing.

This PR's changes can probably be extended to constants, too, but let's tackle that separately, it's likely more involved.
2024-03-16 04:35:02 +00:00
bors
c03ea3dfd9 Auto merge of #121926 - tgross35:f16-f128-step3-feature-gate, r=compiler-errors,petrochenkov
`f16` and `f128` step 3: compiler support & feature gate

Continuation of https://github.com/rust-lang/rust/pull/121841, another portion of https://github.com/rust-lang/rust/pull/114607

This PR exposes the new types to the world and adds a feature gate. Marking this as a draft because I need some feedback on where I did the feature gate check. It also does not yet catch type via suffixed literals (so the feature gate test will fail, probably some others too because I haven't belssed).

If there is a better place to check all types after resolution, I can do that. If not, I figure maybe I can add a second gate location in AST when it checks numeric suffixes.

Unfortunately I still don't think there is much testing to be done for correctness (codegen tests or parsed value checks) until we have basic library support. I think that will be the next step.

Tracking issue: https://github.com/rust-lang/rust/issues/116909

r? `@compiler-errors`
cc `@Nilstrieb`
`@rustbot` label +F-f16_and_f128
2024-03-16 02:02:00 +00:00
León Orell Valerian Liehr
a37fe00ea1
Remove obsolete parameter speculative from instantiate_poly_trait_ref 2024-03-16 02:33:21 +01:00
bors
05a2be3def Auto merge of #122575 - weihanglo:update-cargo, r=weihanglo
Update cargo

6 commits in 7065f0ef4aa267a7455e1c478b5ccacb7baea59c..2fe739fcf16c5bf8c2064ab9d357f4a0e6c8539b
2024-03-12 13:25:15 +0000 to 2024-03-15 21:39:18 +0000
- feat: Add 'open-namespaces' feature (rust-lang/cargo#13591)
- refactor: Expose source/spans to Manifest for emitting lints (rust-lang/cargo#13593)
- feat(tree): Control `--charset` via auto-detecting config value (rust-lang/cargo#13337)
- refactor(toml): Flatten manifest parsing (rust-lang/cargo#13589)
- fix: strip feature dep when dep is dev dep (rust-lang/cargo#13518)
- fix(ci): bump check error when PR is behind master (rust-lang/cargo#13581)

r? ghost
2024-03-16 00:03:52 +00:00
Josh Stone
8d374b1f2a Install the bad-alloc handler before fatal errors
The bad-alloc installer was incorrectly asserting that the other handler
isn't set yet, instead of checking its own, but we can avoid that by
changing the order we install them.

Ref: https://github.com/llvm/llvm-project/issues/83040
2024-03-15 16:49:08 -07:00
Josh Stone
adf57a75d5 Aggressively ignore write errors during bad-alloc 2024-03-15 16:48:16 -07:00
Weihang Lo
20b4b19369
Update cargo 2024-03-15 19:26:58 -04:00
Josh Stone
0ade5a11f5 Register LLVM handlers for bad-alloc / OOM
LLVM's default bad-alloc handler may throw if exceptions are enabled,
and `operator new` isn't hooked at all by default. Now we register our
own handler that prints a message similar to fatal errors, then aborts.
We also call the function that registers the C++ `std::new_handler`.
2024-03-15 15:49:06 -07:00
Guillaume Yziquel
3fc5ed8067 Issue 122262: MAP_PRIVATE for more reliability on virtualised filesystems.
Adding support of quirky filesystems occuring in virtualised settings not
having full POSIX support for memory mapped files. Example: current virtiofs
with cache disabled, occuring in Incus/LXD or Kata Containers. Has been
hitting various virtualised filesystems since 2016, depending on their levels
of maturity at the time. The situation will perhaps improve when virtiofs DAX
support patches will have made it into the qemu mainline.

On a reliability level, using the MAP_PRIVATE sycall flag instead of the
MAP_SHARED syscall flag for the mmap() system call does have some undefined
behaviour when the caller update the memory mapping of the mmap()ed file, but
MAP_SHARED does allow not only the calling process but other processes to
modify the memory mapping. Thus, in the current context, using MAP_PRIVATE
copy-on-write is marginally more reliable than MAP_SHARED.

This discussion of reliability is orthogonal to the type system enforced safety
policy of rust, which does not claim to handle memory modification of memory
mapped files triggered through the operating system and not the running rust
process.
2024-03-15 18:31:07 -04:00
bors
c67326b063 Auto merge of #122571 - matthiaskrgr:rollup-36wwovk, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #122254 (Detect calls to .clone() on T: !Clone types on borrowck errors)
 - #122495 (Visually mark 👻hidden👻 items with document-hidden-items)
 - #122543 (Add `#![rustc_never_type_mode = "..."]` crate-level attribute to allow experimenting)
 - #122560 (Safe Transmute: Use 'not yet supported', not 'unspecified' in errors)
 - #122562 (Mention labelled blocks in `break` docs)
 - #122563 (CI: cache PR CI Docker builds)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-15 21:18:36 +00:00
Matthias Krüger
948e03150b
Rollup merge of #122563 - Kobzol:ci-pr-caching, r=Mark-Simulacrum
CI: cache PR CI Docker builds

An attempt to restore Docker caching for PR CI workflows that share the Docker image with an auto/try workflow.

This was broken by my previous [PR](https://github.com/rust-lang/rust/pull/119290) that changed how we cache the Docker builds.

[Before](https://github.com/rust-lang/rust/pull/122545):
![image](https://github.com/rust-lang/rust/assets/4539057/05e0d347-af64-4e85-bc99-0e4ac07192ec)

After:
![image](https://github.com/rust-lang/rust/assets/4539057/2f657d60-b242-45eb-ac61-d8f71787edda)

r? ``@ghost``
2024-03-15 21:51:58 +01:00
Matthias Krüger
1745f3d405
Rollup merge of #122562 - Wilfred:break_keyword_docs, r=workingjubilee
Mention labelled blocks in `break` docs

`break` doesn't require a loop, so note this in the docs. This is covered in the linked sections of the rust reference, but this page implied that `break` is only for loops.
2024-03-15 21:51:58 +01:00
Matthias Krüger
b482523607
Rollup merge of #122560 - jswrenn:not-yet-supported, r=compiler-errors
Safe Transmute: Use 'not yet supported', not 'unspecified' in errors

We can (and will) support analyzing the transmutability of types whose layouts aren't completely specified by its repr. This change ensures that the error messages remain sensible after this support lands.

r? ``@compiler-errors``
2024-03-15 21:51:57 +01:00
Matthias Krüger
82d5b568b8
Rollup merge of #122543 - WaffleLapkin:never-flags, r=compiler-errors
Add `#![rustc_never_type_mode = "..."]` crate-level attribute to allow experimenting

Demonstrating how different approaches with the never type work is somewhat hard when you can't actually provide a runnable example. Let's add features that change the fallback behavior.

This adds `#![rustc_never_type_mode = "no_fallback"]` and `#![rustc_never_type_mode = "fallback_to_never"]`, but I also plan to add others (in future PRs).

cc ``@traviscross``
r? ``@compiler-errors``
2024-03-15 21:51:57 +01:00
Matthias Krüger
57f210400b
Rollup merge of #122495 - Manishearth:rustdoc-👻👻👻, r=GuillaumeGomez
Visually mark 👻hidden👻 items with document-hidden-items

Fixes #122485

This adds a 👻 in the item list (much like the 🔒 used for private items), and also shows `#[doc(hidden)]` in the code view, where `pub(crate)` etc gets shown for private items.

This does not do anything for enum variants, if people have ideas. I think we can just show the attribute.
2024-03-15 21:51:56 +01:00
Matthias Krüger
9e153ccd45
Rollup merge of #122254 - estebank:issue-48677, r=oli-obk
Detect calls to .clone() on T: !Clone types on borrowck errors

When encountering a lifetime error on a type that *holds* a type that doesn't implement `Clone`, explore the item's body for potential calls to `.clone()` that are only cloning the reference `&T` instead of `T` because `T: !Clone`. If we find this, suggest `T: Clone`.

```
error[E0502]: cannot borrow `*list` as mutable because it is also borrowed as immutable
  --> $DIR/clone-on-ref.rs:7:5
   |
LL |     for v in list.iter() {
   |              ---- immutable borrow occurs here
LL |         cloned_items.push(v.clone())
   |                             ------- this call doesn't do anything, the result is still `&T` because `T` doesn't implement `Clone`
LL |     }
LL |     list.push(T::default());
   |     ^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL |
LL |     drop(cloned_items);
   |          ------------ immutable borrow later used here
   |
help: consider further restricting this bound
   |
LL | fn foo<T: Default + Clone>(list: &mut Vec<T>) {
   |                   +++++++
```
```
error[E0505]: cannot move out of `x` because it is borrowed
  --> $DIR/clone-on-ref.rs:23:10
   |
LL | fn qux(x: A) {
   |        - binding `x` declared here
LL |     let a = &x;
   |             -- borrow of `x` occurs here
LL |     let b = a.clone();
   |               ------- this call doesn't do anything, the result is still `&A` because `A` doesn't implement `Clone`
LL |     drop(x);
   |          ^ move out of `x` occurs here
LL |
LL |     println!("{b:?}");
   |               ----- borrow later used here
   |
help: consider annotating `A` with `#[derive(Clone)]`
   |
LL + #[derive(Clone)]
LL | struct A;
   |
```

Fix #48677.
2024-03-15 21:51:56 +01:00
Markus Reiter
e4b27a2a5b
Fix unknown dwim-print command. 2024-03-15 21:08:06 +01:00
Markus Reiter
3ee1219088
Fix remaining LLDB commands. 2024-03-15 20:30:45 +01:00
bors
1ca424ca43 Auto merge of #122341 - compiler-errors:alias-wfness, r=lcnr
Consolidate WF for aliases

Make RPITs/TAITs/weak (type) aliases/projections all enforce:
1. their nominal predicates
2. their args are WF

This possibly does extra work, but is also nice for consistency sake.

r? lcnr
2024-03-15 19:19:35 +00:00
Jakub Beránek
07545959c5
CI: cache PR CI Docker builds 2024-03-15 19:12:15 +01:00
Jack Wrenn
107807d393 Safe Transmute: lowercase diagnostics 2024-03-15 17:55:49 +00:00
Wilfred Hughes
e1e719e1a1 Mention labelled blocks in break docs
`break` doesn't require a loop, so note this in the docs.
This is covered in the linked sections of the rust reference,
but this page implied that `break` is only for loops.
2024-03-15 10:51:57 -07:00
Maybe Waffle
adfdd273ae Add rustc_never_type_mode = "no_fallback" 2024-03-15 17:48:26 +00:00
Maybe Waffle
19bc337063 Add rustc_never_type_mode crate-level attribute to allow experimenting 2024-03-15 17:48:26 +00:00
Jack Wrenn
dc35339514 Safe Transmute: Use 'not yet supported', not 'unspecified' in errors
We can (and will) support analyzing the transmutability of types
whose layouts aren't completely specified by its repr. This change
ensures that the error messages remain sensible after this support
lands.
2024-03-15 17:42:29 +00:00
hrmny
f858f8727d
Update LLVM submodule 2024-03-15 17:49:50 +01:00
bors
72d78970ec Auto merge of #122555 - GuillaumeGomez:rollup-tr6wu54, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #114651 (rustdoc: add `--test-builder-wrapper` arg to support wrappers such as RUSTC_WRAPPER when building doctests)
 - #122468 (Cleanup `MirBorrowckCtxt::prefixes`)
 - #122496 (Greatly reduce GCC build logs)
 - #122512 (Cursor.rs documentation fix)
 - #122513 (hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id`)
 - #122530 (less symbol interner locks)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-15 16:39:42 +00:00
Guillaume Gomez
6ec4092eaf
Rollup merge of #122530 - klensy:as_str, r=fee1-dead
less symbol interner locks

This reduces instructions under 1% (in rustdoc run), but essentially free.
2024-03-15 17:24:10 +01:00
Guillaume Gomez
3d4464d4d7
Rollup merge of #122513 - petrochenkov:somehir4, r=fmease
hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id`

Also replace a few `hir_node()` calls with `hir_node_by_def_id()`.

Follow up to https://github.com/rust-lang/rust/pull/120943.
2024-03-15 17:24:09 +01:00
Guillaume Gomez
4002638a44
Rollup merge of #122512 - baitcode:2024-03-14-buffer-documentation-fix, r=Nilstrieb
Cursor.rs documentation fix

Reason:

I've been learning Rust std library and got confused. Seek trait documentation clearly states that negative indexes will cause an error. And the code in the Cursor example uses negative index. I found myself trying to understand what am I missing until I've actually executed the code and got error. I decided to submit small fix to the documentation.
2024-03-15 17:24:08 +01:00
Guillaume Gomez
5325c2bdd1
Rollup merge of #122496 - GuillaumeGomez:reduce-gcc-build-logs, r=Mark-Simulacrum
Greatly reduce GCC build logs

Fixes https://github.com/rust-lang/rust-log-analyzer/issues/80.

Based on [makefile documentation](https://www.gnu.org/software/make/manual/html_node/Options-Summary.html#index-_002d_002dquiet-1) and [configure documentation](https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/configure-Invocation.html).

cc `@RalfJung` `@antoyo`
2024-03-15 17:24:08 +01:00
Guillaume Gomez
5c0012b953
Rollup merge of #122468 - beepster4096:borrowck_prefixes_cleanup, r=Nadrieril
Cleanup `MirBorrowckCtxt::prefixes`

Some of the uses of this method aren't necessary anymore and `PrefixSet::Supporting` is not used anywhere.

With `PrefixSet::Supporting` removed, this could technically be moved to an extension trait on `PlaceRef`. However, it would have to be moved back to `MirBorrowckCtxt` when the `Derefer` MIR pass is moved before borrowck so I didn't.
2024-03-15 17:24:07 +01:00
Guillaume Gomez
47be8e8b8b
Rollup merge of #114651 - tmfink:rustdoc-rustc-wrapper, r=GuillaumeGomez
rustdoc: add `--test-builder-wrapper` arg to support wrappers such as RUSTC_WRAPPER when building doctests

Currently, `rustdoc` builds test crates with `rustc` directly instead of using [`RUSTC_WRAPPER`](https://doc.rust-lang.org/cargo/reference/config.html#buildrustc-wrapper) (if any is set).

This causes build issues in build systems that use `cargo` but tweak linking flags by setting the `RUSTC_WRAPPER` environment variable.

This change is not meant to be final--it's only a minimal proof of concept.
Please advise on the best way to proceed.

Open questions:
- [x] Does supporting the `rustc` wrappers make sense?
    - yes, `cargo-miri` for example needs a "hack" to workaround the issue
- [X] What environment variable(s) should be read for the rustc wrapper? Should `rustdoc` [use the same names as `cargo`](https://doc.rust-lang.org/cargo/reference/config.html#buildrustc-wrapper)?
    - None, since `rustdoc` takes arguments
- [X] What name should be used for a `rustdoc` CLI option?
    - `--test-builder-wrapper`
- [X] Should a separate workspace wrapper (like `RUSTC_WORKSPACE_WRAPPER`) be supported?
    - `--test-builder-wrapper` can be passed multiple times to get multiple wrappers passed
- [X] How/where should this be documented? It's not obvious to all users that `cargo doc` actually causes `rustdoc` to compile tests with rust
    - Added doc to `src/doc/rustdoc/src/command-line-arguments.md` per `@GuillaumeGomez`
2024-03-15 17:24:07 +01:00
Laurențiu Nicola
bf89762204 Build releases on Ubuntu 20.04 2024-03-15 18:16:11 +02:00
Guillaume Gomez
c4ece1f4c8 Build GCC with as many threads as available 2024-03-15 16:16:27 +01:00
Guillaume Gomez
e126ceb46d Greatly reduce GCC build logs 2024-03-15 16:16:27 +01:00
Markus Reiter
96431e4b82
Use explicit LLDB commands instead of print/p aliases. 2024-03-15 15:38:03 +01:00
bors
d7ec7a5441 Auto merge of #16847 - HKalbasi:test-explorer, r=HKalbasi
Distinguish integration tests from crates in test explorer

Fix part of #16827
2024-03-15 14:25:53 +00:00
bors
c5b571310d Auto merge of #121297 - michaelwoerister:set-pdb-alt-path, r=wesleywiser
link.exe: Don't embed full path to PDB file in binary.

This PR makes `rustc` unconditionally pass `/PDBALTPATH:%_PDB%` to MSVC-style linkers, causing the linker to only embed the filename of the PDB in the binary instead of the full path. This will help implement the [trim-paths RFC](https://github.com/rust-lang/rust/issues/111540) for `*-msvc` targets.

Passing `/PDBALTPATH:%_PDB%` to the linker is already done by many projects that need reproducible builds and [debugger's should still be able to find the PDB](https://learn.microsoft.com/cpp/build/reference/pdbpath) if it is in the same directory as the binary.

r? `@ghost`

Fixes https://github.com/rust-lang/rust/issues/87825
2024-03-15 14:14:34 +00:00
hkalbasi
dcfc9ccace Distinguish integration tests from crates in test explorer 2024-03-15 17:16:28 +03:30
bors
f9a4d05195 Auto merge of #16845 - HKalbasi:test-explorer, r=HKalbasi
Show compilation progress in test explorer

Fix part of #16827
2024-03-15 13:15:35 +00:00
roife
10aa999c74 fix: typo 2024-03-15 21:14:17 +08:00
roife
d40c0fe48b test: add test for extract_module 2024-03-15 21:05:04 +08:00
roife
513c6d35ed fix: re-insert use stmts that is extracted 2024-03-15 21:04:51 +08:00
hkalbasi
eeff20d172 Show compilation progress in test explorer 2024-03-15 16:28:59 +03:30
bors
d763e05182 Auto merge of #16844 - Veykril:macarons, r=Veykril
internal: Replace `Span` with `SyntaxContextId` in `MacroCallLoc`

This makes these a lot more stable again
2024-03-15 12:32:06 +00:00
bors
accc516128 Auto merge of #122538 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2024-03-15 12:03:12 +00:00