Commit Graph

219733 Commits

Author SHA1 Message Date
clubby789 9afffc5b61 Remove box expressions from HIR 2023-03-14 17:18:26 +00:00
bors 669e751639 Auto merge of #104833 - Swatinem:async-identity-future, r=compiler-errors
Remove `identity_future` indirection

This was previously needed because the indirection used to hide some unexplained lifetime errors, which it turned out were related to the `min_choice` algorithm.

Removing the indirection also solves a couple of cycle errors, large moves and makes async blocks support the `#[track_caller]`annotation.

Fixes https://github.com/rust-lang/rust/issues/104826.
2023-03-14 10:12:58 +00:00
bors 0058748944 Auto merge of #109057 - compiler-errors:rpitit-info-again, r=spastorino
Don't `opt_rpitit_info` as a separate query

... another attempt to undo regressions

r? `@ghost`
2023-03-14 06:42:15 +00:00
bors bd43458d4c Auto merge of #108992 - petrochenkov:qcstore2, r=cjgillot
resolve: Querify most cstore access methods (subset)

A subset of https://github.com/rust-lang/rust/pull/108346 that is not on a hot path in any way.
2023-03-14 03:38:42 +00:00
bors c54af457d0 Auto merge of #109097 - matthiaskrgr:rollup-6ydc4ri, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #108419 (Stabilize `atomic_as_ptr`)
 - #108507 (use `as_ptr` to determine the address of atomics)
 - #108607 (Don't use fd-lock on Solaris in bootstrap)
 - #108830 (Treat projections with infer as placeholder during fast reject in new solver)
 - #109055 (create `config::tests::detect_src_and_out` test for bootstrap)
 - #109058 (Document BinOp::is_checkable)
 - #109081 (simd-wide-sum test: adapt for LLVM 17 codegen change)
 - #109083 (Update books)
 - #109088 (Gracefully handle `#[target_feature]` on statics)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-14 00:30:46 +00:00
Matthias Krüger 30cd4b3a16
Rollup merge of #109088 - Nilstrieb:target-feature-on-statics-when, r=compiler-errors
Gracefully handle `#[target_feature]` on statics

The was careful around not calling `fn_sig` on not-functions but well, it wasn't careful enough. This commit makes it a little more careful and also adds tests for a bunch more item kinds.

I was sadly not able to fully bless the test locally because I'm on an aarch64 machine but I hope some manual editing made it work 😅

Fix #109079
2023-03-13 21:55:39 +01:00
Matthias Krüger f6f238fbc0
Rollup merge of #109083 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/nomicon

1 commits in 79b53665a7c61d171fb8c5ad0b73b371f9ee6ba7..1f3e4cd4fd88b5b5d45feb86a11b6d2f93e5a974
2023-03-12 21:51:29 UTC to 2023-03-12 21:51:29 UTC

