Commit graph

156218 commits

Author SHA1 Message Date
John Kugelman
c3f0577002 Add #[must_use] to non-mutating verb methods 2021-10-11 21:21:32 -04:00
John Kugelman
01b439e764 Add #[must_use] to is_condition tests
A continuation of #89718.
2021-10-11 21:15:57 -04:00
bors
97e3b30285 Auto merge of #89791 - matthiaskrgr:rollup-1lhxh5b, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #89471 (Use Ancestory to check default fn in const impl instead of comparing idents)
 - #89643 (Fix inherent impl overlap check.)
 - #89651 (Add `Poll::ready` and revert stabilization of `task::ready!`)
 - #89675 (Re-use TypeChecker instead of passing around some of its fields )
 - #89710 (Add long explanation for error E0482)
 - #89756 (Greatly reduce amount of debuginfo compiled for bootstrap itself)
 - #89760 (Remove hack ignoring unused attributes for stage 0 std)
 - #89772 (Fix function-names test for GDB 10.1)
 - #89785 (Fix ICE when compiling nightly std/rustc on beta compiler)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-12 00:20:34 +00:00
John Kugelman
0cf84c8c19 Add #[must_use] to to_value conversions 2021-10-11 19:37:16 -04:00
John Kugelman
f9692b5619 Add #[must_use] to From::from and Into::into 2021-10-11 18:10:30 -04:00
Matthias Krüger
f94a325496
Rollup merge of #89785 - nbdd0121:master, r=Mark-Simulacrum
Fix ICE when compiling nightly std/rustc on beta compiler

Fix #89775

#89479 renames a lot of diagnostic items, but it happens that the beta compiler assumes that there must be DefId with `rustc_diagnostic_item = "send_trait"`, causing an ICE when compiling stage 0 std or stage 1 compiler. So gate it with `cfg(bootstrap)`.

The unwrap is also removed, so that existence of the diagnostic item is not required. I ripgreped the code base and this seems the only place where `unwrap` is called on the return value of `get_diagnostic_item`.
2021-10-11 23:45:53 +02:00
Matthias Krüger
603da7e83f
Rollup merge of #89772 - michaelwoerister:fix-function-names-test-gdb, r=Mark-Simulacrum
Fix function-names test for GDB 10.1

This PR updates the test output in `src/test/debuginfo/function-names.rs` for GDB 10.1.

This should fix issue https://github.com/rust-lang/rust/issues/89750 -- but not the underlying problem of CI ignoring tests if not viable debugger happens to be present.
2021-10-11 23:45:52 +02:00
Matthias Krüger
b9311b4248
Rollup merge of #89760 - jyn514:remove-incremental-hack, r=Mark-Simulacrum
Remove hack ignoring unused attributes for stage 0 std

This seems to no longer be giving spurious errors when incremental is
enabled.

Closes https://github.com/rust-lang/rust/issues/58633.
2021-10-11 23:45:51 +02:00
Matthias Krüger
1be64f3431
Rollup merge of #89756 - jyn514:bootstrap-times, r=Mark-Simulacrum
Greatly reduce amount of debuginfo compiled for bootstrap itself

Rather than compiling rustbuild and all its dependencies with
`debuginfo=2`, this compiles dependencies without debuginfo and
rustbuild with `debuginfo=1`. On my laptop, this brings compile times
down from ~1:20 to ~1:05.

See also https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/async.20in.20bootstrap.3F/near/254847594.

r? ``@Mark-Simulacrum``
2021-10-11 23:45:51 +02:00
Matthias Krüger
57504aafe8
Rollup merge of #89710 - sireliah:e0482, r=GuillaumeGomez
Add long explanation for error E0482

This is longer explanation for error E0482 in the #61137.

Please take a look and leave some feedback!
2021-10-11 23:45:50 +02:00
Matthias Krüger
fde2412b23
Rollup merge of #89675 - oli-obk:type_checker, r=davidtwco
Re-use TypeChecker instead of passing around some of its fields

In the future (for lazy TAIT) we will need more of its fields, but even ignoring that, this change seems reasonable on its own to me.
2021-10-11 23:45:49 +02:00
Matthias Krüger
d3984e16bf
Rollup merge of #89651 - ibraheemdev:poll-ready, r=dtolnay
Add `Poll::ready` and revert stabilization of `task::ready!`

