Commit Graph

209410 Commits

Author SHA1 Message Date
yukang
ab22f5521b change error_reported to use Result instead of an option 2022-11-03 04:57:44 +08:00
bors
5b1304a03b Auto merge of #103846 - Kobzol:revert-103295-ninja, r=cuviper
Revert "ci: Bring back ninja for dist builders"

Reverts rust-lang/rust#103295 because of the perf regression.

r? `@cuviper`
2022-11-02 20:49:03 +00:00
Amanieu d'Antras
03e4c76dcf asm: Work around LLVM bug on AArch64
Upstream issue: https://github.com/llvm/llvm-project/issues/58384

LLVM gets confused if we assign a 32-bit value to a 64-bit register, so
pass the 32-bit register name to LLVM in that case.
2022-11-02 19:52:49 +00:00
bors
edf0182213 Auto merge of #103888 - Dylan-DPC:rollup-p7gubqj, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #103275 (Update tinystr)
 - #103703 (Gate some parser recovery behind the check)
 - #103774 (Format `dyn Trait` better in `type_name` intrinsic)
 - #103807 (Add tracking issue for `string_extend_from_within`)
 - #103855 (rustdoc: simplify mobile item-table CSS)
 - #103862 (Use `ObligationCtxt` in `fully_normalize`)
 - #103864 (Reorder `walk_` functions in intravisit.rs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-02 17:35:23 +00:00
Michael Goulet
59be515128 Properly render asyncness for traits without default body 2022-11-02 17:33:25 +00:00
Michael Howell
deb6538348 rustdoc: remove unused mobile CSS .rustdoc { padding-top: 0 }
When this rule was added in dd437ee6ed, as
`body { padding-top: 0 }`, the desktop body tag had non-zero top padding.
This padding was removed in 135281ed15.

This rule no longer overrides a rule in rustdoc's desktop styles, and also
doesn't override the UA stylesheet, since the [HTML standard] has only
margin, not padding, on the page body.

[HTML standard]: https://html.spec.whatwg.org/multipage/rendering.html#the-page
2022-11-02 10:10:44 -07:00
Dylan DPC
5a288dc112
Rollup merge of #103864 - smoelius:reorder-walk-functions, r=fee1-dead
Reorder `walk_` functions in intravisit.rs

Reorder the `walk_` functions to match the order of the `visit_` methods. This is a follow up to https://github.com/rust-lang/rust/pull/103692.

Note that there are some oddballs. I put them where I thought made the most sense:
```diff
$ diff \
<(sed -n 's/^.*\<fn visit_\([^(]*\).*$/\1/;T;p' compiler/rustc_hir/src/intravisit.rs) \
<(sed -n 's/^.*\<fn walk_\([^<]*\).*$/\1/;T;p' compiler/rustc_hir/src/intravisit.rs)
1,5d0
< nested_item
< nested_trait_item
< nested_impl_item
< nested_foreign_item
< nested_body
9,10d3
< id
< name
20c13
< array_length
---
> array_len
30a24
> fn_ret_ty
31a26
> fn_kind
41c36
< variant_data
---
> struct_def
46c41
< infer
---
> inf
54d48
< attribute
```

Also, as some weak evidence that i did things correctly, I get the following before and after the change:
```sh
$ sort compiler/rustc_hir/src/intravisit.rs | openssl sha256
SHA256(stdin)= cac13d2545731ef442f318e2b4286490d7ac5494f4ad10c4cf4c5d4f50d21641
```

r? `@fee1-dead`
2022-11-02 22:32:06 +05:30
Dylan DPC
0312935473
Rollup merge of #103862 - compiler-errors:ocx-in-fully-normalize, r=spastorino
Use `ObligationCtxt` in `fully_normalize`

Simplifies the implementation a bit
2022-11-02 22:32:05 +05:30
Dylan DPC
cd9173ec40
Rollup merge of #103855 - notriddle:notriddle/mobile-item-table, r=GuillaumeGomez
rustdoc: simplify mobile item-table CSS

Using flexbox in column direction is needlessly complicated, since no special flex powers are being used here. Just use regular block layout.

This should result in no visible changes.
2022-11-02 22:32:05 +05:30
Dylan DPC
68db106366
Rollup merge of #103807 - H4x5:string-extend-from-within-tracking-issue, r=Dylan-DPC
Add tracking issue for `string_extend_from_within`

