Commit Graph

23418 Commits

Author SHA1 Message Date
bors
2824db39f1 Auto merge of #109915 - scottmcm:layout-indexvec, r=oli-obk
Use `FieldIdx` in `FieldsShape`

Finally got to the main motivating example from https://github.com/rust-lang/compiler-team/issues/606 :)
2023-04-06 07:38:58 +00:00
bors
f211da7101 Auto merge of #109792 - cjgillot:reachable-lint, r=oli-obk
Only visit reachable blocks in ConstProp lint.

Fixes https://github.com/rust-lang/rust/issues/78803
Fixes https://github.com/rust-lang/rust/issues/109731
2023-04-06 03:05:47 +00:00
bors
8c7ad16e82 Auto merge of #109986 - JohnTitor:rollup-3aax38t, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #109909 (Deny `use`ing tool paths)
 - #109921 (Don't ICE when encountering `dyn*` in statics or consts)
 - #109922 (Disable `has_thread_local` on OpenHarmony)
 - #109926 (write threads info into log only when debugging)
 - #109968 (Add regression test for #80409)
 - #109969 (Add regression test for #86351)
 - #109973 (rustdoc: Improve logo display very small screen)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-05 23:10:09 +00:00
Yuki Okushi
9dfe4af2a8
Rollup merge of #109926 - SparrowLii:parallel_log, r=eholk
write threads info into log only when debugging

The current tracing log will unconditionally write thread information during parallel compilation, which sometimes confuses some normal output log information

This fixes the UI test failure of:
```
[ui] tests/ui/consts/const_in_pattern/issue-73431.rs
```
Updates #75760
2023-04-06 07:18:30 +09:00
Yuki Okushi
836504ec34
Rollup merge of #109922 - Amanieu:ohos-no_thread_local, r=wesleywiser
Disable `has_thread_local` on OpenHarmony

OpenHarmony uses emulated TLS, which doesn't link properly when using thread-local variables across crate boundaries with `-C prefer-dynamic`. This PR makes thread_local! use pthreads directly instead.
2023-04-06 07:18:30 +09:00
Yuki Okushi
4b8725b854
Rollup merge of #109921 - compiler-errors:dyn-star-const-static, r=eholk
Don't ICE when encountering `dyn*` in statics or consts

