Commit Graph

167735 Commits

Author SHA1 Message Date
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
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
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
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
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
Miguel Guarniz
ef1d112095 pass ItemId to check_item_type instead of Item
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 12:11:05 -04:00
Miguel Guarniz
1b07c4af81 remove ImplWfCheck
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 12:11:05 -04:00
Miguel Guarniz
dfe07461f4 remove CheckItemTypesVisitor
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 12:11:04 -04:00
Miguel Guarniz
d88dfd2522 use hir_module_items in check_mod_item_types query
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 12:11:04 -04:00
Miguel Guarniz
422dd3b8dc use hir_module_items instead of visit_all_item_likes in check_mod_impl_wf query
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 12:11:04 -04:00
Miguel Guarniz
f47f39b95f remove UnsafetyChecker
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 12:11:04 -04:00
Miguel Guarniz
7c3c588988 remove ItemLikeVisitor impl for InherentOverlapChecker
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 12:11:04 -04:00
Miguel Guarniz
63849b6ecf remove ItemLikeVisitor impl for InherentCollect
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 12:10:59 -04:00
Miguel Guarniz
c27f30835c remove OutlivesTest
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 11:55:15 -04:00
Miguel Guarniz
9c111dd209 remove VarianceTest
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 11:55:15 -04:00
Miguel Guarniz
03e955d812 use DefKind::Fn instead of DefKind::AsscFn for foreign items
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 11:55:15 -04:00
Miguel Guarniz
a7225275e5 remove ItemLikeVisitor impl for TermsContext
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 11:55:15 -04:00
Miguel Guarniz
7064033bf6 remove ItemLikeVisitor impl for ContraintContext
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 11:55:15 -04:00
Yuki Okushi
35d77c1710
Also suggest calling constructors for external DefIds 2022-05-07 00:43:50 +09:00
Wei Liu
fcb385cfb1 Use matches! for YieldSource::is_await 2022-05-06 15:00:48 +00:00
Wei Liu
85e688e4c3 Fix comment for async closure variant 2022-05-06 14:59:40 +00:00
bors
e209e85e39 Auto merge of #95183 - ibraheemdev:arc-count-acquire, r=Amanieu
Weaken needlessly restrictive orderings on `Arc::*_count`

There is no apparent reason for these to be `SeqCst`. For reference, [the Boost C++ implementation relies on acquire semantics](f2cc84a23c/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp (L137-L140)).
2022-05-06 14:53:24 +00:00
Takayuki Maeda
857eb02abe suggest fully qualified path with appropriate params 2022-05-06 23:14:11 +09:00
bors
9a251644fa Auto merge of #96268 - jackh726:remove-mutable_borrow_reservation_conflict-lint, r=nikomatsakis
Remove mutable_borrow_reservation_conflict lint and allow the code pattern

This was the only breaking issue with the NLL stabilization PR. Lang team decided to go ahead and allow this.

r? `@nikomatsakis`
Closes #59159
Closes #56254
2022-05-06 12:32:44 +00:00
Michael Howell
bd11e22203
Add missing newline 2022-05-06 05:18:32 -07:00