]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoFix minor things in the `f32` primitive docs
Lukas Kalbertodt [Tue, 11 Aug 2020 11:50:54 +0000 (13:50 +0200)]
Fix minor things in the `f32` primitive docs

All of these were review comments in #74621 that I first fixed
in that PR, but later accidentally overwrote by a force push.

4 years agoAdd a function to `TyCtxt` for computing an `Allocation` for a `static` item's initia...
Oliver Scherer [Tue, 11 Aug 2020 09:35:50 +0000 (11:35 +0200)]
Add a function to `TyCtxt` for computing an `Allocation` for a `static` item's initializer

4 years agoSwitch to intra-doc links in library/std/src/os/*/fs.rs
Prabakaran Kumaresshan [Tue, 11 Aug 2020 08:26:07 +0000 (13:56 +0530)]
Switch to intra-doc links in library/std/src/os/*/fs.rs

4 years agoRollup merge of #75360 - pickfire:patch-4, r=GuillaumeGomez
Yuki Okushi [Tue, 11 Aug 2020 07:23:59 +0000 (16:23 +0900)]
Rollup merge of #75360 - pickfire:patch-4, r=GuillaumeGomez

Add sample fix for E0749

Even though the description is clear but the solution may not be as straightforward.
Adding a suggested fix from documentation side.

r? @GuillaumeGomez

However, this suggestion should be shown in rustc itself for easy fix, the documentation should also reflect on the changes in rustc. Currently,
```
error[E0749]: negative impls cannot have any items
 --> test.rs:6:5
  |
6 |     type Foo = i32; // error!
  |     ^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0749`.
