Commit Graph

122506 Commits

Author SHA1 Message Date
Dan Aloni
037e930df7 Review fixes 2020-06-23 22:30:09 +03:00
Nikodem Rabuliński
f37c157f2c
Update map.rs 2020-06-23 20:06:44 +02:00
bors
ff5b446d2f Auto merge of #73644 - ollie27:rustdoc_alias_filter, r=GuillaumeGomez
rustdoc: Fix doc aliases with crate filtering

Fix a crash when searching for an alias contained in the currently selected filter crate.

Also remove alias search results for crates that should be filtered out.

The test suite needed to be fixed to actually take into account the crate filtering and check that there are no results when none are expected.

Needs to be backported to beta to fix the `std` docs.

Fixes #73620

r? @GuillaumeGomez
2020-06-23 17:30:54 +00:00
Alex Crichton
0c2b02536c rustc: Modernize wasm checks for atomics
This commit modernizes how rustc checks for whether the `atomics`
feature is enabled for the wasm target. The `sess.target_features` set
is consulted instead of fiddling around with dealing with various
aspects of LLVM and that syntax.
2020-06-23 09:41:56 -07:00
Ayaz Hafiz
86f6c0e086
Record span of const kw in GenericParamKind
Context: this is needed to fix https://github.com/rust-lang/rustfmt/issues/4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated 🙂
2020-06-23 09:25:46 -07:00
flip1995
a2c0499b39
Merge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup 2020-06-23 17:05:22 +02:00
bors
c2c07fa9d0 Auto merge of #5740 - lzutao:unused-unused, r=flip1995
Remove unused allowed unused attributes

changelog: none
2020-06-23 14:34:18 +00:00
bors
c420382ac2 Auto merge of #5738 - mikerite:loops-20200623-2, r=matthiaskrgr
Improve end of expression check in for loop lints

changelog: none
2020-06-23 14:05:45 +00:00
Lzu Tao
7374185b36 Remove unused allowed unused attributes 2020-06-23 20:59:35 +07:00
bors
9504efc94e Auto merge of #5735 - lzutao:issue-temp, r=flip1995
Add more specific GitHub issue templates

changelog: Make it easier to create feature request and bug reports with issue templates.
2020-06-23 13:40:02 +00:00
bors
b452ad3c0b Auto merge of #5741 - flip1995:rollup-8chbwhy, r=flip1995
Rollup of 9 pull requests

Successful merges:

 - #5178 (clippy-driver: pass all args to rustc if --rustc is present)
 - #5705 (Downgrade unnested_or_patterns to pedantic)
 - #5709 (Fix ICE in consts::binop)
 - #5710 (typo)
 - #5712 (Remove `bar` from blacklisted names)
 - #5713 (Use lints in Clippy that are enabled in rustc bootstrap)
 - #5716 (Fix typo in wildcard_imports)
 - #5724 (redundant_pattern_matching: avoid non-`const fn` calls in const contexts)
 - #5726 (Fix typo)

Failed merges:

r? @ghost

changelog: rollup
2020-06-23 12:52:46 +00:00
Philipp Krones
e4cbd1df4e
Rollup merge of #5726 - sozysozbot:patch-1, r=flip1995
Fix typo

changelog: extending it's lifetime -> extending its lifetime
2020-06-23 14:39:50 +02:00
Philipp Krones
f562117788
Rollup merge of #5724 - ebroto:5697_const_result_option, r=Manishearth
redundant_pattern_matching: avoid non-`const fn` calls in const contexts

changelog: Avoid suggesting non-`const fn` calls in const contexts in [`redundant_pattern_matching`]

Fixes #5697
2020-06-23 14:39:49 +02:00
Philipp Krones
68c0b24e23
Rollup merge of #5716 - bugadani:patch-1, r=matthiaskrgr
Fix typo in wildcard_imports

changelog: none
2020-06-23 14:39:48 +02:00
Philipp Krones
598a79f309
Rollup merge of #5713 - flip1995:more_lints, r=Manishearth
Use lints in Clippy that are enabled in rustc bootstrap

cc https://github.com/rust-lang/rust/pull/73297#discussion_r439747061

