]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #96650 - tmiasko:global-asm-sym-fn, r=Amanieu
Guillaume Gomez [Fri, 6 May 2022 18:05:39 +0000 (20:05 +0200)]
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.

2 years agoRollup merge of #96590 - notriddle:notriddle/tab-bar-fn-search, r=GuillaumeGomez...
Guillaume Gomez [Fri, 6 May 2022 18:05:38 +0000 (20:05 +0200)]
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)

2 years agoRollup merge of #96557 - nbdd0121:const, r=oli-obk
Guillaume Gomez [Fri, 6 May 2022 18:05:37 +0000 (20:05 +0200)]
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

2 years agoAuto merge of #95454 - randomicon00:fix95444, r=wesleywiser
bors [Fri, 6 May 2022 17:52:47 +0000 (17:52 +0000)]
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`

2 years agoLink to correct issue in issue-95034 test
Ali MJ Al-Nasrawy [Fri, 6 May 2022 17:35:06 +0000 (20:35 +0300)]
Link to correct issue in issue-95034 test

2 years agoFix an incorrect link in The Unstable Book
Koichi ITO [Fri, 6 May 2022 16:21:40 +0000 (01:21 +0900)]
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

2 years ago[feat] Make sys::windows::os_str::Slice repr(transparent)
gimbles [Fri, 6 May 2022 17:21:13 +0000 (22:51 +0530)]
[feat] Make sys::windows::os_str::Slice repr(transparent)

2 years ago`mirror_expr` cleanup
lcnr [Fri, 6 May 2022 17:00:37 +0000 (19:00 +0200)]
`mirror_expr` cleanup

2 years agoUpdate LLVM version used to build OS X and Windows artifacts to 14.0.2
Jakub Beránek [Fri, 6 May 2022 16:25:27 +0000 (18:25 +0200)]
Update LLVM version used to build OS X and Windows artifacts to 14.0.2

2 years agoRemove closures on `expect_local` to apply `#[track_caller]`
Yuki Okushi [Fri, 6 May 2022 16:11:32 +0000 (01:11 +0900)]
Remove closures on `expect_local` to apply `#[track_caller]`

2 years agoremove all usages of hir().def_kind
Miguel Guarniz [Fri, 29 Apr 2022 20:45:48 +0000 (16:45 -0400)]
remove all usages of hir().def_kind

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agouse def_span and def_kind queries instead of calling tcx.hir() methods
Miguel Guarniz [Fri, 29 Apr 2022 17:11:22 +0000 (13:11 -0400)]
use def_span and def_kind queries instead of calling tcx.hir() methods

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agopass ItemId to check_item_type instead of Item
Miguel Guarniz [Fri, 29 Apr 2022 17:09:03 +0000 (13:09 -0400)]
pass ItemId to check_item_type instead of Item

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove ImplWfCheck
Miguel Guarniz [Fri, 29 Apr 2022 16:26:15 +0000 (12:26 -0400)]
remove ImplWfCheck

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove CheckItemTypesVisitor
Miguel Guarniz [Fri, 29 Apr 2022 16:24:39 +0000 (12:24 -0400)]
remove CheckItemTypesVisitor

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agouse hir_module_items in check_mod_item_types query
Miguel Guarniz [Fri, 29 Apr 2022 16:22:40 +0000 (12:22 -0400)]
use hir_module_items in check_mod_item_types query

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agouse hir_module_items instead of visit_all_item_likes in check_mod_impl_wf query
Miguel Guarniz [Fri, 29 Apr 2022 15:57:01 +0000 (11:57 -0400)]
use hir_module_items instead of visit_all_item_likes in check_mod_impl_wf query

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove UnsafetyChecker
Miguel Guarniz [Thu, 28 Apr 2022 17:34:49 +0000 (13:34 -0400)]
remove UnsafetyChecker

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove ItemLikeVisitor impl for InherentOverlapChecker
Miguel Guarniz [Thu, 28 Apr 2022 17:03:17 +0000 (13:03 -0400)]
remove ItemLikeVisitor impl for InherentOverlapChecker

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove ItemLikeVisitor impl for InherentCollect
Miguel Guarniz [Thu, 28 Apr 2022 15:00:12 +0000 (11:00 -0400)]
remove ItemLikeVisitor impl for InherentCollect

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoMake the test `check-pass` not to produce a JSON file
Yuki Okushi [Fri, 6 May 2022 15:57:23 +0000 (00:57 +0900)]
Make the test `check-pass` not to produce a JSON file