Tracking issue: #103806

The original PR didn't create a tracking issue.
2022-11-02 22:32:04 +05:30
Dylan DPC
bbd3a10663
Rollup merge of #103774 - compiler-errors:dyn-trait-in-type-name, r=eholk
Format `dyn Trait` better in `type_name` intrinsic

Noticed this in #103764 (though not related to that PR at all!)

```rust
trait Foo {
    type Bar;
}

fn main() {
    println!(
        "`dyn Fn(i32, i32) -> i32` => `{}`",
        std::any::type_name::<dyn Fn(i32, i32) -> i32>()
    );
    println!(
        "`dyn Foo<Bar = i32> + Send + Sync` => `{}`",
        std::any::type_name::<dyn Foo<Bar = i32> + Send + Sync>()
    );
}
```

```
`dyn Fn(i32, i32) -> i32` => `dyn core::ops::function::Fn<(i32, i32)>+Output = i32`
`dyn Foo<Bar = i32> + Send + Sync` => `dyn playground::Foo+Bar = i32+core::marker::Sync+core::marker::Send`
```

Just reuse `pretty_print_dyn_existential` which already makes an attempt to make its output stable.
2022-11-02 22:32:03 +05:30
Dylan DPC
109f887bf5
Rollup merge of #103703 - Nilstrieb:flag-recovery-1, r=compiler-errors
Gate some parser recovery behind the check

Mainly in `expr.rs`. `may_recover` doesn't do anything useful yet until I implement that on top of #103439.

r? `@compiler-errors`
2022-11-02 22:32:03 +05:30
Dylan DPC
f7110e14b8
Rollup merge of #103275 - Manishearth:tinystrup, r=pnkfelix
Update tinystr

Tinystr has changed a ton since the old version and is much less unsafe, updated some of the dependencies that use it.
2022-11-02 22:32:02 +05:30
Michael Goulet
74fec9b95a Remove has_errors from FnCtxt 2022-11-02 16:52:07 +00:00
Guillaume Gomez
c983bb162c Add regression test for doc of reexport of local items 2022-11-02 17:36:35 +01:00
Guillaume Gomez
1123852d08 Fix merge of attributes for reexports of local items 2022-11-02 17:36:35 +01:00
yukang
7df9d818ab deprecate DelaySpanBugEmitted and use ErrorGuaranteed directly 2022-11-02 23:15:49 +08:00
Oli Scherer
ecea616052 Simplify astconv item def id handling 2022-11-02 12:03:59 +00:00
bors
c0a7612728 Auto merge of #103690 - GuillaumeGomez:visibility-on-demand, r=notriddle
Make rustdoc Item::visibility computed on-demand

This is a take-over of https://github.com/rust-lang/rust/pull/91408.

Helps with https://github.com/rust-lang/rust/issues/90852 (needs to use `ty::Visibility` directly too).

cc `@camelid`
r? `@notriddle`
2022-11-02 10:32:08 +00:00
viandoxdev
1bc2bfa44c
prevent open with json 2022-11-02 11:28:31 +01:00
viandoxdev
972d075aa6
merge JsonStd and Std steps 2022-11-02 11:23:42 +01:00
bors
822f8c22f5 Auto merge of #103649 - petrochenkov:docnotrait, r=GuillaumeGomez
rustdoc: Do not add external traits to the crate in `register_res`

It's not clear why it was done, and apparently it's no longer necessary now.
Such additions are unpredictable for early doc link resolution and would force us to collect all doc links from all external traits.

Fixes https://github.com/rust-lang/rust/issues/103463
2022-11-02 07:47:10 +00:00
Takayuki Maeda
b96ad1c096 return const_error when ty has errors 2022-11-02 14:47:48 +09:00
bors
a876a4df32 Auto merge of #103857 - Manishearth:rollup-709fui6, r=Manishearth
Rollup of 8 pull requests

Successful merges:

 - #103072 (compiletest: set the dylib path when gathering target cfg)
 - #103084 (Derive `Eq` and `Hash` for `ControlFlow`)
 - #103575 (Change #[suggestion_*] attributes to use style="...")
 - #103637 (Use stdio in UWP apps)
 - #103638 (Add `multivalue` target feature to WASM target)
 - #103781 (Detect unused files in `src/test/mir-opt` and error on them in tidy.)
 - #103837 (Migrate sidebar-links-color GUI test to functions)
 - #103839 (Print valid `--print` requests if request is invalid)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-02 04:27:48 +00:00
