Commit Graph

124938 Commits

Author SHA1 Message Date
Yuki Okushi
a75bdfa230
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)
2020-08-11 16:23:52 +09:00
Yuki Okushi
f50f1c79b8
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.
2020-08-11 16:23:50 +09:00
Yuki Okushi
06f296a005
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
2020-08-11 16:23:49 +09:00
Yuki Okushi
c27779f59b
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
2020-08-11 16:23:47 +09:00
Yuki Okushi
f26f201d42
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
* 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
2020-08-11 16:23:45 +09:00
Yuki Okushi
fa853f3df0
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
2020-08-11 16:23:43 +09:00
bors
a9025c571e 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
2020-08-11 04:10:39 +00:00
bors
7189ca604a 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
2020-08-11 01:38:31 +00:00
Dylan DPC
0a738d41b1
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`]
2020-08-11 01:56:47 +02:00
Dylan DPC
d00c70363f
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>`]
2020-08-11 01:56:45 +02:00
Dylan DPC
51ed33d8c2
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
2020-08-11 01:56:43 +02:00
Dylan DPC
dff868e3da
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`
2020-08-11 01:56:41 +02:00
Dylan DPC
9edec571cb
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
2020-08-11 01:56:39 +02:00
Dylan DPC
1e41af3c8c
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
2020-08-11 01:56:38 +02:00
Dylan DPC
2932638d34
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`.
2020-08-11 01:56:36 +02:00
Dylan DPC
992988bbc5
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
2020-08-11 01:56:34 +02:00
Dylan DPC
2ad7c1687f
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
2020-08-11 01:56:32 +02:00
Dylan DPC
63d1e372a6
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
2020-08-11 01:56:30 +02:00
bors
3bb5a863c8 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.
2020-08-10 23:50:39 +00:00
bors
770bd3d1d0 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
2020-08-10 21:47:29 +00:00
Denis Vasilik
eea85814e1 Use intra-doc links 2020-08-10 23:16:01 +02:00
Denis Vasilik
f260462c32 Remove links that are in scope 2020-08-10 23:14:43 +02:00
bors
d495ef527c 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
2020-08-10 19:33:25 +00:00
Esteban Küber
54f1b43130 Add missing primary label 2020-08-10 12:04:10 -07:00
Esteban Küber
6c0755a7dc Point at item definition in foreign crates 2020-08-10 12:04:10 -07:00
Esteban Küber
089810a1cb Do not suggest similarly named enclosing item 2020-08-10 12:04:10 -07:00
Esteban Küber
eef284be59 Tweak ordering of suggestions
Modify logic to make it easier to follow and recover labels that would
otherwise be lost.
2020-08-10 12:04:10 -07:00
Denis Vasilik
d7e7271085 Remove AsRef link as it is in the prelude 2020-08-10 20:29:20 +02:00
bors
1275cc15d6 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.
2020-08-10 17:12:42 +00: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
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
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
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
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