Commit Graph

167765 Commits

Author SHA1 Message Date
Jack Huey
e14eae6226 Remove subst_spanned 2022-05-08 21:53:25 -04:00
bors
f9b2e3c87b Auto merge of #96816 - GuillaumeGomez:rollup-oumn95i, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #96581 (make Size and Align debug-printing a bit more compact)
 - #96636 (Fix jump to def regression)
 - #96760 (diagnostics: port more diagnostics to derive + add support for `Vec` fields)
 - #96788 (Improve validator around field projections and checked bin ops)
 - #96805 (Change eslint rules from configuration comments to configuration file)
 - #96807 (update Miri)
 - #96811 (Fix a minor typo in the description of Formatter)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-07 13:31:04 +00:00
Guillaume Gomez
c6007d6b57
Rollup merge of #96811 - createyourpersonalaccount:doc-typofix, r=JohnTitor
Fix a minor typo in the description of Formatter
2022-05-07 15:23:50 +02:00
Guillaume Gomez
af2f9447e9
Rollup merge of #96807 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/96773
r? ``@ghost``
2022-05-07 15:23:49 +02:00
Guillaume Gomez
f98f92fdaf
Rollup merge of #96805 - Folyd:eslint, r=GuillaumeGomez
Change eslint rules from configuration comments to configuration file

Repeatedly declaring eslint rules in source files is an annoying thing, we should move those rules into the eslint configuration file.

r? ``@GuillaumeGomez``
2022-05-07 15:23:48 +02:00
Guillaume Gomez
27a2bae89c
Rollup merge of #96788 - JakobDegen:checked-binop, r=oli-obk
Improve validator around field projections and checked bin ops

The two commits are unrelated. In both cases, these rules were already documented in MIR docs.
2022-05-07 15:23:47 +02:00
Guillaume Gomez
a644197391
Rollup merge of #96760 - davidtwco:diagnostic-translation-vec, r=oli-obk
diagnostics: port more diagnostics to derive + add support for `Vec` fields

- Port "unconstrained opaque type" diagnostic to using the derive.
- Allow `Vec` fields in diagnostic derive - enables support for diagnostics that have multiple primary spans, or have subdiagnostics repeated at multiple locations. `Vec<..>` fields in the diagnostic derive become loops in the generated code.
- Add `create_{err,warning}` - there wasn't a way to create a diagnostic from a struct and not emit it straight away.
- Port "explicit generic args w/ impl trait" diagnostic to using the derive.

r? `````@oli-obk`````
cc `````@pvdrz`````
2022-05-07 15:23:46 +02:00
Guillaume Gomez
3346d11f4e
Rollup merge of #96636 - GuillaumeGomez:fix-jump-to-def-regression, r=notriddle
Fix jump to def regression

https://github.com/rust-lang/rust/pull/93803 introduced a regression in the "jump to def" feature. This fixes it.

Nice side-effect: it adds a new regression test. :)

I also used this opportunity to add documentation about this unstable feature in the rustdoc book.

cc ``@cjgillot``
r? ``@notriddle``
2022-05-07 15:23:45 +02:00
Guillaume Gomez
c29f8575ac
Rollup merge of #96581 - RalfJung:debug-size-align, r=oli-obk
make Size and Align debug-printing a bit more compact

In particular in `{:#?}`-mode, these take up a lot of space, so I think this is the better alternative (even though it is a bit longer in `{:?}` mode, I think it is still more readable).

We could make it even smaller by deviating further from what the actual code looks like, e.g. via something like `Size(4 bytes)`. Not sure what people would think about that?

Cc `````@oli-obk`````
2022-05-07 15:23:44 +02:00
Nikolaos Chatzikonstantinou
7c1d241f2b
Fix a minor typo in the description of Formatter 2022-05-07 19:32:54 +09:00
bors
6139205622 Auto merge of #96780 - Kobzol:ci-llvm-upgrade-osx-windows, r=Mark-Simulacrum
Update LLVM version used to build OS X and Windows artifacts to 14.0.2