Michael Goulet
41e4218d2a Use TraitEngine less 2022-11-02 04:11:05 +00:00
Michael Goulet
5e016b8801 Remove some return-type booleans from FnCtxt 2022-11-02 02:03:09 +00:00
Michael Goulet
a9881f5213 Use ObligationCtxt in fully_normalize 2022-11-02 00:48:58 +00:00
Michael Goulet
20bb56ebfd Use codegen_select in vtable_trait_upcasting_coercion_new_vptr_slot 2022-11-02 00:39:08 +00:00
Manish Goregaokar
c2affd5049
Rollup merge of #103839 - Nilstrieb:print-list, r=compiler-errors
Print valid `--print` requests if request is invalid

When someone makes a typo, it can be useful to see the valid options. This is also useful if someone wants to find out about all the options.
2022-11-01 20:00:40 -04:00
Manish Goregaokar
617f246e21
Rollup merge of #103837 - GuillaumeGomez:migrate-sidebar-links-color-gui-test, r=notriddle
Migrate sidebar-links-color GUI test to functions

r? `@notriddle`
2022-11-01 20:00:40 -04:00
Manish Goregaokar
e2a6d283be
Rollup merge of #103781 - JakobDegen:mir-opt-tidy, r=jyn514
Detect unused files in `src/test/mir-opt` and error on them in tidy.

Closes #97564 .

Determining which files are generated by a given mir opt test is somewhat difficult. Because of this, we extract the logic for doing it out into a common crate that both compiletest and tidy can depend on. This avoids making compiletest a dependency of tidy which would negatively impact compile times for tidy.

Testing for this is that it catches 5 files that violated this lint (and removes them).
2022-11-01 20:00:39 -04:00
Manish Goregaokar
2cfab1f643
Rollup merge of #103638 - ia0:multivalue, r=nagisa
Add `multivalue` target feature to WASM target

This PR is similar to #99643 and #97808. It addresses #96472 for the `multivalue` target feature.

The problem I am trying to fix is to remove the following warning when compiling with `-C target-feature=+multivalue` for `--target=wasm32-unknown-unknown`.

```
warning: unknown feature specified for `-Ctarget-feature`: `multivalue`
  |
  = note: it is still passed through to the codegen backend
  = note: consider filing a feature request
```
2022-11-01 20:00:39 -04:00
Manish Goregaokar
65d63caf8d
Rollup merge of #103637 - ChrisDenton:stdio-uwp, r=thomcc
Use stdio in UWP apps

Fixes #103233

This has been supported since Windows 10.0.16299. See https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-core-console-l1-1-0dll
2022-11-01 20:00:38 -04:00
Manish Goregaokar
69e705564d
Rollup merge of #103575 - Xiretza:suggestions-style-attr, r=davidtwco
Change #[suggestion_*] attributes to use style="..."

As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20tool_only_span_suggestion), this changes `#[(multipart_)suggestion_{short,verbose,hidden}(...)]` attributes to plain `#[(multipart_)suggestion(...)]` attributes with a `style = "{short,verbose,hidden}"` parameter.

It also adds a new style, `tool-only`, that corresponds to `tool_only_span_suggestion`/`tool_only_multipart_suggestion` and causes the suggestion to not be shown in human-readable output at all.

Best reviewed commit-by-commit, there's a bit of noise in there.

cc #100717 `@compiler-errors`
r? `@davidtwco`
2022-11-01 20:00:38 -04:00
Manish Goregaokar
d4bd794f5e
Rollup merge of #103084 - inquisitivecrystal:control-flow, r=scottmcm
Derive `Eq` and `Hash` for `ControlFlow`

There's really no reason for `ControlFlow` not to derive these traits. This is the part of #96416 that no one objected to, but that PR seems stale. The `Eq` derive was also [requested](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/.60ControlFlow.3A.20Eq.60/near/303610659) by `@lcnr` on Zulip to allow for pattern matching.

This change requires an FCP because it's insta-stable.

Closes #96416.
2022-11-01 20:00:37 -04:00
Manish Goregaokar
3aae004281
Rollup merge of #103072 - cuviper:compiletest-path, r=Mark-Simulacrum
compiletest: set the dylib path when gathering target cfg