This PR adds an inherent `ready` method to `Poll` that can be used with the `?` operator as an alternative to the `task::ready!` macro:
```rust
let val = ready!(fut.poll(cx));
let val = fut.poll(cx).ready()?;
```

I think this form is a nice, non-breaking middle ground between changing the `impl Try for Poll`, and adding a separate macro. It looks better than `ready!` in my opinion, and it composes well:

```rust
let elem = ready!(fut.poll(cx)).pop().unwrap();
let elem = fut.poll(cx).ready()?.pop().unwrap();
```

The planned stabilization of `ready!` in 1.56 has been reverted because I think this alternate approach is worth considering.

r? rust-lang/libs
2021-10-11 23:45:48 +02:00
Matthias Krüger
b80dd9e445
Rollup merge of #89643 - cjgillot:overlap, r=matthewjasper
Fix inherent impl overlap check.

The current implementation of the overlap check was slightly buggy, and unified the wrong connected component in the `ids.len() <= 1` case. This became visible in another PR which changed the iteration order of items.

r? ``@matthewjasper`` since you reviewed the other PR.
2021-10-11 23:45:46 +02:00
Matthias Krüger
412301b26a
Rollup merge of #89471 - nbdd0121:const3, r=fee1-dead
Use Ancestory to check default fn in const impl instead of comparing idents

Fixes https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Const.20trait.20impl.20inside.20macro
2021-10-11 23:45:46 +02:00
bors
7cc8c44871 Auto merge of #89648 - nbdd0121:issue-89606, r=nikomatsakis
Ignore type of projections for upvar capturing

Fix #89606

Ignore type of projections for upvar capturing. Originally HashMap is used, and the hash/eq implementation of Place takes the type of projections into account. These types may differ by lifetime which causes #89606 to ICE.

I originally considered erasing regions but `place.ty()` is used when creating upvar tuple type, more than just serving as a key type, so I switched to a linear comparison with custom eq (`compare_place_ignore_ty`) instead.

r? `@wesleywiser`

`@rustbot` label +T-compiler
2021-10-11 21:39:11 +00:00
The8472
f1c588f1ef use fold instead of try_fold now that .by_ref().next() has been inlined 2021-10-11 23:36:04 +02:00
Mark Rousskov
127373822e Remove built-in cache_hit tracking
This was already only enabled in debug_assertions builds. Generally, it seems
like most use cases that would use this could also use the -Zself-profile flag
which also tracks cache hits (in all builds), and so the extra cfg's and such
are not really necessary.

This is largely just a small cleanup though, which primarily is intended to make
other changes easier by avoiding the need to deal with this field.
2021-10-11 16:33:49 -04:00
Gary Guo
148f456cc6 Fix ICE 89775 2021-10-11 20:52:36 +01:00
sireliah
0fde6f672f Clarify the error descriptions 2021-10-11 21:48:35 +02:00
Shinwoo Park
d2564ce5a9 rustdoc: update noto sans kr 2021-10-12 04:47:34 +09:00
Wilfred Hughes
e56d89ae62
Add missing words in Infallible docs
This sentence was previously incomplete.
2021-10-11 12:26:27 -07:00
David Tolnay
a1e03fc563
Add library tracking issue for poll_ready feature 2021-10-11 12:17:41 -07:00
David Tolnay
7a7dfa8b67
Remove task::ready! from 1.56.0 release notes 2021-10-11 12:06:44 -07:00
John Kugelman
b0b09f0842
Update library/core/src/mem/maybe_uninit.rs
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-10-11 14:46:08 -04:00
John Kugelman
06e625f7d5 Add #[must_use] to as_type conversions 2021-10-11 13:57:38 -04:00
pierwill
e71d17b9b4 Edit explanation of test for nested type ascriptions
Closes #88233
2021-10-11 12:56:55 -05:00
Gary Guo
0a03f8c78b Split impl-with-default-fn test into a pass test and a fail test 2021-10-11 18:20:20 +01:00
Gary Guo
de940fc725 Use Ancestory to check default fn in const impl instead of comparing idents 2021-10-11 18:19:54 +01:00
bors
5b210643eb Auto merge of #83908 - Flying-Toast:master, r=davidtwco
Add enum_intrinsics_non_enums lint

