Commit graph

156668 commits

Author SHA1 Message Date
Camille GILLOT
e53404cca6 Move def_path_hash_to_def_id to rustc_middle. 2021-10-20 18:28:54 +02:00
Camille GILLOT
88c6d3de95 Avoid trivial lambdas. 2021-10-20 18:24:16 +02:00
ThibsG
3630afb57f Do not lint if any parent has hidden attribute 2021-10-20 17:53:05 +02:00
Guillaume Gomez
69ca324a53 Add test to ensure that the missing_doc_code_examples is not triggered on foreign trait implementations 2021-10-20 16:52:56 +02:00
bors
3d71e749a2 Auto merge of #90050 - michaelwoerister:fix-vtable-debug-name-crash-90019, r=wesleywiser
Erase late-bound regions before computing vtable debuginfo name.

Fixes #90019.

The `msvc_enum_fallback()` for computing enum type names needs to access the memory layout of niche enums in order to determine the type name. `compute_debuginfo_vtable_name()` did not properly erase regions before computing type names which made memory layout computation ICE when encountering un-erased regions.

r? `@wesleywiser`
2021-10-20 14:37:48 +00:00
Guillaume Gomez
50dc319ef0 Add test for duplicated sidebar entries for reexported macro 2021-10-20 15:44:16 +02:00
Giacomo Stevanato
0aa68a8db9 Prevent invalid values from existing in Vec::swap_remove 2021-10-20 15:42:54 +02:00
bors
76150a4922 Auto merge of #7848 - Veykril:patch-1, r=xFrednet
Fix doc heading of `transmute_num_to_bytes`

changelog: none
2021-10-20 12:02:32 +00:00
Lukas Wirth
9cf68e40fe
Fix doc heading of TRANSMUTE_NUM_TO_BYTES 2021-10-20 13:46:12 +02:00
Guillaume Gomez
457f5782f3 Add test for line-number setting 2021-10-20 13:36:08 +02:00
bors
06722c0c15 Auto merge of #7775 - F3real:no_effect, r=xFrednet
Detect underscored variables with no side effects

Fixes #7545

changelog: Lint on underscored variables with no side effects in [`no_effect`]
2021-10-20 09:33:45 +00:00
Ethan Brierley
be30e60296 remove duplicate subst 2021-10-20 10:21:06 +01:00
bors
ee8c155527 Auto merge of #7840 - dswij:question-mark-result, r=llogiq
Cover `Result` for `question_mark`

closes #7135

changelog: [`question_mark`] now covers `Result`
2021-10-20 07:27:13 +00:00
bors
6162529a01 Auto merge of #89100 - petrochenkov:localbind, r=cjgillot
resolve: Use `NameBinding` for local variables and generic parameters

`NameBinding` is a structure used for representing any name introduction (an item, or import, or even a built-in).
Except that local variables and generic parameters weren't represented as `NameBinding`s, for this reason they requires separate paths in name resolution code in several places.

This PR introduces `NameBinding`s for local variables as well and simplifies all the code working with them leaving only the `NameBinding` paths.
2021-10-20 07:21:01 +00:00
dswij
083a4546f6 Small refactor on question_mark condition checks 2021-10-20 13:41:44 +08:00
woppopo
2fc780638e Make From impls of NonZero integer const.
I also changed the feature gate added to `From` impls of Atomic integer to `const_num_from_num` from `const_convert`.
2021-10-20 12:04:58 +09:00
klensy
f3fb821f3b use array explicitly instead of vec for const content (even if optimizer smart enought to remove allocation) 2021-10-20 03:24:07 +03:00
klensy
aad48f71b3 replace format!("") with String::new()
use array explicitly instead of vec for const content (even if optimizer smart enought to remove allocation)
2021-10-20 03:23:24 +03:00
Eric Huss
6f915056a1 Don't emit a warning for empty rmeta files. 2021-10-19 16:56:47 -07:00
bors
5bdd2cebe2 Auto merge of #7833 - Dmitry-Borodin:patch-1, r=giraffate
Add reference to another doc with explanation

Add reference to another doc that explains which repository should be passed in this command since this is not covered in the command help itself.
changelog: none
2021-10-19 23:47:20 +00:00
F3real
6b22bba902 Lint on underscore variable assignment
Fix tests after no_effect update