```
rustc should tell the user to remove it.

4 years agoRollup merge of #75359 - lcnr:unused-delims-trim, r=oli-obk
Yuki Okushi [Tue, 11 Aug 2020 07:23:57 +0000 (16:23 +0900)]
Rollup merge of #75359 - lcnr:unused-delims-trim, r=oli-obk

unused_delims: trim expr

improves rustfix output.

4 years agoRollup merge of #75353 - estebank:tiny, r=jyn514
Yuki Okushi [Tue, 11 Aug 2020 07:23:56 +0000 (16:23 +0900)]
Rollup merge of #75353 - estebank:tiny, r=jyn514

Tiny cleanup, remove unnecessary `unwrap`

Remove unnecessary `unwrap`.

4 years agoRollup merge of #75352 - estebank:incorrect-tuple-struct-pat, r=oli-obk
Yuki Okushi [Tue, 11 Aug 2020 07:23:54 +0000 (16:23 +0900)]
Rollup merge of #75352 - estebank:incorrect-tuple-struct-pat, r=oli-obk

Tweak conditions for E0026 and E0769

When we have a tuple struct used with struct we don't want to suggest using the (valid) struct syntax with numeric field names. Instead we want to suggest the expected syntax.

Given

```rust
fn main() {
    match MyOption::MySome(42) {
        MyOption::MySome { x: 42 } => (),
        _ => (),
    }
}
```

We now emit E0769 "tuple variant `MyOption::MySome` written as struct variant" instead of E0026 "variant `MyOption::MySome` does not have a field named `x`".

4 years agoRollup merge of #75347 - fusion-engineering-forks:rustdoc-nat-sort, r=GuillaumeGomez
Yuki Okushi [Tue, 11 Aug 2020 07:23:52 +0000 (16:23 +0900)]
Rollup merge of #75347 - fusion-engineering-forks:rustdoc-nat-sort, r=GuillaumeGomez

Rustdoc: Fix natural ordering to look at all numbers.

The old implementation only looks at numbers at the end, but not in other places in a name: `u8` and `u16` got sorted properly, but `u8_bla` and `u16_bla` did not.

![image](https://user-images.githubusercontent.com/783247/89740226-28e8b180-da87-11ea-885d-77a7c8a6ba00.png)

4 years agoRollup merge of #75338 - RalfJung:const-eval-stack-size-check, r=oli-obk
Yuki Okushi [Tue, 11 Aug 2020 07:23:50 +0000 (16:23 +0900)]
Rollup merge of #75338 - RalfJung:const-eval-stack-size-check, r=oli-obk

move stack size check to const_eval machine

This is consistent with how we enforce the step limit. In particular, we do not want this limit checked for Miri-the-tool.

4 years agoRollup merge of #75333 - davidtwco:polymorphization-75260-fixes, r=lcnr
Yuki Okushi [Tue, 11 Aug 2020 07:23:49 +0000 (16:23 +0900)]
Rollup merge of #75333 - davidtwco:polymorphization-75260-fixes, r=lcnr

polymorphize: constrain unevaluated const handling

This PR constrains the support added for handling unevaluated consts in polymorphization (introduced in #75260) by:

- Skipping associated constants as this causes cycle errors.
- Skipping promoted constants when they contain `Self` as this ensures `T` is used in constants of the form `<Self as Foo<T>>`.

Due to an oversight on my part, when landing #75260 and #75255, some tests started failing when polymorphization was enabled that I didn't notice until after landing - this PR fixes the regressions from #75260.

r? @lcnr

4 years agoRollup merge of #75226 - pnadon:miri-undef-uninit, r=RalfJung
Yuki Okushi [Tue, 11 Aug 2020 07:23:47 +0000 (16:23 +0900)]
Rollup merge of #75226 - pnadon:miri-undef-uninit, r=RalfJung

Miri: Renamed "undef" to "uninit"

Renamed remaining references to "undef" to "uninit" when referring to Miri.

Impacted directories are:

- `src/librustc_codegen_llvm/consts.rs`
- `src/librustc_middle/mir/interpret/`
- `src/librustc_middle/ty/print/pretty.rs`
- `src/librustc_mir/`
- `src/tools/clippy/clippy_lints/src/consts.rs`

Upon building Miri based on the new changes it was verified that no changes needed to be made with the Miri project.

Related issue #71193

4 years agoRollup merge of #75085 - lzutao:ip_union, r=cuviper
Yuki Okushi [Tue, 11 Aug 2020 07:23:45 +0000 (16:23 +0900)]
Rollup merge of #75085 - lzutao:ip_union, r=cuviper

Transmute big endian `s6_addr` and `[u16; 8]`

The old code already made the assumption to reinterpret
`Ipv6Addr` as `[u16; 8]`.

Glibc, Linux, FreeBSD, Win32 all makes this assumption.
The main motivation of using union it to better optimize code.
Godbolt: https://rust.godbolt.org/z/b4bGvo
Const is introducing unsafe when transmuting.

ref:
* https://docs.microsoft.com/en-us/windows/win32/api/in6addr/ns-in6addr-in6_addr
* https://github.com/freebsd/freebsd/blob/1d6e4247415d264485ee94b59fdbc12e0c566fd0/contrib/ntp/lib/isc/include/isc/ipv6.h#L63
* https://github.com/zephyrproject-rtos/zephyr/blob/8b531aa996bba254c03129658490af59597acd78/include/net/net_ip.h#L137
* https://sourceware.org/git/?p=glibc.git;a=blob;f=inet/netinet/in.h;h=f6355c7efe5192b88337b136ef687fe9a5ed648c;hb=HEAD#l216

4 years agoRollup merge of #74744 - XAMPPRocky:relnotes-1.46.0, r=Mark-Simulacrum
Yuki Okushi [Tue, 11 Aug 2020 07:23:43 +0000 (16:23 +0900)]
Rollup merge of #74744 - XAMPPRocky:relnotes-1.46.0, r=Mark-Simulacrum

Update RELEASES.md for 1.46.0

### [Rendered](https://github.com/XAMPPRocky/rust/blob/relnotes-1.46.0/RELEASES.md)

r? @Mark-Simulacrum

cc @rust-lang/release

4 years agoAuto merge of #75329 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
bors [Tue, 11 Aug 2020 06:17:02 +0000 (06:17 +0000)]
Auto merge of #75329 - ssomers:btree_cleanup_8, r=Mark-Simulacrum

BTreeMap: better distinguish the root holder from the root node

Renames and intermediate variables

4 years agoAuto merge of #74621 - LukasKalbertodt:float-docs, r=GuillaumeGomez
bors [Tue, 11 Aug 2020 04:10:39 +0000 (04:10 +0000)]
Auto merge of #74621 - LukasKalbertodt:float-docs, r=GuillaumeGomez

Improve `f32` and `f64` primitive documentation

I noticed that the docs for the primitive floats were fairly short. I first only wanted to add the IEEE specification information (compare [the reference](https://doc.rust-lang.org/reference/types/numeric.html)), but then also added some more beginner-friendly docs. Let me know what you think!

Random doc team assign:
r? @rylev

4 years agoAuto merge of #75383 - Dylan-DPC:rollup-6hi36zn, r=Dylan-DPC
bors [Tue, 11 Aug 2020 01:38:31 +0000 (01:38 +0000)]
Auto merge of #75383 - Dylan-DPC:rollup-6hi36zn, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #75098 (Clippy pointer cast lint experiment)
 - #75249 (Only add a border for the rust logo)
 - #75315 (Avoid deleting temporary files on error)
 - #75316 (Don't try to use wasm intrinsics on vectors)
 - #75337 (instance: only polymorphize upvar substs)
 - #75339 (evaluate required_consts when pushing stack frame in Miri engine)
 - #75363 (Use existing `infcx` when emitting trait impl diagnostic)
 - #75366 (Add help button)
 - #75369 (Move to intra-doc links in /library/core/src/borrow.rs)
 - #75379 (Use intra-doc links in /library/core/src/cmp.rs)

Failed merges:

r? @ghost

4 years agoadd Ipv6Addr::to_ipv4_mapped
南浦月 [Mon, 10 Aug 2020 12:20:20 +0000 (20:20 +0800)]
add Ipv6Addr::to_ipv4_mapped

4 years agoRollup merge of #75379 - denisvasilik:intra-docs-links-core-cmp, r=Dylan-DPC
Dylan DPC [Mon, 10 Aug 2020 23:56:47 +0000 (01:56 +0200)]
Rollup merge of #75379 - denisvasilik:intra-docs-links-core-cmp, r=Dylan-DPC

Use intra-doc links in /library/core/src/cmp.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

Known issues:

* Links from `core` to `std` (#74481):
    * [`Vec::sort_by_key`]

4 years agoRollup merge of #75369 - denisvasilik:intra-doc-links-core-borrow, r=Manishearth
Dylan DPC [Mon, 10 Aug 2020 23:56:45 +0000 (01:56 +0200)]
Rollup merge of #75369 - denisvasilik:intra-doc-links-core-borrow, r=Manishearth

Move to intra-doc links in /library/core/src/borrow.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

Known issues:

* Links from `core` to `std` (#74481):
    * [`Box<T>`]
    * [`Mutex<T>`]
    * [`Rc<T>`]
    * [`String`]
    * [`HashMap<K, V>`]

4 years agoRollup merge of #75366 - GuillaumeGomez:help-button, r=jyn514
Dylan DPC [Mon, 10 Aug 2020 23:56:43 +0000 (01:56 +0200)]
Rollup merge of #75366 - GuillaumeGomez:help-button, r=jyn514

Add help button

Part of #75197.

Here is a screenshot of the result:

![Screenshot from 2020-08-10 16-53-20](https://user-images.githubusercontent.com/3050060/89796547-14112a00-db2a-11ea-9f25-57b30ab68f9b.png)

r? @jyn514

4 years agoRollup merge of #75363 - Aaron1011:fix/diag-infcx, r=lcnr
Dylan DPC [Mon, 10 Aug 2020 23:56:41 +0000 (01:56 +0200)]
Rollup merge of #75363 - Aaron1011:fix/diag-infcx, r=lcnr

Use existing `infcx` when emitting trait impl diagnostic

Fixes #75361
Fixes #74918

Previously, we were creating a new `InferCtxt`, which caused an ICE when
used with type variables from the existing `InferCtxt`

4 years agoRollup merge of #75339 - RalfJung:eval-required, r=oli-obk
Dylan DPC [Mon, 10 Aug 2020 23:56:39 +0000 (01:56 +0200)]
Rollup merge of #75339 - RalfJung:eval-required, r=oli-obk

evaluate required_consts when pushing stack frame in Miri engine

[Just like codegen](https://github.com/rust-lang/rust/pull/70820/files#diff-32c57af5c8e23eb048f55d1e955e5cd5R194), Miri needs to make sure all `required_consts` evaluate successfully, to catch post-monomorphization errors.

While at it I also moved the const_eval error reporting logic into rustc_mir::const_eval::error; there is no reason it should be in `rustc_middle`. I kept this in a separate commit for easier reviewing.

Helps with https://github.com/rust-lang/miri/issues/1382. I will add a test on the Miri side (done now: https://github.com/rust-lang/miri/pull/1504).
r? @oli-obk

4 years agoRollup merge of #75337 - davidtwco:polymorphization-75255-fixes, r=eddyb
Dylan DPC [Mon, 10 Aug 2020 23:56:38 +0000 (01:56 +0200)]
Rollup merge of #75337 - davidtwco:polymorphization-75255-fixes, r=eddyb

instance: only polymorphize upvar substs

This PR restricts the substitution polymorphization added in #75255 to only apply to the tupled upvar substitution, rather than all substitutions, fixing a bunch of regressions when polymorphization is
enabled.

Due to an oversight on my part, when landing #75260 and #75255, some tests started failing when polymorphization was enabled that I didn't notice until after landing - this PR fixes the regressions from #75255. #75336 has been filed to make sure that we don't forget to try make this change again in future, as it does enable some optimisations.

r? @lcnr

4 years agoRollup merge of #75316 - alexcrichton:fix-wasm-simd, r=oli-obk
Dylan DPC [Mon, 10 Aug 2020 23:56:36 +0000 (01:56 +0200)]
Rollup merge of #75316 - alexcrichton:fix-wasm-simd, r=oli-obk

Don't try to use wasm intrinsics on vectors

This commit fixes an issue with #74695 where the fptosi and fptoui
specializations on wasm were accidentally used on vector types by the
`simd_cast` intrinsic. This issue showed up as broken CI for the stdsimd
crate. Here this commit simply skips the specialization on vector kinds
flowing into `fpto{s,u}i`.

4 years agoRollup merge of #75315 - Mark-Simulacrum:save-temps, r=ecstatic-morse
Dylan DPC [Mon, 10 Aug 2020 23:56:34 +0000 (01:56 +0200)]
Rollup merge of #75315 - Mark-Simulacrum:save-temps, r=ecstatic-morse

Avoid deleting temporary files on error

Previously if the compiler error'd, fatally, then temporary directories which
should be preserved by -Csave-temps would be deleted due to fatal compiler
errors being implemented as panics.

cc @infinity0

(Hopefully) fixes #75275, but I haven't tested

4 years agoRollup merge of #75249 - GuillaumeGomez:rust-logo-border, r=Manishearth
Dylan DPC [Mon, 10 Aug 2020 23:56:32 +0000 (01:56 +0200)]
Rollup merge of #75249 - GuillaumeGomez:rust-logo-border, r=Manishearth

Only add a border for the rust logo

![Screenshot from 2020-08-07 11-22-51](https://user-images.githubusercontent.com/3050060/89631113-9dadc700-d8a0-11ea-8063-ad40207decaa.png)
![Screenshot from 2020-08-07 11-19-47](https://user-images.githubusercontent.com/3050060/89631114-9e465d80-d8a0-11ea-96ba-1d6926c8e7a9.png)
![Screenshot from 2020-08-07 11-19-41](https://user-images.githubusercontent.com/3050060/89631117-9edef400-d8a0-11ea-9c66-0df3d8c1ac2d.png)

I didn't add a border for the light theme though, as I felt it as unnecessary.

r? @Manishearth

4 years agoRollup merge of #75098 - Ryan1729:clippy-pointer-cast-lint-experiment, r=oli-obk
Dylan DPC [Mon, 10 Aug 2020 23:56:30 +0000 (01:56 +0200)]
Rollup merge of #75098 - Ryan1729:clippy-pointer-cast-lint-experiment, r=oli-obk

Clippy pointer cast lint experiment

This PR is an experiment about exposing more parts of `rustc_typeck` for use in `clippy`. In particular, the code that checks where a cast is valid or not was exposed, which necessitated exposing [`FnCtxt`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html), and figuring out how to create an instance of that type inside `clippy`.

This was prompted by [this clippy issue](https://github.com/rust-lang/rust-clippy/issues/2064).

r? @oli-obk

4 years agoRollup merge of #75098 - Ryan1729:clippy-pointer-cast-lint-experiment, r=oli-obk
Dylan DPC [Mon, 10 Aug 2020 23:56:30 +0000 (01:56 +0200)]
Rollup merge of #75098 - Ryan1729:clippy-pointer-cast-lint-experiment, r=oli-obk

Clippy pointer cast lint experiment

This PR is an experiment about exposing more parts of `rustc_typeck` for use in `clippy`. In particular, the code that checks where a cast is valid or not was exposed, which necessitated exposing [`FnCtxt`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html), and figuring out how to create an instance of that type inside `clippy`.

This was prompted by [this clippy issue](https://github.com/rust-lang/rust-clippy/issues/2064).

r? @oli-obk

4 years agoAuto merge of #74005 - estebank:type-ascription-redux, r=petrochenkov
bors [Mon, 10 Aug 2020 23:50:39 +0000 (23:50 +0000)]
Auto merge of #74005 - estebank:type-ascription-redux, r=petrochenkov

Clean up errors in typeck and resolve

* Tweak ordering of suggestions
* Do not suggest similarly named enclosing item
* Point at item definition in foreign crates
* Add missing primary label

CC #34255.

4 years agoAuto merge of #5888 - matthiaskrgr:lints, r=yaahc
bors [Mon, 10 Aug 2020 22:40:42 +0000 (22:40 +0000)]
Auto merge of #5888 - matthiaskrgr:lints, r=yaahc

make a bunch of lints texts adhere to rustc dev guide

According to the rustc-dev guide: "The text should be matter of fact and avoid capitalization and periods, unless multiple sentences are needed"

changelog: make some lint output adhere to the rustc-dev guide

4 years agoupdate test stderr
Matthias Krüger [Mon, 10 Aug 2020 22:27:55 +0000 (00:27 +0200)]
update test stderr

4 years agoAuto merge of #5889 - ebroto:5886_or_fun_call_const_0_args, r=Manishearth
bors [Mon, 10 Aug 2020 22:12:38 +0000 (22:12 +0000)]
Auto merge of #5889 - ebroto:5886_or_fun_call_const_0_args, r=Manishearth

Avoid or_fun_call for const_fn with no args

Based on #5682 by @lzutao

This avoids a subset of false positives, specifically those related to `const fn`s that take no arguments.
For the rest, a much more involved fix would be needed, see https://github.com/rust-lang/rust-clippy/pull/5682#issuecomment-638681210.

So this does *not* solve #5658

changelog: Avoid triggering [`or_fun_call`] with `const fn`s that take no arguments.

Fixes #5886

4 years agorun cargo dev update-lints
Matthias Krüger [Mon, 10 Aug 2020 21:55:15 +0000 (23:55 +0200)]
run cargo dev update-lints

4 years agoUpdate clippy_lints/src/unwrap.rs
Matthias Krüger [Mon, 10 Aug 2020 21:50:52 +0000 (23:50 +0200)]
Update clippy_lints/src/unwrap.rs

Co-authored-by: Jane Lusby <jlusby42@gmail.com>
4 years agoUpdate clippy_lints/src/neg_cmp_op_on_partial_ord.rs
Matthias Krüger [Mon, 10 Aug 2020 21:50:40 +0000 (23:50 +0200)]
Update clippy_lints/src/neg_cmp_op_on_partial_ord.rs

Co-authored-by: Jane Lusby <jlusby42@gmail.com>
4 years agoneg-cmp-op-on-partial-ord: make lint adhere to lint message convention
Matthias Krüger [Tue, 28 Jul 2020 10:13:22 +0000 (12:13 +0200)]
neg-cmp-op-on-partial-ord: make lint adhere to lint message convention

4 years agoneg-multiply: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 22:24:11 +0000 (00:24 +0200)]
neg-multiply: make lint adhere to lint message convention

4 years agooverflow-check-conditional: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 22:18:34 +0000 (00:18 +0200)]
overflow-check-conditional: make lint adhere to lint message convention

4 years agopath-buf-push-overwrite: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 22:16:28 +0000 (00:16 +0200)]
path-buf-push-overwrite: make lint adhere to lint message convention

4 years agorange-zip-with-len: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 22:12:21 +0000 (00:12 +0200)]
range-zip-with-len: make lint adhere to lint message convention

4 years agoredundant-static-lifetimes: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 21:54:34 +0000 (23:54 +0200)]
redundant-static-lifetimes: make lint adhere to lint message convention

4 years agoalso change "deprecated-attribute" message
Matthias Krüger [Thu, 23 Jul 2020 21:46:52 +0000 (23:46 +0200)]
also change "deprecated-attribute" message

4 years agosuspicious-arithmetic-impl: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 21:45:24 +0000 (23:45 +0200)]
suspicious-arithmetic-impl: make lint adhere to lint message convention

4 years agounknown: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 21:37:16 +0000 (23:37 +0200)]
unknown: make lint adhere to lint message convention

4 years agoref_in_deref: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 21:36:20 +0000 (23:36 +0200)]
ref_in_deref: make lint adhere to lint message convention

4 years agounneeded-field-pattern: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 21:31:33 +0000 (23:31 +0200)]
unneeded-field-pattern: make lint adhere to lint message convention

4 years agoempty-liner-after-outer-attr: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 20:40:50 +0000 (22:40 +0200)]
empty-liner-after-outer-attr: make lint adhere to lint message convention

4 years agodrop_bounds: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 18:05:42 +0000 (20:05 +0200)]
drop_bounds: make lint adhere to lint message convention

4 years agodouble-parens: make lint adhere to lint message convention and do minor refactoring
Matthias Krüger [Thu, 23 Jul 2020 17:56:01 +0000 (19:56 +0200)]
double-parens: make lint adhere to lint message convention and do minor refactoring

4 years agodouble-comparisons: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 17:50:28 +0000 (19:50 +0200)]
double-comparisons: make lint adhere to lint message convention

4 years agodefault-trait-access: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 17:39:35 +0000 (19:39 +0200)]
default-trait-access: make lint adhere to lint message convention

4 years agocmp_null: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 17:21:31 +0000 (19:21 +0200)]
cmp_null: make lint adhere to lint message convention

4 years agounnecessary_unwrap, panicking_unwrap: make lints adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 15:06:29 +0000 (17:06 +0200)]
unnecessary_unwrap, panicking_unwrap: make lints adhere to lint message convention

4 years agochecked-conversions: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 14:58:20 +0000 (16:58 +0200)]
checked-conversions: make lint adhere to lint message convention

4 years agoAuto merge of #75349 - nnethercote:tweak-confusable-idents-checking, r=petrochenkov
bors [Mon, 10 Aug 2020 21:47:29 +0000 (21:47 +0000)]
Auto merge of #75349 - nnethercote:tweak-confusable-idents-checking, r=petrochenkov

Tweak confusable idents checking

The confusable idents checking does some sub-optimal things with symbols.

r? @petrochenkov
cc @crlf0710

4 years agoAvoid or_fun_call for const_fn with no args
Eduardo Broto [Mon, 10 Aug 2020 21:38:58 +0000 (23:38 +0200)]
Avoid or_fun_call for const_fn with no args

4 years agoUse intra-doc links
Denis Vasilik [Mon, 10 Aug 2020 21:16:01 +0000 (23:16 +0200)]
Use intra-doc links

4 years agoRemove links that are in scope
Denis Vasilik [Mon, 10 Aug 2020 21:14:43 +0000 (23:14 +0200)]
Remove links that are in scope

4 years agoFeature gate is always present
Mark Rousskov [Sun, 19 Jul 2020 22:20:01 +0000 (18:20 -0400)]
Feature gate is always present

4 years agoIntroduce `rustc_lexer::is_ident` and use it in couple of places
Vadim Petrochenkov [Mon, 10 Aug 2020 19:27:48 +0000 (22:27 +0300)]
Introduce `rustc_lexer::is_ident` and use it in couple of places

4 years agoAuto merge of #75127 - jyn514:impl-trait, r=pnkfelix
bors [Mon, 10 Aug 2020 19:33:25 +0000 (19:33 +0000)]
Auto merge of #75127 - jyn514:impl-trait, r=pnkfelix

Fix async-std by special-casing rustdoc in typeck

https://github.com/rust-lang/rust/issues/75100

4 years agoMove to doc links inside the prelude
Alexis Bourget [Mon, 10 Aug 2020 17:48:04 +0000 (19:48 +0200)]
Move to doc links inside the prelude

4 years agoAdd missing primary label
Esteban Küber [Mon, 10 Aug 2020 04:24:05 +0000 (21:24 -0700)]
Add missing primary label

4 years agoPoint at item definition in foreign crates
Esteban Küber [Mon, 10 Aug 2020 04:14:59 +0000 (21:14 -0700)]
Point at item definition in foreign crates

4 years agoDo not suggest similarly named enclosing item
Esteban Küber [Mon, 10 Aug 2020 04:02:58 +0000 (21:02 -0700)]
Do not suggest similarly named enclosing item

4 years agoTweak ordering of suggestions
Esteban Küber [Mon, 10 Aug 2020 03:29:39 +0000 (20:29 -0700)]
Tweak ordering of suggestions

Modify logic to make it easier to follow and recover labels that would
otherwise be lost.

4 years agoMove to doc links inside std/time.rs
Alexis Bourget [Mon, 10 Aug 2020 19:01:58 +0000 (21:01 +0200)]
Move to doc links inside std/time.rs

4 years agonaive_bytecount: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 13:18:13 +0000 (15:18 +0200)]
naive_bytecount: make lint adhere to lint message convention

4 years agobuiltin-type-shadow: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 13:16:10 +0000 (15:16 +0200)]
builtin-type-shadow: make lint adhere to lint message convention

4 years agobool-comparison: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 13:14:12 +0000 (15:14 +0200)]
bool-comparison: make lint adhere to lint message convention

4 years agotoo-many-lines: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 13:06:33 +0000 (15:06 +0200)]
too-many-lines: make lint adhere to lint message convention

4 years agoDetect JS-style `===` and `!==` and recover
Esteban Küber [Sun, 9 Aug 2020 04:17:15 +0000 (21:17 -0700)]
Detect JS-style `===` and `!==` and recover

Fix #75312.

4 years agoRemove AsRef link as it is in the prelude
Denis Vasilik [Mon, 10 Aug 2020 18:29:20 +0000 (20:29 +0200)]
Remove AsRef link as it is in the prelude

4 years agoAuto merge of #5887 - robojumper:patch-1, r=flip1995
bors [Mon, 10 Aug 2020 17:51:37 +0000 (17:51 +0000)]
Auto merge of #5887 - robojumper:patch-1, r=flip1995

Fix CHANGELOG's commit range links

Two most recent links linked to the wrong range

changelog: none

4 years agoAuto merge of #74936 - GuillaumeGomez:const-rustc_const_unstable, r=jyn514
bors [Mon, 10 Aug 2020 17:12:42 +0000 (17:12 +0000)]
Auto merge of #74936 - GuillaumeGomez:const-rustc_const_unstable, r=jyn514

Don't print "const" keyword on non-nightly build if rustc_const_unstable is used on the item

Fixes #74579.

4 years agoRemove empty fn main from E0749
Ivan Tham [Mon, 10 Aug 2020 17:06:30 +0000 (01:06 +0800)]
Remove empty fn main from E0749

4 years agoFix CHANGELOG's commit range links
robojumper [Mon, 10 Aug 2020 15:45:04 +0000 (17:45 +0200)]
Fix CHANGELOG's commit range links

Two most recent links linked to the wrong range

changelog: none

4 years agoAuto merge of #74953 - JulianKnodt:master, r=lcnr
bors [Mon, 10 Aug 2020 15:19:46 +0000 (15:19 +0000)]
Auto merge of #74953 - JulianKnodt:master, r=lcnr

Remove restriction on type parameters preceding consts w/ feature const-generics

Removed the restriction on type parameters preceding const parameters when the feature const-generics is enabled.

Builds on #74676, which deals with unsorted generic parameters. This just lifts the check in lowering the AST to HIR that permits consts and types to be reordered with respect to each other. Lifetimes still must precede both

This change is not intended for min-const-generics, and is gated behind the `#![feature(const_generics)]`.

