Commit Graph

167912 Commits

Author SHA1 Message Date
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
gimbles
0a80bb43e5 [feat] Make sys::windows::os_str::Slice repr(transparent) 2022-05-06 22:51:13 +05:30
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
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
Yuki Okushi
038fb67952
Make the test check-pass not to produce a JSON file
`run-pass` produces a JSON file when enabling save analysis.
2022-05-07 00:57:23 +09: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
Josh Stone
fec4818fdb Use statx's 64-bit times on 32-bit linux-gnu 2022-05-06 08:50:53 -07:00
Josh Stone
97b49a0cc5 Use __clock_gettime64 on 32-bit linux-gnu 2022-05-06 08:50:53 -07:00
Josh Stone
bee923f0df unix: always use 64-bit Timespec 2022-05-06 08:50:51 -07: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
Guillaume Gomez
fb2f97a37e Add GUI test for search reexports 2022-05-06 13:52:21 +02:00
Guillaume Gomez
279dee5374 Fix reexports missing from the search index 2022-05-06 13:52:21 +02:00
Arseniy Pendryak
02ac4a4e02 Remove adx_target_feature feature from active features list
The feature was stabilized in https://github.com/rust-lang/rust/pull/93745
2022-05-06 13:12:45 +03:00
bors
8c4fc9d9a4 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, 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.
2022-05-06 09:43:57 +00:00
Ralf Jung
d455752970 bless mir-opt 2022-05-06 10:58:54 +02:00
Ralf Jung
22cc6c3482 don't debug-print ConstValue in MIR pretty-printer 2022-05-06 10:57:03 +02:00
Ralf Jung
bd31ba045d make Size and Align debug-printing a bit more compact 2022-05-06 10:57:03 +02:00
bors
7f9e013ba6 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`
2022-05-06 07:20:04 +00:00
Elliot Roberts
647d0b6dd3 fix unmatched braces 2022-05-06 00:17:02 -07:00
Scott McMurray
ebdcb08abf 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.
2022-05-06 00:14:44 -07:00
Scott McMurray
98054377ee 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.
2022-05-06 00:03:38 -07:00
bors
9714e139ff 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
2022-05-06 04:56:23 +00:00
SparrowLii
8ff01894a0 turn append_place_to_string from recursion into iteration 2022-05-06 12:11:42 +08:00
David Wood
af47257c0d 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>
2022-05-06 03:46:12 +01:00
David Wood
3f413d2abb 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>
2022-05-06 03:44:41 +01:00
David Wood
859079ff12 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>
2022-05-06 03:43:30 +01:00
Michael Goulet
b8c829b64f
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`.
2022-05-05 19:34:27 -07:00
Michael Goulet
8bcf4b0efc
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.
2022-05-05 19:34:26 -07:00
Michael Goulet
7cdad77536
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```
2022-05-05 19:34:25 -07:00