Commit Graph

197293 Commits

Author SHA1 Message Date
David Wood
a9e61677fc triagebot: add mention groups for diag translation
Add mention groups to `triagebot.toml` for diagnostic derive macros and
diagnostic translation sources/resources.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-15 12:26:38 +01:00
David Wood
510ba031dc errors: move translation logic into module
Just moving code around so that triagebot can ping relevant parties when
translation logic is modified.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-15 12:26:35 +01:00
bors
6ce76091c7 Auto merge of #96745 - ehuss:even-more-attribute-validation, r=cjgillot
Visit attributes in more places.

This adds 3 loosely related changes (I can split PRs if desired):

- Attribute checking on pattern struct fields.
- Attribute checking on struct expression fields.
- Lint level visiting on pattern struct fields, struct expression fields, and generic parameters.

There are still some lints which ignore lint levels in various positions. This is a consequence of how the lints themselves are implemented. For example, lint levels on associated consts don't work with `unused_braces`.
2022-08-15 05:50:54 +00:00
bors
80ed61fbd6 Auto merge of #96350 - austinabell:skip_optimization, r=Mark-Simulacrum
fix(iter::skip): Optimize `next` and `nth` implementations of `Skip`

This avoids calling nth/next or nth/nth to first skip elements and then get the next one (unless necessary due to usize overflow).
2022-08-15 03:09:20 +00:00
bors
76c427d6e2 Auto merge of #100510 - compiler-errors:as-a-treat, r=jackh726
make `TypeError` impl `Copy`

r? `@ghost`
2022-08-15 00:22:38 +00:00
bors
b8c0a01b2b Auto merge of #100540 - matthiaskrgr:rollup-734hkpt, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #100249 (Fix HorizonOS regression in FileTimes)
 - #100253 (Recover from mutable variable declaration where `mut` is placed before `let`)
 - #100482 (Add Duration rounding change to release note)
 - #100523 ([rustdoc] remove Clean trait)
 - #100524 (Impl `Debug` for some structs of rustbuild)
 - #100526 (Add tests for the drop behavior of some control flow constructs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-14 21:35:16 +00:00
Michael Goulet
75dfe55a5d TypeError can be Copy 2022-08-14 19:58:46 +00:00
Matthias Krüger
59795d0cb2
Rollup merge of #100526 - Nilstrieb:tests!, r=Mark-Simulacrum
Add tests for the drop behavior of some control flow constructs

In #100513 it was shown that the drop behaviour of let_chains is not correct currently. Since drop behaviour is something pretty subtle, this adds explicit tests for the drop behavior of `if`, `if let` and `match` to make sure that it does not regress in the future.

The `println!`s were left in to make debugging easier in case something goes wrong, but they are not required for the test.
2022-08-14 20:16:03 +02:00
Matthias Krüger
923fe98241
Rollup merge of #100524 - ohno418:impl-debug-for-some-rustbuild-structs, r=Mark-Simulacrum
Impl `Debug` for some structs of rustbuild

A small patch to impl `Debug` for some structs of rustbuild to make debugging easier.

(I was trying to impl `Debug` for the `Config` struct, but found to have a bit more things to do. So gave up for now.)
2022-08-14 20:16:03 +02:00
Matthias Krüger
6519a03236
Rollup merge of #100523 - GuillaumeGomez:remove-clean-impls, r=Dylan-DPC
[rustdoc] remove Clean trait

Follow-up of https://github.com/rust-lang/rust/pull/99638.

This is (finally!) the last part.

r? `@Dylan-DPC`
2022-08-14 20:16:02 +02:00
Matthias Krüger
6e53472ffc
Rollup merge of #100482 - youknowone:patch-1, r=Mark-Simulacrum
Add Duration rounding change to release note

one of possible fix of #100480

fixes https://github.com/rust-lang/rust/issues/100480
2022-08-14 20:16:01 +02:00
Matthias Krüger
13b8b6ede0
Rollup merge of #100253 - obeis:issue-100197, r=cjgillot
Recover from mutable variable declaration where `mut` is placed before `let`

