Commit Graph

219773 Commits

Author SHA1 Message Date
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
Scott McMurray
87696fd5a1 Add a better approach comment in ptr::read to justify the intrinsic 2023-03-12 15:52:34 -07: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
Scott McMurray
1f70bb8c43 Add a codegen test to confirm this fixes 73258 2023-03-12 13:23:22 -07: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
Scott McMurray
0b96fee343 Add a codegen test to confirm this fixes 106369 2023-03-12 12:57:40 -07: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
Matthias Krüger
f41796e6b4
Rollup merge of #108651 - LeSeulArtichaut:108645-target-feature-on-main, r=Nilstrieb
Forbid the use of `#[target_feature]` on `main`

Fixes #108645.
2023-03-12 20:44:49 +01:00
David Tolnay
992957efa9
Fix formatting of new Rc::into_inner test 2023-03-12 11:21:40 -07:00
bors
938afba899 Auto merge of #108845 - Zoxc:par-fix-2, r=cjgillot
Check that a query has not completed and is not executing before starting it

This fixes a race in the query system where we only checked if the query was currently executing, but not if it was already completed, causing queries to re-execute.

r? `@cjgillot`
2023-03-12 17:03:44 +00:00
bors
f1e51afa45 Auto merge of #14328 - lnicola:build-scripts-extra-args, r=Veykril
fix: Pass flycheck extra args when running build scripts

Closes #14315

Not sure if we want to do it like this or to add an extra config key, though.
2023-03-12 15:19:29 +00:00
Guillaume Gomez
cd9759ab92 Add rustdoc-gui eslint check into CI 2023-03-12 15:07:35 +01:00
Guillaume Gomez
77a8070852 Add eslint check for rustdoc-gui tester 2023-03-12 15:06:04 +01:00
bors
f41927f309 Auto merge of #108820 - cjgillot:ensure-on-disk, r=oli-obk
Ensure value is on the on-disk cache before returning from `ensure()`.

The current logic for `ensure()` a query just checks that the node is green in the dependency graph.
However, a lot of places use `ensure()` to prevent the query from being called later. This is the case before stealing a query result.

If the query is actually green but the value is not available in the on-disk cache, `ensure` would return, but a subsequent call to the full query would run the code, and attempt to read from a stolen value.

This PR conforms the query system to the usage by checking whether the queried value is loadable from disk before returning.

Sadly, I can't manage to craft a proper test...

Should fix all instances of "attempted to read from stolen value".
2023-03-12 14:00:28 +00:00
Léo Lanteri Thauvin
29b1789a75 Allow #[target_feature] on main and start for WASM 2023-03-12 14:57:38 +01:00
Léo Lanteri Thauvin
963305bda8 Forbid the use of #[target_feature] on start 2023-03-12 14:57:38 +01:00
Léo Lanteri Thauvin
db26693982 Forbid the use of #[target_feature] on main 2023-03-12 14:57:38 +01:00
Santiago Pastorino
8b9344acc3
Fix object safety checks for new RPITITs 2023-03-12 10:51:20 -03:00
Santiago Pastorino
fa421ec454
Filter out RPITITs in object_safety_violations_for_trait 2023-03-12 10:51:19 -03:00
Santiago Pastorino
b2f3198608
Filter out RPITITs in astconv when checking for missing associated types 2023-03-12 10:51:19 -03:00
Santiago Pastorino
b82d6a2e9e
Run existing impl trait in traits tests using -Zlower-impl-trait-in-trait-to-assoc-ty 2023-03-12 10:50:32 -03:00
Santiago Pastorino
07e018dfef
Run existing async in traits tests using -Zlower-impl-trait-in-trait-to-assoc-ty 2023-03-12 10:50:32 -03:00
Santiago Pastorino
8a5574bf62
Remove tests/ui/impl-trait/in-trait/new-lowering-strategy in favor of using revisions on existing tests 2023-03-12 10:50:31 -03:00
clubby789
8b186dfdb7 Add recovery for use of removed box syntax 2023-03-12 13:26:37 +00:00
clubby789
a8d5950b4d Remove box-syntax from unstable book 2023-03-12 13:19:46 +00:00
clubby789
0932452fa4 Remove box_syntax from AST and use in tools 2023-03-12 13:19:46 +00:00
clubby789
dd7df04e16 Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
Laurențiu Nicola
c3864eb511 Add and use rust-analyzer.cargo.extraArgs setting 2023-03-12 13:04:24 +02:00
Tshepang Mbambo
421c34b2b0 typo 2023-03-12 11:56:56 +02:00