Commit Graph

107592 Commits

Author SHA1 Message Date
Dylan DPC
f548a387a4
Rollup merge of #69544 - lqd:unrevert-67174, r=Mark-Simulacrum
Unrevert "Remove `checked_add` in `Layout::repeat`"

This reapplies @kraai's original `libcore::alloc::Layout::repeat` change from #67174 which was temporarily reverted in #69241. Now that the proper LLVM fix has been cherry-picked, we can unrevert the revert.

This change was originally reviewed by @hanna-kruppe on the initial PR.

cc @RalfJung
2020-03-02 13:42:37 +01:00
Dylan DPC
ffb6d75314
Rollup merge of #68682 - LeSeulArtichaut:stable-intrinsics, r=steveklabnik
Add documentation to compiler intrinsics

This adds documentation to the compiler intrinsics having stable standard implementations.

Relates to #34338 (cc @bstrie)

r? @steveklabnik (for reassignment?)
2020-03-02 13:42:35 +01:00
bors
6af4fd385e Auto merge of #69469 - matthewjasper:type-flags, r=cramertj
Clean up TypeFlags

* Add a new method `has_infer_types_or_consts` that's used instead of `has_infer_types` most of the time, since there's generally no reason to only consider types.
*  Remove `has_closure_types`/`HAS_TY_CLOSURE`, because closures are no longer implicitly linked to the `InferCtxt`.
* Reorder flags to group similar ones together
* Make some flags more granular
* Compute `HAS_FREE_LOCAL_NAMES` from the other flags
* Add some more doc comments
2020-03-02 06:30:52 +00:00
bors
e86c9e6ef8 Auto merge of #69442 - jakevossen5:master, r=Mark-Simulacrum
`--explain` disambiguates no long description and invalid error codes

Closes #44710

First code contribution here, so feedback is very much appreciated!

cc @zackmdavis
cc @Mark-Simulacrum
2020-03-02 03:16:22 +00:00
bors
9dc8dad14f Auto merge of #69432 - petrochenkov:alldeps, r=eddyb
rustc_metadata: Load metadata for indirect macro-only dependencies

Imagine this dependency chain between crates
```
Executable crate -> Library crate -> Macro crate
```
where "Library crate" uses the macros from "Macro crate" for some code generation, but doesn't reexport them any further.

Currently, when compiling "Executable crate" we don't even load metadata for it, because why would we want to load any metadata from "Macro crate" if it already did all its code generation job when compiling "Library crate".
Right?

