Commit graph

125144 commits

Author SHA1 Message Date
robojumper
82c816ee02
Fix CHANGELOG's commit range links
Two most recent links linked to the wrong range

changelog: none
2020-08-10 17:45:04 +02:00
bors
08324fe6f7 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
2020-08-10 15:19:46 +00:00
Guillaume Gomez
2a281e0a76 Add test for rustc_const_unstable on methods 2020-08-10 16:57:25 +02:00
Guillaume Gomez
a34bc7961a Add help button 2020-08-10 16:52:19 +02:00
Ivan Tham
8cb1a2f8a2
Use : rather than . in example description
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2020-08-10 22:46:15 +08:00
Ivan Tham
a2d7c33aa8
Split fix into another section for E0749 2020-08-10 22:33:17 +08:00
bors
c576bedc41 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
2020-08-10 13:02:53 +00:00
bors
4c336d4626 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
2020-08-10 13:01:44 +00:00
Philipp Krones
7f6897c7a3
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
2020-08-10 14:56:30 +02:00
Philipp Krones
ee8db50e13
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
2020-08-10 14:56:29 +02:00
Philipp Krones
08ab29bed1
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
2020-08-10 14:56:27 +02:00
Philipp Krones
8ee57eed79
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)
2020-08-10 14:56:26 +02:00
Philipp Krones
9da5b6d1d0
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.
2020-08-10 14:56:25 +02:00
David Wood
20f4e16824
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>
2020-08-10 13:23:19 +01:00
Aaron Hill
4ed0c6a464
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`
2020-08-10 08:08:15 -04:00
Ivan Tham
ec23f4ed3f
Add sample fix for E0749
Even though the description is clear but the solution may not be as straightforward.
Adding a suggested fix.
2020-08-10 18:51:14 +08:00
Bastian Kauschke
66db8e52d7 unused_delims: trim expr 2020-08-10 12:04:51 +02:00
Erin Power
bf4be5de52 Update RELEASES.md for 1.46.0
Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
Co-authored-by: Lonami <totufals@hotmail.com>
2020-08-10 11:48:59 +02:00
Ralf Jung
fd3851aadb add test for unused erroneous const in CTFE 2020-08-10 10:58:53 +02:00
Ralf Jung
26ec7e9dd9 update Miri 2020-08-10 10:06:23 +02:00
kadmin
64f6437822 Convert Eq impl to check Ord::Equal 2020-08-10 05:54:55 +00:00
bors
13290e83a6 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.
2020-08-10 05:34:53 +00:00
bors
568f6195bb 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
2020-08-10 02:08:35 +00:00
Lzu Tao
0210fd3d73 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
* 1d6e424741/contrib/ntp/lib/isc/include/isc/ipv6.h (L63)
* 8b531aa996/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>
2020-08-10 00:50:26 +00:00
Esteban Küber
7e0180906b Small cleanup
Remove unnecessary `unwrap`.
2020-08-09 17:48:32 -07:00
Esteban Küber
9149ec74db 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`".
2020-08-09 17:12:57 -07:00
bors
cee62c17aa Auto merge of #75351 - JohnTitor:rollup-q9udsyx, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #74200 (Std panicking unsafe block in unsafe fn)
 - #75286 (Add additional case for Path starts with)
 - #75318 (Resolve `char` as a primitive even if there is a module in scope)
 - #75320 (Detect likely `for foo of bar` JS syntax)
 - #75328 (Cleanup E0749)
 - #75344 (Rename "Important traits" to "Notable traits")
 - #75348 (Move to intra-doc links in library/core/src/time.rs)
 - #75350 (Do not ICE when lowering invalid extern fn with bodies)

Failed merges:

r? @ghost
2020-08-10 00:09:45 +00:00
Yuki Okushi
5369619693
Rollup merge of #75350 - estebank:foreign-fn-with-body-ice, r=davidtwco
Do not ICE when lowering invalid extern fn with bodies

Fix #75283.
2020-08-10 09:08:03 +09:00
Yuki Okushi
64d71095c3
Rollup merge of #75348 - denisvasilik:intra-doc-links-core-time, r=jyn514
Move to intra-doc links in library/core/src/time.rs

Helps with #75080.
2020-08-10 09:08:01 +09:00
Yuki Okushi
8176240788
Rollup merge of #75344 - camelid:rename-important-to-notable-traits, r=Manishearth
Rename "Important traits" to "Notable traits"

Fixes #75245.

---

* Rename it in the UI
* Rename the CSS classes
2020-08-10 09:07:59 +09:00
Yuki Okushi
f6c41fbed7
Rollup merge of #75328 - GuillaumeGomez:cleanup-e0749, r=Dylan-DPC
Cleanup E0749

r? @pickfire
2020-08-10 09:07:57 +09:00
Yuki Okushi
d8ac403fd1
Rollup merge of #75320 - estebank:js-for-i-of-x, r=davidtwco
Detect likely `for foo of bar` JS syntax

Fix #75311.
2020-08-10 09:07:56 +09:00
Yuki Okushi
968740a3a3
Rollup merge of #75318 - jyn514:primitive, r=manishearth
Resolve `char` as a primitive even if there is a module in scope

Closes https://github.com/rust-lang/rust/issues/58699.
r? @Manishearth
2020-08-10 09:07:54 +09:00
Yuki Okushi
df2da4637f
Rollup merge of #75286 - pickfire:patch-9, r=jyn514
Add additional case for Path starts with