Add a drop testcase

Don't lint _ variables in macro expansion

Address review comments and update tests

Don't shadow unnecessary operation lint if no_effect is allowed

Revert shadowing change and remove no_effect allows

Update clippy_lints/src/no_effect.rs

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>

Update clippy_lints/src/no_effect.rs

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>

Address review comments
2021-10-20 00:39:28 +02:00
bors
42983a28ab Auto merge of #90067 - JohnTitor:rollup-afrjulz, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #86479 (Automatic exponential formatting in Debug)
 - #87404 (Add support for artifact size profiling)
 - #87769 (Alloc features cleanup)
 - #88789 (remove unnecessary bound on Zip specialization impl)
 - #88860 (Deduplicate panic_fmt)
 - #90009 (Make more `From` impls `const` (libcore))
 - #90018 (Fix rustdoc UI for very long type names)
 - #90025 (Revert #86011 to fix an incorrect bound check)
 - #90036 (Remove border-bottom from most docblocks.)
 - #90060 (Update RELEASES.md)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-19 22:14:21 +00:00
Nathaniel Hamovitz
0f9f591e30 Rename lint 2021-10-19 14:33:43 -07:00
Camille GILLOT
6e98688e68 Replace FnLikeNode by FnKind. 2021-10-19 23:31:51 +02:00
Nathaniel Hamovitz
60da4c9cb6 remove resolved note 2021-10-19 14:23:55 -07:00
Ethan Brierley
99b8c016ce Address lcnr review 2021-10-19 22:18:13 +01:00
Camille GILLOT
05eb6f36f1 Cleanup dead code in hir::map::blocks. 2021-10-19 23:10:09 +02:00
bors
c1e7a07c9c Auto merge of #7811 - rust-lang:eq-op-testless, r=xFrednet
avoid `eq_op` in test code

Add a check to `eq_op` that will avoid linting in functions annotated with `#[test]`

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: avoid `eq_op` in test functions
2021-10-19 19:54:40 +00:00
Yuki Okushi
e54ebe91dd
Rollup merge of #90060 - vincentdephily:patch-1, r=Mark-Simulacrum
Update RELEASES.md

Fix typo.
2021-10-20 04:35:18 +09:00
Yuki Okushi
570b999c96
Rollup merge of #90036 - jsha:less-rule, r=GuillaumeGomez
Remove border-bottom from most docblocks.

Headings in the top-doc docblock still get a border-bottom due to a rule
that covers all h2, h3, and h4. Method docblocks are generally h5, and
so don't get a border-bottom anymore.

This fixes a problem where a sub-sub-heading within a method would have
a line that went all the way across the page, creating a division that
made that sub-sub-heading look much more important than it really is.

Fixes #90033

Demo at https://jacob.hoffman-andrews.com/rust/less-rule/std/string/struct.String.html

r? ``@GuillaumeGomez``
2021-10-20 04:35:17 +09:00
Yuki Okushi
d8b3764bd2
Rollup merge of #90025 - JohnTitor:revert-86011, r=estebank
Revert #86011 to fix an incorrect bound check

This reverts commit 36a1076d24, reversing
changes made to e1e9319d93.

Fixes #89935
r? ``@estebank``
2021-10-20 04:35:17 +09:00
Yuki Okushi
7ceab9ef14
Rollup merge of #90018 - GuillaumeGomez:too-long-item-names, r=jsha
Fix rustdoc UI for very long type names

Fixes #89972.

While working on it, I also discovered that when the item name is too long, it also breaks the flow of the page.

To make things right, I also renamed the `type-decl` CSS class into `item-decl` (because this PR also generates it for more than type declarations).

So here are the before/after screenshots:

