]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoFixed compile errors
JarredAllen [Sat, 4 Jul 2020 03:28:40 +0000 (20:28 -0700)]
Fixed compile errors

4 years agoFormatted updates to lints
JarredAllen [Wed, 1 Jul 2020 18:41:11 +0000 (11:41 -0700)]
Formatted updates to lints

4 years agoUpdate compile-test to follow new lint
JarredAllen [Sat, 27 Jun 2020 23:55:47 +0000 (16:55 -0700)]
Update compile-test to follow new lint

4 years agoClean existing lint code to match new lint
JarredAllen [Thu, 25 Jun 2020 18:58:47 +0000 (11:58 -0700)]
Clean existing lint code to match new lint

4 years agoFix compile error from library change
JarredAllen [Thu, 25 Jun 2020 18:39:58 +0000 (11:39 -0700)]
Fix compile error from library change

4 years agoLast few tweaks
JarredAllen [Fri, 12 Jun 2020 15:32:38 +0000 (08:32 -0700)]
Last few tweaks

4 years agoUsed clippy to clean itself
JarredAllen [Sun, 31 May 2020 22:37:21 +0000 (15:37 -0700)]
Used clippy to clean itself

4 years agoDon't lint if contains a macro
JarredAllen [Sun, 31 May 2020 22:34:10 +0000 (15:34 -0700)]
Don't lint if contains a macro

4 years agoRefactoring pt. 2
JarredAllen [Tue, 12 May 2020 00:52:47 +0000 (17:52 -0700)]
Refactoring pt. 2

4 years agoRefactoring
JarredAllen [Sun, 10 May 2020 03:44:56 +0000 (20:44 -0700)]
Refactoring

4 years agoHandle ref, mut, &, and &mut on the option
JarredAllen [Sun, 10 May 2020 03:20:57 +0000 (20:20 -0700)]
Handle ref, mut, &, and &mut on the option

4 years agoProperly parenthesize to avoid operator precedence errors
JarredAllen [Sat, 25 Apr 2020 16:08:23 +0000 (09:08 -0700)]
Properly parenthesize to avoid operator precedence errors

4 years agoStop linting on macros and correctly use braces for constructs
JarredAllen [Sat, 25 Apr 2020 15:32:33 +0000 (08:32 -0700)]
Stop linting on macros and correctly use braces for  constructs

4 years agoLint for if let Some(x) = ... instead of Option::map_or
JarredAllen [Thu, 5 Mar 2020 18:35:05 +0000 (10:35 -0800)]
Lint for if let Some(x) = ... instead of Option::map_or

4 years agoAuto merge of #4841 - phaylon:pattern-type-mismatch, r=flip1995
bors [Fri, 3 Jul 2020 16:41:26 +0000 (16:41 +0000)]
Auto merge of #4841 - phaylon:pattern-type-mismatch, r=flip1995

Added restriction lint: pattern-type-mismatch

changelog: Added a new restriction lint `pattern-type-mismatch`. This lint is especially helpful for beginners learning about the magic behind pattern matching. (This explanation might be worth to include in the next changelog.)

4 years agofmt fix
Robert Sedlacek [Fri, 3 Jul 2020 16:23:36 +0000 (18:23 +0200)]
fmt fix

4 years agoLateContext has only one lifetime parameter now
Robert Sedlacek [Fri, 3 Jul 2020 16:20:19 +0000 (18:20 +0200)]
LateContext has only one lifetime parameter now

4 years agoAuto merge of #5761 - ThibsG:TypeRepetitionThreshold, r=flip1995
bors [Fri, 3 Jul 2020 16:17:41 +0000 (16:17 +0000)]
Auto merge of #5761 - ThibsG:TypeRepetitionThreshold, r=flip1995

Improvements for `type_repetition_in_bounds` lint

