Commit Graph

219733 Commits

Author SHA1 Message Date
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
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
bors 24c0b81c1f Auto merge of #109043 - matthiaskrgr:rollup-genkz0e, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #108726 (tidy: enforce comment blocks to have an even number of backticks)
 - #108797 (Allow binary files to go through the `FileLoader`)
 - #108841 (Add suggestion to diagnostic when user has array but trait wants slice. (rebased))
 - #108984 (bootstrap: document tidy)
 - #109013 (Give proper error message when tcx wasn't passed to decoder)
 - #109017 (remove duplicated calls to sort_string)
 - #109018 (Expand on the allocator comment in `rustc-main`)
 - #109028 (Add eslint checks for rustdoc-js tester)
 - #109034 (Commit some tests for the new solver + lazy norm)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-12 09:44:17 +00:00
Matthias Krüger 3166b4a245
Rollup merge of #109034 - compiler-errors:lazy-norm-tests, r=jackh726
Commit some tests for the new solver + lazy norm

Also consolidate `typeck/lazy-norm` into `traits/new-solver`, since it's not really useful to maintain a distinction, like when a test really is due to "lazy norm" or "the new solver" (usually both!)
2023-03-12 08:13:29 +01:00
Matthias Krüger 54c95a8072
Rollup merge of #109028 - GuillaumeGomez:rustdoc-js-tester-eslint, r=notriddle
Add eslint checks for rustdoc-js tester

r? ``@notriddle``
2023-03-12 08:13:29 +01:00
Matthias Krüger 7ad471b09d
Rollup merge of #109018 - jyn514:global-allocator-comment, r=lqd
Expand on the allocator comment in `rustc-main`

