Commit Graph

131814 Commits

Author SHA1 Message Date
Guillaume Gomez
4b7fe4a8e1 remove Clean trait implementation for hir::Variant 2022-08-14 11:44:59 +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
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
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
Michael Goulet
4b51df3df0
Rollup merge of #100355 - camelid:has2-rename, r=GuillaumeGomez
rustdoc: Rename `@has FILE PATTERN` to `@hasraw FILE PATTERN`

Fixes #100354.
2022-08-13 14:10:04 -07:00
Ellen
40b1f612c9 move 2022-08-13 19:42:25 +01:00
Michael Goulet
aa1a07f114 Do not inline non-simple argument type errors into labels 2022-08-13 18:24:36 +00:00
Michael Goulet
b0cd1e192c Label argument coercion errors 2022-08-13 18:24:36 +00:00
Ralf Jung
f3fc1cd0c4 update Miri 2022-08-13 10:00:48 -04:00
Takayuki Maeda
d47df26784 use span_suggestion instead of span_suggestion_verbose 2022-08-13 22:10:54 +09:00
Noah Lev
0d588e928e rustdoc: Fix incorrect usage of @!has and @!matches
`@!has` (and `@!matches`) with two arguments used to treat the second
argument as a literal string of HTML code. Now, that feature has been
renamed into `@!hasraw` (and `@!matchesraw`), and the arity-2 `@!has`
version is an error.

These uses thought the second argument was being treated as an XPath, as
with the arity-3 version, but in fact was being treated as literal HTML.
Because these were checking for the *absence* of the string, the tests
silently did nothing -- an XPath string won't ever be showing up in the
test's generated HTML!
2022-08-13 00:56:16 -04:00
Noah Lev
b34e2404fd Update @!has name in tests 2022-08-13 00:52:16 -04:00
yukang
52a15180d2 give a helpful diagnostic even when the next struct field has an attribute 2022-08-13 12:50:53 +08:00
Noah Lev
9db6061d64 Fix line lengths 2022-08-13 00:37:14 -04:00
Noah Lev
13d53273f8 Rename @hastext to @hasraw (same for matches)
I think `@hasraw` is slightly clearer than `@hastext` since it is
actually matching against the raw HTML, not the text nodes.
2022-08-13 00:37:13 -04:00
Noah Lev
37eed1d1ff Update tests: arity-2 @{has,matches} -> ...text 2022-08-13 00:36:50 -04:00
Noah Lev
01408fc627 Rename @{has,matches}-literal to ...text
Reasons:
1. It's shorter.
2. `@matches-literal` seems to contradict itself: a regex is
   intrinsically not a literal match, while it is still a textual match.
2022-08-13 00:35:03 -04:00
Noah Lev
2787eb05d5 Use different name for arity-2 @has and @matches
See #100354 for the rationale.
2022-08-13 00:35:03 -04:00
bors
e8dc8bca21 Auto merge of #100341 - andrewpollack:fuchsia-llvm-libunwind, r=tmandry
Use llvm-libunwind="in-tree" for Fuchsia targets

With updates to Fuchsia CI's Zircon libraries #99833, we can introduce `llvm-libunwind="in-tree"` for Fuchsia targets. This PR restores functionality removed from https://github.com/rust-lang/rust/pull/93604#issuecomment-1136515651.

cc `@tmandry` `@djkoloski`
2022-08-13 02:41:27 +00:00
Josh Stone
de8dedb0a5 Use an extensionless x script for non-Windows 2022-08-12 15:39:26 -07:00
khyperia
dcead65e48 Make [rust] use-lld=true work on windows
Before, it would fail with "error: ignoring unknown argument '-Wl,--icf=all'"
2022-08-12 23:59:02 +02:00
Mark Rousskov
154a09dd91 Adjust cfgs 2022-08-12 16:28:15 -04:00
Mark Rousskov
7b42606758 Bump bootstrap compiler 2022-08-12 16:27:26 -04:00
Michael Goulet
237cbe91a8 Adjust span of closure param 2022-08-12 15:18:40 +00:00
Michael Goulet
262644d94a And for closures 2022-08-12 15:18:40 +00:00
Michael Goulet
20121fa781 Point out a single arg if we have a single arg incompatibility 2022-08-12 15:18:39 +00:00
Michael Goulet
b821ce6097 enum variant ctor inherits stability of variant 2022-08-12 15:15:36 +00:00
Dylan DPC
3bc30bb012
Rollup merge of #100443 - est31:let_else_regression_tests, r=Mark-Simulacrum
Add two let else regression tests