Since we have properly implemented `dyn*` support in CTFE (#107728), let's not ICE here anymore.

Fixes #105777

r? `@eholk`
2023-04-06 07:18:29 +09:00
Yuki Okushi
ea920901e9
Rollup merge of #109909 - clubby789:import-tool-mod, r=petrochenkov
Deny `use`ing tool paths

Fixes #109853
Fixes #109147
2023-04-06 07:18:29 +09:00
bors
2eaeb1eee1 Auto merge of #109437 - petrochenkov:effvisopt, r=davidtwco
resolve: Restore some effective visibility optimizations

Something similar was previously removed as a part of https://github.com/rust-lang/rust/pull/104602.
So we can see [bitmaps-3.1.0](https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/bitmaps-3.1.0), [match-stress](https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/match-stress) and [unused-warnings](https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/unused-warnings) in regressions there, and in improvements in this PR.
After this PR all table changes should also be "locally correct" after every update.
2023-04-05 20:50:33 +00:00
Camille GILLOT
98255cc242 Comment logic around worklist. 2023-04-05 19:34:38 +00:00
Camille GILLOT
7d47a910eb Only visit reachable blocks in ConstProp lint. 2023-04-05 19:34:38 +00:00
Camille GILLOT
f8cfafcceb Extract check_assertion. 2023-04-05 19:34:38 +00:00
Camille GILLOT
b833fcae90 Manipulate Location instead of SourceInfo. 2023-04-05 19:34:36 +00:00
Camille GILLOT
35e622d218 Do not keep extra references to scopes and decls. 2023-04-05 19:30:44 +00:00
bors
2e486be8d2 Auto merge of #107925 - thomcc:sip13, r=cjgillot
Use SipHash-1-3 instead of SipHash-2-4 for StableHasher

Noticed this, and it seems easy and likely a perf win. IIUC we don't need DDOS resistance (just collision) so we ideally would have an even faster hash, but it's hard to beat this SipHash impl here, since it's been so highly tuned for the interface.

It wouldn't surprise me if there's some subtle reason changing this sucks, as it's so obvious it seems likely to have been done. Still, SipHash-1-3 seems to still have the guarantees StableHasher should need (and seemingly more), and is clearly less work. So it's worth a shot.

Not fully tested locally.
2023-04-05 18:35:34 +00:00
bors
b2b676d886 Auto merge of #108905 - ferrocene:pa-compiletest-ignore, r=ehuss
Validate `ignore` and `only` compiletest directive, and add human-readable ignore reasons

This PR adds strict validation for the `ignore` and `only` compiletest directives, failing if an unknown value is provided to them. Doing so uncovered 79 tests in `tests/ui` that had invalid directives, so this PR also fixes them.

Finally, this PR adds human-readable ignore reasons when tests are ignored due to `ignore` or `only` directives, like *"only executed when the architecture is aarch64"* or *"ignored when the operative system is windows"*. This was the original reason why I started working on this PR and #108659, as we need both of them for Ferrocene.

The PR is a draft because the code is extremely inefficient: it calls `rustc --print=cfg --target $target` for every rustc target (to gather the list of allowed ignore values), which on my system takes between 4s and 5s, and performs a lot of allocations of constant values. I'll fix both of them in the coming days.

r? `@ehuss`
2023-04-05 16:15:25 +00:00
Thom Chiovoloni
9d314627aa Fix a couple missed hash constants 2023-04-05 15:48:37 +00:00
Thom Chiovoloni
bb0969cae0 Use SipHash-1-3 instead of SipHash-2-4 for StableHasher 2023-04-05 15:48:37 +00:00
bors
4cb92cc83a Auto merge of #109966 - JohnTitor:rollup-eoqjr5j, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #107236 (Add T-bootstrap label to tools)
 - #109847 (Only create graphviz nodes for reachable MIR bb's)
 - #109848 (submodule detection for proper fix on #96188)
 - #109932 (Source code scrollbar)
 - #109952 (Move comment about python2 closer to the place it's used)
 - #109956 (Tweak debug outputs to make debugging new solver easier)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-05 13:01:08 +00:00
Yuki Okushi
038ece0a42
Rollup merge of #109956 - compiler-errors:tweak-debug-outputs, r=oli-obk
Tweak debug outputs to make debugging new solver easier

1. Move the fields that are "most important" (I know this is subjective) to the beginning of the structs.

For goals, I typically care more about the predicate than the param-env (which is significantly longer in debug output).
For canonicalized things, I typically care more about what is *being* canonicalized.
For a canonical response, I typically care about the response -- or at least, it's typically useful to put it first since it's short and affects the whether the solver recurses or not...

2. Add some more debug and instrument calls to functions to add more structure to tracing lines.

r? `@oli-obk` or `@BoxyUwU` (since I think `@lcnr` is on holiday)
2023-04-05 20:47:24 +09:00
Yuki Okushi
4e0662c8a7
Rollup merge of #109847 - clubby789:graphviz-reachable, r=oli-obk
Only create graphviz nodes for reachable MIR bb's

Fixes #109832
2023-04-05 20:47:22 +09:00
bors
383c1d729e Auto merge of #109117 - oli-obk:locks, r=michaelwoerister
Avoid a few locks

We can use atomics or datastructures tuned for specific access patterns instead of locks. This may be an improvement for parallel rustc, but it's mostly a cleanup making various datastructures only usable in the way they are used right now (append data, never mutate), instead of having a general purpose lock.
2023-04-05 10:38:02 +00:00
Oli Scherer
457a162d00 Use elsa =1.7.1 as 1.8.0 was an accidental copy of 1.7.0 2023-04-05 08:07:29 +00:00
bors
a412564f8c Auto merge of #109954 - clubby789:graphviz-path-trimming, r=compiler-errors
Disable path trimming during graphviz output

Fixes #109943

We can end up pretty-printing a path for the graphviz file without emitting a diagnostic, so disable path trimming at this point.
2023-04-05 05:47:33 +00:00
bors
8d321f7a88 Auto merge of #109843 - scottmcm:better-transmute, r=WaffleLapkin
Allow `transmute`s to produce `OperandValue`s instead of needing `alloca`s

LLVM can usually optimize these away, but especially for things like transmutes of newtypes it's silly to generate the `alloc`+`store`+`load` at all when it's actually a nop at LLVM level.
2023-04-05 03:26:38 +00:00
Michael Goulet
786fc90855 Tweak debug outputs to make debugging new solver easier 2023-04-05 03:18:29 +00:00
clubby789
422c33030f Disable path trimming during graphviz output 2023-04-05 03:06:37 +01:00
Scott McMurray
9aa9a846b6 Allow transmutes to produce OperandValues instead of always using allocas
LLVM can usually optimize these away, but especially for things like transmutes of newtypes it's silly to generate the `alloc`+`store`+`load` at all when it's actually a nop at LLVM level.
2023-04-04 18:44:29 -07:00
bors
603270011e Auto merge of #109944 - cjgillot:lint-cstring-macro, r=Nilstrieb
Do not suppress temporary_cstring_as_ptr in macros.

There isn't really a reason to skip the lint when part of the expression comes from an expansion.

Fixes https://github.com/rust-lang/rust/issues/94694
2023-04-04 22:35:09 +00:00
bors
700938c078 Auto merge of #109808 - jyn514:debuginfo-options, r=michaelwoerister
Extend -Cdebuginfo with new options and named aliases

This is a rebase of https://github.com/rust-lang/rust/pull/83947, along with my best guess at what the new options mean. I tried to follow the LLVM source code to get a better idea but ran into quite a lot of trouble (https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/go-to-definition.20in.20src.2Fllvm-project.3F). The description for the original PR follows below.

Note that the changes in this PR have already been through FCP: https://github.com/rust-lang/rust/pull/83947#issuecomment-878384979

Closes https://github.com/rust-lang/rust/pull/109311. Helps with https://github.com/rust-lang/rust/pull/104968.
r? `@michaelwoerister` cc `@cuviper`

---

The -Cdebuginfo=1 option was never line tables only and can't be due to backwards compatibility issues. This was clarified and an option for emitting line tables only was added. Additionally an option for emitting line info directives only was added, which is needed for some targets, i.e. nvptx. The debug info options should now behave similarly to clang's debug info options.

Fix https://github.com/rust-lang/rust/issues/60020
Fix https://github.com/rust-lang/rust/issues/64405
2023-04-04 20:01:05 +00:00
Scott McMurray
21bb8ef24e Use FieldIdx in FieldsShape
Finally got to the main motivating example from the MCP :)
2023-04-04 12:38:06 -07:00
Camille GILLOT
8528ac6e35 Do not suppress temporary_cstring_as_ptr in macros. 2023-04-04 18:55:02 +00:00
Michael Goulet
b0483e8004
Rollup merge of #109938 - oli-obk:try_norm, r=compiler-errors
Move a const-prop-lint specific hack from mir interpret to const-prop-lint and make it fallible

