Commit Graph

236187 Commits

Author SHA1 Message Date
bors fcab24817c Auto merge of #116705 - pitaj:android-revert, r=workingjubilee
Revert "Invoke `backtrace-rs` buildscript in `std` buildscript"

This reverts commit 93677276bc because it caused issues for projects building the standard library with non-cargo build systems.

See https://github.com/rust-lang/rust/pull/116318#issuecomment-1761977900

r? workingjubilee
2023-10-13 21:38:50 +00:00
Michael Goulet 3f2574e8ba Test that RPITITs have RPIT scope and not impl-wide scope 2023-10-13 21:01:36 +00:00
Michael Goulet ef04c9795b Deprecate E0706 2023-10-13 21:01:36 +00:00
Michael Goulet 59315b8a63 Stabilize AFIT and RPITIT 2023-10-13 21:01:36 +00:00
Esteban Küber feedd68f80 Remove some unnecessary `unwrap`s 2023-10-13 20:36:41 +00:00
Trevor Gross 227c844b16 Stabilize 'atomic_from_ptr', move const gate to 'const_atomic_from_ptr' 2023-10-13 16:10:33 -04:00
Trevor Gross 3209d2d46e Correct documentation for `atomic_from_ptr`
* Remove duplicate alignment note that mentioned `AtomicBool` with other
  types
* Update safety requirements about when non-atomic operations are
  allowed
2023-10-13 16:10:29 -04:00
Peter Jaszkowiak 49aa5a23ca Revert "Invoke `backtrace-rs` buildscript in `std` buildscript"
This reverts commit 93677276bc
because it caused issues for projects building the standard
library with non-cargo build systems.
2023-10-13 13:43:00 -06:00
bors 09eff44889 Auto merge of #116645 - estebank:issue-116608, r=oli-obk
Detect ruby-style closure in parser

When parsing a closure without a body that is surrounded by a block, suggest moving the opening brace after the closure head.

Fix #116608.
2023-10-13 19:26:27 +00:00
Michael Goulet 362b75badf Fix AFIT lint message to mention pitfall 2023-10-13 19:13:18 +00:00
Augie Fackler 321572503d linker: also pass debuginfo compression flags
We support compressing debuginfo during codegen, but until this patch we
didn't pass the flag to the linker. Doing so means we'll respect the
requested compression even when building binaries or dylibs. This
produces much smaller binaries: in my testing a debug build of ripgrep
goes from 85M to 32M, and the target/ directory (after a clean build in
both cases) goes from 508M to 329M just by enabling zlib compression of
debuginfo.
2023-10-13 13:49:36 -04:00
bors 57ef889852 Auto merge of #116233 - DaniPopes:stabilize-const_maybe_uninit_assume_init_read, r=dtolnay
Stabilize `const_maybe_uninit_assume_init_read`