changelog: none
2020-06-23 14:39:47 +02:00
Philipp Krones
0799be7156
Rollup merge of #5712 - ijijn:master, r=flip1995
Remove `bar` from blacklisted names

changelog: Remove `bar` from blacklisted names
fixes #5225
2020-06-23 14:39:45 +02:00
Philipp Krones
24b77ea72f
Rollup merge of #5710 - lcnr:patch-1, r=flip1995
typo

changelog: none
2020-06-23 14:39:44 +02:00
Philipp Krones
9505919be5
Rollup merge of #5709 - ebroto:5389_ice, r=Manishearth
Fix ICE in consts::binop

changelog: Fix ICE in `consts::binop`

Fixes #5389
2020-06-23 14:39:43 +02:00
Philipp Krones
1f39eeb06d
Rollup merge of #5705 - dtolnay:orpat, r=flip1995
Downgrade unnested_or_patterns to pedantic

Even with #5704 fixed, I don't believe it is a safe bet that if someone is using or-patterns anywhere in a codebase then they want to use it as much as possible in the whole codebase. I think it would be reasonable to reevaluate after the feature is stable. I feel that a warn-by-default lint suggesting use of an unstable feature, even if already being used in one place, is questionable.

changelog: Remove unnested_or_patterns from default set of enabled lints
2020-06-23 14:39:42 +02:00
Philipp Krones
7c61be615a
Rollup merge of #5178 - matthiaskrgr:rustc_arg_pass, r=flip1995
clippy-driver: pass all args to rustc if --rustc is present

changelog: clippy-driver: pass all args to rustc if --rustc is present
2020-06-23 14:39:40 +02:00
flip1995
b886c06c1a
Fix fallout 2020-06-23 14:05:53 +02:00
flip1995
ed083cc959
Use lints in Clippy that are enabled in rustc bootstrap 2020-06-23 14:05:52 +02:00
bors
4cc2fa933b Auto merge of #5739 - flip1995:rustup, r=flip1995
Rustup

changelog: none

r? @ghost
2020-06-23 12:04:08 +00:00
Dan Aloni
404df1cbbf Add re-exports to use suggestions
In the following example, an inaccessible path is suggested via
`use foo::bar::X;` whereas an accessible public exported path can
be suggested instead.

```
mod foo {
    mod bar {
        pub struct X;
    }
    pub use self::bar::X;
}

fn main() { X; }
```

This fixes the issue.
2020-06-23 13:37:50 +03:00
Yuki Okushi
814782b4c6
Add test for issue-69840 2020-06-23 17:52:51 +09:00
Yuki Okushi
e817cd2a6e
Add test for issue-59435 2020-06-23 17:52:42 +09:00
Yuki Okushi
43ef554b6a
Add test for issue-51506 2020-06-23 17:52:26 +09:00
Yuki Okushi
bb882d74bd
Add test for issue-44861 2020-06-23 17:52:01 +09:00
Oliver Middleton
478750c1db rustdoc: Fix doc aliases with crate filtering
Fix a crash when searching for an alias contained in the currently selected filter crate.

Also remove alias search results for crates that should be filtered out.

The test suite needed to be fixed to actually take into account the crate filtering and check that there are no results when none are expected.
2020-06-23 09:27:37 +01:00
Oliver Scherer
5fa8b08808 The const propagator cannot trace references.
Thus we avoid propagation of a local the moment we encounter references to it.
2020-06-23 10:18:14 +02:00
bors
1557fb031b Auto merge of #73643 - Manishearth:rollup-68dr8fz, r=Manishearth
Rollup of 9 pull requests

Successful merges:

 - #72271 (Improve compiler error message for wrong generic parameter order)
 - #72493 ( move leak-check to during coherence, candidate eval)
 - #73398 (A way forward for pointer equality in const eval)
 - #73472 (Clean up E0689 explanation)
 - #73496 (Account for multiple impl/dyn Trait in return type when suggesting `'_`)
 - #73515 (Add second message for LiveDrop errors)
 - #73567 (Clarify --extern documentation.)
 - #73572 (Fix typos in doc comments)
 - #73590 (bootstrap: no `config.toml` exists regression)