One thing is that it also permits type parameters without a default to come after consts, which I expected to not work, and was hoping to get more guidance on whether that should be permitted or how to prevent it otherwise.

I did not go through the RFC process for this pull request because there was prior work to get this feature added. In the previous PR that was cited, work was done to enable this change.

r? @lcnr

4 years agoAdd test for rustc_const_unstable on methods
Guillaume Gomez [Tue, 4 Aug 2020 09:57:28 +0000 (11:57 +0200)]
Add test for rustc_const_unstable on methods

4 years agoAdd help button
Guillaume Gomez [Mon, 10 Aug 2020 14:42:11 +0000 (16:42 +0200)]
Add help button

4 years agoUse : rather than . in example description
Ivan Tham [Mon, 10 Aug 2020 14:46:15 +0000 (22:46 +0800)]
Use : rather than . in example description

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
4 years agoSplit fix into another section for E0749
Ivan Tham [Mon, 10 Aug 2020 14:33:17 +0000 (22:33 +0800)]
Split fix into another section for E0749

4 years agoAuto merge of #5883 - flip1995:rollup-x9mftxe, r=flip1995
bors [Mon, 10 Aug 2020 13:02:53 +0000 (13:02 +0000)]
Auto merge of #5883 - flip1995:rollup-x9mftxe, r=flip1995

