Commit graph

156313 commits

Author SHA1 Message Date
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
Joshua Nelson
7f974d0aae 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.
2021-10-10 21:18:57 -05:00
bors
1ddd4e6d7e Auto merge of #89752 - matthiaskrgr:rollup-v4fgmwg, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #89579 (Add regression test for issue 80108)
 - #89632 (Fix docblock code display on mobile)
 - #89691 (Move `DebuggerCommands` and `check_debugger_output` to a separate module)
 - #89707 (Apply clippy suggestions for std)
 - #89722 (Fix spelling: Cannonical -> Canonical)
 - #89736 (Remove unused CSS rule)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-11 01:06:26 +00:00
John Kugelman
b115781bcd Add #[must_use] to conversions that move self 2021-10-10 19:50:52 -04:00
John Kugelman
cf2bcd10ed Add #[must_use] to from_value conversions 2021-10-10 19:00:33 -04:00
Matthias Krüger
bf01a59be5
Rollup merge of #89736 - GuillaumeGomez:rm-unused-css-rule, r=dns2utf8
Remove unused CSS rule

As you can see in the firefox devtools:

![Screenshot from 2021-10-10 14-28-08](https://user-images.githubusercontent.com/3050060/136695689-16c77ceb-b1ab-40df-963a-048f2258e217.png)

It needs the display to be `grid` or `inline-grid`, which isn't the case.

r? `@dns2utf8`
2021-10-11 00:34:41 +02:00
Matthias Krüger
9d307f1ed4
Rollup merge of #89722 - jkugelman:cannonical-typo, r=joshtriplett
Fix spelling: Cannonical -> Canonical
2021-10-11 00:34:40 +02:00
Matthias Krüger
9c4791300a
Rollup merge of #89707 - clemenswasser:apply_clippy_suggestions, r=Mark-Simulacrum
Apply clippy suggestions for std
2021-10-11 00:34:39 +02:00
Matthias Krüger
1b8f7a9db5
Rollup merge of #89691 - Nicholas-Baron:debugger_commands, r=Mark-Simulacrum
Move `DebuggerCommands` and `check_debugger_output` to a separate module

Work towards #89475.

As part of this move, the public functions were changed to return `Result`. This is so that the error handling that initially took `&self: TestCx` can still use that `TestCx`.
2021-10-11 00:34:38 +02:00
Matthias Krüger
3fa897df26
Rollup merge of #89632 - GuillaumeGomez:fix-docblock-code, r=jsha
Fix docblock code display on mobile

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

Before:

![Screenshot from 2021-10-07 12-01-37](https://user-images.githubusercontent.com/3050060/136363624-72bedddd-b45e-48a0-89b4-6563612f8677.png)

After:

![Screenshot from 2021-10-07 20-17-21](https://user-images.githubusercontent.com/3050060/136440704-fa9ffa68-8e94-46a7-b556-c41aa5153750.png)

r? `@jsha`
2021-10-11 00:34:37 +02:00
Matthias Krüger
2bfbf97762
Rollup merge of #89579 - workingjubilee:regression-test-80108, r=Mark-Simulacrum
Add regression test for issue 80108

Closes #80108
2021-10-11 00:34:37 +02:00
bors
3bf55753c6 Auto merge of #89541 - workingjubilee:abbrev-shufvec-t, r=Mark-Simulacrum
Cleanup src/test/ui/{simd,simd-intrinsic}

Initial motivation was to simplify a huge macro expansion using a tuple, since we can just use an array in `#[repr(simd)]` now for the same result. But also, several tests were going unnoticed during development of SIMD intrinsics because people kept looking in the wrong directory, and many are basically run-pass vs. build-fail versions of the same tests, so let's keep them close together and simplify their names, so they're easier to sift through.
2021-10-10 22:25:49 +00:00
Jubilee Young
7fb6e1aa61 Add regression test for issue 80108 2021-10-10 14:09:55 -07:00
bors
41dfaaa3c6 Auto merge of #89739 - matthiaskrgr:rollup-kskwqy5, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #88374 (Fix documentation in Cell)
 - #88713 (Improve docs for int_log)
 - #89428 (Feature gate the non_exhaustive_omitted_patterns lint)
 - #89438 (docs: `std:#️⃣:Hash` should ensure prefix-free data)
 - #89520 (Don't rebuild GUI test crates every time you run test src/test/rustdoc-gui)
 - #89705 (Cfg hide no_global_oom_handling and no_fp_fmt_parse)
 - #89713 (Fix ABNF of inline asm options)
 - #89718 (Add #[must_use] to is_condition tests)
 - #89719 (Add #[must_use] to char escape methods)
 - #89720 (Add #[must_use] to math and bit manipulation methods)
 - #89735 (Stabilize proc_macro::is_available)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-10 19:05:13 +00:00
Matthew Jasper
9e6e89af69 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-10 19:59:36 +01:00
Milan
15b119897c integrate I/O safety changes 2021-10-10 14:01:36 -04:00
Milan Landaverde
92d680589c cross-platform doctests 2021-10-10 14:01:09 -04:00
Milan Landaverde
d68a8d9870 moves use ptr within from_abstract_namespace fn 2021-10-10 14:01:08 -04:00
Milan Landaverde
565e349c79 Update tracking issue in stability refs 2021-10-10 14:01:07 -04:00
Milan Landaverde
1c2143193f rustfmt 2021-10-10 14:01:07 -04:00
Milan Landaverde
63ebfc2c55 Add abstract namespace support for Unix domain sockets 2021-10-10 14:01:06 -04:00
Matthias Krüger
4d89488c41
Rollup merge of #89735 - bjorn3:stabilize_proc_macro_is_available, r=petrochenkov
Stabilize proc_macro::is_available

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

The FCP for the stabilization of `proc_macro::is_available` has completed.
2021-10-10 18:22:26 +02:00
Matthias Krüger
c8b5a7b0c4
Rollup merge of #89720 - jkugelman:must-use-math-operations, r=joshtriplett
Add #[must_use] to math and bit manipulation methods

Also tidied up a few other nearby `#[must_use]`s.

Parent issue: #89692
2021-10-10 18:22:25 +02:00
Matthias Krüger
758a901a40
Rollup merge of #89719 - jkugelman:must-use-char-escape-methods, r=joshtriplett
Add #[must_use] to char escape methods

Parent issue: #89692
2021-10-10 18:22:24 +02:00
Matthias Krüger
0c04b1fc03
Rollup merge of #89718 - jkugelman:must-use-is_condition-tests, r=joshtriplett
Add #[must_use] to is_condition tests

There's nothing insightful to say about these so I didn't write any extra explanations.

Parent issue: #89692
2021-10-10 18:22:23 +02:00