Wrong!
Hygiene data and spans (https://github.com/rust-lang/rust/issues/68686, https://github.com/rust-lang/rust/pull/68941) from "Macro crate" still may need to be decoded from "Executable crate".
So we'll have to load them properly.

Questions:
- How this will affect compile times for larger crate trees in practice? How to measure it?
Hygiene/span encoding/decoding will necessarily slow down compilation because right now we just don't do some work that we should do, but this introduces a whole new way to slow down things. E.g. loading metadata for `syn` (and its dependencies) when compiling your executable if one of its library dependencies uses it.
- We are currently detecting whether a crate reexports macros from "Macro crate" or not, could we similarly detect whether a crate "reexports spans" and keep it unloaded if it doesn't?
Or at least "reexports important spans" affecting hygiene, we can probably lose spans that only affect diagnostics.
2020-03-02 00:07:06 +00:00
Matthew Jasper
1617ec4ad2 Clean up TypeFlags
* Reorder flags to group similar ones together
* Make some flags more granular
* Compute `HAS_FREE_LOCAL_NAMES` from the other flags
* Remove `HAS_TY_CLOSURE`
* Add some more doc comments
2020-03-01 21:42:34 +00:00
Matthew Jasper
ebc86b441d Fix use of has_infer_types
* Add a new method `has_infer_types_or_consts` that's used instead most
  of the time, since there's generally no reason to only consider types.
*  Remove use of `has_closure_types`, because closures are no longer
  implicitly linked to the `InferCtxt`.
2020-03-01 21:42:34 +00:00
bors
1cf090e8d1 Auto merge of #69408 - RalfJung:canonical-alloc-id, r=oli-obk
Miri: let machine canonicalize AllocIDs

This implements the rustc side of the plan I laid out [here](https://github.com/rust-lang/miri/pull/1147#issuecomment-581868901).

Miri PR: https://github.com/rust-lang/miri/pull/1190
2020-03-01 20:53:04 +00:00
bors
beac68a887 Auto merge of #69612 - Dylan-DPC:rollup-f180gcc, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #69504 (Use assert_ne in hash tests)
 - #69554 (Cleanup e0374)
 - #69568 (Clarify explanation of Vec<T> 'fn resize')
 - #69569 (simplify boolean expressions)
 - #69577 (Clean up E0375 explanation)
 - #69598 (rustdoc: HTML escape crate version)
 - #69607 (Clean up E0376 explanation)

Failed merges:

r? @ghost
2020-03-01 17:39:05 +00:00
Dylan DPC
d3a5a5d20b
Rollup merge of #69607 - GuillaumeGomez:cleanup-e0376, r=Dylan-DPC
Clean up E0376 explanation

r? @Dylan-DPC
2020-03-01 17:23:36 +01:00
Dylan DPC
22a03913f4
Rollup merge of #69598 - ollie27:rustdoc_crate-version_escape, r=GuillaumeGomez
rustdoc: HTML escape crate version

As `--crate-version` accepts arbitrary strings they need to be escaped.

r? @GuillaumeGomez
2020-03-01 17:23:34 +01:00
Dylan DPC
8ffbf9033b
Rollup merge of #69577 - GuillaumeGomez:cleanup-e0375, r=Dylan-DPC
Clean up E0375 explanation

r? @Dylan-DPC
2020-03-01 17:23:32 +01:00
Dylan DPC
87284d7e79
Rollup merge of #69569 - matthiaskrgr:nonminimal_bool, r=mark-Simulacrum
simplify boolean expressions
2020-03-01 17:23:30 +01:00
Dylan DPC
55d0a8b201
Rollup merge of #69568 - JOE1994:patch-2, r=Dylan-DPC
Clarify explanation of Vec<T> 'fn resize'

1. Clarified on what should implement `Clone` trait.
2. Minor grammar fix:
to be able clone => to be able **to** clone
2020-03-01 17:23:29 +01:00
Dylan DPC
6fc73bc10a
Rollup merge of #69554 - GuillaumeGomez:cleanup-e0374, r=Dylan-DPC
Cleanup e0374

r? @Dylan-DPC
2020-03-01 17:23:27 +01:00
Dylan DPC
e9e1ab1058
Rollup merge of #69504 - MichaelMcDonnell:hash_assert_ne, r=LukasKalbertodt
Use assert_ne in hash tests

The hash tests were written before the assert_ne macro was added to the standard library. The assert_ne macro provides better output in case of a failure.
2020-03-01 17:23:26 +01:00
Michael Mc Donnell
87327eb72a Remove assert that had been replaced by assert_ne 2020-03-01 08:04:18 -08:00
bors
360e42de82 Auto merge of #69380 - Zoxc:parent-module, r=michaelwoerister
Use a query to get parent modules

Split out from https://github.com/rust-lang/rust/pull/69015 / https://github.com/rust-lang/rust/pull/68944.

r? @michaelwoerister
2020-03-01 14:21:03 +00:00
Guillaume Gomez
dd142b1dc4 Clean up E0376 explanation 2020-03-01 12:03:38 +01:00
bors
6b2983af1a Auto merge of #69606 - JohnTitor:rollup-i3nrrcf, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #69397 (bootstrap: Remove commit hash from LLVM version suffix to avoid rebuilds)
 - #69549 (Improve MinGW detection when cross compiling )
 - #69562 (Don't `bug` when taking discriminant of generator during dataflow)
 - #69579 (parser: Remove `Parser::prev_span`)
 - #69580 (use .copied() instead of .map(|x| *x) on iterators)
 - #69583 (Do not ICE on invalid type node after parse recovery)
 - #69605 (Use `opt_def_id()` over `def_id()`)

Failed merges:

r? @ghost
2020-03-01 11:03:16 +00:00
Yuki Okushi
47d87d7ca5
Rollup merge of #69605 - JohnTitor:opt-def-id, r=petrochenkov
Use `opt_def_id()` over `def_id()`

Fixes #69588
2020-03-01 19:28:15 +09:00
Yuki Okushi
9801696214
Rollup merge of #69583 - LeSeulArtichaut:ice-69378, r=Centril
Do not ICE on invalid type node after parse recovery

Closes #69378.
r? @estebank
2020-03-01 19:28:13 +09:00
Yuki Okushi
680a0e1dd5
Rollup merge of #69580 - matthiaskrgr:map_clone, r=Centril
use .copied() instead of .map(|x| *x) on iterators
2020-03-01 19:28:12 +09:00
Yuki Okushi
4439bb09aa
Rollup merge of #69579 - petrochenkov:noprevspan, r=Centril
parser: Remove `Parser::prev_span`

Follow-up to https://github.com/rust-lang/rust/pull/69384.
r? @Centril
2020-03-01 19:28:10 +09:00
Yuki Okushi
48ec25224b
Rollup merge of #69562 - ecstatic-morse:dataflow-generator-discriminant, r=oli-obk
Don't `bug` when taking discriminant of generator during dataflow

The proper fix for rust-lang/rust-clippy#5239. `Rvalue::Discriminant` is used on generators as well as `enum`s. This didn't cause a test failure in `rustc` since we don't need to do any dataflow passes until after the generator transform that adds the `Rvalue::Discriminant`.

This required a small refactoring. `diff -w` is beneficial.

r? @oli-obk
cc @JohnTitor
2020-03-01 19:28:09 +09:00
Yuki Okushi
559e5ab7ad
Rollup merge of #69549 - mati865:mingw, r=kennytm
Improve MinGW detection when cross compiling

Official mingw-w64 builds, MSYS2 and LLVM MinGW provide both `gcc.exe` and `$ARCH-w64-mingw32-gcc.exe` so they should not regress but I included CI changes to verify it though `@bors try` (I don't have permission).

This change will come handy when cross compiling from Linux or Cygwin since they use `gcc` as native compiler and `$ARCH-w64-mingw32-gcc.exe` for MinGW. This means users will no longer have to override the linker.
2020-03-01 19:28:07 +09:00
Yuki Okushi
1e258784e1
Rollup merge of #69397 - tmiasko:llvm-version-suffix, r=nagisa
bootstrap: Remove commit hash from LLVM version suffix to avoid rebuilds

The custom LLVM version suffix was introduced to avoid unintentional
library names conflicts. By default it included the LLVM submodule
commit hash. Changing the version suffix requires the complete LLVM
rebuild, and since then every change to the submodules required it as
well.

Remove the commit hash from version suffix to avoid complete rebuilds,
while leaving the `rust` string, the release number and release channel
to disambiguate the library name.

Context: version suffix was introduced by #59173 as solution to #59034.

Resolves #68715.
2020-03-01 19:28:05 +09:00
bors
ee50590803 Auto merge of #69295 - ecstatic-morse:unified-dataflow-generators, r=tmandry
Use new dataflow framework for generators

#65672 introduced a new dataflow framework that can handle arbitrarily complex transfer functions as well as ones expressed as a series of gen/kill operations. This PR ports the analyses used to implement generators to the new framework so that we can remove the old one. See #68241 for a prior example of this. The new framework has some superficial API changes, but this shouldn't alter the generator passes in any way.

r? @tmandry
2020-03-01 07:53:13 +00:00
Yuki Okushi
f9c8c49c0b Use opt_def_id() over def_id() 2020-03-01 15:15:29 +09:00
bors
d9051341a1 Auto merge of #68943 - ecstatic-morse:no-useless-drop-on-enum-variants, r=matthewjasper
Skip `Drop` terminators for enum variants without drop glue

Split out from #68528.

When doing drop elaboration for an `enum` that may or may not be moved out of (an open drop), we check the discriminant of the `enum` to see whether the live variant has any drop flags and then check the drop flags to see whether we need to drop each field. Sometimes, however, the live
variant has no move paths and thus no drop flags. In this case, we still emit a drop terminator
for the entire enum after checking the enum discriminant. This drop shim will check the discriminant of the enum *again* and then drop the fields of the active variant. If the active variant has no drop glue, nothing will be done.

This commit skips emitting the drop terminator during drop elaboration when the "otherwise" variants, those without move paths, have no drop glue. A common example of this scenario is when an `Option` is moved from, since `Option::None` never needs drop glue. Below is a fragment the pre-codegen CFG for `Option::unwrap_or` in which we check the drop flag (`_5`) for `self` (`_1`), before and after the change.

Before:

![image](https://user-images.githubusercontent.com/29463364/74078927-52942380-49e5-11ea-8e34-4b9d6d94ef25.png)

After:

![image](https://user-images.githubusercontent.com/29463364/74078945-78b9c380-49e5-11ea-8302-b043c4a7515a.png)

This change doesn't do much on its own, but it is a prerequisite to get the perf gains from #68528.

cc @arielb1
2020-03-01 04:42:21 +00:00
bors
2917d99302 Auto merge of #69592 - petrochenkov:nosyntax, r=Centril
Rename `libsyntax` to `librustc_ast`

This was the last rustc crate that wasn't following the `rustc_*` naming convention.

Follow-up to https://github.com/rust-lang/rust/pull/67763.
2020-03-01 01:36:58 +00:00
Oliver Middleton
3c97f8ad12 rustdoc: HTML escape crate version
As `--crate-version` accepts arbitrary strings they need to be escaped.
2020-03-01 00:15:44 +00:00
bors
d3c79346a3 Auto merge of #69590 - Dylan-DPC:rollup-i3z0sic, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #69504 (Use assert_ne in hash tests)
 - #69571 (remove unneeded .as_ref() calls.)
 - #69572 (use .iter() instead of .into_iter() on references)
 - #69581 (fix aliasing violation in align_to_mut)
 - #69582 (improve transmute and Vec::from_raw_parts docs)
 - #69584 (Correct comment to match behavior)
 - #69587 (rustc_parse: Tweak the function parameter name check)

Failed merges:

r? @ghost
2020-02-29 20:23:10 +00:00
Vadim Petrochenkov
e08c279eac Rename syntax to rustc_ast in source code 2020-02-29 21:59:09 +03:00
Jake Vossen
5f3ffee6b7
added try_find_description to distinguish no desc from invalid code 2020-02-29 11:53:51 -07:00
Dylan DPC
ad200af5c4
Rollup merge of #69587 - petrochenkov:reqname, r=Centril
rustc_parse: Tweak the function parameter name check

The function doesn't need a full token, only its edition.

Noticed while implementing https://github.com/rust-lang/rust/pull/69384.
I'm still not sure whether normalized or unnormalized token is a better fit for the edition check here, so  https://github.com/rust-lang/rust/pull/69384 and this PR just keep the status quo behavior.
r? @Centril
2020-02-29 18:54:07 +01:00
Dylan DPC
cf48ca6170
Rollup merge of #69584 - zantysor:fix-saturating-duration-since-comment, r=varkor
Correct comment to match behavior

Corrects the header comment on `saturating_duration_since` to match the behavior of returning 0 if the other timestamp is _later_ than the invocant, not earlier,

This is purely a documentation change, so hopefully it doesn't require an issue; if it does, I'll open one and resubmit.
2020-02-29 18:54:05 +01:00
Dylan DPC
015bb74650
Rollup merge of #69582 - RalfJung:vec-parts, r=Centril
improve transmute and Vec::from_raw_parts docs

I think this fixes https://github.com/rust-lang/rust/issues/64073. @Shnatsel please let me know if this is less confusing. :)
2020-02-29 18:54:04 +01:00
Dylan DPC
02381db8e0
Rollup merge of #69581 - RalfJung:align_to_mut, r=Centril
fix aliasing violation in align_to_mut

Fixes https://github.com/rust-lang/rust/issues/68549

I decided to add the testcase here to make it all one PR, but if you prefer I can also add that test case in the Miri repo instead.
2020-02-29 18:54:02 +01:00
Dylan DPC
7d43997053
Rollup merge of #69572 - matthiaskrgr:try_err_and_iter_on_ref, r=Centril
use .iter() instead of .into_iter() on references
2020-02-29 18:54:01 +01:00
Dylan DPC
b22631bfaf
Rollup merge of #69571 - matthiaskrgr:useless_asref, r=Centril
remove unneeded .as_ref() calls.
2020-02-29 18:53:59 +01:00
Vadim Petrochenkov
6054a30370 Make it build again 2020-02-29 20:47:10 +03:00
Vadim Petrochenkov
e94d3b70cb Move directory libsyntax -> librustc_ast 2020-02-29 20:47:10 +03:00
Mateusz Mikuła
cdb6955659 Update src/bootstrap/dist.rs
Co-Authored-By: kennytm <kennytm@gmail.com>
2020-02-29 18:42:42 +01:00
bors
4f0edbdfe5 Auto merge of #69263 - anyska:blacklist-powerpc-zst, r=nagisa
Blacklist powerpc-unknown-linux-{gnu,musl} as having non-ignored GNU C ZSTs.

Ref #64259 (this is a simpler alternative to that). See also https://github.com/rust-lang/rust/pull/64259#issuecomment-585815831.
2020-02-29 17:14:54 +00:00
Vadim Petrochenkov
65a666c339 rustc_parse: Tweak the function parameter name check 2020-02-29 18:56:05 +03:00
Ralf Jung
b6e847cc98
Fix typo
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-02-29 16:20:17 +01:00
Matthias Krüger
c9a02c2e42 use .copied() instead of .map(|x| *x) on iterators 2020-02-29 15:23:13 +01:00
bors
e9bca510fe Auto merge of #69260 - GuillaumeGomez:create-E0747-error-code, r=varkor,estebank
Create E0747 error code for unterminated raw strings

Reopening of #66035.

r? @estebank
2020-02-29 13:59:45 +00:00
Ralf Jung
c34451ffb7 fix aliasing violation in align_to_mut 2020-02-29 14:53:20 +01:00