Rollup of 5 pull requests

Successful merges:

 - #5825 (Add the new lint `same_item_push`)
 - #5869 (New lint against `Self` as an arbitrary self type)
 - #5870 (enable #[allow(clippy::unsafe_derive_deserialize)])
 - #5871 (Lint .min(x).max(y) with x < y)
 - #5874 (Make the docs clearer for new contributors)

Failed merges:

r? @ghost

changelog: rollup

4 years agoAuto merge of #75357 - RalfJung:miri, r=RalfJung
bors [Mon, 10 Aug 2020 13:01:44 +0000 (13:01 +0000)]
Auto merge of #75357 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/75274
Cc @rust-lang/miri r? @ghost

4 years agoRollup merge of #5874 - camelid:patch-1, r=flip1995
Philipp Krones [Mon, 10 Aug 2020 12:56:30 +0000 (14:56 +0200)]
Rollup merge of #5874 - camelid:patch-1, r=flip1995

Make the docs clearer for new contributors

It confused me before, so I made it extra obvious that you need to run
a script to set up your toolchain before you can build Clippy.

I also added a note so that new contributors aren't confused when
Clippy doesn't build as a result of a change in rustc's internals.

changelog: make `CONTRIBUTING.md` clearer for new contributors

4 years agoRollup merge of #5871 - wiomoc:feature/methodcall-minmax, r=flip1995
Philipp Krones [Mon, 10 Aug 2020 12:56:29 +0000 (14:56 +0200)]
Rollup merge of #5871 - wiomoc:feature/methodcall-minmax, r=flip1995