- Change incorrect reference to "above" in ffi.md (rust-lang/nomicon#404)

## rust-lang/reference

4 commits in a9afb04b47a84a6753e4dc657348c324c876102c..24c87f6663aed55b05d2cc286878f28f21918825
2023-03-11 13:53:24 UTC to 2023-02-28 16:07:20 UTC

- Document movbe target feature (rust-lang/reference#1336)
- fix typo (rust-lang/reference#1339)
- fix: Typo/reference (rust-lang/reference#1338)
- Document `cmpxchg16b` target feature (rust-lang/reference#1331)

## rust-lang/rustc-dev-guide

13 commits in b06dab84083390e0ee1e998f466545a8a1a76a9f..b1b6d693cd1461e53de4132c1b183ace31cd36e5
2023-03-13 02:42:00 UTC to 2023-03-03 11:12:51 UTC

- Rename `config.toml.example` to `config.example.toml` (rust-lang/rustc-dev-guide#1641)
- fix typo `SubstRef` to `SubstsRef` (rust-lang/rustc-dev-guide#1642)
- tracing log along diff crates (rust-lang/rustc-dev-guide#1640)
- Fix Rust Analyzer settings location (rust-lang/rustc-dev-guide#1637)
- Reflect the changes in rust-lang/rust#67000 (rust-lang/rustc-dev-guide#1632)
- improve capacity note (rust-lang/rustc-dev-guide#1634)
- Remove mention to lexer/parser refactoring (rust-lang/rustc-dev-guide#1629)
- Update date reference about infer context variables (rust-lang/rustc-dev-guide#1630)
- Update explnation about `Body.basic_blocks` (rust-lang/rustc-dev-guide#1631)
- Add detail to contributing guide (rust-lang/rustc-dev-guide#1628)
- Making the sentence more clear (rust-lang/rustc-dev-guide#1624)
- Fixed typing error (rust-lang/rustc-dev-guide#1623)
- update error code docs to reflect recent changes (rust-lang/rustc-dev-guide#1625)
2023-03-13 21:55:38 +01:00
Matthias Krüger 39e1f810a9
Rollup merge of #109081 - krasimirgg:llvm-17-simd-wide-sum, r=nikic
simd-wide-sum test: adapt for LLVM 17 codegen change

After 0d4a709bb8 LLVM becomes more clever and turns ```@wider_reduce_loop``` into an alias:

https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/17806#0186da6b-582c-46bf-a227-1565fa0859ac/743-766

This adapts the test to prevent this.
2023-03-13 21:55:38 +01:00
Matthias Krüger 9fc8de0caa
Rollup merge of #109058 - tmiasko:is-checkable, r=jackh726
Document BinOp::is_checkable
2023-03-13 21:55:37 +01:00
Matthias Krüger f33292fa5d
Rollup merge of #109055 - ozkanonur:detect_src_and_out, r=albertlarsan68
create `config::tests::detect_src_and_out` test for bootstrap

Resolves one of the `FIXME` in bootstrap
2023-03-13 21:55:37 +01:00
Matthias Krüger 6cec8cb5c2
Rollup merge of #108830 - compiler-errors:new-solver-fast-reject-faster, r=lcnr
Treat projections with infer as placeholder during fast reject in new solver

r? ``@lcnr``

Kind of a shame that we need to change all of the call sites for `for_each_relevant_impl`, etc. to pass an extra parameter. I guess I could have the "default" fn which calls a configurable fn?
2023-03-13 21:55:36 +01:00
Matthias Krüger b4c7fc4ea1
Rollup merge of #108607 - psumbera:solaris-no-flock-bootstrap, r=albertlarsan68
Don't use fd-lock on Solaris in bootstrap

...as Solaris is missing flock()

fixes #103630
2023-03-13 21:55:36 +01:00
Matthias Krüger 96f4497f46
Rollup merge of #108507 - hermitcore:new, r=m-ou-se
use `as_ptr` to determine the address of atomics

The PR #107736 renamed  atomic `as_mut_ptr` to `as_ptr`. Consequently, the futex implementation of the tier-3 platform `RutyHermit` has to use this new interface. In addition, this PR removes also an unused import.
2023-03-13 21:55:35 +01:00
Matthias Krüger e670379b57
Rollup merge of #108419 - tgross35:atomic-as-ptr, r=m-ou-se
Stabilize `atomic_as_ptr`

Fixes #66893

This stabilizes the `as_ptr` methods for atomics. The stabilization feature gate used here is `atomic_as_ptr` which supersedes `atomic_mut_ptr` to match the change in https://github.com/rust-lang/rust/pull/107736.

This needs FCP.

New stable API:

```rust
impl AtomicBool {
    pub const fn as_ptr(&self) -> *mut bool;
}

impl AtomicI32 {
    pub const fn as_ptr(&self) -> *mut i32;
}

// Includes all other atomic types

impl<T> AtomicPtr<T> {
    pub const fn as_ptr(&self) -> *mut *mut T;
}
```

r? libs-api
``@rustbot`` label +needs-fcp
2023-03-13 21:55:35 +01:00
bors 22f247c6f3 Auto merge of #109094 - Nilstrieb:no-thin-lto-on-windows, r=jyn514
Revert "enable ThinLTO for rustc on x86_64-pc-windows-msvc dist builds"

This lead to a miscompilation in at least `char::is_whitespace` and probably in more unknown places.....

See #109067

This reverts commit 684663ed38, PR #103591.
2023-03-13 20:45:28 +00:00
Nilstrieb 58884a30a0 Revert "enable ThinLTO for rustc on x86_64-pc-windows-msvc dist builds"
This lead to a miscompilation in at least `char::is_whitespace` and
probably in more unknown places.....

This reverts commit 684663ed38.
2023-03-13 21:18:54 +01:00
Nilstrieb 34be05e097 Gracefully handle `#[target_feature]` on statics
The was careful around not calling `fn_sig` on not-functions but well,
it wasn't careful enough. This commit makes it a little more careful and
also adds tests for a bunch more item kinds.
2023-03-13 19:05:06 +00:00
Michael Goulet ce8dae5800 Don't opt_rpitit_info as a separate query 2023-03-13 17:02:47 +00:00
rustbot f044156487 Update books 2023-03-13 13:00:51 -04:00
bors 8efa635b40 Auto merge of #109069 - lnicola:rust-analyzer-2023-03-13, r=lnicola
⬆️ `rust-analyzer`

r? `@ghost`
2023-03-13 16:54:43 +00:00
Petr Sumbera 04dfedb3e9 Don't use fd-lock on Solaris in bootstrap
...as Solaris is missing flock()

fixes #103630
2023-03-13 17:43:04 +01:00
Michael Goulet 84d254ead0 Better names? 2023-03-13 16:34:16 +00:00
Michael Goulet 868aa42f4b Add a test that used to take forever to compile 2023-03-13 16:34:16 +00:00
Michael Goulet c32527fb92 Treat projections with infer as placeholder during fast reject in new solver 2023-03-13 16:34:16 +00:00
Krasimir Georgiev ed8dc5d817 simd-wide-sum test: adapt for LLVM 17 codegen change
After 0d4a709bb8
LLVM becomes more clever and turns `@wider_reduce_loop` into an alias:

https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/17806#0186da6b-582c-46bf-a227-1565fa0859ac/743-766

This adapts the test to prevent this.
2023-03-13 15:07:16 +00:00
bors cf8d98b227 Auto merge of #108623 - scottmcm:try-different-as-slice-impl, r=the8472
Move `Option::as_slice` to an always-sound implementation

This approach depends on CSE to not have any branches or selects when the guessed offset is correct -- which it always will be right now -- but to also be *sound* (just less efficient) if the layout algorithms change such that the guess is incorrect.

The codegen test confirms that CSE handles this as expected, leaving the optimal codegen.

cc JakobDegen #108545
2023-03-13 13:53:24 +00:00
Vadim Petrochenkov 4a61922ef0 metadata/resolve: Minor refactoring to "tcx -> cstore" conversions 2023-03-13 17:31:55 +04:00
Vadim Petrochenkov 98cce81917 metadata: Remove some more untracked `CStore` methods 2023-03-13 17:31:55 +04:00
Vadim Petrochenkov b3ee735993 resolve: Remove `struct_field_names_untracked` 2023-03-13 17:31:55 +04:00
Vadim Petrochenkov 2a716f3563 resolve: Centralize retrieval of items span and item name 2023-03-13 17:31:54 +04:00
Vadim Petrochenkov c7f424b80a resolve: Remove `fn_has_self_parameter_untracked` 2023-03-13 17:31:54 +04:00
Vadim Petrochenkov c05b7bd7d0 resolve: Remove `struct_field_visibilities_untracked` 2023-03-13 17:31:54 +04:00
Vadim Petrochenkov 901f1c9c62 resolve: Partially remove `item_attrs_untracked` 2023-03-13 17:31:54 +04:00
Vadim Petrochenkov 17127f3e78 resolve: Remove `visibility_untracked` 2023-03-13 17:31:54 +04:00
bors f1b1ed7e18 Auto merge of #108471 - clubby789:unbox-the-syntax, r=Nilstrieb,est31
Remove `box_syntax`

r? `@Nilstrieb`

This removes the feature `box_syntax`, which allows the use of `box <expr>` to create a Box, and finalises removing use of the feature from the compiler. `box_patterns` (allowing the use of `box <pat>` in a pattern) is unaffected.
It also removes `ast::ExprKind::Box` - the only way to create a 'box' expression now is with the rustc-internal `#[rustc_box]` attribute.
As a temporary measure to help users move away, `box <expr>` now parses the inner expression, and emits a `MachineApplicable` lint to replace it with `Box::new`

Closes #49733
2023-03-13 10:41:50 +00:00
Laurențiu Nicola e8629011ae ⬆️ rust-analyzer 2023-03-13 10:42:24 +02:00
bors 9549753352 Auto merge of #14333 - lnicola:sync-from-rust, r=lnicola
minor: sync from downstream
2023-03-13 08:25:23 +00:00
Laurențiu Nicola bdbd2a59b0 Merge branch 'master' into sync-from-rust 2023-03-13 10:21:53 +02:00
bors d610b0c514 Auto merge of #109011 - jsha:reduce-allocations-inner-full-print, r=notriddle
rustdoc: reduce allocs in FnDecl::inner_full_print

Instead of maintaining parallel buffers for both HTML and non-HTML output, follow the idiom from the rest of format.rs that f.alternate() == true means textual output. Also, add an argument to control line wrapping explicitly.

This allows the caller to render once with textual output and no line wrapping, to decide whether line wrapping should be applied in the final HTML output.

Also, remove some format! and " ".repeat calls, and remove a dependency on calling `String::replace` to switch from newlines to spaces.

This coincidentally fixes some minor bugs where the old code was undercounting the number of characters for a declaration in text mode.
2023-03-13 02:17:49 +00:00
Scott McMurray e97505704e Clarify the text of some comments 2023-03-12 16:30:51 -07:00
bors b05bb29008 Auto merge of #108872 - cjgillot:simp-const-prop, r=oli-obk
Strengthen state tracking in const-prop

Some/many of the changes are replicated between both the const-prop lint and the const-prop optimization.

Behaviour changes:
- const-prop opt does not give a span to propagated values. This was useless as that span's primary purpose is to diagnose evaluation failure in codegen.
- we remove the `OnlyPropagateInto` mode. It was only used for function arguments, which are better modeled by a write before entry.
- the tracking of assignments and discriminants make clearer that we do nothing in `NoPropagation` mode or on indirect places.
2023-03-12 23:27:52 +00:00
ozkanonur 58c7b670ad create `config::tests::detect_src_and_out` test for bootstrap
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-03-12 22:18:56 +00:00
bors 7b4f48927d Auto merge of #109056 - matthiaskrgr:rollup-9trny1z, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #108651 (Forbid the use of `#[target_feature]` on `main`)
 - #109009 (rustdoc: use restricted Damerau-Levenshtein distance for search)
 - #109026 (Introduce `Rc::into_inner`, as a parallel to `Arc::into_inner`)
 - #109029 (Gate usages of `dyn*` and const closures in macros)
 - #109031 (Rename `config.toml.example` to `config.example.toml`)
 - #109032 (Use `TyCtxt::trait_solver_next` in some places)
 - #109047 (typo)
 - #109052 (Add eslint check for rustdoc-gui tester)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-12 20:21:26 +00:00
Matthias Krüger 5dc0113725
Rollup merge of #109052 - GuillaumeGomez:rustdoc-gui-tester-eslint, r=notriddle
Add eslint check for rustdoc-gui tester

r? `@notriddle`
2023-03-12 20:44:53 +01:00
Matthias Krüger fb4bb1679a
Rollup merge of #109047 - tshepang:type, r=lcnr
typo
2023-03-12 20:44:52 +01:00
Matthias Krüger 4305c1a89d
Rollup merge of #109032 - compiler-errors:shorter, r=BoxyUwU
Use `TyCtxt::trait_solver_next` in some places

Also flip order of if statements to avoid `!`
2023-03-12 20:44:52 +01:00
Matthias Krüger 66f07c74d5
Rollup merge of #109031 - thomcc:config-example-toml, r=ozkanonur
Rename `config.toml.example` to `config.example.toml`

This had bothered me for a while as it leads to bad (missing) syntax highlighting in most editors I've used, and `@jyn514` suggested I just make the change and that the compatibility concerns I had don't really matter.

I suspect it will be a contentious one, so will not be offended if the outcome of this is to close the PR.
2023-03-12 20:44:51 +01:00
Matthias Krüger 98fea68470
Rollup merge of #109029 - compiler-errors:parse-gating, r=jackh726
Gate usages of `dyn*` and const closures in macros

We silently accepted `dyn*` and const closures in macros as long as they didn't expand to anything containing these experimental features, unlike other gated features such as `for<'a>` binders on closures, etc. Let's not do that, to make sure nobody begins relying on this.
2023-03-12 20:44:51 +01:00
Matthias Krüger b28775cdcb
Rollup merge of #109026 - joshtriplett:rc-into-inner, r=dtolnay
Introduce `Rc::into_inner`, as a parallel to `Arc::into_inner`

Unlike `Arc`, `Rc` doesn't have the same race condition to avoid, but
maintaining an equivalent API still makes it easier to work with both
`Rc` and `Arc`.
2023-03-12 20:44:50 +01:00
Matthias Krüger afe257554c
Rollup merge of #109009 - notriddle:notriddle/edit-distance, r=GuillaumeGomez
rustdoc: use restricted Damerau-Levenshtein distance for search

Based on https://github.com/rust-lang/rust/pull/108200, for the same rationale.

> This replaces the existing Levenshtein algorithm with the Damerau-Levenshtein algorithm. This means that "ab" to "ba" is one change (a transposition) instead of two (a deletion and insertion). More specifically, this is a restricted implementation, in that "ca" to "abc" cannot be performed as "ca" → "ac" → "abc", as there is an insertion in the middle of a transposition. I believe that errors like that are sufficiently rare that it's not worth taking into account.

Before this change, searching [`prinltn!`] listed `print!` first, followed by `println!`. With this change, `println!` matches more closely.

[`prinltn!`]: https://doc.rust-lang.org/nightly/std/?search=prinltn!
2023-03-12 20:44:50 +01:00