Adds a regression test for #94176, as it was fixed by #98574 but doesn't have a regression test. The PR also incorporates a commit from #94012 which added a test for an issue discovered in that PR.

Originally they have been part of #99291, but I've moved them out in the hopes of getting them merged more quickly, as that PR is already open since a month, and so that #99291 can focus on the drop order part of things.

Closes #94176
Closes #96961 -- dupe of #94176
2022-08-12 20:39:18 +05:30
Dylan DPC
03560346c4
Rollup merge of #100409 - jsha:highlight-lighter, r=GuillaumeGomez
rustdoc: don't generate DOM element for operator

In our source page highlighting, we were generating `<span class="op">` tags for all "operators", including e.g. `<` `>` around generic parameters, `*`, `&`. This contributed significantly to DOM size, but we don't actually style `.op` except in the ayu theme.

Remove the styles for `.op` in ayu, and stop generating the `<span>`s.

This reduces DOM size of an example page[1] from 265,938 HTML elements to 242,165 elements, a 9% reduction.

r? ``@GuillaumeGomez``

Demo: (warning - slow!) https://rustdoc.crud.net/jsha/highlight-lighter/src/core/up/up/stdarch/crates/core_arch/src/x86/avx512f.rs.html

[1]:
https://doc.rust-lang.org/nightly/src/core/up/up/stdarch/crates/core_arch/src/x86/avx512f.rs.html
2022-08-12 20:39:17 +05:30
Dylan DPC
9914c96f06
Rollup merge of #100396 - chenyukang:fix-100394, r=petrochenkov
Suggest const and static for global variable

Fixing #100394
2022-08-12 20:39:16 +05:30
Dylan DPC
9e69dbce19
Rollup merge of #100366 - davidtwco:translation-never-fail, r=compiler-errors
errors: don't fail on broken primary translations

If a primary bundle doesn't contain a message then the fallback bundle is used. However, if the primary bundle's message is broken (e.g. it refers to a interpolated variable that the compiler isn't providing) then this would just result in a compiler panic. While there aren't any primary bundles right now, this is the type of issue that could come up once translation is further along.

r? ```@compiler-errors``` (since this comes out of a in-person discussion we had at RustConf)
2022-08-12 20:39:14 +05:30
Dylan DPC
caac670a16
Rollup merge of #100247 - cjgillot:verify-dyn-trait-alias-defaults, r=lcnr
Generalize trait object generic param check to aliases.

The current algorithm only checks that `Self` does not appear in defaults for traits.  This is not sufficient for trait aliases.
This PR moves the check to trait object elaboration, which sees through trait aliases.

Fixes https://github.com/rust-lang/rust/issues/82927.
Fixes https://github.com/rust-lang/rust/issues/84789.
2022-08-12 20:39:12 +05:30
Dylan DPC
392ba5f111
Rollup merge of #100229 - RalfJung:extra-const-ub-checks, r=lcnr
add -Zextra-const-ub-checks to enable more UB checking in const-eval

Cc https://github.com/rust-lang/rust/issues/99923
r? `@oli-obk`
2022-08-12 20:39:11 +05:30
Guillaume Gomez
001cc12af7 remove Clean trait implementation for hir::BareFnTy 2022-08-12 11:40:39 +02:00
Guillaume Gomez
a65647a7f6 remove Clean trait implementation for hir::PathSegment 2022-08-12 11:37:32 +02:00