`run-pass` produces a JSON file when enabling save analysis.

2 years agoremove OutlivesTest
Miguel Guarniz [Thu, 28 Apr 2022 14:47:13 +0000 (10:47 -0400)]
remove OutlivesTest

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove VarianceTest
Miguel Guarniz [Thu, 28 Apr 2022 02:03:57 +0000 (22:03 -0400)]
remove VarianceTest

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agouse DefKind::Fn instead of DefKind::AsscFn for foreign items
Miguel Guarniz [Thu, 28 Apr 2022 01:52:51 +0000 (21:52 -0400)]
use DefKind::Fn instead of DefKind::AsscFn for foreign items

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove ItemLikeVisitor impl for TermsContext
Miguel Guarniz [Thu, 28 Apr 2022 00:14:53 +0000 (20:14 -0400)]
remove ItemLikeVisitor impl for TermsContext

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove ItemLikeVisitor impl for ContraintContext
Miguel Guarniz [Wed, 27 Apr 2022 21:22:58 +0000 (17:22 -0400)]
remove ItemLikeVisitor impl for ContraintContext

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoUse statx's 64-bit times on 32-bit linux-gnu
Josh Stone [Thu, 10 Mar 2022 01:05:16 +0000 (17:05 -0800)]
Use statx's 64-bit times on 32-bit linux-gnu

2 years agoUse __clock_gettime64 on 32-bit linux-gnu
Josh Stone [Wed, 9 Mar 2022 20:41:47 +0000 (12:41 -0800)]
Use __clock_gettime64 on 32-bit linux-gnu

2 years agounix: always use 64-bit Timespec
Josh Stone [Wed, 9 Mar 2022 20:25:46 +0000 (12:25 -0800)]
unix: always use 64-bit Timespec

2 years agoAlso suggest calling constructors for external DefIds
Yuki Okushi [Fri, 6 May 2022 15:43:50 +0000 (00:43 +0900)]
Also suggest calling constructors for external DefIds

2 years agoUse matches! for YieldSource::is_await
Wei Liu [Fri, 6 May 2022 15:00:48 +0000 (15:00 +0000)]
Use matches! for YieldSource::is_await

2 years agoFix comment for async closure variant
Wei Liu [Fri, 6 May 2022 14:59:40 +0000 (14:59 +0000)]
Fix comment for async closure variant