If the compiler is built with `rpath = false`, then it won't find its
own libraries unless the library search path is set. We already do that
while running the actual compiletests, but #100260 added another rustc
command for getting the target cfg.

    Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    thread 'main' panicked at 'error: failed to get cfg info from "[...]/build/x86_64-unknown-linux-gnu/stage1/bin/rustc"
    --- stdout

    --- stderr
    [...]/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-a2a76dc626cd02d2.so: cannot open shared object file: No such file or directory
    ', src/tools/compiletest/src/common.rs:476:13

Now the library path is set here as well, so it works without rpath.
2022-11-01 20:00:37 -04:00
Michael Howell
82c68cae18 rustdoc: simplify mobile item-table CSS
Using flexbox in column direction is needlessly complicated, since no
special flex powers are being used here. Just use regular block layout.

This should result in no visible changes.
2022-11-01 16:28:58 -07:00
Samuel Moelius
e604327286 Reorder walk_ functions in intravisit.rs 2022-11-01 19:02:45 -04:00
Zhixing Zhang
744fa610eb fix(generic_const_exprs): Fix predicate inheritance for children of opaque types 2022-11-01 15:41:16 -07:00
viandoxdev
ffd4078264
fix json running all the time 2022-11-01 22:18:19 +01:00
bors
11ebe6512b Auto merge of #103217 - mejrs:track, r=eholk
Track where diagnostics were created.

This implements the `-Ztrack-diagnostics` flag, which uses `#[track_caller]` to track where diagnostics are created. It is meant as a debugging tool much like `-Ztreat-err-as-bug`.

For example, the following code...

```rust
struct A;
struct B;

fn main(){
    let _: A = B;
}
```
...now emits the following error message:

```
error[E0308]: mismatched types
 --> src\main.rs:5:16
  |
5 |     let _: A = B;
  |            -   ^ expected struct `A`, found struct `B`
  |            |
  |            expected due to this
-Ztrack-diagnostics: created at compiler\rustc_infer\src\infer\error_reporting\mod.rs:2275:31
```
2022-11-01 21:09:45 +00:00
viandoxdev
6e1361f358
Fixes #103816 make --json work 2022-11-01 21:50:28 +01:00
Michael Goulet
e24df2778f Format dyn Trait better in type_name intrinsic 2022-11-01 20:41:47 +00:00
Guillaume Gomez
a1dfefaded Remove unneeded "rustdoc-preferred-dark-theme" setting 2022-11-01 19:47:12 +01:00
Guillaume Gomez
2024f70379 Migrate sidebar-links-color GUI test to functions 2022-11-01 19:46:42 +01:00
Jakub Beránek
f00d2c9c90
Revert "ci: Bring back ninja for dist builders" 2022-11-01 19:36:25 +01:00
bors
ab5a2bc731 Auto merge of #103841 - Dylan-DPC:rollup-rff2x1l, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #84022 (Make PROC_MACRO_DERIVE_RESOLUTION_FALLBACK a hard error)
 - #103760 (resolve: Turn the binding from `#[macro_export]` into a proper `Import`)
 - #103813 (rustdoc: remove unnecessary CSS `.search-results { clear: both }`)
 - #103817 (rustdoc: rename syntax highlighting CSS class `attribute` to `attr`)
 - #103833 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-01 18:15:32 +00:00
Cameron Steffen
10a5e75537 Add track_caller to some Lock methods 2022-11-01 12:28:14 -05:00
Dylan DPC
2b10891b96
Rollup merge of #103833 - lnicola:rust-analyzer-2022-11-01, r=lnicola
⬆️ rust-analyzer

r? `@ghost`
2022-11-01 22:01:37 +05:30
Dylan DPC
2b0ead3126
Rollup merge of #103817 - notriddle:notriddle/attribute-css, r=GuillaumeGomez
rustdoc: rename syntax highlighting CSS class `attribute` to `attr`

Link classes use the abbreviation `attr` ...

2afca78a0b/src/librustdoc/html/static/css/rustdoc.css (L255-L259)

... so why does syntax highlighting use the full word?

2afca78a0b/src/librustdoc/html/static/css/rustdoc.css (L1095-L1097)
2022-11-01 22:01:37 +05:30