Closes #100197
2022-08-14 20:16:00 +02:00
Matthias Krüger
b8b3ead67a
Rollup merge of #100249 - Meziu:master, r=joshtriplett
Fix HorizonOS regression in FileTimes

The changes in #98246 caused a regression for multiple Newlib-based systems. This is just a fix including HorizonOS to the list of  targets which require a workaround.

``@AzureMarker`` ``@ian-h-chamberlain``
r? ``@nagisa``
2022-08-14 20:16:00 +02:00
austinabell
00bc9e8ac4
fix(iter::skip): Optimize next and nth implementations of Skip 2022-08-14 13:25:13 -04:00
bors
801821d156 Auto merge of #100429 - GuillaumeGomez:merge-html-elements-together, r=notriddle
rustdoc: Merge source code pages HTML elements together

We realized that the HTML generated for the source code pages could be improved quite a lot. This PR is a first pass toward this goal. Some explanations: it merges similar classes elements (even when there are white characters in between).

There is an exception to this: if this is an ident, I also merged it with "unclassified" elements. This part is up to debate and can be very easily removed as the check is performed in one place (in the `can_merge` function).

EDIT: The `ident` is now only kept in the code for the `span` it contains but it is not rendered into the HTML.

So now some numbers:

For these ones, on each page, I run this JS: `document.getElementsByTagName('*').length`. The goal is to count the number of DOM elements. I took some pages that seemed big, but don't hesitate to check some others.

| file name | before this PR | with this PR | diff | without ident | diff |
|-|-|-|-|-|-|
| std/lib.rs.html (source link on std crate page) | 3455 | 2776 | 20.7% | 2387 | 31% |
| alloc/vec/mod.rs.html (source on Vec type page) | 11012 | 8084 | 26.6% | 6682 | 39.4% |
| alloc/string.rs.html (source on String type page) | 10800 | 8214 | 24% | 6712 | 37.9% |
| std/sync/mutex.rs.html (source on Mutex type page) | 2953 | 2403 | 18.7% | 2139 | 27.6% |