Let's see what breaks.

r? `@Mark-Simulacrum`
2022-05-07 09:11:12 +00:00
Ralf Jung
59d5c20042 update Miri 2022-05-07 10:14:16 +02:00
bors
574830f573 Auto merge of #96094 - Elliot-Roberts:fix_doctests, r=compiler-errors
Begin fixing all the broken doctests in `compiler/`

Begins to fix #95994.
All of them pass now but 24 of them I've marked with `ignore HELP (<explanation>)` (asking for help) as I'm unsure how to get them to work / if we should leave them as they are.
There are also a few that I marked `ignore` that could maybe be made to work but seem less important.
Each `ignore` has a rough "reason" for ignoring after it parentheses, with

- `(pseudo-rust)` meaning "mostly rust-like but contains foreign syntax"
- `(illustrative)` a somewhat catchall for either a fragment of rust that doesn't stand on its own (like a lone type), or abbreviated rust with ellipses and undeclared types that would get too cluttered if made compile-worthy.
- `(not-rust)` stuff that isn't rust but benefits from the syntax highlighting, like MIR.
- `(internal)` uses `rustc_*` code which would be difficult to make work with the testing setup.

Those reason notes are a bit inconsistently applied and messy though. If that's important I can go through them again and try a more principled approach. When I run `rg '```ignore \(' .` on the repo, there look to be lots of different conventions other people have used for this sort of thing. I could try unifying them all if that would be helpful.

I'm not sure if there was a better existing way to do this but I wrote my own script to help me run all the doctests and wade through the output. If that would be useful to anyone else, I put it here: https://github.com/Elliot-Roberts/rust_doctest_fixing_tool
2022-05-07 06:30:29 +00:00
bors
36aa7c1436 Auto merge of #96804 - compiler-errors:rollup-1mc6aw3, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #96660 ([bootstrap] Give a better error when trying to run a path with no registered step)
 - #96701 (update `jemallocator` example to use 2018 edition import syntax)
 - #96746 (Fix an ICE on #96738)
 - #96758 (bootstrap: bsd platform flags for split debuginfo)
 - #96778 (Remove closures on `expect_local` to apply `#[track_caller]`)
 - #96781 (Fix an incorrect link in The Unstable Book)
 - #96783 (Link to correct issue in issue-95034 known-bug)
 - #96801 (Add regression test for #96319)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-07 04:15:52 +00:00
Michael Goulet
fe526695d1
Rollup merge of #96801 - Aaron1011:coinductive-cycle-test, r=compiler-errors
Add regression test for #96319
2022-05-06 20:49:37 -07:00
Michael Goulet
24d1304e5e
Rollup merge of #96783 - aliemjay:typo-issue-95034, r=compiler-errors
Link to correct issue in issue-95034 known-bug

fix a typo is issue number: 94034 -> 95034
2022-05-06 20:49:36 -07:00
Michael Goulet
738d58b36e
Rollup merge of #96781 - koic:fix_an_incorrect_link_in_the_unstable_book, r=ehuss
Fix an incorrect link in The Unstable Book

https://github.com/rust-lang/rust/blob/master/src/librustc_session/lint/builtin.rs returns page not found.

The following is the background of the move.
First https://github.com/rust-lang/rust/pull/74862 moves from src/librustc_session/lint/builtin.rs to compiler/rustc_session/src/lint/builtin.rs.
Then https://github.com/rust-lang/rust/commit/23018a5 moves from compiler/rustc_session/src/lint/builtin.rs to compiler/rustc_lint_defs/src/builtin.rs.

So, the current correct link is https://github.com/rust-lang/rust/blob/master/compiler/rustc_lint_defs/src/builtin.rs.