Before, it said "global_allocator does nothing". Now it gives you suggestions for what to do if you want to change the global allocator (which is likely the main reason you'd be reading the comment).

cc https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/improving.20rustc.20memory.20usage
2023-03-12 08:13:28 +01:00
Matthias Krüger c9a38c3c69
Rollup merge of #109017 - klensy:dupe, r=cjgillot
remove duplicated calls to sort_string

`with_forced_trimmed_paths!` was removed in 62ba3e70a1, and this lines became dups.
2023-03-12 08:13:28 +01:00
Matthias Krüger 738c4bf176
Rollup merge of #109013 - Nilstrieb:obscurity-is-not-a-necessity, r=fee1-dead
Give proper error message when tcx wasn't passed to decoder

I hit this yesterday and found it very confusing, even though the solution to the problem is very simple.
2023-03-12 08:13:27 +01:00
Matthias Krüger 0b0f334764
Rollup merge of #108984 - Teapot4195:issue-106803-fix, r=ozkanonur
bootstrap: document tidy

Enable documentation of tidy, as suggested in #106803. Jyn mentioned they should probably be added to `doc.rust-lang.org`, how should that be done?
2023-03-12 08:13:27 +01:00
Matthias Krüger 67c9dbfe02
Rollup merge of #108841 - jackh726:issue-90528, r=compiler-errors
Add suggestion to diagnostic when user has array but trait wants slice. (rebased)

Rebase of #91314, except for change to multipart suggestion

Resolves #90528

r? ``@compiler-errors`` since you requested the multipart suggestion
2023-03-12 08:13:26 +01:00
Matthias Krüger b16ed694f7
Rollup merge of #108797 - thomcc:sourcemap_include_binary_file, r=compiler-errors
Allow binary files to go through the `FileLoader`

I'd like for `include_bytes!` to go through the `FileLoader` in an out-of-tree `rustc_driver` wrapper, and I can't find a reason it's not already done. It seems like most folks providing a custom `FileLoader` would want this too, so I added it.

I can solve my problem in other ways if there's a strong reason not to do it, but it seems simple and harmless.
2023-03-12 08:13:26 +01:00
Matthias Krüger 9668ae5eb8
Rollup merge of #108726 - est31:backticks_matchmaking_tidy, r=Nilstrieb
tidy: enforce comment blocks to have an even number of backticks

After PR #108694, most unmatched backticks in `compiler/` comments have been eliminated. This PR adds a tidy lint to ensure no new unmatched backticks are added, and either addresses the lint in the remaining instances it found, or allows it.

Very often, backtick containing sections wrap around lines, for example:

```Rust
// This function takes a tuple `(Vec<String>,
// Box<[u8]>)` and transforms it into `Vec<u8>`.
```

The lint is implemented to work on top of blocks, counting each line with a `//` into a block, and counting if there are an odd or even number of backticks in the entire block, instead of looking at just a single line.
2023-03-12 08:13:25 +01:00
bors 150cb38147 Auto merge of #108794 - nnethercote:avoid-unnecessary-hashing, r=cjgillot
Avoid unnecessary hashing

I noticed some stable hashing being done in a non-incremental build. It turns out that some of this is necessary to compute the crate hash, but some of it is not. Removing the unnecessary hashing is a perf win.

r? `@cjgillot`
2023-03-12 06:48:30 +00:00
Scott McMurray f6a57c1955 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.
2023-03-11 20:29:26 -08:00
bors 501ad021b9 Auto merge of #108682 - est31:simplify_dirs, r=davidtwco
Simplify message paths

This makes it easier to open the messages file. Right now I have to first click on the `locales` dir to open it, and then on the `en-US.ftl` file. `Cargo.toml` and `build.rs` files are also in the top level, and I think there should not be more than one file, so a directory isn't really needed. The [chosen strategy for pontoon adoption](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/pontoon.20and.20next.20steps) is out of tree. Even if this descision is changed in the future, the `messages.ftl` approach is also compatible with non-english translations living in-tree, as long as the non-english translations don't live in the `compiler/rustc_foo/` directories but in different ones. That would also be helpful for grepability purposes.

The commit was the result of automated changes:

```
for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done

for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
```

r? `@davidtwco`
2023-03-12 03:51:21 +00:00
Michael Howell ce795d9ca8 rustdoc: collapse edit distance state into an object 2023-03-11 20:39:15 -07:00
bors 9455a5591b Auto merge of #108700 - spastorino:new-rpitit-impl-side-2, r=compiler-errors
Make RPITITs simple cases work when using lower_impl_trait_in_trait_to_assoc_ty

r? `@compiler-errors`

It's probably best reviewed commit by commit.
2023-03-12 00:49:35 +00:00
Tomasz Miąsko b16d6ccdcd Document BinOp::is_checkable 2023-03-12 00:00:00 +00:00
Jacob Hoffman-Andrews 121ae1d29c 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-11 15:36:50 -08:00
Michael Goulet 1c4603e3b0 Commit some tests for the new solver + lazy norm 2023-03-11 23:16:46 +00:00
Camille GILLOT e955ec0908 Use ensure_with_value in a few more places. 2023-03-11 22:42:13 +00:00
Camille GILLOT 382cc909d5 Make the check for cache opt-in. 2023-03-11 22:41:01 +00:00
Camille GILLOT facf1e017d Use ensure for thir_abstract_const. 2023-03-11 22:41:01 +00:00
Camille GILLOT 1ca103a168 Ensure value is on the on-disk cache before returning. 2023-03-11 22:41:01 +00:00
Thom Chiovoloni fcb2a3665f
Rename `config.toml.example` to `config.example.toml` 2023-03-11 14:10:00 -08:00
Michael Goulet d2834525ba Use TyCtxt::trait_solver_next in some places 2023-03-11 22:05:50 +00:00
est31 7e2ecb3cd8 Simplify message paths
This makes it easier to open the messages file while developing on features.

The commit was the result of automatted changes:

for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done

for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-03-11 22:51:57 +01:00
bors 542ed2bf72 Auto merge of #108417 - Zoxc:dep-graph-branch, r=cjgillot
Move dep graph methods to DepGraphData to avoid branches and `unwrap`s

This moves methods from `DepGraph` to `DepGraphData` which makes the code a bit cleaner since the dep graph is unconditionally available. It also changes `try_execute_query` to only branch on dep graph availability once, removing unnecessary branches and `unwrap`s.

This is based on https://github.com/rust-lang/rust/pull/108134 and https://github.com/rust-lang/rust/pull/108167.

Performance impact of just the last commit:
<table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.7354s</td><td align="right">1.7242s</td><td align="right"> -0.64%</td></tr><tr><td>🟣 <b>clap</b>:check:initial</td><td align="right">2.0813s</td><td align="right">2.0687s</td><td align="right"> -0.61%</td></tr><tr><td>🟣 <b>clap</b>:check:unchanged</td><td align="right">0.4554s</td><td align="right">0.4550s</td><td align="right"> -0.09%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2528s</td><td align="right">0.2521s</td><td align="right"> -0.27%</td></tr><tr><td>🟣 <b>hyper</b>:check:initial</td><td align="right">0.3222s</td><td align="right">0.3214s</td><td align="right"> -0.25%</td></tr><tr><td>🟣 <b>hyper</b>:check:unchanged</td><td align="right">0.1339s</td><td align="right">0.1333s</td><td align="right"> -0.38%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9484s</td><td align="right">0.9455s</td><td align="right"> -0.30%</td></tr><tr><td>🟣 <b>regex</b>:check:initial</td><td align="right">1.1805s</td><td align="right">1.1727s</td><td align="right"> -0.66%</td></tr><tr><td>🟣 <b>regex</b>:check:unchanged</td><td align="right">0.3305s</td><td align="right">0.3307s</td><td align="right"> 0.08%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.5453s</td><td align="right">1.5374s</td><td align="right"> -0.51%</td></tr><tr><td>🟣 <b>syn</b>:check:initial</td><td align="right">1.9230s</td><td align="right">1.9206s</td><td align="right"> -0.12%</td></tr><tr><td>🟣 <b>syn</b>:check:unchanged</td><td align="right">0.6340s</td><td align="right">0.6333s</td><td align="right"> -0.11%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">5.8623s</td><td align="right">5.8536s</td><td align="right"> -0.15%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check:initial</td><td align="right">7.2873s</td><td align="right">7.2786s</td><td align="right"> -0.12%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check:unchanged</td><td align="right">1.8378s</td><td align="right">1.8478s</td><td align="right"> 0.54%</td></tr><tr><td>Total</td><td align="right">26.5300s</td><td align="right">26.4750s</td><td align="right"> -0.21%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9976s</td><td align="right"> -0.24%</td></tr></table>

r? `@cjgillot`
2023-03-11 21:34:23 +00:00
Michael Goulet c3159b851a Gate const closures even when they appear in macros 2023-03-11 21:29:28 +00:00
Michael Goulet bd4355500a Gate all usages of dyn*, even in macros 2023-03-11 21:29:28 +00:00
Josh Triplett a2341fbbc2 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-11 12:47:12 -08:00
Guillaume Gomez ca9b6180f0 Add rustdoc-js eslint check into CI 2023-03-11 21:42:11 +01:00
Guillaume Gomez 904d9c5c54 Improve rustdoc-js tester code clarity a bit 2023-03-11 21:40:17 +01:00
Guillaume Gomez 856c9bb481 Add eslint checks for rustdoc-js tester 2023-03-11 21:37:59 +01:00
est31 b2aeb07137 Use trimmed instead of line for performance 2023-03-11 20:43:04 +01:00
est31 3a20d52694 Extend the tidy lint to ftl files 2023-03-11 20:43:04 +01:00