You can test it [here](https://rustdoc.crud.net/imperio/merge-html-elements-together/src/std/lib.rs.html).

cc `@jsha`
r? `@notriddle`
2022-08-14 14:37:17 +00:00
Nilstrieb
f6c2816f47 Add tests for the drop behavior of some control flow constructs
In #100513 it was shown that the drop behavior of let_chains is not correct
currently. Since drop behavior is something pretty subtle, this adds
explicit tests for the drop behavior of `if`, `if let` and `match` to
make sure that it does not regress in the future.

The `println!`s were left in to make debugging easier in case something
goes wrong, but they are not required for the test.
2022-08-14 16:00:17 +02:00
bors
4c56655838 Auto merge of #100525 - Dylan-DPC:rollup-4cp6nu0, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #99582 (Delay a span bug if we see ty/const generic params during writeback)
 - #99861 (orphan check: rationalize our handling of constants)
 - #100026 (Add `Iterator::array_chunks` (take N+1))
 - #100115 (Suggest removing `let` if `const let` or `let const` is used)
 - #100126 (rustc_target: Update some old naming around self contained linking)
 - #100487 (`assert_{inhabited,zero_valid,uninit_valid}` intrinsics are safe)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-14 12:06:50 +00:00
Dylan DPC
9de9786ef8
Rollup merge of #100487 - tmiasko:assert-safe, r=petrochenkov
`assert_{inhabited,zero_valid,uninit_valid}` intrinsics are safe

Those intrinsics either panic or do nothing. They are safe.
2022-08-14 17:09:17 +05:30
Dylan DPC
38bc93730b
Rollup merge of #100126 - petrochenkov:screname, r=davidtwco
rustc_target: Update some old naming around self contained linking

The "fallback" naming pre-dates introduction of `-Clink-self-contained`.
Noticed when reviewing https://github.com/rust-lang/rust/pull/99500.

This PR doesn't break any json target spec, but supporting per-linker-flavor startup objects needed by https://github.com/rust-lang/rust/pull/99500 will break them, so maybe next time I'll remove the compatibility names.
2022-08-14 17:09:16 +05:30
Dylan DPC
7473484d52
Rollup merge of #100115 - obeis:issue-99910, r=cjgillot
Suggest removing `let` if `const let` or `let const` is used

Closes #99910
2022-08-14 17:09:15 +05:30
Dylan DPC
482a6eaf10
Rollup merge of #100026 - WaffleLapkin:array-chunks, r=scottmcm
Add `Iterator::array_chunks` (take N+1)

A revival of https://github.com/rust-lang/rust/pull/92393.

r? `@Mark-Simulacrum`
cc `@rossmacarthur` `@scottmcm` `@the8472`

I've tried to address most of the review comments on the previous attempt. The only thing I didn't address is `try_fold` implementation, I've left the "custom" one for now, not sure what exactly should it use.
2022-08-14 17:09:14 +05:30
Dylan DPC
92344e369b
Rollup merge of #99861 - lcnr:orphan-check-cg, r=jackh726
orphan check: rationalize our handling of constants

cc `@rust-lang/types` `@rust-lang/project-const-generics` on whether you agree with this reasoning.

r? types
2022-08-14 17:09:13 +05:30
Dylan DPC
a9f3e0393a
Rollup merge of #99582 - compiler-errors:issue-99566, r=cjgillot
Delay a span bug if we see ty/const generic params during writeback

Fixes #99566
2022-08-14 17:09:12 +05:30
Guillaume Gomez
6e574e100c Update rustdoc tests 2022-08-14 13:31:46 +02:00
ohno418
0931358d88 Impl Debug for some structs of rustbuild 2022-08-14 19:42:06 +09:00
Guillaume Gomez
74fb5f85b3 Remove the Clean trait 2022-08-14 11:45:49 +02:00
Guillaume Gomez
4b7fe4a8e1 remove Clean trait implementation for hir::Variant 2022-08-14 11:44:59 +02:00
Guillaume Gomez
33df8a9655 Don't generate ident elements as DOM nodes 2022-08-14 11:30:52 +02:00
Guillaume Gomez
68f327bcc1 Merge HTML elements in highlighting when they can be merged together 2022-08-14 11:30:52 +02:00
bors
2fbc08e2ce Auto merge of #100516 - compiler-errors:rollup-fgrfeb3, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #99646 (Only point out a single function parameter if we have a single arg incompatibility)
 - #100299 (make `clean::Item::span` return `Option` instead of dummy span)
 - #100335 (Rustdoc-Json: Add `Path` type for traits.)
 - #100367 (Suggest the path separator when a dot is used on a trait)
 - #100431 (Enum variant ctor inherits the stability of the enum variant)
 - #100446 (Suggest removing a semicolon after impl/trait items)
 - #100468 (Use an extensionless `x` script for non-Windows)
 - #100479 (Argument type error improvements)

Failed merges:

 - #100483 (Point to generic or arg if it's the self type of unsatisfied projection predicate)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-14 06:40:58 +00:00
Michael Goulet
b3e76aa491
Rollup merge of #100479 - compiler-errors:argument-type-error-improvements, r=lcnr
Argument type error improvements

Motivated by this interesting code snippet:

```rust
#[derive(Copy, Clone)]
struct Wrapper<T>(T);

fn foo(_: fn(i32), _: Wrapper<i32>) {}

fn f(_: u32) {}

fn main() {
    let w = Wrapper::<isize>(1isize);
    foo(f, w);
}
```

Which currently errors like:
```
error[E0308]: arguments to this function are incorrect
  --> src/main.rs:10:5
   |
10 |     foo(f, w);
   |     ^^^ -  - expected `i32`, found `isize`
   |         |
   |         expected `i32`, found `u32`
   |
   = note: expected fn pointer `fn(i32)`
                 found fn item `fn(u32) {f}`
   = note: expected struct `Wrapper<i32>`
              found struct `Wrapper<isize>`
note: function defined here
  --> src/main.rs:4:4
   |
4  | fn foo(_: fn(i32), _: Wrapper<i32>) {}
   |    ^^^ ----------  ---------------
```

Specifically, that double `expected .. found ..` which is very difficult to correlate to the types in the arguments. Also, the fact that "expected `i32`, found `isize`" and the other argument mismatch label don't even really explain what's going on here.

After this PR:
```
error[E0308]: arguments to this function are incorrect
  --> $DIR/two-mismatch-notes.rs:10:5
   |
LL |     foo(f, w);
   |     ^^^
   |
note: expected fn pointer, found fn item
  --> $DIR/two-mismatch-notes.rs:10:9
   |
LL |     foo(f, w);
   |         ^
   = note: expected fn pointer `fn(i32)`
                 found fn item `fn(u32) {f}`
note: expected struct `Wrapper`, found a different struct `Wrapper`
  --> $DIR/two-mismatch-notes.rs:10:12
   |
LL |     foo(f, w);
   |            ^
   = note: expected struct `Wrapper<i32>`
              found struct `Wrapper<isize>`
note: function defined here
  --> $DIR/two-mismatch-notes.rs:4:4
   |
LL | fn foo(_: fn(i32), _: Wrapper<i32>) {}
   |    ^^^ ----------  ---------------

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
```

Yeah, it's a bit verbose, but much clearer IMO.

---

Open to discussions about how this could be further improved. Motivated by `@jyn514's` [tweet](https://mobile.twitter.com/joshuayn514/status/1558042020601634816) here.
2022-08-13 21:06:53 -07:00
Michael Goulet
809fc86871
Rollup merge of #100468 - cuviper:lazy-x, r=jyn514
Use an extensionless `x` script for non-Windows

#99992 added `x.sh` and `x.ps1`, but this broke my lazy `./xTAB` habit that used to get me to `./x.py`. If we rename `x.sh` to `x`, then I can adjust to `./xSPACE` for the same number of characters typed.

r? `@jyn514`
2022-08-13 21:06:52 -07:00
Michael Goulet
86e1d1e28f
Rollup merge of #100446 - TaKO8Ki:suggest-removing-semicolon-after-impl-trait-items, r=compiler-errors
Suggest removing a semicolon after impl/trait items

fixes #99822
2022-08-13 21:06:51 -07:00
Michael Goulet
d46451ce2c
Rollup merge of #100431 - compiler-errors:enum-ctor-variant-stab, r=estebank
Enum variant ctor inherits the stability of the enum variant

Fixes #100399
Fixes #100420

Context #71481 for why enum variants don't need stability
2022-08-13 21:06:50 -07:00
Michael Goulet
e248c7f9ae
Rollup merge of #100367 - fmease:fix-100365, r=compiler-errors
Suggest the path separator when a dot is used on a trait

Fixes #100365.

`@rustbot` label A-diagnostics
r? diagnostics
2022-08-13 21:06:49 -07:00
Michael Goulet
4989f6a724
Rollup merge of #100335 - aDotInTheVoid:rdj-resolved-path, r=GuillaumeGomez
Rustdoc-Json: Add `Path` type for traits.

Avoids using `Type` for trait fields, as a trait must always be a path, and not any other kind of type.

``@rustbot`` modify labels: +A-rustdoc-json +T-rustdoc

Closes #100106
2022-08-13 21:06:48 -07:00
Michael Goulet
d496c4eee8
Rollup merge of #100299 - compiler-errors:issue-100283, r=notriddle
make `clean::Item::span` return `Option` instead of dummy span

Fixes #100283
2022-08-13 21:06:47 -07:00
Michael Goulet
2af344595a
Rollup merge of #99646 - compiler-errors:arg-mismatch-single-arg-label, r=estebank
Only point out a single function parameter if we have a single arg incompatibility

Fixes #99635
2022-08-13 21:06:46 -07:00
bors
d70c0ecfae Auto merge of #100495 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/100424
2022-08-14 04:00:04 +00:00
bors
b76fec3ca8 Auto merge of #100511 - compiler-errors:rollup-vrte4w5, r=compiler-errors
Rollup of 11 pull requests

Successful merges:

 - #100355 (rustdoc: Rename ``@has` FILE PATTERN` to ``@hasraw` FILE PATTERN`)
 - #100407 (avoid some int2ptr casts in thread_local_key tests)
 - #100434 (Fix HIR pretty printing of let else)
 - #100438 (Erase regions better in `promote_candidate`)
 - #100445 (adapt test for msan message change)
 - #100447 (Remove more Clean trait implementations)
 - #100464 (Make `[rust] use-lld=true` work on windows)
 - #100475 (Give a helpful diagnostic when the next struct field has an attribute)
 - #100490 (wf: correctly `shallow_resolve` consts)
 - #100501 (nicer Miri backtraces for from_exposed_addr)
 - #100509 (merge two test directories that mean the same thing)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-14 01:29:58 +00:00
Michael Goulet
752b0e0672 make clean::Item::span return option instead of dummy span 2022-08-13 22:03:47 +00:00
Michael Goulet
860e093efb
Rollup merge of #100509 - BoxyUwU:merge_hrtb_with_higher_rank_trait_bound, r=compiler-errors
merge two test directories that mean the same thing

hopefully `hrtb` doesnt have a secret second meaning that i'm not aware of 😆

r? `@compiler-errors`
2022-08-13 14:10:15 -07:00
Michael Goulet
f8bdd9c680
Rollup merge of #100501 - RalfJung:miri-from-exposed-addr, r=Mark-Simulacrum
nicer Miri backtraces for from_exposed_addr

Miri by default warns about using from_exposed_addr; this makes the span for that a bit nicer.
2022-08-13 14:10:14 -07:00
Michael Goulet
aafaec38bb
Rollup merge of #100490 - lcnr:wf-consts, r=jackh726
wf: correctly `shallow_resolve` consts

`shallow_resolve` on `InferConst` is always a noop. this is mostly irrelevant as inference vars should already be resolved at most - if not all - call sites. Haven't actually looked too deeply into whether this was a problem.
2022-08-13 14:10:13 -07:00
Michael Goulet
29f905bfaf
Rollup merge of #100475 - chenyukang:fix-100461, r=fee1-dead
Give a helpful diagnostic when the next struct field has an attribute

Fixes #100461
2022-08-13 14:10:12 -07:00
Michael Goulet
7a34d39278
Rollup merge of #100464 - khyperia:lld-icf-on-windows, r=jyn514
Make `[rust] use-lld=true` work on windows

Before, it would fail with "error: ignoring unknown argument '-Wl,--icf=all'"

This option was introduced in https://github.com/rust-lang/rust/pull/99062 (well, technically https://github.com/rust-lang/rust/pull/99680)

See zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/rust-lld.3A.20error.3A.20ignoring.20unknown.20argument.20'-Wl.2C--icf.3Dall'
2022-08-13 14:10:11 -07:00
Michael Goulet
b1d77dd2dc
Rollup merge of #100447 - GuillaumeGomez:rm-clean-impl, r=Dylan-DPC
Remove more Clean trait implementations

Follow-up of https://github.com/rust-lang/rust/pull/99638.

r? ``@Dylan-DPC``
2022-08-13 14:10:10 -07:00
Michael Goulet
ef72484f08
Rollup merge of #100445 - krasimirgg:llvm-16-msan, r=tmiasko
adapt test for msan message change

LLVM commit 057cabd997 removed the function from the msan error message. This adapts our test accordingly.

Found via our experimental rust + llvm @ HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12634#018289fe-b0bc-4bab-89b3-fb1d4e38f6db
2022-08-13 14:10:08 -07:00
Michael Goulet
9ab54df8d7
Rollup merge of #100438 - compiler-errors:issue-100360, r=lcnr
Erase regions better in `promote_candidate`

Use `tcx.erase_regions` instead of manually walking through the substs.... this also makes the code slightly simpler 🙈

Fixes #100360
Fixes #89851
2022-08-13 14:10:07 -07:00
Michael Goulet
2126cc62fb
Rollup merge of #100434 - compiler-errors:issue-100373, r=cjgillot
Fix HIR pretty printing of let else

Fixes #100373
Fixes #99318
Fixes #99319
2022-08-13 14:10:06 -07:00