This PR fixes a broken link on the following page:
https://doc.rust-lang.org/beta/unstable-book/language-features/plugin.html
2022-05-06 20:49:35 -07:00
Michael Goulet
f799c5d897
Rollup merge of #96778 - JohnTitor:expect-local-track-caller-take-2, r=petrochenkov
Remove closures on `expect_local` to apply `#[track_caller]`

Pointed out in https://github.com/rust-lang/rust/pull/96747#discussion_r866576196
Didn't change `expect_non_local` as I'm not sure if it's also the case.
r? ``@petrochenkov``
2022-05-06 20:49:35 -07:00
Michael Goulet
0f1c067aec
Rollup merge of #96758 - davidtwco:split-debuginfo-bootstrap-bsd, r=Mark-Simulacrum
bootstrap: bsd platform flags for split debuginfo

Addresses https://github.com/rust-lang/rust/pull/96597#issuecomment-1118905025.

Bootstrap currently provides `-Zunstable-options` for OpenBSD when using split debuginfo - this commit provides it for all BSD targets.

We should probably work out a better way of handling the stability of the split debuginfo flag - all options for the flag are unstable but one of them is the default for each platform already.

cc `@m-ou-se`
r? `@Mark-Simulacrum`
2022-05-06 20:49:34 -07:00
Michael Goulet
825dc80d1a
Rollup merge of #96746 - JohnTitor:issue-96738, r=petrochenkov
Fix an ICE on #96738

In the block we don't know if the method actually exists thus `expect_local` panics.
Fixes #96738
Fixes #96583
2022-05-06 20:49:32 -07:00
Michael Goulet
102bbc9ad3
Rollup merge of #96701 - kraktus:alloc_example_2018_edition, r=Mark-Simulacrum
update `jemallocator` example to use 2018 edition import syntax
2022-05-06 20:49:31 -07:00
Michael Goulet
6226d10a1b
Rollup merge of #96660 - jyn514:better-missing-path-error, r=Mark-Simulacrum
[bootstrap] Give a better error when trying to run a path with no registered step

