Commit graph

139285 commits

Author SHA1 Message Date
Ryan Levick
1999a3147f Fix borrow and deref 2021-03-03 11:23:29 +01:00
Ryan Levick
da3995f0ec Remove lint pass on borrow and deref 2021-03-03 11:23:14 +01:00
Ryan Levick
6bf6652616 Move unrelated ui test back to what it was before 2021-03-03 11:22:59 +01:00
Ryan Levick
4be7052b1a Allow noop_method_call in clippy ui test 2021-03-03 11:22:58 +01:00
Esteban Küber
055db16479 Clean up code rightward drift 2021-03-03 11:22:57 +01:00
Esteban Küber
e48670c34a Increase accuracy of lint trigger 2021-03-03 11:22:56 +01:00
Ryan Levick
49f32e0c8e Improve error messages 2021-03-03 11:22:55 +01:00
Ryan Levick
316e9db0cf Fix tidy error 2021-03-03 11:22:55 +01:00
Ryan Levick
95e330bd01 Update error message 2021-03-03 11:22:54 +01:00
Ryan Levick
16c4afbde4 Fix tidy errors 2021-03-03 11:22:53 +01:00
Ryan Levick
217c88655b Improve warning 2021-03-03 11:22:52 +01:00
Ryan Levick
c5ff54cbdb Fix std tests 2021-03-03 11:22:51 +01:00
Ryan Levick
d3b49c2ed2 Only allow new lint when not bootstrapping - since beta doesn't know about the lint 2021-03-03 11:22:50 +01:00
Ryan Levick
ee65416f0d Fix core tests 2021-03-03 11:22:49 +01:00
Ryan Levick
3a86184777 Fix ui-full-deps suite 2021-03-03 11:22:49 +01:00
Ryan Levick
618c395a8d Bless test where order of error message changed 2021-03-03 11:22:48 +01:00
Ryan Levick
a6d926d80d Fix tests 2021-03-03 11:22:44 +01:00
Ryan Levick
f49ed7a6b7 Add tests and support two more noop methods 2021-03-03 11:22:17 +01:00
Ryan Levick
040735c110 First version of noop-lint 2021-03-03 11:22:16 +01:00
bors
cbca5689a5 Auto merge of #76345 - okready:sgx-mem-range-overflow-checks, r=joshtriplett
Add is_enclave_range/is_user_range overflow checks

Fixes #76343.

This adds overflow checking to `is_enclave_range` and `is_user_range` in `sgx::os::fortanix_sgx::mem` in order to mitigate possible security issues with enclave code. It also accounts for an edge case where the memory range provided ends exactly at the end of the address space, where calculating `p + len` would overflow back to zero despite the range potentially being valid.
2021-03-03 05:45:50 +00:00
bors
35dbef2350 Auto merge of #82562 - llogiq:one-up-82248, r=oli-obk
Optimize counting digits in line numbers during error reporting further

This one-ups #82248 by switching the strategy: Instead of dividing the value by 10 repeatedly, we compare with a limit that we multiply by 10 repeatedly. In my benchmarks, this took between 50% and 25% of the original time. The reasons for being faster are:

1. While LLVM is able to replace a division by constant with a multiply + shift, a plain multiplication is still faster. However, this doesn't even factor, because
2. Multiplication, unlike division, is const. We also use a simple for-loop instead of a more complex loop + break, which allows
3. rustc to const-fold the whole loop, and indeed the assembly output simply shows a series of comparisons.
2021-03-02 21:01:47 +00:00
bors
795a934b51 Auto merge of #82043 - tmiasko:may-have-side-effect, r=kennytm
Turn may_have_side_effect into an associated constant

The `may_have_side_effect` is an implementation detail of `TrustedRandomAccess`
trait. It describes if obtaining an iterator element may have side effects. It
is currently implemented as an associated function.