![Screenshot from 2021-10-18 16-58-03](https://user-images.githubusercontent.com/3050060/137757247-637fcf04-4406-49c6-8a8a-18c2074aacd9.png)
![Screenshot from 2021-10-18 16-58-26](https://user-images.githubusercontent.com/3050060/137757252-17935e63-53b3-449f-a535-7be91ff0e257.png)

![Screenshot from 2021-10-18 16-58-07](https://user-images.githubusercontent.com/3050060/137757278-8b12e348-2980-4fc4-8853-bef99d58981f.png)
![Screenshot from 2021-10-18 16-58-28](https://user-images.githubusercontent.com/3050060/137757282-534a0e1b-3016-49ba-b3ac-e45bdb9035cb.png)

r? ``@jsha``
2021-10-20 04:35:15 +09:00
Yuki Okushi
9f2ad0a061
Rollup merge of #90009 - woppopo:const_from_more, r=dtolnay
Make more `From` impls `const` (libcore)

Adding `const` to `From` implementations in the core. `rustc_const_unstable` attribute is not added to unstable implementations.

Tracking issue: #88674

<details>
<summary>Done</summary><div>

- `T` from `T`
- `T` from `!`
- `Option<T>` from `T`
- `Option<&T>` from `&Option<T>`
- `Option<&mut T>` from `&mut Option<T>`
- `Cell<T>` from `T`
- `RefCell<T>` from `T`
- `UnsafeCell<T>` from `T`
- `OnceCell<T>` from `T`
- `Poll<T>` from `T`
- `u32` from `char`
- `u64` from `char`
- `u128` from `char`
- `char` from `u8`
- `AtomicBool` from `bool`
- `AtomicPtr<T>` from `*mut T`
- `AtomicI(bits)` from `i(bits)`
- `AtomicU(bits)` from `u(bits)`
- `i(bits)` from `NonZeroI(bits)`
- `u(bits)` from `NonZeroU(bits)`
- `NonNull<T>` from `Unique<T>`
- `NonNull<T>` from `&T`
- `NonNull<T>` from `&mut T`
- `Unique<T>` from `&mut T`
- `Infallible` from `!`
- `TryIntError` from `!`
- `TryIntError` from `Infallible`
- `TryFromSliceError` from `Infallible`
- `FromResidual for Option<T>`
</div></details>

<details>
<summary>Remaining</summary><dev>

- `NonZero` from `NonZero`
These can't be made const at this time because these use Into::into.
https://github.com/rust-lang/rust/blob/master/library/core/src/convert/num.rs#L393

- `std`, `alloc`
There may still be many implementations that can be made `const`.
</div></details>
2021-10-20 04:35:15 +09:00
Yuki Okushi
30cc96efce Rollup merge of #88860 - nbdd0121:panic, r=m-ou-se
Deduplicate panic_fmt

std's begin_panic_fmt and core's panic_fmt are duplicates. Merge them to declutter code and remove a lang item.
2021-10-20 04:35:14 +09:00
Yuki Okushi
f7024998c7
Rollup merge of #88860 - nbdd0121:panic, r=m-ou-se
Deduplicate panic_fmt

std's begin_panic_fmt and core's panic_fmt are duplicates. Merge them to declutter code and remove a lang item.
2021-10-20 04:35:14 +09:00
Yuki Okushi
84fe598f00
Rollup merge of #88789 - the8472:rm-zip-bound, r=JohnTitor
remove unnecessary bound on Zip specialization impl

I originally added this bound in an attempt to make the specialization
sound for owning iterators but it was never correct here and the correct
and [already implemented](497ee321af/library/alloc/src/vec/into_iter.rs (L220-L232)) solution is is to place it on the IntoIter
implementation.
2021-10-20 04:35:13 +09:00
Yuki Okushi
71fcb72307
Rollup merge of #87769 - m-ou-se:alloc-features-cleanup, r=yaahc,dtolnay
Alloc features cleanup

This sorts and categorizes the `#![features]` in `alloc` and removes unused ones.

This is part of #87766

The following feature attributes were unnecessary and are removed:

```diff
// Library features:
-#![feature(cow_is_borrowed)]
-#![feature(maybe_uninit_uninit_array)]
-#![feature(slice_partition_dedup)]

// Language features:
-#![feature(arbitrary_self_types)]
-#![feature(auto_traits)]
-#![feature(box_patterns)]
-#![feature(decl_macro)]
-#![feature(nll)]
```
2021-10-20 04:35:12 +09:00
Yuki Okushi
3d95330230
Rollup merge of #87404 - rylev:artifact-size-profiling, r=wesleywiser
Add support for artifact size profiling

This adds support for profiling artifact file sizes (incremental compilation artifacts and query cache to begin with).

Eventually we want to track this in perf.rlo so we can ensure that file sizes do not change dramatically on each pull request.

This relies on support in measureme: https://github.com/rust-lang/measureme/pull/169. Once that lands we can update this PR to not point to a git dependency.

This was worked on together with `@michaelwoerister.`

r? `@wesleywiser`
2021-10-20 04:35:11 +09:00
Yuki Okushi
ca6798ab07
Rollup merge of #86479 - exphp-forks:float-debug-exponential, r=yaahc
Automatic exponential formatting in Debug

Context: See [this comment from the libs team](https://github.com/rust-lang/rfcs/pull/2729#issuecomment-853454204)

---

Makes `"{:?}"` switch to exponential for floats based on magnitude. The libs team suggested exploring this idea in the discussion thread for RFC rust-lang/rfcs#2729. (**note:** this is **not** an implementation of the RFC; it is an implementation of one of the alternatives)

Thresholds chosen were 1e-4 and 1e16.  Justification described [here](https://github.com/rust-lang/rfcs/pull/2729#issuecomment-864482954).

**This will require a crater run.**

---

As mentioned in the commit message of 8731d4dfb4, this behavior will not apply when a precision is supplied, because I wanted to preserve the following existing and useful behavior of `{:.PREC?}` (which recursively applies `{:.PREC}` to floats in a struct):

```rust
assert_eq!(
    format!("{:.2?}", [100.0, 0.000004]),
    "[100.00, 0.00]",
)
```

I looked around and am not sure where there are any tests that actually use this in the test suite, though?

All things considered, I'm surprised that this change did not seem to break even a single existing test in `x.py test --stage 2`.  (even when I tried a smaller threshold of 1e6)
2021-10-20 04:35:10 +09:00
Andre Bogus
e88c956e1e avoid eq_op in test code 2021-10-19 21:02:30 +02:00
Dmitry Borodin
7246731ad8
made description of intellij a link by moving outside of code block. 2021-10-19 20:33:39 +02:00
Wesley Wiser
5929cf0d67
Update src/test/codegen/debug-vtable.rs
Co-authored-by: r00ster <r00ster91@protonmail.com>
2021-10-19 11:36:21 -04:00
Vincent de Phily
3b53c8ef3d
Update RELEASES.md
Fix typo.
2021-10-19 15:50:27 +01:00
bors
1af55d19c7 Auto merge of #89933 - est31:let_else, r=michaelwoerister
Adopt let_else across the compiler

This performs a substitution of code following the pattern:

```
let <id> = if let <pat> = ... { identity } else { ... : ! };
```

To simplify it to:

```
let <pat> = ... { identity } else { ... : ! };
```

By adopting the `let_else` feature (cc #87335).

The PR also updates the syn crate because the currently used version of the crate doesn't support `let_else` syntax yet.

Note: Generally I'm the person who *removes* usages of unstable features from the compiler, not adds more usages of them, but in this instance I think it hopefully helps the feature get stabilized sooner and in a better state. I have written a [comment](https://github.com/rust-lang/rust/issues/87335#issuecomment-944846205) on the tracking issue about my experience and what I feel could be improved before stabilization of `let_else`.
2021-10-19 14:41:39 +00:00
Gary Guo
ebf4f03f7d Remove begin_panic_fmt from clippy 2021-10-19 15:15:59 +01:00
Gary Guo
7bd93dfeef Remove begin_panic_fmt from clippy 2021-10-19 15:15:59 +01:00
Gary Guo
9370156957 Deduplicate panic_fmt
std's begin_panic_fmt and core's panic_fmt are duplicates.
Merge them to declutter code and remove a lang item.
2021-10-19 15:02:21 +01:00
Mara Bos
6fdcedc9c8 Reenable feature(nll) in alloc. 2021-10-19 14:54:35 +02:00
Mara Bos
2104ac5706 Remove unused language #![feature]s from alloc. 2021-10-19 14:53:37 +02:00
Mara Bos
4ddc1f2109 Remove unused library #![feature]s from alloc. 2021-10-19 14:51:25 +02:00