Before:
```
thread 'main' panicked at 'error: no rules matched invalid', src/bootstrap/builder.rs:287:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

After:
```
error: no `check` rules matched 'invalid'
help: run `x.py check --help --verbose` to show a list of available paths
note: if you are adding a new Step to bootstrap itself, make sure you register it with `describe!`
```
2022-05-06 20:49:30 -07:00
Folyd
a8ede1248d Change eslint rules from configuration comments to configuration files 2022-05-07 11:47:30 +08:00
Aaron Hill
848028c0a7
Add regression test for #96319 2022-05-06 22:28:22 -04:00
bors
f6e5570460 Auto merge of #96531 - kckeiks:remove-item-like-visitor-from-rustc-typeck, r=cjgillot
Remove ItemLikeVisitor impls from rustc_typeck

Issue #95004
cc `@cjgillot`
2022-05-07 01:59:11 +00:00
bors
4799baa70d Auto merge of #96458 - Aaron1011:no-cycle-caching, r=jackh726,cjgillot
Don't cache results of coinductive cycle
2022-05-06 22:41:16 +00:00
Jakob Degen
c4168fdb50 Check that field projections have the correct type 2022-05-06 16:43:09 -04:00
bors
77652b9ef3 Auto merge of #96785 - GuillaumeGomez:rollup-rgiwa57, r=GuillaumeGomez
Rollup of 10 pull requests

Successful merges:

 - #96557 (Allow inline consts to reference generic params)
 - #96590 (rustdoc: when running a function-signature search, tweak the tab bar)
 - #96650 (Collect function instance used in `global_asm!` sym operand)
 - #96733 (turn `append_place_to_string` from recursion into iteration)
 - #96748 (Fixes reexports in search)
 - #96752 (Put the incompatible_closure_captures lint messages in alphabetical order)
 - #96754 (rustdoc: ensure HTML/JS side implementors don't have dups)
 - #96772 (Suggest fully qualified path with appropriate params)
 - #96776 (Fix two minor issues in hir.rs)
 - #96782 (a small `mirror_expr` cleanup)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-06 20:14:01 +00:00
Guillaume Gomez
3bfa2eb9f0 Add rustdoc documentation about unstable feature "jump to def" 2022-05-06 22:02:05 +02:00
Guillaume Gomez
fd6b01f0e9 Add regression test for jump-to-def 2022-05-06 22:02:04 +02:00
Guillaume Gomez
5c7ce84d74 Remove unneeded SpanMapVisitor::visit_generics function 2022-05-06 22:01:30 +02:00
Jakob Degen
5289bbece3 Expand validator to be more precise on checked binary ops 2022-05-06 15:40:32 -04:00
Guillaume Gomez
a0e2c7e8bb
Rollup merge of #96782 - lcnr:mirror-expr, r=compiler-errors
a small `mirror_expr` cleanup
2022-05-06 20:05:45 +02:00
Guillaume Gomez
a411a32cae
Rollup merge of #96776 - liuw:hir, r=oli-obk
Fix two minor issues in hir.rs

I found these two places in hir.rs which could use a bit of improvements while going through the code.

No functional change.
2022-05-06 20:05:45 +02:00
Guillaume Gomez
6db969ec95
Rollup merge of #96772 - TaKO8Ki:suggest-fully-qualified-path-with-appropriate-params, r=compiler-errors
Suggest fully qualified path with appropriate params

closes #96291
2022-05-06 20:05:44 +02:00
Guillaume Gomez
bcfb95afd3
Rollup merge of #96754 - notriddle:notriddle/impl-dups, r=GuillaumeGomez
rustdoc: ensure HTML/JS side implementors don't have dups

Fixes #94641

Rendered:

- https://notriddle.com/notriddle-rustdoc-test/impl-dups/std/iter/trait.Iterator.html
- https://notriddle.com/notriddle-rustdoc-test/impl-dups/core/iter/trait.Iterator.html
2022-05-06 20:05:43 +02:00
Guillaume Gomez
28d85ab8c4
Rollup merge of #96752 - scottmcm:error-sorting, r=compiler-errors
Put the incompatible_closure_captures lint messages in alphabetical order

Looks like they were in hash order before, which was causing me trouble in #94598, so this PR sorts the errors by trait name.
2022-05-06 20:05:42 +02:00
Guillaume Gomez
93b86d69b6
Rollup merge of #96748 - GuillaumeGomez:reexports-in-search, r=notriddle
Fixes reexports in search

Fixes #96681.

At some point we stopped reexporting items in search so this PR fixes it.

It also adds a regression test.

r? ```@notriddle```
2022-05-06 20:05:41 +02:00
Guillaume Gomez
c3ddd59f5b
Rollup merge of #96733 - SparrowLii:place_to_string, r=davidtwco
turn `append_place_to_string` from recursion into iteration

This PR fixes the FIXME in the impl of `append_place_to_string` which turns `append_place_to_string` from recursion into iteration, meanwhile simplifying the code relatively.
2022-05-06 20:05:40 +02:00
Guillaume Gomez
c7af4e67c3
Rollup merge of #96650 - tmiasko:global-asm-sym-fn, r=Amanieu
Collect function instance used in `global_asm!` sym operand

The constants used in SymFn operands have FnDef type,
so the type of the constant identifies the function.

Fixes #96623.
2022-05-06 20:05:39 +02:00
Guillaume Gomez
fcb0bce25c
Rollup merge of #96590 - notriddle:notriddle/tab-bar-fn-search, r=GuillaumeGomez,jsha
rustdoc: when running a function-signature search, tweak the tab bar

# Before

![In Names (7) / In Parameters (0) / In Return types (0)](https://user-images.githubusercontent.com/1593513/166122875-ffdeafe6-8d4d-4e61-84a6-f5986b50ac35.png)

# After

![In Function Signature (7)](https://user-images.githubusercontent.com/1593513/166122883-9a3d7515-3235-4ee3-8c4b-5401d109e099.png)
2022-05-06 20:05:38 +02:00
Guillaume Gomez
66443a1852
Rollup merge of #96557 - nbdd0121:const, r=oli-obk
Allow inline consts to reference generic params

Tracking issue: #76001

The RFC says that inline consts cannot reference to generic parameters (for now), same as array length expressions. And expresses that it's desirable for it to reference in-scope generics, when array length expressions gain that feature as well.

However it is possible to implement this for inline consts before doing this for all anon consts, because inline consts are only used as values and they won't be used in the type system. So we can have:
```rust
fn foo<T>() {
    let x = [4i32; std::mem::size_of::<T>()];   // NOT ALLOWED (for now)
    let x = const { std::mem::size_of::<T>() }; // ALLOWED with this PR!
    let x = [4i32; const { std::mem::size_of::<T>() }];   // NOT ALLOWED (for now)
}
```

This would make inline consts super useful for compile-time checks and assertions:
```rust
fn assert_zst<T>() {
    const { assert!(std::mem::size_of::<T>() == 0) };
}
```

This would create an error during monomorphization when `assert_zst` is instantiated with non-ZST `T`s. A error during mono might sound scary, but this is exactly what a "desugared" inline const would do:
```rust
fn assert_zst<T>() {
    struct F<T>(T);
    impl<T> F<T> {
        const V: () = assert!(std::mem::size_of::<T>() == 0);
    }
    let _ = F::<T>::V;
}
```

It should also be noted that the current inline const implementation can already reference the type params via type inference, so this resolver-level restriction is not any useful either:
```rust
fn foo<T>() -> usize {
    let (_, size): (PhantomData<T>, usize) = const {
        const fn my_size_of<T>() -> (PhantomData<T>, usize) {
            (PhantomData, std::mem::size_of::<T>())
        }
        my_size_of()
    };
    size
}
```

```@rustbot``` label: F-inline_const
2022-05-06 20:05:37 +02:00
bors
d60b4f52c9 Auto merge of #95454 - randomicon00:fix95444, r=wesleywiser
Fixing #95444 by only displaying passes that take more than 5 millise…

As discussed in #95444, I have added the code to test and only display prints that are greater than 5 milliseconds.

r? `@jyn514`
2022-05-06 17:52:47 +00:00
Ali MJ Al-Nasrawy
d7d928e967 Link to correct issue in issue-95034 test 2022-05-06 20:35:06 +03:00
Koichi ITO
d6c64f4368 Fix an incorrect link in The Unstable Book
https://github.com/rust-lang/rust/blob/master/src/librustc_session/lint/builtin.rs
returns page not found.

The following is the background of the move.
First https://github.com/rust-lang/rust/pull/74862 moves from src/librustc_session/lint/builtin.rs
to compiler/rustc_session/src/lint/builtin.rs
Then https://github.com/rust-lang/rust/commit/23018a5 moves from compiler/rustc_session/src/lint/builtin.rs
to compiler/rustc_lint_defs/src/builtin.rs

So, the current correct link is https://github.com/rust-lang/rust/blob/master/compiler/rustc_lint_defs/src/builtin.rs

This PR fixes a broken link on the following page:
https://doc.rust-lang.org/beta/unstable-book/language-features/plugin.html
2022-05-07 02:22:26 +09:00
lcnr
a87fa6314f mirror_expr cleanup 2022-05-06 19:00:37 +02:00
Jakub Beránek
af54244939
Update LLVM version used to build OS X and Windows artifacts to 14.0.2 2022-05-06 18:25:27 +02:00
Yuki Okushi
7b773e890e
Remove closures on expect_local to apply #[track_caller] 2022-05-07 01:11:32 +09:00
Miguel Guarniz
91ef3ba71d remove all usages of hir().def_kind
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 12:11:05 -04:00
Miguel Guarniz
3afc5ea201 use def_span and def_kind queries instead of calling tcx.hir() methods
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 12:11:05 -04:00