Show what happens if there is an extra extension
2020-08-10 09:07:52 +09:00
Yuki Okushi
62e5488198
Rollup merge of #74200 - poliorcetics:std-panicking-unsafe-block-in-unsafe-fn, r=Mark-Simulacrum
Std panicking unsafe block in unsafe fn

Partial fix of #73904.

This encloses `unsafe` operations in `unsafe fn` in `libstd/ffi/panicking.rs`.

I also made a two lines change to `libstd/thread/local.rs` to add the necessary `unsafe` block without breaking everything else.

@rustbot modify labels: F-unsafe-block-in-unsafe-fn
2020-08-10 09:07:46 +09:00
Esteban Küber
bdf426afe7 Do not ICE when lowering invalid extern fn with bodies
Fix #75283.
2020-08-09 15:14:54 -07:00
bors
f5fef3c715 Auto merge of #75345 - Aaron1011:fix/no-std-hygiene, r=petrochenkov
Remove normalization of `Span` debug output in proc-macro tests

Fixes #74800

The definition of `is_x86_feature_detected!` (and similar macros)
depends on the platform - it is produced by a `cfg_if!` invocation on
x86, and a plain `#[cfg]` on other platforms. Since it is part of the
prelude, we will end up importing different hygiene information
depending on the platform. This previously required us to avoid printing raw
`SyntaxContext` ids in any tests that uses the standard library, since
the captured output will be platform-dependent.

Previously, we replaced all `SyntaxContext` ids with "#CTXT", and the
raw `Span` lo/hi bytes with "LO..HI".

This commit adds `#![no_std]` and `extern crate std` to all proc-macro
tests that print spans. This suppresses the prelude import, while
still using lang items from `std` (which gives us a buildable binary).
With this apporach, we will only load hygiene information for things
which we explicitly import. This lets us re-add
`-Z unpretty=expanded,hygiene`, since its output can now be made stable
across all platforms.

Additionally, we use `-Z span-debug` in more places, which lets us avoid
the "LO..HI" normalization hack.
2020-08-09 22:08:02 +00:00
Denis Vasilik
9e71c13f28
Add link for Duration
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-09 23:26:42 +02:00
Nicholas Nethercote
0a597bd98f Remove CowBoxSymStr.
`CowBoxSymStr` is a type that either holds a `SymbolStr` (which is much
the same as a `Symbol`), or an owned string. When computing skeletons,
a `SymbolStr` is stored if the skeleton is the same as the original
string, otherwise an owned string is stored.

So, basically, `CowBoxSymStr` is a type for string interning. But we
already have one of those: `Symbol` itself. This PR removes
`CowBoxSymStr`, using `Symbol` instead. A good thing about this is that
it avoids storing `SymbolStr` values in `skeleton_map`, something that
is discouraged.

The PR also inlines and removes the `calc_skeleton()` function because
that simplifies the code.
2020-08-10 07:12:59 +10:00
Nicholas Nethercote
75b67c2d5e Fix symbol ordering for confusable idents detection.
Confusable idents detection uses a type `BTreeMap<Symbol, Span>`. This is
highly dubious given that `Symbol` doesn't guarantee a meaningful order. (In
practice, it currently gives an order that mostly matches source code order.)

As a result, changes in `Symbol` representation make the
`lint-confusable-idents.rs` test fail, because this error message:

> identifier pair considered confusable between `s` and `s`

is changed to this:

> identifier pair considered confusable between `s` and `s`

and the corresponding span pointers get swapped erroneously, leading to
an incorrect "previous identifier" label.

This commit sorts the relevant symbols by span before doing the checking,
which ensures that the ident that appears first in the code will be mentioned
first in the message. The commit also extends the test slightly to be more
thorough.
2020-08-10 07:12:59 +10:00
Denis Vasilik
ce244210b1 Remove liNone as it is in the prelude 2020-08-09 23:12:30 +02:00
Denis Vasilik
7dba693f0e Use intra-doc links 2020-08-09 23:06:44 +02:00
Mara Bos
8c705f83db 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.
2020-08-09 23:05:35 +02:00
bors
18f3be7704 Auto merge of #75278 - cuviper:indexmap, r=Mark-Simulacrum
Upgrade indexmap and use it more

First this upgrades `indexmap` to 1.5.1, which is now based on `hashbrown::raw::RawTable`. This means it shares a lot of the same performance characteristics for insert, lookup, etc., while keeping items in insertion order.

Then across various rustc crates, this replaces a lot of `Vec`+`HashMap` pairs with a single `IndexMap` or `IndexSet`.

Closes #60608.
r? @eddyb
2020-08-09 20:08:50 +00:00
Josh Stone
ca0b89aa04 rustc_span: note the perf loss seen from IndexSet in symbol::Interner 2020-08-09 12:41:09 -07:00
Josh Stone
1d03ffe0bc rustc_typeck: use IndexSet in InteriorVisitor 2020-08-09 12:25:22 -07:00
Josh Stone
b258817115 rustc_typeck: use IndexSet in UniquePredicates 2020-08-09 12:25:22 -07:00
Josh Stone
7d1547d300 rustc_span: use IndexSet in SpanInterner 2020-08-09 12:25:22 -07:00
Josh Stone
4efc7e92fa rustc_mir_build: use IndexMap in TestKind::SwitchInt 2020-08-09 12:25:22 -07:00
Josh Stone
c61f1c8bfa rustc_mir: use IndexSet in PlaceholderIndices 2020-08-09 12:25:22 -07:00