fixes #109743

This hack didn't need to live in the mir interpreter. For const-prop-lint it is entirely correct to avoid doing any const prop if normalization fails at this stage. Most likely we couldn't const propagate anything anyway, and if revealing was needed (so opaque types were involved), we wouldn't want to be too smart and leak the hidden type anyway.
2023-04-04 09:27:47 -07:00
Michael Goulet
a5c395ed94
Rollup merge of #109914 - compiler-errors:rtn-bad-parens, r=oli-obk
Emit feature error for parenthesized generics in associated type bounds

We don't actually do AST->HIR lowering with some `-Zunpretty` flags, so it's not correct to just delay a bug instead of emitting a feature error.

Some diagnostics regressed because of the new errors, but oh well. 🤷

Fixes #109898
2023-04-04 09:27:46 -07:00
Michael Goulet
5485a54e19
Rollup merge of #109913 - scottmcm:index-slice, r=WaffleLapkin
Doc-comment  `IndexVec::from_elem` and use it in a few more places

Since this PR is a reply to https://github.com/rust-lang/rust/pull/109819#discussion_r1156128164,
r? ``@WaffleLapkin``
2023-04-04 09:27:45 -07:00
Michael Goulet
ed17b599df
Rollup merge of #109901 - cjgillot:validate-debuginfo, r=b-naber
Enforce VarDebugInfo::Place in MIR validation.
2023-04-04 09:27:44 -07:00
Michael Goulet
4d32de6fcb
Rollup merge of #109838 - clubby789:non-exhaustive-span, r=Nilstrieb
Fix `non_exhaustive_omitted_patterns` lint span