There is a clippy lint to prevent calling [`mem::discriminant`](https://doc.rust-lang.org/std/mem/fn.discriminant.html) with a non-enum type. I think the lint is worthy of being included in rustc, given that `discriminant::<T>()` where `T` is a non-enum has an unspecified return value, and there are no valid use cases where you'd actually want this.

I've also made the lint check [variant_count](https://doc.rust-lang.org/core/mem/fn.variant_count.html) (#73662).

closes #83899
2021-10-11 17:12:14 +00:00
The8472
a398b6b9d4 inline next() on &mut Iterator impl 2021-10-11 17:50:03 +02:00
Michael Woerister
6531cd8cba Fix function-names test for GDB 10.1 2021-10-11 17:20:45 +02:00
bors
1067e2ca5e Auto merge of #89767 - GuillaumeGomez:rollup-sczixhk, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #89655 (bootstrap: don't use `--merges` to look for commit hashes for downloading artifacts)
 - #89726 (Add #[must_use] to alloc constructors)
 - #89729 (Add #[must_use] to core and std constructors)
 - #89743 (Fix RUSTC_LOG handling)
 - #89753 (Add #[must_use] to from_value conversions)
 - #89754 (Cleanup .item-table CSS)
 - #89761 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-11 14:16:15 +00:00
John Kugelman
3ac0ae21d5 Add #[must_use] to MaybeUninit::new 2021-10-11 10:03:55 -04:00
Guillaume Gomez
913b1de0ec
Rollup merge of #89761 - lnicola:rust-analyzer-2021-10-11, r=lnicola
⬆️ rust-analyzer

r? ``@ghost``
2021-10-11 14:11:46 +02:00
Guillaume Gomez
f36c109a95
Rollup merge of #89754 - dns2utf8:rustdoc_cleanup_css, r=GuillaumeGomez
Cleanup .item-table CSS

The main table-like element must be `display: table;`

r? `@GuillaumeGomez`
2021-10-11 14:11:46 +02:00
Guillaume Gomez
96ffc74fe3
Rollup merge of #89753 - jkugelman:must-use-from_value-conversions, r=joshtriplett
Add #[must_use] to from_value conversions

I added two methods to the list myself. Clippy did not flag them because they take `mut` args, but neither modifies their argument.

```rust
core::str           const unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str;
std::ffi::CString   unsafe fn from_raw(ptr: *mut c_char) -> CString;
```

I put a custom note on `from_raw`:

```rust
#[must_use = "call `drop(from_raw(ptr))` if you intend to drop the `CString`"]
pub unsafe fn from_raw(ptr: *mut c_char) -> CString {
```

Parent issue: #89692

r? ``@joshtriplett``
2021-10-11 14:11:45 +02:00
Guillaume Gomez
9183942e83
Rollup merge of #89743 - matthewjasper:env-log-fix, r=jyn514
Fix RUSTC_LOG handling

Rustc was incorrectly reading the value of `RUSTC_LOG` as the environment vairable with the logging configuration, rather than the logging configuration itself.
2021-10-11 14:11:44 +02:00
Guillaume Gomez
77be7e441a
Rollup merge of #89729 - jkugelman:must-use-core-std-constructors, r=joshtriplett
Add #[must_use] to core and std constructors

Parent issue: #89692

r? ``@joshtriplett``
2021-10-11 14:11:43 +02:00
Guillaume Gomez
d7c9693401
Rollup merge of #89726 - jkugelman:must-use-alloc-constructors, r=joshtriplett
Add #[must_use] to alloc constructors

Added `#[must_use]`. to the various forms of `new`, `pin`, and `with_capacity` in the `alloc` crate. No extra explanations given as I couldn't think of anything useful to add.

I figure this deserves extra scrutiny compared to the other PRs I've done so far. In particular:

* The 4 `pin`/`pin_in` methods I touched. Are there legitimate use cases for pinning and not using the result? Pinning's a difficult concept I'm not very comfortable with.
* `Box`'s constructors. Do people ever create boxes just for the side effects... allocating or zeroing out memory?

Parent issue: #89692

r? ``@joshtriplett``
2021-10-11 14:11:42 +02:00
Guillaume Gomez
08a7a5759a
Rollup merge of #89655 - tlyu:find-non-merge-commits, r=jyn514
bootstrap: don't use `--merges` to look for commit hashes for downloading artifacts

Shallow clones (and possibly worktrees, though I can't seem to reproduce the problem there) can cause `git rev-list --merges` to falsely return no results, even if a merge commit is present. Stop using the `--merges` option when looking for commit hashes that have build artifacts. `--first-parent` and `--author=bors@rust-lang.org` should be sufficient.

Also exit with an error if the configuration asks for artifacts to be downloaded and we can't determine an appropriate commit hash to use to download artifacts.

Fixes #87890.

r? ``@jyn514``
``@rustbot`` label +A-rustbuild +A-contributor-roadblock
2021-10-11 14:11:41 +02:00
bors
6ae8912a3e Auto merge of #89709 - clemenswasser:apply_clippy_suggestions_2, r=petrochenkov
Apply clippy suggestions for rustc and core
2021-10-11 11:14:47 +00:00
Stefan Schindler
4bd7e965b2 Cleanup .item-table CSS 2021-10-11 10:53:48 +02:00
flip1995
f4836768be
Deprecate mem_discriminant_non_enum
This lint has been uplifted and is now included in
enum_intrinsics_non_enums.
2021-10-11 10:10:16 +02:00
Flying-Toast
59b186d99a
Add enum_intrinsics_non_enums lint 2021-10-11 09:46:27 +02:00
bors
86d6d2b738 Auto merge of #89755 - jkugelman:must-use-conversions-that-move-self, r=joshtriplett
Add #[must_use] to conversions that move self

Everything here got the same message. Is the wording okay?

```rust
#[must_use = "`self` will be dropped if the result is not used"]
```

I want to draw attention to these methods in particular:

```rust
alloc::sync::Arc<MaybeUninit<T>>     unsafe fn assume_init(self) -> Arc<T>;
alloc::sync::Arc<[MaybeUninit<T>]>   unsafe fn assume_init(self) -> Arc<[T]>;
core::pin::Pin<&'a mut T>            const fn into_ref(self) -> Pin<&'a T>;
core::pin::Pin<&'a mut T>            const fn get_mut(self) -> &'a mut T;
core::pin::Pin<&'a mut T>            const unsafe fn get_unchecked_mut(self) -> &'a mut T;
core::pin::Pin<&'a mut T>            unsafe fn map_unchecked_mut(self, func: F) -> Pin<&'a mut U>;
core::pin::Pin<&'a mut Pin<P>>       fn as_deref_mut(self) -> Pin<&'a mut P::Target>;
```

Parent issue: #89692

r? `@joshtriplett`
2021-10-11 07:27:44 +00:00
Laurențiu Nicola
687cc5d4a6 ⬆️ rust-analyzer 2021-10-11 10:01:39 +03:00
Clemens Wasser
14b6cf6fd7 Remove unnecessary variable 2021-10-11 08:11:30 +02:00
Joshua Nelson
1b283d49c7 Remove hack ignoring unused attributes for stage 0 std
This seems to no longer be giving spurious errors when incremental is
enabled.
2021-10-11 04:52:18 +00:00
bors
9a757817c3 Auto merge of #89597 - michaelwoerister:improve-vtable-debuginfo, r=wesleywiser
Create more accurate debuginfo for vtables.

Before this PR all vtables would have the same name (`"vtable"`) in debuginfo. Now they get an unambiguous name that identifies the implementing type and the trait that is being implemented.

This is only one of several possible improvements:
- This PR describes vtables as arrays of `*const u8` pointers. It would nice to describe them as structs where function pointer is represented by a field with a name indicative of the method it maps to. However, this requires coming up with a naming scheme that avoids clashes between methods with the same name (which is possible if the vtable contains multiple traits).
- The PR does not update the debuginfo we generate for the vtable-pointer field in a fat `dyn` pointer. Right now there does not seem to be an easy way of getting ahold of a vtable-layout without also knowing the concrete self-type of a trait object.

r? `@wesleywiser`
2021-10-11 04:31:47 +00:00
Joshua Nelson
9177fa3dd2 Use shallow clones for submodules
This reduces the amount of git history downloaded from ~67M to ~11M.
2021-10-10 22:37:37 -05:00