2 years agoAuto merge of #95183 - ibraheemdev:arc-count-acquire, r=Amanieu
bors [Fri, 6 May 2022 14:53:24 +0000 (14:53 +0000)]
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](https://github.com/boostorg/smart_ptr/blob/f2cc84a23c64b8a73c9b72b34799d0854d7e0787/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp#L137-L140).

2 years agosuggest fully qualified path with appropriate params
Takayuki Maeda [Fri, 6 May 2022 14:14:11 +0000 (23:14 +0900)]
suggest fully qualified path with appropriate params

2 years agoAuto merge of #96268 - jackh726:remove-mutable_borrow_reservation_conflict-lint,...
bors [Fri, 6 May 2022 12:32:44 +0000 (12:32 +0000)]
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

2 years agoAdd missing newline
Michael Howell [Fri, 6 May 2022 12:18:32 +0000 (05:18 -0700)]
Add missing newline

2 years agoAdd GUI test for search reexports
Guillaume Gomez [Thu, 5 May 2022 19:56:40 +0000 (21:56 +0200)]
Add GUI test for search reexports

2 years agoFix reexports missing from the search index
Guillaume Gomez [Thu, 5 May 2022 19:56:03 +0000 (21:56 +0200)]
Fix reexports missing from the search index

2 years agoRemove `adx_target_feature` feature from active features list
Arseniy Pendryak [Fri, 6 May 2022 10:12:45 +0000 (13:12 +0300)]
Remove `adx_target_feature` feature from active features list

The feature was stabilized in https://github.com/rust-lang/rust/pull/93745

2 years agoAuto merge of #94598 - scottmcm:prefix-free-hasher-methods, r=Amanieu
bors [Fri, 6 May 2022 09:43:57 +0000 (09:43 +0000)]
Auto merge of #94598 - scottmcm:prefix-free-hasher-methods, r=Amanieu

Add a dedicated length-prefixing method to `Hasher`

This accomplishes two main goals:
- Make it clear who is responsible for prefix-freedom, including how they should do it
- Make it feasible for a `Hasher` that *doesn't* care about Hash-DoS resistance to get better performance by not hashing lengths

This does not change rustc-hash, since that's in an external crate, but that could potentially use it in future.

Fixes #94026

r? rust-lang/libs

---

The core of this change is the following two new methods on `Hasher`:

```rust
pub trait Hasher {
    /// Writes a length prefix into this hasher, as part of being prefix-free.
    ///
    /// If you're implementing [`Hash`] for a custom collection, call this before
    /// writing its contents to this `Hasher`.  That way
    /// `(collection![1, 2, 3], collection![4, 5])` and
    /// `(collection![1, 2], collection![3, 4, 5])` will provide different
    /// sequences of values to the `Hasher`
    ///
    /// The `impl<T> Hash for [T]` includes a call to this method, so if you're
    /// hashing a slice (or array or vector) via its `Hash::hash` method,
    /// you should **not** call this yourself.
    ///
    /// This method is only for providing domain separation.  If you want to
    /// hash a `usize` that represents part of the *data*, then it's important
    /// that you pass it to [`Hasher::write_usize`] instead of to this method.
    ///
    /// # Examples
    ///
    /// ```
    /// #![feature(hasher_prefixfree_extras)]
    /// # // Stubs to make the `impl` below pass the compiler
    /// # struct MyCollection<T>(Option<T>);
    /// # impl<T> MyCollection<T> {
    /// #     fn len(&self) -> usize { todo!() }
    /// # }
    /// # impl<'a, T> IntoIterator for &'a MyCollection<T> {
    /// #     type Item = T;
    /// #     type IntoIter = std::iter::Empty<T>;
    /// #     fn into_iter(self) -> Self::IntoIter { todo!() }
    /// # }
    ///
    /// use std::hash::{Hash, Hasher};
    /// impl<T: Hash> Hash for MyCollection<T> {
    ///     fn hash<H: Hasher>(&self, state: &mut H) {
    ///         state.write_length_prefix(self.len());
    ///         for elt in self {
    ///             elt.hash(state);
    ///         }
    ///     }
    /// }
    /// ```
    ///
    /// # Note to Implementers
    ///
    /// If you've decided that your `Hasher` is willing to be susceptible to
    /// Hash-DoS attacks, then you might consider skipping hashing some or all
    /// of the `len` provided in the name of increased performance.
    #[inline]
    #[unstable(feature = "hasher_prefixfree_extras", issue = "88888888")]
    fn write_length_prefix(&mut self, len: usize) {
        self.write_usize(len);
    }

    /// Writes a single `str` into this hasher.
    ///
    /// If you're implementing [`Hash`], you generally do not need to call this,
    /// as the `impl Hash for str` does, so you can just use that.
    ///
    /// This includes the domain separator for prefix-freedom, so you should
    /// **not** call `Self::write_length_prefix` before calling this.
    ///
    /// # Note to Implementers
    ///
    /// The default implementation of this method includes a call to
    /// [`Self::write_length_prefix`], so if your implementation of `Hasher`
    /// doesn't care about prefix-freedom and you've thus overridden
    /// that method to do nothing, there's no need to override this one.
    ///
    /// This method is available to be overridden separately from the others
    /// as `str` being UTF-8 means that it never contains `0xFF` bytes, which
    /// can be used to provide prefix-freedom cheaper than hashing a length.
    ///
    /// For example, if your `Hasher` works byte-by-byte (perhaps by accumulating
    /// them into a buffer), then you can hash the bytes of the `str` followed
    /// by a single `0xFF` byte.
    ///
    /// If your `Hasher` works in chunks, you can also do this by being careful
    /// about how you pad partial chunks.  If the chunks are padded with `0x00`
    /// bytes then just hashing an extra `0xFF` byte doesn't necessarily
    /// provide prefix-freedom, as `"ab"` and `"ab\u{0}"` would likely hash
    /// the same sequence of chunks.  But if you pad with `0xFF` bytes instead,
    /// ensuring at least one padding byte, then it can often provide
    /// prefix-freedom cheaper than hashing the length would.
    #[inline]
    #[unstable(feature = "hasher_prefixfree_extras", issue = "88888888")]
    fn write_str(&mut self, s: &str) {
        self.write_length_prefix(s.len());
        self.write(s.as_bytes());
    }
}
```

With updates to the `Hash` implementations for slices and containers to call `write_length_prefix` instead of `write_usize`.

`write_str` defaults to using `write_length_prefix` since, as was pointed out in the issue, the `write_u8(0xFF)` approach is insufficient for hashers that work in chunks, as those would hash `"a\u{0}"` and `"a"` to the same thing.  But since `SipHash` works byte-wise (there's an internal buffer to accumulate bytes until a full chunk is available) it overrides `write_str` to continue to use the add-non-UTF-8-byte approach.

---

Compatibility:

Because the default implementation of `write_length_prefix` calls `write_usize`, the changed hash implementation for slices will do the same thing the old one did on existing `Hasher`s.

2 years agobless mir-opt
Ralf Jung [Fri, 6 May 2022 08:58:54 +0000 (10:58 +0200)]
bless mir-opt

2 years agodon't debug-print ConstValue in MIR pretty-printer
Ralf Jung [Fri, 6 May 2022 08:30:29 +0000 (10:30 +0200)]
don't debug-print ConstValue in MIR pretty-printer

2 years agomake Size and Align debug-printing a bit more compact
Ralf Jung [Sat, 30 Apr 2022 16:30:11 +0000 (18:30 +0200)]
make Size and Align debug-printing a bit more compact

2 years agoAuto merge of #96510 - m-ou-se:futex-bsd, r=Amanieu
bors [Fri, 6 May 2022 07:20:04 +0000 (07:20 +0000)]
Auto merge of #96510 - m-ou-se:futex-bsd, r=Amanieu

Use futex-based locks and thread parker on {Free, Open, DragonFly}BSD.

This switches *BSD to our futex-based locks and thread parker.

Tracking issue: https://github.com/rust-lang/rust/issues/93740

This is a draft, because this still needs a new version of the `libc` crate to be published that includes https://github.com/rust-lang/libc/pull/2770.

r? `@Amanieu`

2 years agofix unmatched braces
Elliot Roberts [Fri, 6 May 2022 07:17:02 +0000 (00:17 -0700)]
fix unmatched braces

2 years agoFor now, don't change the details of hashing a `str`
Scott McMurray [Fri, 6 May 2022 06:18:11 +0000 (23:18 -0700)]
For now, don't change the details of hashing a `str`

We might want to change the default before stabilizing (or maybe even after), but for getting in the new unstable methods, leave it as-is for now.  That way it won't break cargo and such.

2 years agoAdd a dedicated length-prefixing method to `Hasher`
Scott McMurray [Fri, 4 Mar 2022 08:17:26 +0000 (00:17 -0800)]
Add a dedicated length-prefixing method to `Hasher`

This accomplishes two main goals:
- Make it clear who is responsible for prefix-freedom, including how they should do it
- Make it feasible for a `Hasher` that *doesn't* care about Hash-DoS resistance to get better performance by not hashing lengths

This does not change rustc-hash, since that's in an external crate, but that could potentially use it in future.

2 years agoAuto merge of #96759 - compiler-errors:rollup-p4jtm92, r=compiler-errors
bors [Fri, 6 May 2022 04:56:23 +0000 (04:56 +0000)]
Auto merge of #96759 - compiler-errors:rollup-p4jtm92, r=compiler-errors

Rollup of 7 pull requests

Successful merges:

 - #96174 (mark ptr-int-transmute test as no_run)
 - #96639 (Fix typo in `offset_from` documentation)
 - #96704 (Add rotation animation on settings button when loading)
 - #96730 (Add a regression test for #64173 and #66152)
 - #96741 (Improve settings loading strategy)
 - #96744 (Implement [OsStr]::join)
 - #96747 (Add `track_caller` to `DefId::expect_local()`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoturn `append_place_to_string` from recursion into iteration
SparrowLii [Fri, 6 May 2022 04:11:42 +0000 (12:11 +0800)]
turn `append_place_to_string` from recursion into iteration

2 years agotypeck: port "explicit generic args w/ impl trait"
David Wood [Fri, 6 May 2022 02:46:12 +0000 (03:46 +0100)]
typeck: port "explicit generic args w/ impl trait"

Port the "explicit generic arguments with impl trait" diagnostic to
using the diagnostic derive.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agosess: add `create_{err,warning}`
David Wood [Fri, 6 May 2022 02:44:41 +0000 (03:44 +0100)]
sess: add `create_{err,warning}`

Currently, the only API for creating errors from a diagnostic derive
will emit it immediately. This makes it difficult to add subdiagnostics
to diagnostics from the derive, so add `create_{err,warning}` functions
that return the diagnostic without emitting it.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agomacros: allow `Vec` fields in diagnostic derive
David Wood [Fri, 6 May 2022 02:43:30 +0000 (03:43 +0100)]
macros: allow `Vec` fields in diagnostic derive

Diagnostics can have multiple primary spans, or have subdiagnostics
repeated at multiple locations, so support `Vec<..>` fields in the
diagnostic derive which become loops in the generated code.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoRollup merge of #96747 - JohnTitor:expect-local-track-caller, r=compiler-errors
Michael Goulet [Fri, 6 May 2022 02:34:27 +0000 (19:34 -0700)]
Rollup merge of #96747 - JohnTitor:expect-local-track-caller, r=compiler-errors

Add `track_caller` to `DefId::expect_local()`

Suggested in https://github.com/rust-lang/rust/issues/96738#issuecomment-1118961888.
`DefId::expect_local()` often causes ICEs (panics) and should be a good candidate to add `track_caller`.

2 years agoRollup merge of #96744 - est31:join_osstr, r=thomcc
Michael Goulet [Fri, 6 May 2022 02:34:26 +0000 (19:34 -0700)]
Rollup merge of #96744 - est31:join_osstr, r=thomcc

Implement [OsStr]::join

Implements join for `OsStr` and `OsString` slices:

```Rust
    let strings = [OsStr::new("hello"), OsStr::new("dear"), OsStr::new("world")];
    assert_eq!("hello dear world", strings.join(OsStr::new(" ")));