Fixes #109837

`DUMMY_SP` was being passed as the span in many cases where we have a span available to use. This meant that the location of the violating pattern wasn't shown, or the list of un-covered variants

r? `@Nilstrieb`
2023-04-04 09:27:44 -07:00
Michael Goulet
ec22850c2c
Rollup merge of #109723 - oli-obk:ast_refactor, r=Nilstrieb
Pull some tuple variant fields out into their own struct

This is groundwork for adding more fields to those new structs, but I believe the change to be useful on its own.

r? `@Nilstrieb` but feel free to reroll for `compiler`
2023-04-04 09:27:43 -07:00
Oli Scherer
373807a95c Rename ast::Static to ast::StaticItem to match ast::ConstItem 2023-04-04 15:34:40 +00:00
Oli Scherer
4bebdd7104 box a bunch of large types 2023-04-04 13:58:50 +00:00
clubby789
ebde2ab363 Deny useing tool paths 2023-04-04 14:10:13 +01:00
bors
be8e5ba157 Auto merge of #109917 - compiler-errors:remove-relation-methods, r=oli-obk
Remove `intercrate` and `mark_ambiguous` from `TypeRelation`

Fixes #109863

Pulls this logic into `super_combine_tys`, which has access to `InferCtxt` and takes a `ObligationEmittingRelation` -- both of which simplify the logic here.

r? `@oli-obk` `@aliemjay`
2023-04-04 11:08:23 +00:00
Oli Scherer
b5d96d5ec5 Move a const-prop-lint specific hack from mir interpret to const-prop-lint and make it fallible 2023-04-04 10:39:26 +00:00
Oli Scherer
ec74653652 Split out ast::ItemKind::Const into its own struct 2023-04-04 09:44:50 +00:00
Oli Scherer
e3828777a6 rust-analyzer guided tuple field to named field 2023-04-04 09:44:50 +00:00
Oli Scherer
b08a557f80 rust-analyzer guided enum variant structification 2023-04-04 09:44:45 +00:00
Oli Scherer
54214c8d8d Use a simpler atomic operation than the compare_exchange hammer 2023-04-04 09:01:44 +00:00
Oli Scherer
300901b705 Use new iteration helpers instead of manually rolling them 2023-04-04 09:01:44 +00:00
Oli Scherer
a1d20cf7a2 Another AppendOnlyVec 2023-04-04 09:01:44 +00:00
Oli Scherer
7edd1d8799 Replace another lock with an append-only vec 2023-04-04 09:01:44 +00:00
Oli Scherer
4699632637 Remove a lock in favor of an AppendOnlyVec 2023-04-04 09:01:44 +00:00