]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoUpdate libssh2-sys
Eric Huss [Tue, 28 Dec 2021 21:24:03 +0000 (13:24 -0800)]
Update libssh2-sys

2 years agoRemove unused parameter
Noah Lev [Tue, 28 Dec 2021 03:28:05 +0000 (19:28 -0800)]
Remove unused parameter

2 years agoPrint space after formal generic params in fn type
David Tolnay [Thu, 23 Dec 2021 20:31:37 +0000 (12:31 -0800)]
Print space after formal generic params in fn type

2 years agoOnly special case struct fields for intra-doc links, not enum variants
Joshua Nelson [Sat, 18 Dec 2021 15:48:51 +0000 (09:48 -0600)]
Only special case struct fields for intra-doc links, not enum variants

Variants are already handled by `resolve_str_path_error`, rustdoc doesn't need to consider them separately.

2 years agoRemove pretty printer space inside block with only outer attrs
David Tolnay [Tue, 28 Dec 2021 20:26:18 +0000 (12:26 -0800)]
Remove pretty printer space inside block with only outer attrs

2 years agoParse and suggest moving where clauses after equals for type aliases
Jack Huey [Mon, 20 Dec 2021 14:10:10 +0000 (09:10 -0500)]
Parse and suggest moving where clauses after equals for type aliases

2 years agoAuto merge of #8187 - ApamNapat:fix_7651, r=llogiq
bors [Tue, 28 Dec 2021 17:11:40 +0000 (17:11 +0000)]
Auto merge of #8187 - ApamNapat:fix_7651, r=llogiq

Fixed issues with to_radians and to_degrees lints

fixes #7651

I fixed the original problem as described in the issue, but the bug remains for complex expressions (the commented out TC I added is an example). I would also love some feedback on how to cleanup my code and reduce duplication. I hope it's not a problem that the issue has been claimed by someone else - that was over two months ago.

changelog: ``[`suboptimal_flops`]`` no longer proposes broken code with `to_radians` and `to_degrees`

2 years agoAuto merge of #92352 - matthiaskrgr:rollup-19fbq7u, r=matthiaskrgr
bors [Tue, 28 Dec 2021 16:59:56 +0000 (16:59 +0000)]
Auto merge of #92352 - matthiaskrgr:rollup-19fbq7u, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #92076 (Ignore other `PredicateKind`s in rustdoc auto trait finder)
 - #92219 (Remove VCVARS_BAT)
 - #92238 (Add a test suite for stringify macro)
 - #92330 (Add myself to .mailmap)
 - #92333 (Tighten span when suggesting lifetime on path)
 - #92335 (Document units for `std::column`)
 - #92344 (:arrow_up: rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoFixed issues with to_radians and to_degrees lints
BB [Tue, 28 Dec 2021 16:45:43 +0000 (17:45 +0100)]
Fixed issues with to_radians and to_degrees lints

2 years agocontants peel_refs to catch `x << &0`
Alex Ozdemir [Tue, 28 Dec 2021 16:32:55 +0000 (08:32 -0800)]
contants peel_refs to catch `x << &0`

2 years agotest
Alex Ozdemir [Tue, 28 Dec 2021 16:19:47 +0000 (08:19 -0800)]
test

2 years agoUpdate pulldown-cmark version in clippy
Guillaume Gomez [Tue, 28 Dec 2021 15:19:23 +0000 (16:19 +0100)]
Update pulldown-cmark version in clippy

2 years agoUpdate pulldown-cmark version to 0.9
Guillaume Gomez [Fri, 24 Dec 2021 11:21:04 +0000 (12:21 +0100)]
Update pulldown-cmark version to 0.9

2 years agoAdd y.bin.dSYM to .gitignore
bjorn3 [Tue, 28 Dec 2021 15:16:49 +0000 (16:16 +0100)]
Add y.bin.dSYM to .gitignore

2 years agoAuto merge of #92153 - petrochenkov:foreignchild, r=cjgillot
bors [Tue, 28 Dec 2021 13:47:22 +0000 (13:47 +0000)]
Auto merge of #92153 - petrochenkov:foreignchild, r=cjgillot

rustc_metadata: Merge items from `extern` blocks into their parent modules during metadata encoding rather than during metadata decoding

2 years agoRollup merge of #92344 - lnicola:rust-analyzer-2021-12-28, r=lnicola
Matthias Krüger [Tue, 28 Dec 2021 12:59:27 +0000 (13:59 +0100)]
Rollup merge of #92344 - lnicola:rust-analyzer-2021-12-28, r=lnicola

:arrow_up: rust-analyzer