AFAICT the only reason this was not included in the `maybe_uninit_extra` stabilization was because `ptr::read` was unstable (https://github.com/rust-lang/rust/pull/92768#issuecomment-1011101383), which has since been stabilized in 1.71.

Needs a separate FCP from the [original `maybe_uninit_extra` one](https://github.com/rust-lang/rust/issues/63567#issuecomment-964428807).

Tracking issue: #63567
2023-10-13 17:11:03 +00:00
Chris Wailes 166c353484 Lowercase the feature flags for riscv64-linux-android 2023-10-13 10:01:14 -07:00
bors 985795270e Auto merge of #115108 - ijackson:broken-wait-status, r=dtolnay
Fix exit status / wait status on non-Unix cfg(unix) platforms

Fixes #114593

Needs FCP due to behavioural changes (NB only on non-Unix `#[cfg(unix)]` platforms).

Also, I think this is likely to break in CI.  I have not been yet able to compile the new bits of `process_unsupported.rs`, although I have compiled the new module.  I'd like some help from people familiar with eg emscripten and fuchsia (which are going to be affected, I think).
2023-10-13 14:53:35 +00:00
Caio 6b59f6fbea Misc improvements 2023-10-13 10:22:33 -03:00
Deadbeef eae6e02eba Fix a comment 2023-10-13 12:57:38 +00:00
daxpedda dd34d9027a
Add some optimizations 2023-10-13 14:54:33 +02:00
daxpedda 6db2587999
Implement `OnceCell/Lock::try_insert()` 2023-10-13 14:54:32 +02:00
bors 193e8a196b Auto merge of #116670 - oli-obk:host_docs, r=fmease
Hide host effect params from docs

addresses (only on nightly, needs backport) https://github.com/rust-lang/rust/issues/116629

r? `@compiler-errors`

cc `@GuillaumeGomez` `@fee1-dead`
2023-10-13 12:38:18 +00:00
Oli Scherer 16f8396f6d Add some FIXMEs for remaining issues that we need to fix before using more const trait things in libcore 2023-10-13 11:04:01 +00:00
bors 34bc5716b5 Auto merge of #116676 - estebank:issue-116658, r=compiler-errors
On type error involving closure, avoid ICE

When we encounter a type error involving a closure, we try to typeck prior closure invocations to see if they influenced the current expected type. When trying to do so, ensure that the closure was defined in our current scope.

Fix #116658.
2023-10-13 10:29:55 +00:00
lcnr 1bc6ae4401 explicitly handle auto trait leakage in coherence 2023-10-13 09:42:51 +00:00
Oğuz Ağcayazı d6a55d3409 change fn name, return loc info, local name 2023-10-13 11:44:38 +03:00
bors a4a10bdf29 Auto merge of #116666 - Urgau:check-cfg-pre-mcp636, r=petrochenkov
Improve check-cfg diagnostics

This PR tries to improve some of the diagnostics of check-cfg.

The main changes is the unexpected name or value being added to the main diagnostic:
```diff
- warning: unexpected `cfg` condition name
+ warning: unexpected `cfg` condition name: `widnows`
```

It also cherry-pick the better sensible logic for when we print the list of expected values when we have a matching value for a very similar name.

Address https://github.com/rust-lang/rust/pull/111072#discussion_r1356818100

r? `@petrochenkov`
2023-10-13 08:37:27 +00:00
bors 2763ca50da Auto merge of #116619 - nnethercote:rustc_driver_impl, r=compiler-errors
Streamline `rustc_driver_impl` pretty-printing.

This PR simplifies a lot of unnecessary structure in
`rustc_driver_impl/src/pretty.rs`. It removes some traits and functions,
simplifies some structs, renames some things for increased consistency, and
eliminates some boilerplate code. Overall it cuts more than 150 lines of code.

r? `@compiler-errors`
2023-10-13 05:35:29 +00:00
Chris Denton 2f5dea0978
Test that unix sockets exist on Windows 2023-10-13 06:02:38 +01:00
Chris Denton 2b7fe7e0a1
Make try_exists return Ok(true) for Windows UDS
`fs::try_exists` currently fails on Windows if encountering a Unix Domain Socket (UDS). Fix this by checking for an error code that's returned when there's a failure to use a reparse point.

A reparse point is a way to invoke a filesystem filter on a file instead of the file being opened normally. This is used to implement symbolic links (by redirecting to a different path) but also to implement other types of special files such as Unix domain sockets. If the reparse point is not a link type then opening it with `CreateFileW` may fail with `ERROR_CANT_ACCESS_FILE` because the filesystem filter does not implement that operation. This differs from resolving links which may fail with errors such as `ERROR_FILE_NOT_FOUND` or `ERROR_CANT_RESOLVE_FILENAME`.

So `ERROR_CANT_ACCESS_FILE` means that the file exists but that we can't open it normally. Still, the file does exist so `try_exists` should report that as `Ok(true)`.
2023-10-13 06:02:18 +01:00
bors 130ff8cb6c Auto merge of #115964 - bjorn3:cgu_reuse_tracker_global_state, r=cjgillot
Remove cgu_reuse_tracker from Session

This removes a bit of global mutable state.

It will now miss post-lto cgu reuse when ThinLTO determines that a cgu doesn't get changed, but there weren't any tests for this anyway and a test for it would be fragile to the exact implementation of ThinLTO in LLVM.
2023-10-13 00:09:30 +00:00
Esteban Küber e7618756c0 On type error involving closure, avoid ICE
When we encounter a type error involving a closure, we try to typeck
prior closure invocations to see if they influenced the current expected
type. When trying to do so, ensure that the closure was defined in our
current scope.

Fix #116658.
2023-10-12 23:29:02 +00:00
Joshua Liebow-Feeser a9b0966aa5
Update library/core/src/alloc/layout.rs
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2023-10-12 16:03:45 -07:00
Esteban Küber 6b2c6c7fd3 Detect ruby-style closure in parser
When parsing a closure without a body that is surrounded by a block,
suggest moving the opening brace after the closure head.

Fix #116608.
2023-10-12 21:50:18 +00:00
bors e20cb77021 Auto merge of #116391 - Nadrieril:constructorset, r=cjgillot
exhaustiveness: Rework constructor splitting

`SplitWildcard` was pretty opaque. I replaced it with a more legible abstraction: `ConstructorSet` represents the set of constructors for patterns of a given type. This clarifies responsibilities: `ConstructorSet` handles one clear task, and diagnostic-related shenanigans can be done separately.

I'm quite excited, I had has this in mind for years but could never quite introduce it. This opens up possibilities, including type-specific optimisations (like using a `FxHashSet` to collect enum variants, which had been [hackily attempted some years ago](https://github.com/rust-lang/rust/pull/76918)), my one-pass rewrite (https://github.com/rust-lang/rust/pull/116042), and future librarification.
2023-10-12 21:33:31 +00:00
Nicholas Nethercote 2b4c33817a Remove unneeded `pub`s. 2023-10-13 06:35:19 +11:00
Nicholas Nethercote 2e2924f263 Split and rename the annotation structs.
`NoAnn` and `IdentifiedAnnotation` impl both `pprust_ast::PpAnn` and
`pprust_hir::PpAnn`, which is a bit confusing, because the optional
`tcx` is only needed for the HIR cases. (Currently the `tcx` is
unnecessarily provided in the `expanded` AST cases.)

This commit splits each one into `Ast` and `Hir` versions, which makes
things clear about where the `tcx` is needed. The commit also renames
all the traits so they consistently end with `Ann`.
2023-10-13 06:35:19 +11:00
Nicholas Nethercote b65227a9ee Make `needs_analysis` true for `PpHirMode::Typed`.
This avoids the need for a bespoke `tcx.analysis()` call.
2023-10-13 06:35:19 +11:00
Nicholas Nethercote ba58e3213d Rename some `'hir` lifetimes as `'tcx`.
Because they all end up within a `TyCtxt`.
2023-10-13 06:35:19 +11:00
Nicholas Nethercote 060851b764 Remove pretty-printing traits.
`call_with_pp_support_ast` and `call_with_pp_support_hir` how each have
a single call site. This commit inlines and removes them, which also
removes the need for all the supporting traits: `Sess`,
`AstPrinterSupport`, and `HirPrinterSupport`. The `sess` member is also
removed from several structs.
2023-10-13 06:35:17 +11:00
Nicholas Nethercote 7d145a0fde Merge `print_*` functions.
The handling of the `PpMode` variants is currently spread across three
functions: `print_after_parsing`, `print_after_hir_lowering`, and
`print_with_analysis`. Each one handles some of the variants. This split
is primarily because `print_after_parsing` has slightly different
arguments to the other two.

This commit changes the structure. It merges the three functions into a
single `print` function, and encapsulates the different arguments in a
new enum `PrintExtra`.

Benefits:
- The code is a little shorter.
- All the `PpMode` variants are handled in a single `match`, with no
  need for `unreachable!` arms.
- It enables the trait removal in the subsequent commit by reducing
  the number of `call_with_pp_support_ast` call sites from two to one.
2023-10-13 06:34:55 +11:00
Nicholas Nethercote e3d8bbbfe2 Simplify support traits.
First, both `AstPrinterSupport` and `HirPrinterSupport` have a `sess`
method. This commit introduces a `Sess` trait and makes the support
traits be subtraits of `Sess`, to avoid some duplication.

Second, both support traits have a `pp_ann` method that isn't needed if
we enable `trait_upcasting`. This commit removes those methods.

(Both of these traits will be removed in a subsequent commit, as will
the `trait_upcasting` use.)
2023-10-13 06:20:11 +11:00
Nicholas Nethercote d5e7c5f3cc Remove unused `PrinterSupport::hir_map` method. 2023-10-13 06:20:11 +11:00
Nicholas Nethercote 1467ba06b6 Remove PpAstTreeMode.
It's simpler to distinguish the two AST modes directly in `PpMode`.
2023-10-13 06:20:11 +11:00
Nicholas Nethercote 87090a97e3 Remove an outdated comment.
`phase_3_run_analysis_passes` no longer exists, and AFAICT this code has
been refactored so much since this comment was written that it no longer
has any useful meaning.
2023-10-13 06:20:11 +11:00
Nicholas Nethercote c5cfcdc4ac Remove unnecessary call to `call_with_pp_support_hir`.
The callback is trivial and no pp support is actually needed. This makes
the `HirTree` case more like the `AstTree` case above.
2023-10-13 06:20:11 +11:00
Nicholas Nethercote ef8701a4a0 Rename some things.
- Rename `pprust` as `pprust_ast`, to align with `pprust_hir`.
- Rename `PrinterSupport` as `AstPrinterSupport`, to align with
  `HirPrinterSupport`.
2023-10-13 06:20:11 +11:00
bors df4379b4eb Auto merge of #116510 - scottmcm:no-1-simd-v2, r=compiler-errors
Copy 1-element arrays as scalars, not vectors

For `[T; 1]` it's silly to copy as `<1 x T>` when we can just copy as `T`.

Inspired by https://github.com/rust-lang/rust/issues/101210#issuecomment-1732470941, which pointed out that `Option<[u8; 1]>` was codegenning worse than `Option<u8>`.

(I'm not sure *why* LLVM doesn't optimize out `<1 x u8>`, but might as well just not emit it in the first place in this codepath.)

---

I think I bit off too much in #116479; let me try just the scalar case first.

r? `@ghost`
2023-10-12 18:45:01 +00:00
Scott McMurray f5cdd3e130 Exclude apple from assembly test 2023-10-12 11:03:02 -07:00
Oli Scherer 6724f9926c hide `host` param from generic parameter list of `~const` bounds 2023-10-12 17:14:19 +00:00
Oli Scherer cfb6afa296 Add regression test for generic args showing `host` param 2023-10-12 16:49:23 +00:00
Oli Scherer 8f2af7e010 Test cross crate 2023-10-12 16:44:37 +00:00
bors 672fad9b86 Auto merge of #116671 - matthiaskrgr:rollup-b41rw92, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #116593 (Add unstable book page for the no-jump-tables codegen option)
 - #116625 (`rustc_hir_pretty` cleanups)
 - #116642 (Handle several `#[diagnostic::on_unimplemented]` attributes correctly)
 - #116654 (coverage: Clarify loop-edge detection and graph traversal)
 - #116669 (Fix mips platform support entries.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-12 16:39:36 +00:00