````

This saves one from converting to strings and back, or from implementing it manually.

2 years agoRollup merge of #96741 - GuillaumeGomez:improve-settings-loading-strategy, r=jsha
Michael Goulet [Fri, 6 May 2022 02:34:25 +0000 (19:34 -0700)]
Rollup merge of #96741 - GuillaumeGomez:improve-settings-loading-strategy, r=jsha

Improve settings loading strategy

I learned about this thanks to ```@jsha``` who suggested this approach:

It improves the settings loading strategy by loading CSS and JS at the same time to prevent the style to be applied afterwards on slow connections.

r? ```@jsha```

2 years agoRollup merge of #96730 - JohnTitor:unused-lifetimes-tests, r=compiler-errors
Michael Goulet [Fri, 6 May 2022 02:34:25 +0000 (19:34 -0700)]
Rollup merge of #96730 - JohnTitor:unused-lifetimes-tests, r=compiler-errors

Add a regression test for #64173 and #66152

Closes #64173
Closes #66152

Mixed the code as the root cause seems the same.

2 years agoRollup merge of #96704 - GuillaumeGomez:rotation-animation, r=jsha
Michael Goulet [Fri, 6 May 2022 02:34:24 +0000 (19:34 -0700)]
Rollup merge of #96704 - GuillaumeGomez:rotation-animation, r=jsha