Turn `may_have_side_effect` into an associated constant. This makes the
value immediately available to the optimizer.
2021-03-02 16:08:32 +00:00
bors
67342b830e Auto merge of #82698 - JohnTitor:rollup-htd533c, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #80189 (Convert primitives in the standard library to intra-doc links)
 - #80874 (Update intra-doc link documentation to match the implementation)
 - #82376 (Add option to enable MIR inlining independently of mir-opt-level)
 - #82516 (Add incomplete feature gate for inherent associate types.)
 - #82579 (Fix turbofish recovery with multiple generic args)
 - #82593 (Teach rustdoc how to display WASI.)
 - #82597 (Get TyCtxt from self instead of passing as argument in AutoTraitFinder)
 - #82627 (Erase late bound regions to avoid ICE)
 - #82661 (⬆️ rust-analyzer)
 - #82691 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-02 12:57:06 +00:00
Yuki Okushi
97f9b186ae
Rollup merge of #82691 - ehuss:update-books, r=ehuss
Update books

## reference

2 commits in 361367c126290ac17cb4089f8d38fd8b2ac43f98..3b6fe80c205d2a2b5dc8a276192bbce9eeb9e9cf
2021-02-15 09:58:13 -0800 to 2021-02-22 22:09:17 -0800
- Add an extra fn() entry to the variance table in the subtyping chapter (rust-lang-nursery/reference#874)
- Turbofish: Explain what the example is of. (rust-lang-nursery/reference#966)

## book

28 commits in db5e8a5105aa22979490dce30e33b68d8645761d..0f87daf683ae3de3cb725faecb11b7e7e89f0e5a
2021-02-12 16:58:20 -0500 to 2021-03-01 08:54:04 -0500
- Ohhh the should_panic was for mdbook test. Oops
- Fix bad regex in the update rustc script and regenerate broken output
- Clarify that we only mentioned unwrap_or_else, but haven't explained it
- Add ferris to some listings that don't compile. Fixes rust-lang/book#2598
- Remove fancy quote from a code comment
- Panic now points at our code, not stdlib slice code
- Disable playground on thread::sleep examples
- Disable playground button on listings in ch 12 that use CLI args
- Reword ambiguous sentence. Fixes rust-lang/book#2317.
- Rename shoes_in_my_size to shoes_in_size to be a better example
- Fix visible "ANCHOR: here" in listing 13-21 (rust-lang/book#2628)
- minor clarification about deriving Copy and Clone (rust-lang/book#2627)
- Clarify relationship of trait to mock object
- Fix "message" that should be "method"
- Fix rust-lang/book#2625 (rust-lang/book#2626)
- fix misleading hash claim (rust-lang/book#2621)
- Make link syntax consistent and word wrap
- Added hyperlinks to Appendices
- Use console syntax highlighting in some more places
- Merge remote-tracking branch 'origin/pr/2615'
- Fix broken blockquote
- Update one more bit of output caught by the update rust script
- Update and clarify some text affected by the rand update
- Update lock files and output
- Update error output for changes to chapter 10 listings
- Merge remote-tracking branch 'origin/pr/2542'
- Tweak wording in for loop explanation
- Merge remote-tracking branch 'origin/pr/2460'

## rust-by-example

1 commits in 551cc4bc8394feccea6acd21f86d9a4e1d2271a0..3e0d98790c9126517fa1c604dc3678f396e92a27
2021-02-03 17:12:37 -0300 to 2021-02-25 08:23:10 -0300
- Make flow_control/for/.into_iter() example run (rust-lang/rust-by-example#1415)

## rustc-dev-guide

530 commits in 7adfab42bab045a848126895c2f1e09927c1331a..c431f8c29a41413dddcb3bfa0d71c9cabe366317
2020-04-08 08:52:05 +0200 to 2021-02-28 16:35:20 -0500

... Many updates.

## embedded-book

1 commits in 4cf7981696a85c3e633076c6401611bd3f6346c4..a96d096cffe5fa2c84af1b4b61e1492f839bb2e1
2021-02-11 10:55:22 +0000 to 2021-02-17 08:08:52 +0000
- Add note about using more recent openocd interface file. Closes rust-embedded/book#277 and rust-embedded/book#263  (rust-embedded/book#284)
2021-03-02 21:23:22 +09:00
Yuki Okushi
738cacffd1
Rollup merge of #82661 - lnicola:rust-analyzer-2021-03-01, r=jonas-schievink
⬆️ rust-analyzer
2021-03-02 21:23:21 +09:00
Yuki Okushi
2c40e13b84
Rollup merge of #82627 - JohnTitor:issue-82612, r=estebank
Erase late bound regions to avoid ICE

Fixes #82612, which is caused by #81769.

r? `@estebank`
2021-03-02 21:23:20 +09:00
Yuki Okushi
43bcfdb0d0
Rollup merge of #82597 - noslaver:fix-82137, r=nagisa
Get TyCtxt from self instead of passing as argument in AutoTraitFinder

First contribution 🦀, let me know if anything is amiss.

Fix #82137.
2021-03-02 21:23:19 +09:00
Yuki Okushi
543ef7f13c
Rollup merge of #82593 - sunfishcode:wasi-docs, r=alexcrichton
Teach rustdoc how to display WASI.

As a followup to [this comment] in #82420, this patch teaches rustdoc
how to display WASI.

[this comment]: https://github.com/rust-lang/rust/pull/82420#issuecomment-784523826

r? `@alexcrichton`
2021-03-02 21:23:18 +09:00
Yuki Okushi
906e535205
Rollup merge of #82579 - osa1:issue82566, r=estebank
Fix turbofish recovery with multiple generic args

This consists of two commits, each can be individually reviewed.

- First commit fixes the issue in [this comment](https://github.com/rust-lang/rust/issues/82566#issuecomment-786924466).
- Second commit fixes #82566

---

r? ````@estebank````
2021-03-02 21:23:17 +09:00
Yuki Okushi
5e68c60406
Rollup merge of #82516 - PoignardAzur:inherent-impl-ty, r=oli-obk
Add incomplete feature gate for inherent associate types.

Mentored by ``````@oli-obk``````

So far the only change is that instead of giving an automatic error, the following code compiles:

```rust
struct Foo;

impl Foo {
    type Bar = isize;
}
```

The backend work to make it actually usable isn't there yet. In particular, this:

```rust
let x : Foo::Bar;
```

will give you:

```sh
error[E0223]: ambiguous associated type
  --> /$RUSTC_DIR/src/test/ui/assoc-inherent.rs:15:13
   |
LL |     let x : Foo::Bar;
   |             ^^^^^^^^ help: use fully-qualified syntax: `<Foo as Trait>::Bar`
```
2021-03-02 21:23:15 +09:00
Yuki Okushi
ae5e024194
Rollup merge of #82376 - tmiasko:inline-options, r=oli-obk
Add option to enable MIR inlining independently of mir-opt-level

Add `-Zinline-mir` option that enables MIR inlining independently of the
current MIR opt level. The primary use-case is enabling MIR inlining on the
default MIR opt level.

Turn inlining thresholds into optional values to make it possible to configure
different defaults depending on the current mir-opt-level (although thresholds
are yet to be used in such a manner).
2021-03-02 21:23:14 +09:00
Yuki Okushi
a9339ed531
Rollup merge of #80874 - jyn514:intra-doc-docs, r=Manishearth
Update intra-doc link documentation to match the implementation

r? `@Manishearth`
cc `@camelid` `@m-ou-se`

Relevant PRs:
- https://github.com/rust-lang/rust/pull/74489
- https://github.com/rust-lang/rust/pull/80181
- https://github.com/rust-lang/rust/pull/76078
- https://github.com/rust-lang/rust/pull/77519
- https://github.com/rust-lang/rust/pull/73101

Relevant issues:
- https://github.com/rust-lang/rust/issues/78800
- https://github.com/rust-lang/rust/issues/77200
- https://github.com/rust-lang/rust/issues/77199 / https://github.com/rust-lang/rust/issues/54191/

I haven't documented things that I consider 'just bugs', like https://github.com/rust-lang/rust/issues/77732, but I have documented features that aren't implemented, like https://github.com/rust-lang/rust/issues/78800.
2021-03-02 21:23:13 +09:00
Yuki Okushi
bc5669eef8
Rollup merge of #80189 - jyn514:convert-primitives, r=poliorcetics
Convert primitives in the standard library to intra-doc links

Blocked on https://github.com/rust-lang/rust/pull/80181. I forgot that this needs to wait for the beta bump so the standard library can be documented with `doc --stage 0`.

Notably I didn't convert `core::slice` because it's like 50 links and I got scared 😨
2021-03-02 21:23:12 +09:00
bors
edeee915b1 Auto merge of #82634 - osa1:osa1/remove_old_fixme, r=Mark-Simulacrum
Remove an old FIXME comment and inline attribute

Apparently #35870 caused a problem in this code (which originally
returned an impl trait) and `#[inline]` was added as a workaround, in
ade79d7609.

The issue is now fixed and the comment and `#[inline]` can now be
removed.
2021-03-02 10:15:34 +00:00
bors
ef0d5924c2 Auto merge of #82688 - GuillaumeGomez:rollup-b754t11, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #80734 (check that first arg to `panic!()` in const is `&str`)
 - #81932 (Always compile rustdoc with debug logging enabled when `download-rustc` is set)
 - #82018 (Remove the dummy cache in `DocContext`; delete RenderInfo)
 - #82598 (Check stability and feature attributes in rustdoc)
 - #82655 (Highlight identifier span instead of whole pattern span in `unused` lint)
 - #82662 (Warn about unknown doc attributes)
 - #82676 (Change twice used large const table to static)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-02 05:21:25 +00:00
Eric Huss
b840304d8b Update books 2021-03-01 18:00:56 -08:00
Guillaume Gomez
9a0ac7cb5f
Rollup merge of #82676 - dtolnay:powers, r=Mark-Simulacrum
Change twice used large const table to static

This table is used twice in core::num::dec2flt::algorithm::power_of_ten. According to the semantics of const, a separate huge definition of the table is inlined at both places.

5233edcf1c/library/core/src/num/dec2flt/algorithm.rs (L16-L22)

Theoretically this gets cleaned up by optimization passes, but in practice I am experiencing a miscompile from LTO on this code. Making the table a static, which would only be defined a single time and not require attention from LTO, eliminates the miscompile and seems semantically more appropriate anyway. A separate bug report on the LTO bug is forthcoming.

Original addition of `const` is from #27307.
2021-03-02 00:50:11 +01:00
Guillaume Gomez
0c6b69aa70
Rollup merge of #82662 - GuillaumeGomez:doc-attr-check, r=jyn514
Warn about unknown doc attributes

Fixes #82652.

For the text error, I decided to go for "invalid" instead of "unknown". What do you think?

r? `@jyn514`
2021-03-02 00:50:10 +01:00
Guillaume Gomez
d259d1d98a
Rollup merge of #82655 - SkiFire13:fix-issue-81314, r=estebank
Highlight identifier span instead of whole pattern span in `unused` lint

Fixes #81314

This pretty much just changes the span highlighted in the lint from `pat_sp` to `ident.span`. There's however an exception, which is in patterns with shorthands like `Point { y, ref mut x }`, where a suggestion to change just `x` would be invalid; in those cases I had to keep the pattern span. Another option would be suggesting something like `Point { y, x: ref mut _x }`.

I also added a new test since there weren't any test that checked the `unused` lint with optional patterns.
2021-03-02 00:50:09 +01:00
Guillaume Gomez
5a82251e92
Rollup merge of #82598 - GuillaumeGomez:rustdoc-rustc-pass, r=jyn514
Check stability and feature attributes in rustdoc

Fixes #82588.

cc `@Nemo157` `@camelid`
r? `@jyn514`
2021-03-02 00:50:08 +01:00
Guillaume Gomez
b51272edfe
Rollup merge of #82018 - jyn514:no-dummy-cache, r=camelid,GuillaumeGomez
Remove the dummy cache in `DocContext`; delete RenderInfo

The same information is available everywhere; the only reason the dummy
cache was needed is because it was previously stored in three different
places. This consolidates the info a bit so the cache in `DocContext` is
used throughout. As a bonus, it also completely removes `RenderInfo`.

- Return a `Cache` from `run_global_ctxt`, not `RenderInfo`
- Remove the unused `render_info` from `run_renderer`
- Remove RenderInfo altogether

Helps with https://github.com/rust-lang/rust/pull/82014. The next step is to move the `populate()` call before the `collect_intra_doc_links` pass, which currently breaks because a) lots of the cache is populated in early passes, and b) intra_doc_links itself sets some info with `register_res`. I'm working on separate PR for that to avoid making too many big changes at once.

r? `@GuillaumeGomez`
2021-03-02 00:50:07 +01:00
Guillaume Gomez
22ebb867f7
Rollup merge of #81932 - jyn514:rustdoc-logging, r=Mark-Simulacrum
Always compile rustdoc with debug logging enabled when `download-rustc` is set

Previously, logging at DEBUG or below would always be silenced, because
rustc compiles tracing with the `static_max_level_info` feature. That
makes sense for release artifacts, but not for developing rustdoc.

Instead, this compiles two different versions of tracing: one in the
release artifacts, distributed in the sysroot, and a new version
compiled by rustdoc. Since `rustc_driver` is always linked to the
version of sysroot, this copy/pastes `init_env_logging` into rustdoc.

To avoid compiling an unnecessary version of tracing when
`download-rustc` isn't set, this adds a new `using-ci-artifacts`
feature for rustdoc and passes that feature in bootstrap.

Addresses https://github.com/rust-lang/rust/issues/81930. This builds on https://github.com/rust-lang/rust/pull/79540.

r? `@Mark-Simulacrum`
2021-03-02 00:50:06 +01:00
Guillaume Gomez
865cf0c3b6
Rollup merge of #80734 - abonander:ab/issue-66693, r=oli-obk
check that first arg to `panic!()` in const is `&str`

closes #66693

~~TODO: regression test~~

cc `@RalfJung` for error message wording
2021-03-02 00:50:04 +01:00
Noam Koren
854fffde5d Get TyCtxt from self instead of passing as argument in AutoTraitFinder
methods
2021-03-01 22:59:24 +02:00
bors
4f20caa625 Auto merge of #82663 - jyn514:rollup-xh3cb0c, r=jyn514
Rollup of 8 pull requests

Successful merges:

 - #81210 (BTreeMap: correct node size test case for choices of B)
 - #82360 (config.toml parsing error improvements)
 - #82428 (Update mdbook)
 - #82480 (Remove `ENABLE_DOWNLOAD_RUSTC` constant)
 - #82578 (Add some diagnostic items for Clippy)
 - #82620 (Apply lint restrictions from renamed lints)
 - #82635 (Fix typos in rustc_infer::infer::nll_relate)
 - #82645 (Clarify that SyncOnceCell::set blocks.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-01 20:52:47 +00:00
Guillaume Gomez
d20fd62d70 Add missing stability attributes in libstd 2021-03-01 20:28:37 +01:00
Guillaume Gomez
f6de1300b4 Add tests for doc attribute check 2021-03-01 20:26:28 +01:00
Guillaume Gomez
b0b330f143 Validate meta items used in \#\[doc(...)\] 2021-03-01 20:26:28 +01:00
David Tolnay
bd51dea693
Change twice used large const table to static
This table is used twice in core::num::dec2flt::algorithm::power_of_ten.
According to the semantics of const, a separate huge definition of the
table is inlined at both places.

    fn power_of_ten(e: i16) -> Fp {
        assert!(e >= table::MIN_E);
        let i = e - table::MIN_E;
        let sig = table::POWERS.0[i as usize];
        let exp = table::POWERS.1[i as usize];
        Fp { f: sig, e: exp }
    }

Theoretically this gets cleaned up by optimization passes, but in
practice I am experiencing a miscompile from LTO on this code. Making
the table a static, which would only be defined a single time and not
require attention from LTO, eliminates the miscompile and seems
semantically more appropriate anyway. A separate bug report on the LTO
bug is forthcoming.
2021-03-01 10:41:16 -08:00
bors
ccad218e7f Auto merge of #82587 - taiki-e:unaligned_references, r=oli-obk
Enable report_in_external_macro in unaligned_references

Fixes an issue where `unaligned_references` is not triggered in external macros, unlike `safe_packed_borrows`.
Also, given that this lint is planned to eventually change to hard error (#82525), it would make sense for this lint to be triggered for external macros as well.

See https://github.com/taiki-e/pin-project-lite/pull/55#issuecomment-787038676 and https://github.com/taiki-e/pin-project-lite/pull/55#issuecomment-787052874 for more.

r? `@RalfJung`
2021-03-01 18:10:38 +00:00