Lint .min(x).max(y) with x < y

Fixes  #5854

changelog: Also lint `ord.min(a).max(b)`, where `a < b` in [`min_max`] lint

4 years agoRollup merge of #5870 - ebroto:5789_allow_unsafe_derive_deserialize, r=flip1995
Philipp Krones [Mon, 10 Aug 2020 12:56:27 +0000 (14:56 +0200)]
Rollup merge of #5870 - ebroto:5789_allow_unsafe_derive_deserialize, r=flip1995

enable #[allow(clippy::unsafe_derive_deserialize)]

Before this change this lint could not be allowed as the code we are checking is automatically generated.

changelog: Enable using the `allow` attribute on top of an ADT linted by [`unsafe_derive_deserialize`].

Fixes: #5789
4 years agoRollup merge of #5869 - wiomoc:feature/implicit-self, r=ebroto,flip1995
Philipp Krones [Mon, 10 Aug 2020 12:56:26 +0000 (14:56 +0200)]
Rollup merge of #5869 - wiomoc:feature/implicit-self, r=ebroto,flip1995

New lint against `Self` as an arbitrary self type

Fixes #5861

changelog: * [`needless_arbitrary_self_type`] [#5869](https://github.com/rust-lang/rust-clippy/pull/5869)

4 years agoRollup merge of #5825 - giraffate:same_item_push, r=Manishearth
Philipp Krones [Mon, 10 Aug 2020 12:56:25 +0000 (14:56 +0200)]
Rollup merge of #5825 - giraffate:same_item_push, r=Manishearth

Add the new lint `same_item_push`

changelog: Add the new lint `same_item_push`

Fixed #4078. As I said in https://github.com/rust-lang/rust-clippy/issues/4078#issuecomment-658184195, I referrerd to https://github.com/rust-lang/rust-clippy/pull/4647.

4 years agopolymorphize: constrain unevaluated const handling
David Wood [Sun, 9 Aug 2020 10:22:50 +0000 (11:22 +0100)]
polymorphize: constrain unevaluated const handling

This commit constrains the support added for handling unevaluated consts
in polymorphization (introduced in #75260) by:

- Skipping associated constants as this causes cycle errors.
- Skipping promoted constants when they contain `Self` as this ensures
  `T` is used in constants of the form `<Self as Foo<T>>`.

Signed-off-by: David Wood <david@davidtw.co>
4 years agoUse existing `infcx` when emitting trait impl diagnostic
Aaron Hill [Mon, 10 Aug 2020 12:05:43 +0000 (08:05 -0400)]
Use existing `infcx` when emitting trait impl diagnostic

Fixes #75361
Fixes #74918

Previously, we were creating a new `InferCtxt`, which caused an ICE when
used with type variables from the existing `InferCtxt`

4 years agoAdd sample fix for E0749
Ivan Tham [Mon, 10 Aug 2020 10:51:14 +0000 (18:51 +0800)]
Add sample fix for E0749

Even though the description is clear but the solution may not be as straightforward.
Adding a suggested fix.

4 years agounused_delims: trim expr
Bastian Kauschke [Mon, 10 Aug 2020 10:04:51 +0000 (12:04 +0200)]
unused_delims: trim expr

4 years agoUpdate RELEASES.md for 1.46.0
Erin Power [Sat, 25 Jul 2020 14:36:17 +0000 (16:36 +0200)]
Update RELEASES.md for 1.46.0

Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
Co-authored-by: Lonami <totufals@hotmail.com>
4 years agoadd test for unused erroneous const in CTFE
Ralf Jung [Mon, 10 Aug 2020 08:58:53 +0000 (10:58 +0200)]
add test for unused erroneous const in CTFE

4 years agoupdate Miri
Ralf Jung [Mon, 10 Aug 2020 08:06:23 +0000 (10:06 +0200)]
update Miri

4 years agoConvert `Eq` impl to check Ord::Equal
kadmin [Sun, 9 Aug 2020 07:50:56 +0000 (07:50 +0000)]
Convert `Eq` impl to check Ord::Equal

4 years agoAuto merge of #75204 - cuviper:freebsd11, r=Mark-Simulacrum
bors [Mon, 10 Aug 2020 05:34:53 +0000 (05:34 +0000)]
Auto merge of #75204 - cuviper:freebsd11, r=Mark-Simulacrum

Upgrade the FreeBSD toolchain to version 11.4

FreeBSD 10 reached its end-of-life in October 2018, and that toolchain
caused issues in the LLVM 11 upgrade (#73526) that are resolved with the
toolchain from FreeBSD 11.

Closes #72390.

4 years agoAuto merge of #74410 - mati865:mingw-no-self-contained-when-cross-compiling, r=petroc...
bors [Mon, 10 Aug 2020 02:08:35 +0000 (02:08 +0000)]
Auto merge of #74410 - mati865:mingw-no-self-contained-when-cross-compiling, r=petrochenkov

MinGW: disable self-contained mode when cross compiling

When cross compiling users have to provide own linker and libraries anyway.
Using rust provided MinGW crt objects is harmful here and has no benefits.

cc https://github.com/rust-lang/rust/issues/68887

4 years agoTransmute between big endian `s6_addr` and `[u16; 8]`.
Lzu Tao [Wed, 5 Aug 2020 10:29:38 +0000 (10:29 +0000)]
Transmute between big endian `s6_addr` and `[u16; 8]`.

The old code already made the assumption to reinterpret
`Ipv6Addr` as `[u16; 8]`.

Glibc, Linux, FreeBSD, Win32 all makes this assumption.
The main motivation of using union it to better optimize code.

ref:
* https://docs.microsoft.com/en-us/windows/win32/api/in6addr/ns-in6addr-in6_addr
* https://github.com/freebsd/freebsd/blob/1d6e4247415d264485ee94b59fdbc12e0c566fd0/contrib/ntp/lib/isc/include/isc/ipv6.h#L63
* https://github.com/zephyrproject-rtos/zephyr/blob/8b531aa996bba254c03129658490af59597acd78/include/net/net_ip.h#L137
* https://sourceware.org/git/?p=glibc.git;a=blob;f=inet/netinet/in.h;h=f6355c7efe5192b88337b136ef687fe9a5ed648c;hb=HEAD#l216

Co-authored-by: Josh Stone <cuviper@gmail.com>
Co-authored-by: Peter Atashian <retep998@gmail.com>