Add rotation animation on settings button when loading

As discussed, I added an animation when the settings JS file is loading (I voluntarily made the timeout at the end of the `settings.js` super long so we can see what the animation looks like):

https://user-images.githubusercontent.com/3050060/166693243-816a08b7-5e39-4142-acd3-686ad9950d8e.mp4

r? ````@jsha````

2 years agoRollup merge of #96639 - adpaco-aws:fix-offset-from-typo, r=scottmcm
Michael Goulet [Fri, 6 May 2022 02:34:23 +0000 (19:34 -0700)]
Rollup merge of #96639 - adpaco-aws:fix-offset-from-typo, r=scottmcm

Fix typo in `offset_from` documentation

Small fix for what I think is a typo in the `offset_from` documentation.

Someone reading this may understand that the distance in bytes is obtained by dividing the distance by `mem::size_of::<T>()`, but here we just want to define "units of T" in terms of bytes (i.e., units of T == bytes / `mem::size_of::<T>()`).

2 years agoRollup merge of #96174 - RalfJung:no-run-transmute, r=scottmcm
Michael Goulet [Fri, 6 May 2022 02:34:22 +0000 (19:34 -0700)]
Rollup merge of #96174 - RalfJung:no-run-transmute, r=scottmcm

mark ptr-int-transmute test as no_run