r? ``@ghost``

2 years agoRollup merge of #92335 - ecstatic-morse:std-column-unicode, r=Manishearth
Matthias Krüger [Tue, 28 Dec 2021 12:59:26 +0000 (13:59 +0100)]
Rollup merge of #92335 - ecstatic-morse:std-column-unicode, r=Manishearth

Document units for `std::column`

Fixes #92301.

r? ``@Manishearth`` (for the terminology and the Chinese)

2 years agoRollup merge of #92333 - compiler-errors:elided-lifetime-spans, r=cjgillot
Matthias Krüger [Tue, 28 Dec 2021 12:59:25 +0000 (13:59 +0100)]
Rollup merge of #92333 - compiler-errors:elided-lifetime-spans, r=cjgillot

Tighten span when suggesting lifetime on path

This is kind of a hack.

Really the issue here is that we want to suggest the segment's span if the path resolves to something defined outside of the macro, and the macro's span if it resolves to something defined within.. I'll look into seeing if we can do something like that.

Fixes #92324

r? `@cjgillot`

2 years agoRollup merge of #92330 - wesleywiser:mailmap, r=Mark-Simulacrum
Matthias Krüger [Tue, 28 Dec 2021 12:59:24 +0000 (13:59 +0100)]
Rollup merge of #92330 - wesleywiser:mailmap, r=Mark-Simulacrum

Add myself to .mailmap

2 years agoRollup merge of #92238 - dtolnay:stringifytest, r=Mark-Simulacrum
Matthias Krüger [Tue, 28 Dec 2021 12:59:24 +0000 (13:59 +0100)]
Rollup merge of #92238 - dtolnay:stringifytest, r=Mark-Simulacrum

Add a test suite for stringify macro

This attempts to cover the behavior of `stringify!` on various interpolated syntax tree nodes.