Some improvements for `type_repetition_in_bounds`:
- add a configurable threshold to trigger the lint (#4380). The lint won't trigger anymore if there are more bounds (strictly) than `conf.max_trait_bounds` on this type.
- take generic args into account over bounded type (#4323)
- don't lint for predicates generated in macros (#4326)

Fixes #4380,
Fixes #4323,
Fixes #4326,
Closes #3764

changelog: Fix multiple FPs in `type_repetition_in_bounds` and add a configuration option

Note: the #3764 has already been fixed but not closed

4 years agoExpanded lint documentation
Robert Sedlacek [Wed, 1 Jul 2020 13:49:46 +0000 (15:49 +0200)]
Expanded lint documentation

4 years agoCatching up with rustc changes
Robert Sedlacek [Wed, 1 Jul 2020 13:49:06 +0000 (15:49 +0200)]
Catching up with rustc changes

4 years agoFix rebase fallout
flip1995 [Mon, 8 Jun 2020 13:10:57 +0000 (15:10 +0200)]
Fix rebase fallout

4 years agoAdjusted expected STDERR
Robert Sedlacek [Mon, 10 Feb 2020 21:19:19 +0000 (22:19 +0100)]
Adjusted expected STDERR

4 years agospan_help_and_lint -> span_lint_and_help
Robert Sedlacek [Sun, 9 Feb 2020 16:57:35 +0000 (17:57 +0100)]
span_help_and_lint -> span_lint_and_help

4 years agoAdded restriction lint: pattern-type-mismatch
Robert Sedlacek [Mon, 4 Nov 2019 18:39:03 +0000 (19:39 +0100)]
Added restriction lint: pattern-type-mismatch

4 years agoDon't lint for predicates generated in macros
ThibsG [Fri, 3 Jul 2020 09:48:28 +0000 (11:48 +0200)]
Don't lint for predicates generated in macros

4 years agoTake generic args into account for bounded type
ThibsG [Fri, 3 Jul 2020 08:29:14 +0000 (10:29 +0200)]
Take generic args into account for bounded type

4 years agoAdd configurable threshold for `type_repetition_in_bounds` lint
ThibsG [Sun, 28 Jun 2020 10:14:04 +0000 (12:14 +0200)]
Add configurable threshold for `type_repetition_in_bounds` lint

4 years agoAuto merge of #5763 - flip1995:rustup, r=Manishearth
bors [Fri, 3 Jul 2020 14:48:59 +0000 (14:48 +0000)]
Auto merge of #5763 - flip1995:rustup, r=Manishearth

Rustup

changelog: none

4 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Fri, 3 Jul 2020 10:50:41 +0000 (12:50 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

4 years agoUse 'tcx for references to AccessLevels wherever possible.
Eduard-Mihai Burtescu [Thu, 25 Jun 2020 20:41:36 +0000 (23:41 +0300)]
Use 'tcx for references to AccessLevels wherever possible.

4 years agorustc_lint: avoid using TypeckTables::empty for LateContext.
Eduard-Mihai Burtescu [Fri, 26 Jun 2020 02:55:23 +0000 (05:55 +0300)]
rustc_lint: avoid using TypeckTables::empty for LateContext.

4 years agoAuto merge of #5760 - phansch:deprecate-regex-macro, r=Manishearth
bors [Wed, 1 Jul 2020 14:50:53 +0000 (14:50 +0000)]
Auto merge of #5760 - phansch:deprecate-regex-macro, r=Manishearth

Deprecate regex_macro lint

Closes #2586

changelog: Deprecate regex_macro lint

4 years agoDeprecate regex_macro lint
Philipp Hansch [Wed, 1 Jul 2020 10:36:36 +0000 (12:36 +0200)]
Deprecate regex_macro lint

4 years agoAuto merge of #5759 - mikerite:multiple_crate_versions_20200701, r=matthiaskrgr
bors [Wed, 1 Jul 2020 08:13:52 +0000 (08:13 +0000)]
Auto merge of #5759 - mikerite:multiple_crate_versions_20200701, r=matthiaskrgr

Fix multiple_crate_versions error

Fix the versions of packages in the multiple_crate_versions ui test by
checking in the Cargo.lock for the test package. `ansi_term 0.11`
depends on `winapi ^0.3.4`. This means means that the expected stderr for
this test would have to be updated whenever `winapi 0.3` is updated
otherwise.

changelog: none

4 years agoFix multiple_crate_versions error
Michael Wright [Wed, 1 Jul 2020 05:30:03 +0000 (07:30 +0200)]
Fix multiple_crate_versions error

Fix the versions of packages in the multiple_crate_versions ui test by
checking in the Cargo.lock for the test package. `ansi_term 0.11`
depends on `winapi ^0.3.4`. This means means that the expected stderr for
this test would have to be updated whenever `winapi 0.3` is updated
otherwise.

4 years agoAuto merge of #5758 - ebroto:5704_unnested_or_pats, r=flip1995
bors [Tue, 30 Jun 2020 22:23:23 +0000 (22:23 +0000)]
Auto merge of #5758 - ebroto:5704_unnested_or_pats, r=flip1995

Require `or_patterns` to suggest nesting them

changelog: Require `#![feature(or_patterns)]` to trigger [`unnested_or_patterns`]

Fixes #5704

4 years agoRequire `or_patterns` to suggest nesting them
Eduardo Broto [Tue, 30 Jun 2020 22:15:21 +0000 (00:15 +0200)]
Require `or_patterns` to suggest nesting them

4 years agoAuto merge of #5750 - ebroto:blanket_clippy_restriction_lints, r=Manishearth,flip1995...
bors [Tue, 30 Jun 2020 21:55:46 +0000 (21:55 +0000)]
Auto merge of #5750 - ebroto:blanket_clippy_restriction_lints, r=Manishearth,flip1995,phansch,oli-obk

Lint enabling the whole restriction group

I've added it to the `correctness` category, but I may be missing some valid use cases. In that case it could be changed to `pedantic`.

changelog: Add [`blanket_clippy_restriction_lints`] to check against enabling the whole restriction group.

4 years agoMove blanket_clippy_restriction_lints to "style"
Eduardo Broto [Sat, 27 Jun 2020 19:49:34 +0000 (21:49 +0200)]
Move blanket_clippy_restriction_lints to "style"

4 years agoLint enabling the whole restriction group
Eduardo Broto [Fri, 26 Jun 2020 08:52:14 +0000 (10:52 +0200)]
Lint enabling the whole restriction group

4 years agoAuto merge of #5751 - flip1995:rustup, r=Manishearth,flip1995
bors [Tue, 30 Jun 2020 14:20:09 +0000 (14:20 +0000)]
Auto merge of #5751 - flip1995:rustup, r=Manishearth,flip1995

Rustup

cc https://github.com/rust-lang/rust/pull/73743

r? @Manishearth

changelog: none

4 years agoDisable chrono integration test
flip1995 [Tue, 30 Jun 2020 14:19:42 +0000 (16:19 +0200)]
Disable chrono integration test

4 years agoMerge remote-tracking branch 'upstream/master' into rustup2
flip1995 [Tue, 30 Jun 2020 13:40:22 +0000 (15:40 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup2

4 years agotypeck: adding type information to projection
Azhng [Wed, 24 Jun 2020 20:33:31 +0000 (16:33 -0400)]
typeck: adding type information to projection

This commit modifies the Place as follow:
* remove 'ty' from ProjectionKind
* add type information into to Projection
* replace 'ty' in Place with 'base_ty'
* introduce 'ty()' in `Place` to return the final type of the `Place`
* introduce `ty_before_projection()` in `Place` to return the type of
  a `Place` before i'th projection is applied

Closes https://github.com/rust-lang/project-rfc-2229/issues/5

4 years agoUpdate tests
Dylan MacKenzie [Fri, 26 Jun 2020 00:43:48 +0000 (17:43 -0700)]
Update tests

4 years agoAuto merge of #73756 - Manishearth:rollup-aehswb2, r=Manishearth
bors [Fri, 26 Jun 2020 10:11:43 +0000 (10:11 +0000)]
Auto merge of #73756 - Manishearth:rollup-aehswb2, r=Manishearth

Rollup of 13 pull requests

Successful merges:

 - #72620 (Omit DW_AT_linkage_name when it is the same as DW_AT_name)
 - #72967 (Don't move cursor in search box when using arrows to navigate results)
 - #73102 (proc_macro: Stop flattening groups with dummy spans)
 - #73297 (Support configurable deny-warnings for all in-tree crates.)
 - #73507 (Cleanup MinGW LLVM linkage workaround)
 - #73588 (Fix handling of reserved registers for ARM inline asm)
 - #73597 (Record span of `const` kw in GenericParamKind)
 - #73629 (Make AssocOp Copy)
 - #73681 (Update Chalk to 0.14)
 - #73707 (Fix links in `SliceIndex` documentation)
 - #73719 (emitter: column width defaults to 140)
 - #73729 (disable collectionbenches for android)
 - #73748 (Add code block to code in documentation of `List::rebase_onto`)

Failed merges:

r? @ghost

4 years agoRollup merge of #73597 - ayazhafiz:i/const-span, r=ecstatic-morse
Manish Goregaokar [Fri, 26 Jun 2020 07:39:08 +0000 (00:39 -0700)]
Rollup merge of #73597 - ayazhafiz:i/const-span, r=ecstatic-morse

Record span of `const` kw in GenericParamKind

Context: this is needed for a fix of 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 :slightly_smiling_face:

4 years agorustc_lint: only query `typeck_tables_of` when a lint needs it.
Eduard-Mihai Burtescu [Thu, 25 Jun 2020 23:56:23 +0000 (02:56 +0300)]
rustc_lint: only query `typeck_tables_of` when a lint needs it.

4 years agoAuto merge of #5748 - carols10cents:tiny-docs-fix, r=flip1995
bors [Thu, 25 Jun 2020 15:28:50 +0000 (15:28 +0000)]
Auto merge of #5748 - carols10cents:tiny-docs-fix, r=flip1995

Change a noun to a verb to make the sentence complete

changelog: Fixed some grammar in the documentation for `await_holding_lock`.

Just a tiny little thing I found while using clippy <3

4 years agoChange a noun to a verb to make the sentence complete
Carol (Nichols || Goulding) [Thu, 25 Jun 2020 15:25:21 +0000 (11:25 -0400)]
Change a noun to a verb to make the sentence complete

4 years agoAuto merge of #5701 - ebroto:4874_cmp_owned_fp, r=flip1995
bors [Wed, 24 Jun 2020 12:48:24 +0000 (12:48 +0000)]
Auto merge of #5701 - ebroto:4874_cmp_owned_fp, r=flip1995

cmp_owned: handle when PartialEq is not implemented symmetrically

changelog: Handle asymmetrical implementations of PartialEq in [`cmp_owned`].

Fixes #4874

4 years agoAuto merge of #5745 - montrivo:copy_on_clone, r=phansch
bors [Wed, 24 Jun 2020 07:11:07 +0000 (07:11 +0000)]
Auto merge of #5745 - montrivo:copy_on_clone, r=phansch

clone_on_copy - add machine applicability

Fix #4826.
Change the applicability of the lint clone_on_copy. Split a test file and run rustfix on the clone_on_copy part.

changelog: clone_on_copy - add machine applicability

4 years agocopy_on_clone - add machine applicability
Tim Nielens [Tue, 23 Jun 2020 23:01:23 +0000 (01:01 +0200)]
copy_on_clone - add machine applicability

4 years agocmp_owned: reverse operands if necessary
Eduardo Broto [Fri, 12 Jun 2020 22:03:19 +0000 (00:03 +0200)]
cmp_owned: reverse operands if necessary

4 years agocmp_owned: avoid FP when PartialEq is not implemented symmetrically
Eduardo Broto [Tue, 9 Jun 2020 20:40:43 +0000 (22:40 +0200)]
cmp_owned: avoid FP when PartialEq is not implemented symmetrically

4 years agoRecord span of `const` kw in GenericParamKind
Ayaz Hafiz [Sun, 21 Jun 2020 22:49:56 +0000 (15:49 -0700)]
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 :slightly_smiling_face:

4 years agoAuto merge of #5694 - wangtheo:issue-5626, r=matthiaskrgr
bors [Tue, 23 Jun 2020 15:59:27 +0000 (15:59 +0000)]
Auto merge of #5694 - wangtheo:issue-5626, r=matthiaskrgr

#5626: lint iterator.map(|x| x)

changelog: adds a new lint for iterator.map(|x| x) (see https://github.com/rust-lang/rust-clippy/issues/5626)

The code also lints for result.map(|x| x) and option.map(|x| x). Also, I'm not sure if I'm checking for type adjustments correctly and I can't think of an example where .map(|x| x) would apply type adjustments.

4 years agoFix pattern match of ExprKind::MethodCall
Teddy_Wang [Tue, 23 Jun 2020 15:40:38 +0000 (11:40 -0400)]
Fix pattern match of ExprKind::MethodCall

4 years agoMerge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup
flip1995 [Tue, 23 Jun 2020 15:05:22 +0000 (17:05 +0200)]
Merge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup

4 years agoAuto merge of #5740 - lzutao:unused-unused, r=flip1995
bors [Tue, 23 Jun 2020 14:34:18 +0000 (14:34 +0000)]
Auto merge of #5740 - lzutao:unused-unused, r=flip1995

Remove unused allowed unused attributes

changelog: none

4 years agoAuto merge of #5738 - mikerite:loops-20200623-2, r=matthiaskrgr
bors [Tue, 23 Jun 2020 14:05:45 +0000 (14:05 +0000)]
Auto merge of #5738 - mikerite:loops-20200623-2, r=matthiaskrgr

Improve end of expression check in for loop lints

changelog: none

4 years agoRemove unused allowed unused attributes
Lzu Tao [Tue, 23 Jun 2020 13:59:35 +0000 (20:59 +0700)]
Remove unused allowed unused attributes

4 years agoAuto merge of #5735 - lzutao:issue-temp, r=flip1995
bors [Tue, 23 Jun 2020 13:40:02 +0000 (13:40 +0000)]
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.

4 years agoAuto merge of #5741 - flip1995:rollup-8chbwhy, r=flip1995
bors [Tue, 23 Jun 2020 12:52:46 +0000 (12:52 +0000)]
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

4 years agoRollup merge of #5726 - sozysozbot:patch-1, r=flip1995
Philipp Krones [Tue, 23 Jun 2020 12:39:50 +0000 (14:39 +0200)]
Rollup merge of #5726 - sozysozbot:patch-1, r=flip1995

Fix typo

changelog: extending it's lifetime -> extending its lifetime

4 years agoRollup merge of #5724 - ebroto:5697_const_result_option, r=Manishearth
Philipp Krones [Tue, 23 Jun 2020 12:39:49 +0000 (14:39 +0200)]
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

4 years agoRollup merge of #5716 - bugadani:patch-1, r=matthiaskrgr
Philipp Krones [Tue, 23 Jun 2020 12:39:48 +0000 (14:39 +0200)]
Rollup merge of #5716 - bugadani:patch-1, r=matthiaskrgr

Fix typo in wildcard_imports

changelog: none

4 years agoRollup merge of #5713 - flip1995:more_lints, r=Manishearth
Philipp Krones [Tue, 23 Jun 2020 12:39:47 +0000 (14:39 +0200)]
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

4 years agoRollup merge of #5712 - ijijn:master, r=flip1995
Philipp Krones [Tue, 23 Jun 2020 12:39:45 +0000 (14:39 +0200)]
Rollup merge of #5712 - ijijn:master, r=flip1995

Remove `bar` from blacklisted names

changelog: Remove `bar` from blacklisted names
fixes #5225

4 years agoRollup merge of #5710 - lcnr:patch-1, r=flip1995
Philipp Krones [Tue, 23 Jun 2020 12:39:44 +0000 (14:39 +0200)]
Rollup merge of #5710 - lcnr:patch-1, r=flip1995

typo

changelog: none

4 years agoRollup merge of #5709 - ebroto:5389_ice, r=Manishearth
Philipp Krones [Tue, 23 Jun 2020 12:39:43 +0000 (14:39 +0200)]
Rollup merge of #5709 - ebroto:5389_ice, r=Manishearth

Fix ICE in consts::binop

changelog: Fix ICE in `consts::binop`

Fixes #5389

4 years agoRollup merge of #5705 - dtolnay:orpat, r=flip1995
Philipp Krones [Tue, 23 Jun 2020 12:39:42 +0000 (14:39 +0200)]
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

4 years agoRollup merge of #5178 - matthiaskrgr:rustc_arg_pass, r=flip1995
Philipp Krones [Tue, 23 Jun 2020 12:39:40 +0000 (14:39 +0200)]
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

4 years agoFix fallout
flip1995 [Sat, 13 Jun 2020 16:22:49 +0000 (18:22 +0200)]
Fix fallout

4 years agoUse lints in Clippy that are enabled in rustc bootstrap
flip1995 [Sat, 13 Jun 2020 16:22:38 +0000 (18:22 +0200)]
Use lints in Clippy that are enabled in rustc bootstrap

4 years agoAuto merge of #5739 - flip1995:rustup, r=flip1995
bors [Tue, 23 Jun 2020 12:04:08 +0000 (12:04 +0000)]
Auto merge of #5739 - flip1995:rustup, r=flip1995

Rustup

changelog: none

r? @ghost

4 years agoAdd more specific GitHub issue templates
Lzu Tao [Tue, 23 Jun 2020 07:27:11 +0000 (14:27 +0700)]
Add more specific GitHub issue templates

Apply suggestions from code review

Co-authored-by: Philipp Krones <hello@philkrones.com>
4 years agoImprove end of expression check in for loop lints
Michael Wright [Thu, 11 Jun 2020 18:25:14 +0000 (20:25 +0200)]
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.

4 years agoAuto merge of #5695 - esamudera:lint_mem_uninitialized, r=phansch,oli-obk
bors [Tue, 23 Jun 2020 05:14:21 +0000 (05:14 +0000)]
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()`

4 years agoRollup merge of #73578 - RalfJung:ty-ctxt-at, r=jonas-schievink
Dylan DPC [Tue, 23 Jun 2020 01:16:22 +0000 (03:16 +0200)]
Rollup merge of #73578 - RalfJung:ty-ctxt-at, r=jonas-schievink

Make is_freeze and is_copy_modulo_regions take TyCtxtAt

Make is_freeze and is_copy_modulo_regions take TyCtxtAt instead of separately taking TyCtxt and Span. This is consistent with is_sized.

4 years agoAuto merge of #5711 - flip1995:rustup, r=flip1995
bors [Tue, 23 Jun 2020 00:27:02 +0000 (00:27 +0000)]
Auto merge of #5711 - flip1995:rustup, r=flip1995

Rustup

changelog: none

4 years agoFix sync fallout
flip1995 [Tue, 23 Jun 2020 00:18:38 +0000 (02:18 +0200)]
Fix sync fallout

4 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Tue, 23 Jun 2020 00:18:17 +0000 (02:18 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

4 years agoStop using old version of `syn` in `rustc-workspace-hack`
Aaron Hill [Mon, 22 Jun 2020 17:29:04 +0000 (13:29 -0400)]
Stop using old version of `syn` in `rustc-workspace-hack`

None of the tools seem to need syn 0.15.35, so we can just build syn
1.0.

This was causing an issue with clippy's `compile-test` program: since
multiple versions of `syn` would exist in the build directory, we would
non-deterministically pick one based on filesystem iteration order. If
the pre-1.0 version of `syn` was picked, a strange build error would
occur (see
https://github.com/rust-lang/rust/pull/73594#issuecomment-647671463)

To prevent this kind of issue from happening again, we now panic if we
find multiple versions of a crate in the build directly, instead of
silently picking the first version we find.

4 years agoMake is_freeze and is_copy_modulo_regions take TyCtxtAt
Ralf Jung [Sun, 21 Jun 2020 09:20:48 +0000 (11:20 +0200)]
Make is_freeze and is_copy_modulo_regions take TyCtxtAt

4 years agoRefactor hir::Place
Aman Arora [Wed, 17 Jun 2020 22:13:05 +0000 (18:13 -0400)]
Refactor hir::Place

For the following code
```rust
let c = || bar(foo.x, foo.x)
```

We generate two different `hir::Place`s for both `foo.x`.
Handling this adds overhead for analysis we need to do for RFC 2229.

We also want to store type information at each Projection to support
analysis as part of the RFC. This resembles what we have for
`mir::Place`

This commit modifies the Place as follows:
- Rename to `PlaceWithHirId`, where there `hir_id` is that of the
expressioin.
- Move any other information that describes the access out to another
struct now called `Place`.
- Removed `Span`, it can be accessed using the [hir
API](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.span)
- Modify `Projection` to be a strucutre of its own, that currently only
contains the `ProjectionKind`.

Adding type information to projections wil be completed as part of https://github.com/rust-lang/project-rfc-2229/issues/5

Closes https://github.com/rust-lang/project-rfc-2229/issues/3

Co-authored-by: Aman Arora <me@aman-arora.com>
Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
4 years agoFix typo
sozysozbot [Wed, 17 Jun 2020 21:50:04 +0000 (06:50 +0900)]
Fix typo

extending it's lifetime -> extending its lifetime

4 years agoredundant_pattern_matching: avoid non-const fn in const context
Eduardo Broto [Tue, 16 Jun 2020 22:32:47 +0000 (00:32 +0200)]
redundant_pattern_matching: avoid non-const fn in const context

4 years agoAvoid triggering similar names on code from expansion
Eduardo Broto [Tue, 26 May 2020 22:06:50 +0000 (00:06 +0200)]
Avoid triggering similar names on code from expansion

4 years agoFix fallout in similar_names
flip1995 [Tue, 12 May 2020 14:50:00 +0000 (16:50 +0200)]
Fix fallout in similar_names

4 years agoFix fallout in redundant_field_names
flip1995 [Tue, 12 May 2020 14:26:55 +0000 (16:26 +0200)]
Fix fallout in redundant_field_names

4 years agoRegister redundant_field_names and non_expressive_names as early passes
flip1995 [Thu, 23 Apr 2020 22:14:03 +0000 (00:14 +0200)]
Register redundant_field_names and non_expressive_names as early passes

4 years agomem_replace_with_uninit: suggest std::ptr::read
Ericko Samudera [Sun, 7 Jun 2020 17:44:14 +0000 (00:44 +0700)]
mem_replace_with_uninit: suggest std::ptr::read

4 years agoRollup merge of #72938 - lzutao:stabilize_option_zip, r=dtolnay
Ralf Jung [Mon, 15 Jun 2020 10:01:03 +0000 (12:01 +0200)]
Rollup merge of #72938 - lzutao:stabilize_option_zip, r=dtolnay

Stabilize Option::zip

This PR stabilizes the following API:

```rust
impl<T> Option<T> {
    pub fn zip<U>(self, other: Option<U>) -> Option<(T, U)>;
}
```

This API has real world usage as seen in <https://grep.app/search?q=-%3E%20Option%3C%5C%28T%2C%5Cs%3FU%5C%29%3E&regexp=true&filter[lang][0]=Rust>.

The `zip_with` method is left unstably as this API is kinda niche
and it hasn't received much usage in Rust repositories on GitHub.

cc #70086

4 years agoAuto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakis
bors [Mon, 15 Jun 2020 04:10:24 +0000 (04:10 +0000)]
Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakis

Clean up type alias impl trait implementation

- Removes special case for top-level impl trait
- Removes associated opaque types
- Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types.
- Handle lifetimes in type alias impl trait more uniformly with other parameters

cc #69323
cc #63063
Closes #57188
Closes #62988
Closes #69136
Closes #73061

4 years agoFix typo in wildcard_imports
Dániel Buga [Sun, 14 Jun 2020 09:07:44 +0000 (11:07 +0200)]
Fix typo in wildcard_imports

4 years agoUpdate comment in conf.rs
Iain Brandram-Adams [Sun, 14 Jun 2020 00:46:56 +0000 (12:46 +1200)]
Update comment in conf.rs

4 years agoUpdate stderr to match, and reinforce comments
Iain Brandram-Adams [Sun, 14 Jun 2020 00:40:36 +0000 (12:40 +1200)]
Update stderr to match, and reinforce comments

4 years agoAdded a lint for .map(|x| x)
Teddy_Wang [Mon, 8 Jun 2020 04:35:10 +0000 (00:35 -0400)]
Added a lint for .map(|x| x)

4 years agoRemove `bar` from blacklisted names
Iain Brandram-Adams [Sat, 13 Jun 2020 13:24:36 +0000 (01:24 +1200)]
Remove `bar` from blacklisted names