This causes [CI failures in Miri](https://github.com/rust-lang/miri-test-libstd/runs/6062500259?check_suite_focus=true) since ptr-int-transmutes are rejected there (when strict provenance is enabled).

2 years agotypeck: port "unconstrained opaque type" diag
David Wood [Wed, 4 May 2022 06:27:12 +0000 (07:27 +0100)]
typeck: port "unconstrained opaque type" diag

Port the "unconstrained opaque type" diagnostic to using the diagnostic
derive.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agobootstrap: bsd platform flags for split debuginfo
David Wood [Fri, 6 May 2022 02:00:39 +0000 (03:00 +0100)]
bootstrap: bsd platform flags for split debuginfo

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

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoDon't constantly rebuild clippy on `x test src/tools/clippy`.
Joshua Nelson [Fri, 6 May 2022 01:37:08 +0000 (20:37 -0500)]
Don't constantly rebuild clippy on `x test src/tools/clippy`.

This happened because the `SYSROOT` variable was set for `x test`, but not `x build`.
Set it consistently for both to avoid unnecessary rebuilds.

2 years agoFix test case checking for where the JS goes
Michael Howell [Fri, 6 May 2022 01:26:47 +0000 (18:26 -0700)]
Fix test case checking for where the JS goes

2 years agoEnable compiler-docs by default for `compiler`, `codegen`, and `tools` profiles.
Joshua Nelson [Fri, 6 May 2022 01:03:10 +0000 (20:03 -0500)]
Enable compiler-docs by default for `compiler`, `codegen`, and `tools` profiles.

2 years agorustdoc: ensure HTML/JS side implementors don't have dups
Michael Howell [Fri, 6 May 2022 00:20:14 +0000 (17:20 -0700)]
rustdoc: ensure HTML/JS side implementors don't have dups

2 years agoPut the 2229 migration errors in alphabetical order
Scott McMurray [Wed, 4 May 2022 02:17:57 +0000 (19:17 -0700)]
Put the 2229 migration errors in alphabetical order

Looks like they were in FxHash order before, so it might just be luck that this used to be consistent across different word lengths.

2 years agoFixing #95444 by only displaying passes that take more than 5 milliseconds
Peh [Wed, 30 Mar 2022 00:29:29 +0000 (00:29 +0000)]
Fixing #95444 by only displaying passes that take more than 5 milliseconds

95444: Adding passes that include memory increase

Fix95444: Change the substraction with the abs_diff() method

Fix95444: Change the substraction with abs_diff() method

2 years agoAuto merge of #96520 - lcnr:general-incoherent-impls, r=petrochenkov
bors [Thu, 5 May 2022 23:24:36 +0000 (23:24 +0000)]
Auto merge of #96520 - lcnr:general-incoherent-impls, r=petrochenkov

generalize "incoherent impls" impl for user defined types

To allow the move of `trait Error` into core.

continues the work from #94963, finishes https://github.com/rust-lang/compiler-team/issues/487

r? `@petrochenkov` cc `@yaahc`

2 years agoAdd `track_caller` to `DefId::expect_local()`
Yuki Okushi [Thu, 5 May 2022 22:28:06 +0000 (07:28 +0900)]
Add `track_caller` to `DefId::expect_local()`

2 years agoFix an ICE on #96738
Yuki Okushi [Thu, 5 May 2022 22:15:35 +0000 (07:15 +0900)]
Fix an ICE on #96738

2 years agoImplement [OsStr]::join
est31 [Thu, 5 May 2022 19:38:15 +0000 (21:38 +0200)]
Implement [OsStr]::join

2 years agoRemove condvar::two_mutexes test.
Mara Bos [Thu, 5 May 2022 19:47:13 +0000 (21:47 +0200)]
Remove condvar::two_mutexes test.

We don't guarantee this panics. On most platforms it doesn't anymore.

2 years agoAuto merge of #96735 - flip1995:clippyup, r=Manishearth
bors [Thu, 5 May 2022 19:28:41 +0000 (19:28 +0000)]
Auto merge of #96735 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

2 years agoImprove settings loading strategy by loading CSS and JS at the same time to prevent...
Guillaume Gomez [Thu, 5 May 2022 18:19:40 +0000 (20:19 +0200)]
Improve settings loading strategy by loading CSS and JS at the same time to prevent the style to be applied afterwards on slow connections

2 years agoDon't cache results of coinductive cycle
Aaron Hill [Wed, 27 Apr 2022 00:34:58 +0000 (20:34 -0400)]
Don't cache results of coinductive cycle

Fixes #96319

The logic around handling co-inductive cycles in the evaluation cache
is confusing and error prone. Fortunately, a perf run showed that it
doesn't actually appear to improve performance, so we can simplify
this code (and eliminate a source of ICEs) by just skipping caching
the evaluation results for co-inductive cycle participants.

This commit makes no changes to any of the other logic around
co-inductive cycle handling. Thus, while this commit could
potentially expose latent bugs that were being hidden by
caching, it should not introduce any new bugs.

2 years agoAuto merge of #96734 - matthiaskrgr:rollup-hng33tb, r=matthiaskrgr
bors [Thu, 5 May 2022 16:59:54 +0000 (16:59 +0000)]
Auto merge of #96734 - matthiaskrgr:rollup-hng33tb, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #95359 (Update `int_roundings` methods from feedback)
 - #95843 (Improve Rc::new_cyclic and Arc::new_cyclic documentation)
 - #96507 (Suggest calling `Self::associated_function()`)
 - #96635 (Use "strict" mode in JS scripts)
 - #96673 (Report that opaque types are not allowed in impls even in the presence of other errors)
 - #96682 (Show invisible delimeters (within comments) when pretty printing.)
 - #96714 (interpret/validity: debug-check ScalarPair layout information)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agorustdoc: fix JS error when rendering parse error
Michael Howell [Tue, 3 May 2022 16:20:45 +0000 (09:20 -0700)]
rustdoc: fix JS error when rendering parse error

2 years agorustdoc: add test case assertions for ArrowDown highlight first result
Michael Howell [Tue, 3 May 2022 16:20:22 +0000 (09:20 -0700)]
rustdoc: add test case assertions for ArrowDown highlight first result

2 years agorustdoc: fix keyboard shortcuts and console log on search page
Michael Howell [Mon, 2 May 2022 22:50:01 +0000 (15:50 -0700)]
rustdoc: fix keyboard shortcuts and console log on search page

2 years agorustdoc: change the "In Function Signatures" to context-sensitive
Michael Howell [Mon, 2 May 2022 16:45:32 +0000 (09:45 -0700)]
rustdoc: change the "In Function Signatures" to context-sensitive

* If it's just `-> a`, use "In Function Return Types"
* If it's just `a b`, use "In Function Parameters"
* Otherwise, still use "In Function Signatures"

2 years agoUse STARTS_WITH, since it's more specific
Michael Howell [Sun, 1 May 2022 22:40:46 +0000 (15:40 -0700)]
Use STARTS_WITH, since it's more specific

Co-Authored-By: Guillaume Gomez <guillaume1.gomez@gmail.com>
2 years agorustdoc: when running a function-signature search, tweak the tab bar
Michael Howell [Sat, 30 Apr 2022 20:05:40 +0000 (13:05 -0700)]
rustdoc: when running a function-signature search, tweak the tab bar

2 years ago(Partially) Revert "HACK: Move buggy lints to nursery"
flip1995 [Thu, 5 May 2022 14:20:07 +0000 (15:20 +0100)]
(Partially) Revert "HACK: Move buggy lints to nursery"

This reverts commit bb01aca86f66954b80798213711e8eadc4b26902.

Partial: Keep regression tests

2 years agoUpdate Cargo.lock
flip1995 [Thu, 5 May 2022 14:13:10 +0000 (15:13 +0100)]
Update Cargo.lock

2 years agoMerge commit '7c21f91b15b7604f818565646b686d90f99d1baf' into clippyup
flip1995 [Thu, 5 May 2022 14:12:52 +0000 (15:12 +0100)]
Merge commit '7c21f91b15b7604f818565646b686d90f99d1baf' into clippyup

2 years agoRollup merge of #96714 - RalfJung:scalar-pair-debug, r=oli-obk
Matthias Krüger [Thu, 5 May 2022 13:43:07 +0000 (15:43 +0200)]
Rollup merge of #96714 - RalfJung:scalar-pair-debug, r=oli-obk

interpret/validity: debug-check ScalarPair layout information

This would have caught https://github.com/rust-lang/rust/issues/96158.
I ran the Miri test suite and it still passes.

r? `@oli-obk`

2 years agoRollup merge of #96682 - nnethercote:show-invisible-delims, r=petrochenkov
Matthias Krüger [Thu, 5 May 2022 13:43:05 +0000 (15:43 +0200)]
Rollup merge of #96682 - nnethercote:show-invisible-delims, r=petrochenkov

Show invisible delimeters (within comments) when pretty printing.

Because invisible syntax is really hard to work with!

r? `@petrochenkov`

2 years agoRollup merge of #96673 - oli-obk:tait_impl_diagnostic, r=petrochenkov
Matthias Krüger [Thu, 5 May 2022 13:43:05 +0000 (15:43 +0200)]
Rollup merge of #96673 - oli-obk:tait_impl_diagnostic, r=petrochenkov

Report that opaque types are not allowed in impls even in the presence of other errors

fixes  #96569

before this PR those useful errors were hidden because either `unused parameter` or `only traits defined in the current crate can be implemented for arbitrary types` got emitted first.

2 years agoRollup merge of #96635 - GuillaumeGomez:js-script-mode, r=notriddle
Matthias Krüger [Thu, 5 May 2022 13:43:04 +0000 (15:43 +0200)]
Rollup merge of #96635 - GuillaumeGomez:js-script-mode, r=notriddle

Use "strict" mode in JS scripts

Part of #93058.

r? `@notriddle`

2 years agoRollup merge of #96507 - TaKO8Ki:suggest-calling-associated-function, r=lcnr
Matthias Krüger [Thu, 5 May 2022 13:43:03 +0000 (15:43 +0200)]
Rollup merge of #96507 - TaKO8Ki:suggest-calling-associated-function, r=lcnr

Suggest calling `Self::associated_function()`

closes #96453

2 years agoRollup merge of #95843 - GuillaumeGomez:improve-new-cyclic-doc, r=m-ou-se
Matthias Krüger [Thu, 5 May 2022 13:43:02 +0000 (15:43 +0200)]
Rollup merge of #95843 - GuillaumeGomez:improve-new-cyclic-doc, r=m-ou-se

Improve Rc::new_cyclic and Arc::new_cyclic documentation

Fixes https://github.com/rust-lang/rust/issues/95672.

cc `@CAD97` (since I used your explanations)

2 years agoRollup merge of #95359 - jhpratt:int_roundings, r=joshtriplett
Matthias Krüger [Thu, 5 May 2022 13:43:00 +0000 (15:43 +0200)]
Rollup merge of #95359 - jhpratt:int_roundings, r=joshtriplett

Update `int_roundings` methods from feedback

This updates `#![feature(int_roundings)]` (#88581) from feedback. All methods now take `NonZeroX`. The documentation makes clear that they panic in debug mode and wrap in release mode.

r? `@joshtriplett`

`@rustbot` label +T-libs +T-libs-api +S-waiting-on-review

2 years agoBless clippy error msg
Gary Guo [Thu, 5 May 2022 13:27:11 +0000 (14:27 +0100)]
Bless clippy error msg

2 years agoAuto merge of #8788 - flip1995:rustup, r=xFrednet,flip1995
bors [Thu, 5 May 2022 13:12:09 +0000 (13:12 +0000)]
Auto merge of #8788 - flip1995:rustup, r=xFrednet,flip1995

Rustup

r? `@ghost`

changelog: move trait_duplication_in_bounds and type_repetition_in_bounds to nursery temporarily. This could already be reverted before the release. Check the Clippy in the Rust repo beta branch when writing this changelog.

2 years agoFix ICE in EarlyAttribtues lints
flip1995 [Thu, 5 May 2022 13:10:06 +0000 (14:10 +0100)]
Fix ICE in EarlyAttribtues lints

2 years agoHACK: Move buggy lints to nursery
flip1995 [Thu, 5 May 2022 12:32:31 +0000 (13:32 +0100)]
HACK: Move buggy lints to nursery

Those lints are trait_duplication_in_bounds and
type_repetition_in_bounds. I don't think those can be fixed on the
Clippy side alone, but need changes in the compiler. So let's move them
to nursery to get the sync through and then fix them on the rustc side.

Also adds a regression test that has to be fixed before they can be
moved back to pedantic.

2 years agoBump nightly version -> 2022-05-05
flip1995 [Thu, 5 May 2022 12:32:18 +0000 (13:32 +0100)]
Bump nightly version -> 2022-05-05

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 5 May 2022 12:01:37 +0000 (13:01 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoupdate error messages and explicitly mention them in tests
lcnr [Thu, 5 May 2022 12:29:24 +0000 (14:29 +0200)]
update error messages and explicitly mention them in tests

2 years agoAuto merge of #91779 - ridwanabdillahi:natvis, r=michaelwoerister
bors [Thu, 5 May 2022 12:26:38 +0000 (12:26 +0000)]
Auto merge of #91779 - ridwanabdillahi:natvis, r=michaelwoerister

Add a new Rust attribute to support embedding debugger visualizers

Implemented [this RFC](https://github.com/rust-lang/rfcs/pull/3191) to add support for embedding debugger visualizers into a PDB.

Added a new attribute `#[debugger_visualizer]` and updated the `CrateMetadata` to store debugger visualizers for crate dependencies.

RFC: https://github.com/rust-lang/rfcs/pull/3191