The pretty printer has a history of unsightly whitespace (double spaces, missing spaces, spaces where there shouldn't be spaces) &mdash; #91437, #91562, #91568. There are several such issues left; the test cases that I consider to be currently behaving incorrectly are marked with `// FIXME` in the PR.

2 years agoRollup merge of #92219 - ehuss:remove-vcvars, r=Mark-Simulacrum
Matthias Krüger [Tue, 28 Dec 2021 12:59:23 +0000 (13:59 +0100)]
Rollup merge of #92219 - ehuss:remove-vcvars, r=Mark-Simulacrum

Remove VCVARS_BAT

This environment variable is no longer used.  It was used in the original Azure Pipelines configuration (#60777). When GitHub Actions were added (#70190), it was no longer used, and I suspect it was just an oversight while transitioning the configuration.

2 years agoRollup merge of #92076 - Aaron1011:rustdoc-auto-trait-ignore, r=cjgillot
Matthias Krüger [Tue, 28 Dec 2021 12:59:22 +0000 (13:59 +0100)]
Rollup merge of #92076 - Aaron1011:rustdoc-auto-trait-ignore, r=cjgillot

Ignore other `PredicateKind`s in rustdoc auto trait finder

Fixes #92073

There's not really anything we can do with them, and they're
causing ICEs. I'm not using a wildcard match, as we should check
that any new `PredicateKind`s are handled properly by rustdoc.

2 years agodocs(error-codes): Add long error explanation for E0227
TmLev [Tue, 28 Dec 2021 12:46:20 +0000 (15:46 +0300)]
docs(error-codes): Add long error explanation for E0227

2 years agoAuto merge of #8127 - dswij:8090, r=xFrednet
bors [Tue, 28 Dec 2021 12:01:21 +0000 (12:01 +0000)]
Auto merge of #8127 - dswij:8090, r=xFrednet

Fix `enum_variants` FP on prefixes that are not camel-case

closes #8090

Fix FP on `enum_variants` when prefixes are only a substring of a camel-case word. Also adds some util helpers on `str_utils` to help parsing camel-case strings.

This changes how the lint behaves:

1. previously if the Prefix is only a length of 1, it's going to get ignored, i.e. these were previously ignored and now is warned
```rust
enum Foo {
    cFoo,
    cBar,
    cBaz,
}

enum Something {
    CCall,
    CCreate,
    CCryogenize,
}
```

2. non-ascii characters that doesn't have casing will not be split,
```rust
enum NonCaps {
    PrefixXXX,
    PrefixTea,
    PrefixCake,
}
```
will be considered as `PrefixXXX`, `Prefix`, `Prefix`, so this won't lint as opposed to fired previously.

changelog: [`enum_variant_names`] Fix FP when first prefix are only a substring of a camel-case word.

---

 (Edited by `@xFrednet` removed some non ascii characters)

2 years agorustc_metadata: Encode list of all crate's traits into metadata
Vadim Petrochenkov [Fri, 24 Dec 2021 03:09:32 +0000 (11:09 +0800)]
rustc_metadata: Encode list of all crate's traits into metadata

2 years agoAuto merge of #8185 - dswij:8177, r=llogiq
bors [Tue, 28 Dec 2021 11:15:53 +0000 (11:15 +0000)]
Auto merge of #8185 - dswij:8177, r=llogiq

`needless_return` suggest return unit type on void returns

closes #8177

previously, `needless_return` suggests an empty block `{}` to replace void `return` on match arms, this PR improve the suggestion by suggesting a unit instead.

changelog: `needless_return` suggests `()` instead of `{}` on match arms

2 years ago`needless_return` suggest return unit type on void returns
bors [Tue, 28 Dec 2021 11:15:53 +0000 (11:15 +0000)]
`needless_return` suggest return unit type on void returns

closes #8177

previously, `needless_return` suggests an empty block `{}` to replace void `return` on match arms, this PR improve the suggestion by suggesting a unit instead.

changelog: `needless_return` suggests `()` instead of `{}` on match arms

2 years agoAuto merge of #8175 - Kage-Yami:feature/document-8145, r=llogiq
bors [Tue, 28 Dec 2021 09:29:08 +0000 (09:29 +0000)]
Auto merge of #8175 - Kage-Yami:feature/document-8145, r=llogiq

Readme: note that config changes don't apply to already compiled code

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

changelog: added a note to the Readme that config changes don't apply to already compiled code

2 years agoReadme: note that config changes don't apply to already compiled code
bors [Tue, 28 Dec 2021 09:29:08 +0000 (09:29 +0000)]
Readme: note that config changes don't apply to already compiled code

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

changelog: added a note to the Readme that config changes don't apply to already compiled code

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 28 Dec 2021 07:44:21 +0000 (09:44 +0200)]
:arrow_up: rust-analyzer

2 years agoTighten span when suggesting lifetime on path
Michael Goulet [Mon, 27 Dec 2021 22:10:59 +0000 (14:10 -0800)]
Tighten span when suggesting lifetime on path

2 years agoAuto merge of #92159 - petrochenkov:decoditer, r=cjgillot
bors [Tue, 28 Dec 2021 07:32:43 +0000 (07:32 +0000)]
Auto merge of #92159 - petrochenkov:decoditer, r=cjgillot

rustc_metadata: Switch crate data iteration from a callback to iterator

The iteration looks more conventional this way, and some allocations are avoided.

2 years agorustc_metadata: Merge items from `extern` blocks into their parent modules
Vadim Petrochenkov [Tue, 21 Dec 2021 06:37:38 +0000 (14:37 +0800)]
rustc_metadata: Merge items from `extern` blocks into their parent modules

during metadata encoding rather than during metadata decoding

2 years agoAuto merge of #8182 - rust-lang:cache-test-items, r=giraffate
bors [Tue, 28 Dec 2021 05:50:20 +0000 (05:50 +0000)]
Auto merge of #8182 - rust-lang:cache-test-items, r=giraffate

cache test item names

This avoids quadratic behavior (collecting all test item names for each `eq_op` instance within the module). However, it invests a good deal of memory to buy this speedup. If that becomes a problem, I may need to change the cache to only store the chain of last visited modules.

This hopefully fixes #8171.

---

changelog: none

2 years agocache test item names
Andre Bogus [Mon, 27 Dec 2021 23:13:03 +0000 (00:13 +0100)]
cache test item names

2 years agoAuto merge of #92088 - camelid:intra-doc-cleanup, r=Manishearth
bors [Tue, 28 Dec 2021 04:19:01 +0000 (04:19 +0000)]
Auto merge of #92088 - camelid:intra-doc-cleanup, r=Manishearth

intra-doc: Use an enum to represent URL fragments

This is a step in the direction of computing the links more lazily,
which I think will simplify the implementation of intra-doc links.
This will also make it easier to eventually use the actual `Res` for
associated items, enum variants, and fields, rather than their HTML
page's `Res`.

r? `@jyn514`

2 years agoImplement support in wtf8
Xuanwo [Tue, 28 Dec 2021 03:53:14 +0000 (11:53 +0800)]
Implement support in wtf8

Signed-off-by: Xuanwo <github@xuanwo.io>
2 years agoFix windows build
Xuanwo [Tue, 28 Dec 2021 03:40:58 +0000 (11:40 +0800)]
Fix windows build

Signed-off-by: Xuanwo <github@xuanwo.io>
2 years agoAdd try_reserve for OsString
Xuanwo [Tue, 28 Dec 2021 03:28:05 +0000 (11:28 +0800)]
Add try_reserve for OsString

Signed-off-by: Xuanwo <github@xuanwo.io>
2 years agoGive clearer names to several search index functions
Noah Lev [Tue, 28 Dec 2021 03:19:56 +0000 (19:19 -0800)]
Give clearer names to several search index functions

2 years agoCoalesce two arguments as `&Function`
Noah Lev [Tue, 28 Dec 2021 03:16:33 +0000 (19:16 -0800)]
Coalesce two arguments as `&Function`

2 years agoMake `search_index` functions private where possible
Noah Lev [Tue, 28 Dec 2021 02:59:27 +0000 (18:59 -0800)]
Make `search_index` functions private where possible

Now the only two crate-public items are `build_index` and
`get_index_search_type` (because for some reason the latter is also used
in `formats::cache`).

2 years agoMove `ExternalLocation` to `clean::types`
Noah Lev [Tue, 28 Dec 2021 02:57:07 +0000 (18:57 -0800)]
Move `ExternalLocation` to `clean::types`

It was previously defined in `render::search_index` but wasn't used at
all there. `clean::types` seems like a better fit since that's where
`ExternalCrate` is defined.

2 years agorustdoc: Remove some unnecessary `cache` parameters
Noah Lev [Tue, 28 Dec 2021 02:53:00 +0000 (18:53 -0800)]
rustdoc: Remove some unnecessary `cache` parameters

Based on
https://github.com/rust-lang/rust/pull/80883#issuecomment-774437832.
The `tcx` parameters do seem to be used though, so I only removed the
`cache` parameters.

2 years agoRename `rustdoc::html::render::cache` to `search_index`
Noah Lev [Tue, 28 Dec 2021 02:39:35 +0000 (18:39 -0800)]
Rename `rustdoc::html::render::cache` to `search_index`

The old name wasn't very clear, while the new one makes it clear that
this is the code responsible for creating the search index.

2 years agointra-doc: Use an enum to represent URL fragments
Noah Lev [Sat, 18 Dec 2021 21:33:01 +0000 (13:33 -0800)]
intra-doc: Use an enum to represent URL fragments

This is a step in the direction of computing the links more lazily,
which I think will simplify the implementation of intra-doc links.
This will also make it easier to eventually use the actual `Res` for
associated items, enum variants, and fields, rather than their HTML
page's `Res`.

2 years agoRemove needless `return`
Noah Lev [Sat, 18 Dec 2021 01:14:53 +0000 (17:14 -0800)]
Remove needless `return`

2 years agoAuto merge of #92130 - Kobzol:stable-hash-str, r=cjgillot
bors [Tue, 28 Dec 2021 01:04:33 +0000 (01:04 +0000)]
Auto merge of #92130 - Kobzol:stable-hash-str, r=cjgillot

Use hash_stable for hashing str

This seemed like an oversight. With this change the hash can go through the `HashStable` machinery directly.

2 years agoAuto merge of #8181 - ApamNapat:typos_fixes, r=giraffate
bors [Tue, 28 Dec 2021 00:29:24 +0000 (00:29 +0000)]
Auto merge of #8181 - ApamNapat:typos_fixes, r=giraffate

Fixed some typos in README and CONTRIBUTING

changelog: none

2 years agochore: reduce some vis. for updated unreachable_pub lint
Caleb Cartwright [Mon, 27 Dec 2021 23:42:48 +0000 (17:42 -0600)]
chore: reduce some vis. for updated unreachable_pub lint

2 years agoLimit the identity_op lint to integral operands.
Alex Ozdemir [Tue, 28 Dec 2021 00:06:27 +0000 (16:06 -0800)]
Limit the identity_op lint to integral operands.

If operands are being applied to non-integers, then the lint is likely
wrong.

2 years agoDocument units for `std::column`
Dylan MacKenzie [Mon, 27 Dec 2021 23:35:01 +0000 (15:35 -0800)]
Document units for `std::column`

2 years agoFixed some typos in README and CONTRIBUTING
BB [Mon, 27 Dec 2021 23:08:25 +0000 (00:08 +0100)]
Fixed some typos in README and CONTRIBUTING

2 years agoAuto merge of #92329 - matthiaskrgr:rollup-l3b4fl1, r=matthiaskrgr
bors [Mon, 27 Dec 2021 21:55:52 +0000 (21:55 +0000)]
Auto merge of #92329 - matthiaskrgr:rollup-l3b4fl1, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #90586 (Relax priv-in-pub lint on generic bounds and where clauses of trait impls.)
 - #92112 (Fix the error of checking `base_expr` twice in type_changing_struct_update)
 - #92147 (rustc_builtin_macros: make asm mod public for rustfmt)
 - #92161 (resolve: Minor miscellaneous cleanups from #89059)
 - #92264 (Remove `maybe_uninit_extra` feature from Vec docs)
 - #92303 (Add test cases for issue #26186)
 - #92307 (Fix minor typos)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoAuto merge of #8170 - rust-lang:numbered-fields, r=xFrednet
bors [Mon, 27 Dec 2021 21:02:15 +0000 (21:02 +0000)]
Auto merge of #8170 - rust-lang:numbered-fields, r=xFrednet

new lint: `init-numbered-fields`

This fixes #7985.

r? `@xFrednet`

---

changelog: new lint: [`init_numbered_fields`]

2 years agoAuto merge of #8175 - Kage-Yami:feature/document-8145, r=llogiq
bors [Mon, 27 Dec 2021 20:43:48 +0000 (20:43 +0000)]
Auto merge of #8175 - Kage-Yami:feature/document-8145, r=llogiq

Readme: note that config changes don't apply to already compiled code

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

changelog: added a note to the Readme that config changes don't apply to already compiled code

2 years agoReadme: note that config changes don't apply to already compiled code
bors [Mon, 27 Dec 2021 20:43:48 +0000 (20:43 +0000)]
Readme: note that config changes don't apply to already compiled code

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

changelog: added a note to the Readme that config changes don't apply to already compiled code

2 years agoRollup merge of #92307 - hiroshi-maybe:fix-minor-typos, r=camelid
Matthias Krüger [Mon, 27 Dec 2021 20:42:30 +0000 (21:42 +0100)]
Rollup merge of #92307 - hiroshi-maybe:fix-minor-typos, r=camelid

Fix minor typos

2 years agoRollup merge of #92303 - Patrick-Poitras:issue-26186, r=jackh726
Matthias Krüger [Mon, 27 Dec 2021 20:42:29 +0000 (21:42 +0100)]
Rollup merge of #92303 - Patrick-Poitras:issue-26186, r=jackh726

Add test cases for issue #26186

Closes #26186

It seems that issue #26186 has been solved at some point since the issue has been last updated. I've merged together the examples that were supplied by `@Osspial,` `@Mark-Simulacrum,` `@Diggsey,` `@eefriedman` and `@shepmaster,` so that we can add this to the testing suite and prevent these issues from re-occurring.

2 years agoRollup merge of #92264 - Shadlock0133:patch-1, r=the8472
Matthias Krüger [Mon, 27 Dec 2021 20:42:28 +0000 (21:42 +0100)]
Rollup merge of #92264 - Shadlock0133:patch-1, r=the8472

Remove `maybe_uninit_extra` feature from Vec docs

In `Vec`, two doc tests are using `MaybeUninit::write` , stabilized in 1.55. This makes docs' usage of `maybe_uninit_extra` feature unnecessary.

2 years agoRollup merge of #92161 - petrochenkov:misclean, r=cjgillot
Matthias Krüger [Mon, 27 Dec 2021 20:42:27 +0000 (21:42 +0100)]
Rollup merge of #92161 - petrochenkov:misclean, r=cjgillot

resolve: Minor miscellaneous cleanups from #89059

`@bors` rollup=always

2 years agoRollup merge of #92147 - calebcartwright:publicize-builtin_macro-asm, r=cjgillot
Matthias Krüger [Mon, 27 Dec 2021 20:42:26 +0000 (21:42 +0100)]
Rollup merge of #92147 - calebcartwright:publicize-builtin_macro-asm, r=cjgillot

rustc_builtin_macros: make asm mod public for rustfmt

Follow up to #92016, as I'd completely missed that the mod we needed was internal

2 years agoRollup merge of #92112 - SparrowLii:issue92010, r=cjgillot
Matthias Krüger [Mon, 27 Dec 2021 20:42:25 +0000 (21:42 +0100)]
Rollup merge of #92112 - SparrowLii:issue92010, r=cjgillot

Fix the error of checking `base_expr` twice in type_changing_struct_update

Fixes #92010

2 years agoRollup merge of #90586 - jswrenn:relax-privacy-lints, r=petrochenkov
Matthias Krüger [Mon, 27 Dec 2021 20:42:25 +0000 (21:42 +0100)]
Rollup merge of #90586 - jswrenn:relax-privacy-lints, r=petrochenkov

Relax priv-in-pub lint on generic bounds and where clauses of trait impls.

The priv-in-pub lint is a legacy mechanism of the compiler, supplanted by a reachability-based [type privacy](https://github.com/rust-lang/rfcs/blob/master/text/2145-type-privacy.md) analysis. This PR does **not** relax type privacy; it only relaxes the lint (as proposed by the type privacy RFC) in the case of trait impls.

## Current Behavior
On public trait impls, it's currently an **error** to have a `where` bound constraining a private type with a trait:
```rust
pub trait Trait {}
pub struct Type {}

struct Priv {}
impl Trait for Priv {}

impl Trait for Type
where
    Priv: Trait // ERROR
{}
```

...and it's a **warning** to have have a public type constrained by a private trait:
```rust
pub trait Trait {}
pub struct Type {}

pub struct Pub {}
trait Priv {}
impl Priv for Pub {}

impl Trait for Type
where
    Pub: Priv // WARNING
{}
```

This lint applies to `where` clauses in other contexts, too; e.g. on free functions:
```rust
struct Priv<T>(T);
pub trait Pub {}
impl<T: Pub> Pub for Priv<T> {}

pub fn function<T>()
where
    Priv<T>: Pub // WARNING
{}
```

**These constraints could be relaxed without issue.**

## New Behavior
This lint is relaxed for `where` clauses on trait impls, such that it's okay to have a `where` bound constraining a private type with a trait:
```rust
pub trait Trait {}
pub struct Type {}

struct Priv {}
impl Trait for Priv {}

impl Trait for Type
where
    Priv: Trait // OK
{}
```

...and it's okay to have a public type constrained by a private trait:
```rust
pub trait Trait {}
pub struct Type {}

pub struct Pub {}
trait Priv {}
impl Priv for Pub {}

impl Trait for Type
where
    Pub: Priv // OK
{}
```

## Rationale
While the priv-in-pub lint is not essential for soundness, it *can* help programmers avoid pitfalls that would make their libraries difficult to use by others. For instance, such a lint *is* useful for free functions; e.g. if a downstream crate tries to call the `function` in the previous snippet in a generic context:
```rust
fn callsite<T>()
where
    Priv<T>: Pub // ERROR: omitting this bound is a compile error, but including it is too
{
    function::<T>()
}
```
...it cannot do so without repeating `function`'s `where` bound, which we cannot do because `Priv` is out-of-scope. A lint for this case is arguably helpful.

However, this same reasoning **doesn't** hold for trait impls. To call an unconstrained method on a public trait impl with private bounds, you don't need to forward those private bounds, you can forward the public trait:
```rust
mod upstream {
    pub trait Trait {
        fn method(&self) {}
    }
    pub struct Type<T>(T);

    pub struct Pub<T>(T);
    trait Priv {}
    impl<T: Priv> Priv for Pub<T> {}

    impl<T> Trait for Type<T>
    where
        Pub<T>: Priv // WARNING
    {}
}

mod downstream {
    use super::upstream::*;

    fn function<T>(value: Type<T>)
    where
        Type<T>: Trait // <- no private deets!
    {
        value.method();
    }
}
```

**This PR only eliminates the lint on trait impls.** It leaves it intact for all other contexts, including trait definitions, inherent impls, and function definitions. It doesn't need to exist in those cases either, but I figured I'd first target a case where it's mostly pointless.

## Other Notes
- See discussion [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/relax.20priv-in-pub.20lint.20for.20trait.20impl.20.60where.60.20bounds/near/222458397).
- This PR effectively reverts #79291.

2 years agoAdd myself to .mailmap
Wesley Wiser [Mon, 27 Dec 2021 20:37:12 +0000 (15:37 -0500)]
Add myself to .mailmap

2 years agoVisit patterns' literal expressions before binding new idents
Michael Goulet [Fri, 24 Dec 2021 00:03:30 +0000 (16:03 -0800)]
Visit patterns' literal expressions before binding new idents

2 years agoRemove TyCtxt dependency from UnwindContext
bjorn3 [Mon, 27 Dec 2021 16:54:06 +0000 (17:54 +0100)]
Remove TyCtxt dependency from UnwindContext

2 years agocompiletest: Remove some vestigial code
Eric Huss [Mon, 27 Dec 2021 04:33:10 +0000 (20:33 -0800)]
compiletest: Remove some vestigial code

2 years agofix typo: intialized -> initialized
Hiroshi Kori [Mon, 27 Dec 2021 00:20:38 +0000 (16:20 -0800)]
fix typo: intialized -> initialized

2 years agofix typo: the use f.pad -> then use f.pad
Hiroshi Kori [Mon, 27 Dec 2021 00:03:17 +0000 (16:03 -0800)]
fix typo: the use f.pad -> then use f.pad

2 years agorelax priv-in-pub lint on generic bounds and where clauses in trait impls
Jack Wrenn [Thu, 4 Nov 2021 16:31:18 +0000 (16:31 +0000)]
relax priv-in-pub lint on generic bounds and where clauses in trait impls

2 years agoAdd test cases for issue #26186
PFPoitras [Sun, 26 Dec 2021 20:59:25 +0000 (16:59 -0400)]
Add test cases for issue #26186

2 years agoAdd Attribute::meta_kind
Jakub Beránek [Sun, 26 Dec 2021 15:47:08 +0000 (16:47 +0100)]
Add Attribute::meta_kind

2 years agonew lint: `init-numbered-fields`
Andre Bogus [Sat, 25 Dec 2021 15:52:58 +0000 (16:52 +0100)]
new lint: `init-numbered-fields`

2 years agoAuto merge of #8133 - surechen:fix_8128, r=xFrednet
bors [Sun, 26 Dec 2021 14:05:35 +0000 (14:05 +0000)]
Auto merge of #8133 - surechen:fix_8128, r=xFrednet

Fix 8128

Fixes #8128

changelog: Fix  error suggestion of `skip(..).next()` for immutable variable.

2 years agoFixes #8128
surechen [Fri, 17 Dec 2021 02:03:59 +0000 (10:03 +0800)]
Fixes #8128

changelog: Fix error suggestion of skip(..).next() for immutable variable.

2 years agoRun incremental rustc tests and update broken test list
bjorn3 [Sun, 26 Dec 2021 13:11:09 +0000 (14:11 +0100)]
Run incremental rustc tests and update broken test list

2 years agoTest rustc tests with unstable features disabled
bjorn3 [Sun, 26 Dec 2021 13:10:30 +0000 (14:10 +0100)]
Test rustc tests with unstable features disabled

2 years agoReverts #92135 because perf regression
AngelicosPhosphoros [Sun, 26 Dec 2021 13:02:33 +0000 (16:02 +0300)]
Reverts #92135 because perf regression

2 years agoFix schedule time
bjorn3 [Sun, 26 Dec 2021 10:55:12 +0000 (11:55 +0100)]
Fix schedule time

Run at 01:17 UTC instead of 17:01

2 years agoAuto merge of #92257 - fee1-dead:fix_env_further_bounds, r=oli-obk
bors [Sun, 26 Dec 2021 08:52:31 +0000 (08:52 +0000)]
Auto merge of #92257 - fee1-dead:fix_env_further_bounds, r=oli-obk

normalize env constness for nested obligations

Closes #92230.

2 years agoRemove unneeded call to `collect`
Roc Yu [Sun, 26 Dec 2021 02:35:05 +0000 (21:35 -0500)]
Remove unneeded call to `collect`

2 years agoRemove `String` allocation in loop
Roc Yu [Sun, 26 Dec 2021 00:41:19 +0000 (19:41 -0500)]
Remove `String` allocation in loop

2 years agoAuto merge of #92262 - notriddle:notriddle/unused-hash, r=jyn514
bors [Sat, 25 Dec 2021 19:41:11 +0000 (19:41 +0000)]
Auto merge of #92262 - notriddle:notriddle/unused-hash, r=jyn514

rustdoc: remove unused Hash impl

2 years agoAuto merge of #92227 - Kobzol:rustdoc-doc-hidden, r=jyn514
bors [Sat, 25 Dec 2021 14:47:12 +0000 (14:47 +0000)]
Auto merge of #92227 - Kobzol:rustdoc-doc-hidden, r=jyn514

Rustdoc: use `is_doc_hidden` method on more places

While profiling `rustdoc`, I noticed that finding out if some item is marked with `#[doc(hidden)]` is relatively hot, so I tried to optimize it.

I noticed that there is already a method called `is_doc_hidden` on `TyCtxt`, but it wasn't used much, so I replaced the manual calls to `attrs(...).has_word(...)` with this method. Just by doing that, perf. was improved locally, although I'm not sure if the semantics of the previous calls and this method are the same?

As another step, I tried to querify `is_doc_hidden`, but I didn't include that here until we see the perf. results from the first commit and until I find whether this change is OK at all :)

Can I ask for a perf. run? Thanks.

r? `@jyn514`

2 years agoAdd limitation description for `enum_variant_names`
dswij [Fri, 24 Dec 2021 04:32:12 +0000 (12:32 +0800)]
Add limitation description for `enum_variant_names`

`enum_variant_names` will consider characters with no case to be a part
of prefixes/suffixes substring that are compared. This means `Foo1` and
`Foo2` has different prefixes (`Foo1` and `Foo2` prefix respeectively).
This applies to all non-ascii characters with no casing.

2 years agoSome minor cleanup
dswij [Fri, 24 Dec 2021 04:10:34 +0000 (12:10 +0800)]
Some minor cleanup

2 years agoFix reversed suggestion on postfix
dswij [Thu, 23 Dec 2021 05:55:41 +0000 (13:55 +0800)]
Fix reversed suggestion on postfix

2 years agoUpdate str_utils test
dswij [Thu, 23 Dec 2021 03:32:04 +0000 (11:32 +0800)]
Update str_utils test

2 years agoupdate `enum_variants` test
dswij [Wed, 22 Dec 2021 09:04:48 +0000 (17:04 +0800)]
update `enum_variants` test

2 years agoAdd str_util helpers to split camelcase strings
dswij [Wed, 22 Dec 2021 15:18:24 +0000 (23:18 +0800)]
Add str_util helpers to split camelcase strings

2 years agoFix False Positive on `enum_variants` when prefixes are not camel-case
dswij [Wed, 22 Dec 2021 15:18:11 +0000 (23:18 +0800)]
Fix False Positive on `enum_variants` when prefixes are not camel-case

2 years agoRefactor `enum_variants`
dswij [Wed, 15 Dec 2021 04:08:13 +0000 (12:08 +0800)]
Refactor `enum_variants`

2 years agoAuto merge of #8167 - rust-lang:fix-8166, r=xFredNet
bors [Sat, 25 Dec 2021 13:38:08 +0000 (13:38 +0000)]
Auto merge of #8167 - rust-lang:fix-8166, r=xFredNet

fix an ICE on unwrapping a None

This very likely fixes #8166 though I wasn't able to meaningfully reduce a test case. This line is the only call to `unwrap` within that function, which was the one in the stack trace that triggered the ICE, so I think we'll be OK.

`@hackmad` can you pull and build this branch and check if it indeed fixes your problem?

---

changelog: Fixed ICE in [`unnecessary_cast`]

2 years agofix an ICE on unwrapping a None
Andre Bogus [Sat, 25 Dec 2021 12:11:54 +0000 (13:11 +0100)]
fix an ICE on unwrapping a None

2 years agoAuto merge of #8165 - ebobrow:shadow_reuse_fn, r=xFrednet
bors [Sat, 25 Dec 2021 11:58:25 +0000 (11:58 +0000)]
Auto merge of #8165 - ebobrow:shadow_reuse_fn, r=xFrednet

fix [`shadow_reuse`] false negative for if let bindings

fixes #8087

changelog: trigger [`shadow_reuse`] instead of [`shadow_unrelated`] on shadowed `if let` bindings

2 years agoAuto merge of #92247 - lnicola:rust-analyzer-2021-12-24, r=lnicola
bors [Sat, 25 Dec 2021 02:19:48 +0000 (02:19 +0000)]
Auto merge of #92247 - lnicola:rust-analyzer-2021-12-24, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

2 years agoAuto merge of #92229 - fee1-dead:fix-rustdoc-const-drop, r=dtolnay
bors [Fri, 24 Dec 2021 23:12:14 +0000 (23:12 +0000)]
Auto merge of #92229 - fee1-dead:fix-rustdoc-const-drop, r=dtolnay

Do not display `~const Drop` in rustdoc

Although `T: ~const Drop` is still at an experimental stage, we have already begun inserting these bounds in libstd. This change hides them from rustdoc because 1. `~const` should not be documented in general as it is not yet official syntax; 2. users are not expected to know what `~const Drop` means yet.

2 years agoRemove `maybe_uninit_extra` feature from Vec docs
Shadlock0133 [Fri, 24 Dec 2021 22:04:10 +0000 (23:04 +0100)]
Remove `maybe_uninit_extra` feature from Vec docs

In `Vec`, two doc tests are using `MaybeUninit::write` , stabilized in 1.55. This makes docs' usage of `maybe_uninit_extra` feature unnecessary.

2 years agofix `shadow_reuse` false negative for if let bindings
Elliot Bobrow [Fri, 24 Dec 2021 21:20:40 +0000 (13:20 -0800)]
fix `shadow_reuse` false negative for if let bindings