Failed merges:

r? @ghost
2020-06-23 07:50:51 +00:00
Lzu Tao
51c3b42ef3 Add more specific GitHub issue templates
Apply suggestions from code review

Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-06-23 14:34:32 +07:00
Manish Goregaokar
44900f8236
Rollup merge of #73590 - davidtwco:bootstrap-fix-config-env-var, r=Mark-Simulacrum
bootstrap: no `config.toml` exists regression

Fixes #73574.

This PR fixes a regression introduced in #73317 where an oversight meant that `config.toml` was assumed to exist.
2020-06-23 00:34:06 -07:00
Manish Goregaokar
84bd1e776b
Rollup merge of #73572 - JOE1994:patch-4, r=jonas-schievink
Fix typos in doc comments

Hello 🦀 ,

This commit fixes typos in the doc comments of 'librustc_mir/monomorphize/collector.rs'

Thank you for reviewing this PR 👍
2020-06-23 00:34:05 -07:00
Manish Goregaokar
05601515be
Rollup merge of #73567 - adetaylor:extern-doc-fix, r=dtolnay
Clarify --extern documentation.

Fixes #64731, #73531.

See also https://github.com/rust-lang/rust/issues/64402#issuecomment-530852886
2020-06-23 00:34:03 -07:00
Manish Goregaokar
0f9a6edc09
Rollup merge of #73515 - christianpoveda:livedrop-diagnostics, r=oli-obk
Add second message for LiveDrop errors

This is an attempt to fix https://github.com/rust-lang/rust/issues/72907 by adding a second message to the `LiveDrop` diagnostics. Changing from this
```
error[E0493]: destructors cannot be evaluated at compile-time
 --> src/lib.rs:7:9
  |
7 |     let mut always_returned = None;
  |         ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors

error: aborting due to previous error
```
to this
```
error[E0493]: destructors cannot be evaluated at compile-time
  --> foo.rs:6:9
   |
6  |     let mut always_returned = None;
   |         ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors
...
10 |         always_returned = never_returned;
   |         --------------- value is dropped here

error: aborting due to previous error
```
r? @RalfJung @ecstatic-morse
2020-06-23 00:34:00 -07:00
Manish Goregaokar
cd18ac1ce8
Rollup merge of #73496 - estebank:opaque-missing-lts-in-fn-3, r=nikomatsakis
Account for multiple impl/dyn Trait in return type when suggesting `'_`

Make `impl` and `dyn` Trait lifetime suggestions a bit more resilient.

Follow up to #72804.

r? @nikomatsakis
2020-06-23 00:33:58 -07:00
Manish Goregaokar
98aa34cb57
Rollup merge of #73472 - GuillaumeGomez:cleanup-e0689, r=Dylan-DPC
Clean up E0689 explanation

r? @Dylan-DPC
2020-06-23 00:33:56 -07:00
Manish Goregaokar
ae38698e7f
Rollup merge of #73398 - oli-obk:const_raw_ptr_cmp, r=varkor,RalfJung,nagisa
A way forward for pointer equality in const eval

r? @varkor on the first commit and @RalfJung on the second commit

cc #53020
2020-06-23 00:33:54 -07:00
Manish Goregaokar
903823c59b
Rollup merge of #72493 - nikomatsakis:move-leak-check, r=matthewjasper
move leak-check to during coherence, candidate eval

Implementation of MCP https://github.com/rust-lang/compiler-team/issues/295.

I'd like to do a crater run on this.

Note to @rust-lang/lang: This PR is a breaking change (bugfix). It causes tests like the following to go from a future-compatibility warning #56105 to a hard error:

```rust
trait Trait {}
impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {}
impl Trait for for<'c> fn(&'c u32, &'c u32) {} // now rejected, used to warn
```

I am not aware of any instances of this code in the wild, but that is why we are doing a crater run. The reason for this change is that those two types are, in fact, the same type, and hence the two impls are overlapping.

There will still be impls that trigger #56105 after this lands, however -- I hope that we will eventually just accept those impls without warning, for the most part. One example of such an impl is this pattern, which is used by wasm-bindgen and other crates as well:

```rust
trait Trait {}
impl<T> Trait for fn(&T) { }
impl<T> Trait for fn(T) { } // still accepted, but warns
```
2020-06-23 00:33:52 -07:00
Manish Goregaokar
59e87c0b81
Rollup merge of #72271 - rakshith-ravi:master, r=varkor
Improve compiler error message for wrong generic parameter order

- Added optional "help" parameter that shows a help message on the compiler error if required.
- Added a simple ordered parameter as a sample help.

@varkor will make more changes as required. Let me know if I'm heading in the right direction.

Fixes #68437

r? @varkor
2020-06-23 00:33:46 -07:00
Rich Kadel
977ce57d91 Updated query for num_counters to compute from max index
Also added FIXME comments to note the possible need to accommodate
counter increment calls in source-based functions that differ from the
function context of the caller instance (e.g., inline functions).
2020-06-22 23:50:30 -07:00
Michael Wright
52c4864757 Improve end of expression check in for loop lints
The code should to check that the current expression _is_ the end
expression; not that it's equal to it. The equality check seems very
wasteful in terms of performance.
2020-06-23 07:51:51 +02:00
bors
c56c7e2d02 Auto merge of #5695 - esamudera:lint_mem_uninitialized, r=phansch,oli-obk
New lint: suggest `ptr::read` instead of `mem::replace(..., uninitialized())`

resolves: #5575

changelog: improvements to `MEM_REPLACE_WITH_UNINIT`:
- add a new test case in `tests/ui/repl_uninit.rs` to cover the case of replacing with `mem::MaybeUninit::uninit().assume_init()`.
- modify the existing `MEM_REPLACE_WITH_UNINIT` when replacing with `mem::uninitialized` to suggest using `ptr::read` instead.
- lint with `MEM_REPLACE_WITH_UNINIT` when replacing with `mem::MaybeUninit::uninit().assume_init()`
2020-06-23 05:14:21 +00:00
bors
3b1c08c68c Auto merge of #73635 - Dylan-DPC:rollup-b4wbp42, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #71756 (add Windows system error codes that should map to io::ErrorKind::TimedOut)
 - #73495 (Converted all platform-specific stdin/stdout/stderr implementations to use io:: traits)
 - #73575 (Fix typo in error_codes doc)
 - #73578 (Make is_freeze and is_copy_modulo_regions take TyCtxtAt)
 - #73586 (switch_ty is redundant)
 - #73600 (Fix spurious 'value moved here in previous iteration of loop' messages)
 - #73610 (Clean up E0699 explanation)

Failed merges:

r? @ghost
2020-06-23 04:03:28 +00:00
Ayaz Hafiz
7930f9a368
Change heuristic for determining range literal
Currently, rustc uses a heuristic to determine if a range expression is
not a literal based on whether the expression looks like a function call
or struct initialization. This fails for range literals whose
lower/upper bounds are the results of function calls. A possibly-better
heuristic is to check if the expression contains `..`, required in range
literals.

Of course, this is also not perfect; for example, if the range
expression is a struct which includes some text with `..` this will
fail, but in general I believe it is a better heuristic.

A better alternative altogether is to add the `QPath::LangItem` enum
variant suggested in #60607. I would be happy to do this as a precursor
to this patch if someone is able to provide general suggestions on how
usages of `QPath` need to be changed later in the compiler with the
`LangItem` variant.

Closes #73553
2020-06-22 20:52:44 -07:00
yuqio
9267b4f612 Remove unused crate imports in 2018 edition crates 2020-06-23 05:01:20 +02:00
Rich Kadel
a045140268 using "mir_body" (vs "body") in InstrumentCoverage
The mod uses both MIR bodies and HIR bodies, so I'm trying to maintain
consistency with these names.
2020-06-22 19:30:52 -07:00
Rich Kadel
3d0192e7c8 PR no longer requires u32 impl TypeFoldable 2020-06-22 19:27:48 -07:00
Rich Kadel
08ec4cbb9e moves coverage data computation from pass to query 2020-06-22 19:21:56 -07:00