]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoMake functions dependent only on shared root avoidance safe
Mark Rousskov [Wed, 18 Mar 2020 14:45:35 +0000 (10:45 -0400)]
Make functions dependent only on shared root avoidance safe

4 years agoRemove shared root code and assertions from BTree nodes
Mark Rousskov [Wed, 18 Mar 2020 14:28:33 +0000 (10:28 -0400)]
Remove shared root code and assertions from BTree nodes

4 years agoReplace shared root with optional root
Mark Rousskov [Wed, 18 Mar 2020 14:25:46 +0000 (10:25 -0400)]
Replace shared root with optional root

This simplifies the node manipulation, as we can (in later commits) always know
when traversing nodes that we are not in a shared root.

4 years agoAuto merge of #66131 - eddyb:local-def-id, r=petrochenkov
bors [Thu, 19 Mar 2020 09:18:49 +0000 (09:18 +0000)]
Auto merge of #66131 - eddyb:local-def-id, r=petrochenkov

rustc: use LocalDefId instead of DefIndex where possible.

That is, wherever `DefIndex` always referred to a "def" in the local crate, I replaced it with `LocalDefId`.
While `LocalDefId` already existed, it wasn't used a lot, but I hope I'm on the right track.

Unresolved questions:
* [x] ~~should `LocalDefId` implement `rustc_index::Idx`?~~
  * ~~this would get rid of a couple more `DefIndex` uses~~
* [x] ~~should `LocalDefId` be encoded/decoded as just a `DefIndex`?~~
  * ~~right now it's a bit messy, `LocalDefId` encodes/decodes like `DefId`~~
* [x] ~~should `DefId::assert_local` be named something else, like `expect_local`?~~

A future PR should change `tcx.hir().local_def_id(...)` to return `LocalDefId` instead of `DefId`, as changing it in this PR would be too noisy.

r? @michaelwoerister cc @nikomatsakis @petrochenkov @Zoxc

4 years agorustc: use LocalDefId instead of DefIndex in hir::map::definitions.
Eduard-Mihai Burtescu [Sun, 3 Nov 2019 12:36:59 +0000 (14:36 +0200)]
rustc: use LocalDefId instead of DefIndex in hir::map::definitions.

4 years agorustc: use LocalDefId instead of DefIndex in ich.
Eduard-Mihai Burtescu [Tue, 5 Nov 2019 16:44:07 +0000 (18:44 +0200)]
rustc: use LocalDefId instead of DefIndex in ich.

4 years agorustc: use LocalDefId instead of DefIndex in HirId.
Eduard-Mihai Burtescu [Wed, 18 Mar 2020 18:27:59 +0000 (20:27 +0200)]
rustc: use LocalDefId instead of DefIndex in HirId.

4 years agorustc: use LocalDefId instead of DefIndex in hir::lowering.
Eduard-Mihai Burtescu [Sun, 3 Nov 2019 19:29:40 +0000 (21:29 +0200)]
rustc: use LocalDefId instead of DefIndex in hir::lowering.

4 years agorustc: introduce DefId::as_local(self) -> Option<LocalDefId> and use it.
Eduard-Mihai Burtescu [Sun, 3 Nov 2019 18:48:08 +0000 (20:48 +0200)]
rustc: introduce DefId::as_local(self) -> Option<LocalDefId> and use it.

4 years agorustc: rename DefId::to_local to expect_local and use it instead of LocalDefId::from_...
Eduard-Mihai Burtescu [Sun, 3 Nov 2019 12:48:52 +0000 (14:48 +0200)]
rustc: rename DefId::to_local to expect_local and use it instead of LocalDefId::from_def_id.

4 years agorustc: make LocalDefId's index field public like DefId's is.
Eduard-Mihai Burtescu [Thu, 31 Oct 2019 18:48:13 +0000 (20:48 +0200)]
rustc: make LocalDefId's index field public like DefId's is.

4 years agorustc_typeck: remove dead impl for `DefIndex`.
Eduard-Mihai Burtescu [Thu, 31 Oct 2019 14:27:44 +0000 (16:27 +0200)]
rustc_typeck: remove dead impl for `DefIndex`.

4 years agorustc: use LocalDefId instead of DefIndex for query keys.
Eduard-Mihai Burtescu [Thu, 31 Oct 2019 13:32:07 +0000 (15:32 +0200)]
rustc: use LocalDefId instead of DefIndex for query keys.

4 years agoAuto merge of #70132 - Centril:rollup-oe8unsn, r=Centril
bors [Thu, 19 Mar 2020 05:57:57 +0000 (05:57 +0000)]
Auto merge of #70132 - Centril:rollup-oe8unsn, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #68941 (Properly handle Spans that reference imported SourceFiles)
 - #69036 (rustc: don't resolve Instances which would produce malformed shims.)
 - #69443 (tidy: Better license checks.)
 - #69814 (Smaller and more correct generator codegen)
 - #69929 (Regenerate tables for Unicode 13.0.0)
 - #69959 (std: Don't abort process when printing panics in tests)
 - #69969 (unix: Set a guard page at the end of signal stacks)
 - #70005 ([rustdoc] Improve visibility for code blocks warnings)
 - #70088 (Use copy bound in atomic operations to generate simpler MIR)

Failed merges:

r? @ghost

4 years agoRollup merge of #70088 - tmiasko:atomic-copy, r=eddyb
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:41 +0000 (06:57 +0100)]
Rollup merge of #70088 - tmiasko:atomic-copy, r=eddyb

Use copy bound in atomic operations to generate simpler MIR

4 years agoRollup merge of #70005 - GuillaumeGomez:code-block-signs, r=kinnison
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:39 +0000 (06:57 +0100)]
Rollup merge of #70005 - GuillaumeGomez:code-block-signs, r=kinnison

[rustdoc] Improve visibility for code blocks warnings

It appeared that a lot of people didn't notice when a code block was meant to fail compilation or wasn't tested at all. The changes here make the colors less transparent and the icon bigger. So before it looked like this:

![old-light](https://user-images.githubusercontent.com/3050060/76687070-f1cdbb80-6620-11ea-9b73-0c787dc671f7.png)
![old-dark](https://user-images.githubusercontent.com/3050060/76687079-f4c8ac00-6620-11ea-90fb-e548329e01b4.png)

And now it looks like this:

![new-light](https://user-images.githubusercontent.com/3050060/76687092-fd20e700-6620-11ea-9ebb-2b6852f00899.png)
![new-dark](https://user-images.githubusercontent.com/3050060/76687091-fd20e700-6620-11ea-8fea-6854c8367b97.png)

cc @rust-lang/rustdoc
r? @kinnison

4 years agoRollup merge of #69969 - iximeow:sigstack-guard-page, r=cuviper
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:37 +0000 (06:57 +0100)]
Rollup merge of #69969 - iximeow:sigstack-guard-page, r=cuviper

unix: Set a guard page at the end of signal stacks

This mitigates possible issues when signal stacks overflow, which could
manifest as segfaults or in unlucky circumstances possible clobbering of
other memory values as stack overflows tend to enable.

I went ahead and made a PR for this because it's a pretty small change, though if I should open an issue/RFC for this and discuss there first I'll happily do so. I've also added some example programs that demonstrate the uncomfortably clobber-happy behavior we currently have, and the segfaults that could/should result instead, [here](https://github.com/iximeow/jubilant-train).

4 years agoRollup merge of #69959 - alexcrichton:fix-panic-in-print, r=Mark-Simulacrum
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:36 +0000 (06:57 +0100)]
Rollup merge of #69959 - alexcrichton:fix-panic-in-print, r=Mark-Simulacrum

std: Don't abort process when printing panics in tests

This commit fixes an issue when using `set_print` and friends, notably
used by libtest, to avoid aborting the process if printing panics. This
previously panicked due to borrowing a mutable `RefCell` twice, and this
is worked around by borrowing these cells for less time, instead
taking out and removing contents temporarily.

Closes #69558

4 years agoRollup merge of #69929 - cuviper:unicode-13.0.0, r=Mark-Simulacrum
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:34 +0000 (06:57 +0100)]
Rollup merge of #69929 - cuviper:unicode-13.0.0, r=Mark-Simulacrum

Regenerate tables for Unicode 13.0.0

4 years agoRollup merge of #69814 - jonas-schievink:gen-ret-unw, r=Zoxc
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:32 +0000 (06:57 +0100)]
Rollup merge of #69814 - jonas-schievink:gen-ret-unw, r=Zoxc

Smaller and more correct generator codegen

This removes unnecessary panicking branches in the resume function when the generator can not return or unwind, respectively.

Closes https://github.com/rust-lang/rust/issues/66100

It also addresses the correctness concerns wrt poisoning on unwind. These are not currently a soundness issue because any operation *inside* a generator that could possibly unwind will result in a cleanup path for dropping it, ultimately reaching a `Resume` terminator, which we already handled correctly. Future MIR optimizations might optimize that out, though.

r? @Zoxc

4 years agoRollup merge of #69443 - ehuss:tidy-license, r=skade,Mark-Simulacrum
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:30 +0000 (06:57 +0100)]
Rollup merge of #69443 - ehuss:tidy-license, r=skade,Mark-Simulacrum

tidy: Better license checks.

This implements some improvements to the license checks in tidy:

* Use `cargo_metadata` instead of parsing vendored crates. This allows license checks to run without vendoring enabled, and allows the checks to run on PR builds.
* Check for stale entries.
* Check that the licenses for exceptions are what we think they are.
* Verify exceptions do not leak into the runtime.

Closes #62618
Closes #62619
Closes #63238 (I think)

There are some substantive changes here. The follow licenses have changed from the original comments:

* openssl BSD+advertising clause to Apache-2.0
* pest MPL2 to MIT/Apache-2.0
* smallvec MPL2 to MIT/Apache-2.0
* clippy lints MPL2 to MIT OR Apache-2.0

4 years agoRollup merge of #69036 - eddyb:monoshim, r=nikomatsakis
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:28 +0000 (06:57 +0100)]
Rollup merge of #69036 - eddyb:monoshim, r=nikomatsakis

rustc: don't resolve Instances which would produce malformed shims.

There are some `InstanceDef` variants (shims and drop "glue") which contain a `Ty`, and that `Ty` is used in generating the shim MIR. But if that `Ty` mentions any generic parameters, the generated shim would refer to them (but they won't match the `Substs` of the `Instance`), or worse, generating the shim would fail because not enough of the type is known.

Ideally we would always produce a "skeleton" of the type, e.g. `(_, _)` for dropping any tuples with two elements, or `Vec<_>` for dropping any `Vec` value, but that's a lot of work, and they would still not match the `Substs` of the `Instance` as it exists today, so `Instance` would probably need to change.

By making `Instance::resolve` return `None` in the still-generic cases, we get behavior similar to specialization, where a default can only be used if there are no more generic parameters which would allow a more specialized `impl` to match.

<hr/>

This was found while testing the MIR inliner with #68965, because it was trying to inline shims.

cc @rust-lang/wg-mir-opt

4 years agoRollup merge of #68941 - Aaron1011:fix/imported-span, r=petrochenkov
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:27 +0000 (06:57 +0100)]
Rollup merge of #68941 - Aaron1011:fix/imported-span, r=petrochenkov

Properly handle Spans that reference imported SourceFiles

Previously, metadata encoding used DUMMY_SP to represent any spans that
referenced an 'imported' SourceFile - e.g. a SourceFile from an upstream
dependency. This currently has no visible consequences, since these
kinds of spans don't currently seem to be emitted anywhere. However,
there's no reason that we couldn't start using such spans in
diagnostics.

This PR changes how we encode and decode spans in crate metadata. We
encode spans in one of two ways:

* 'Local' spans, which reference non-imported SourceFiles, are encoded
  exactly as before.
* 'Foreign' spans, which reference imported SourceFiles, are encoded
  with the CrateNum of their 'originating' crate. Additionally, their
'lo' and 'high' values are rebased on top of the 'originating' crate,
which allows them to be used with the SourceMap data encoded for that
crate.

To support this change, I've also made the following modifications:

* `DefId` and related structs are now moved to `rustc_span`. This allows
  us to use a `CrateNum` inside `SourceFile`. `CrateNum` has special
handling during deserialization (it gets remapped to be the proper
`CrateNum` from the point of view of the current compilation session),
so using a `CrateNum` instead of a plain integer 'workaround type' helps
to simplify deserialization.
* The `ExternalSource` enum is renamed to `ExternalSourceKind`. There is
now a struct called `ExternalSource`, which holds an
`ExternalSourceKind` along with the original line number information for
the file. This is used during `Span` serialization to rebase spans onto
their 'owning' crate.

4 years agoProperly handle Spans that reference imported SourceFiles
Aaron Hill [Fri, 7 Feb 2020 19:02:24 +0000 (14:02 -0500)]
Properly handle Spans that reference imported SourceFiles

Previously, metadata encoding used DUMMY_SP to represent any spans that
referenced an 'imported' SourceFile - e.g. a SourceFile from an upstream
dependency. These leads to sub-optimal error messages in certain cases
(see the included test).

This PR changes how we encode and decode spans in crate metadata. We
encode spans in one of two ways:

* 'Local' spans, which reference non-imported SourceFiles, are encoded
  exactly as before.
* 'Foreign' spans, which reference imported SourceFiles, are encoded
  with the CrateNum of their 'originating' crate. Additionally, their
'lo' and 'high' values are rebased on top of the 'originating' crate,
which allows them to be used with the SourceMap data encoded for that
crate.

The `ExternalSource` enum is renamed to `ExternalSourceKind`. There is
now a struct called `ExternalSource`, which holds an
`ExternalSourceKind` along with the original line number information for
the file. This is used during `Span` serialization to rebase spans onto
their 'owning' crate.

4 years agoAuto merge of #70118 - pietroalbini:rollup-pgjc90i, r=pietroalbini
bors [Thu, 19 Mar 2020 00:28:33 +0000 (00:28 +0000)]
Auto merge of #70118 - pietroalbini:rollup-pgjc90i, r=pietroalbini

Rollup of 2 pull requests

Successful merges:

 - #70112 (Rollup of 10 pull requests)
 - #70116 (ci: use python from the correct path)

Failed merges:

r? @ghost

4 years agoRollup merge of #70116 - pietroalbini:ci-fix-windows-python-path, r=Mark-Simulacrum
Pietro Albini [Wed, 18 Mar 2020 20:11:11 +0000 (21:11 +0100)]
Rollup merge of #70116 - pietroalbini:ci-fix-windows-python-path, r=Mark-Simulacrum

ci: use python from the correct path

Apparently the old path we were using for Python 2 on Windows was not documented, and eventually got removed. This switches our CI to use the correct path.

See https://github.com/rust-lang/rust/pull/70112#issuecomment-600760786 for the actual failure.

4 years agoRollup merge of #70112 - Centril:rollup-gpi5tbq, r=Centril
Pietro Albini [Wed, 18 Mar 2020 20:11:07 +0000 (21:11 +0100)]
Rollup merge of #70112 - Centril:rollup-gpi5tbq, r=Centril

Rollup of 10 pull requests

Successful merges:

 - #67749 (keyword docs for else and inkeyword docs for else and in.)
 - #69139 (clean up E0308 explanation)
 - #69189 (Erase regions in writeback)
 - #69837 (Use smaller discriminants for generators)
 - #69838 (Expansion-driven outline module parsing)
 - #69839 (Miri error reform)
 - #69899 (Make methods declared by `newtype_index` macro `const`)
 - #69920 (Remove some imports to the rustc crate)
 - #70075 (Fix repr pretty display)
 - #70106 (Tidy: fix running rustfmt twice)

Failed merges:

 - #70051 (Allow `hir().find` to return `None`)
 - #70074 (Expand: nix all fatal errors)

r? @ghost

4 years agoci: use python from the correct path
Pietro Albini [Wed, 18 Mar 2020 17:57:37 +0000 (18:57 +0100)]
ci: use python from the correct path

Apparently the old path we were using for Python 2 on Windows was not
documented, and eventually got removed. This switches our CI to use the
correct path.

4 years agoRollup merge of #70106 - ehuss:fix-tidy-fmt-twice, r=Mark-Simulacrum
Mazdak Farrokhzad [Wed, 18 Mar 2020 17:03:49 +0000 (18:03 +0100)]
Rollup merge of #70106 - ehuss:fix-tidy-fmt-twice, r=Mark-Simulacrum

Tidy: fix running rustfmt twice

`./x.py test tidy` runs rustfmt twice. This is because `Build::build` runs `execute_cli` twice (once dry, once not). This can be quite slow (and prints a bunch of things twice).

I'm not sure if this is really the best place to check the dry_run status.

4 years agoRollup merge of #70075 - GuillaumeGomez:fix-repr-display, r=petrochenkov
Mazdak Farrokhzad [Wed, 18 Mar 2020 17:03:47 +0000 (18:03 +0100)]
Rollup merge of #70075 - GuillaumeGomez:fix-repr-display, r=petrochenkov

Fix repr pretty display

Fixes #70027.

r? @varkor

4 years agoRollup merge of #69920 - Centril:hir-cleanup, r=Zoxc
Mazdak Farrokhzad [Wed, 18 Mar 2020 17:03:44 +0000 (18:03 +0100)]
Rollup merge of #69920 - Centril:hir-cleanup, r=Zoxc

Remove some imports to the rustc crate

- When we have `NestedVisitorMap::None`, we use `type Map = dyn intravisit::Map<'v>;` instead of the actual map. This doesn't actually result in dynamic dispatch (in the future we may want to use an associated type default to simplify the code).

- Use `rustc_session::` imports instead of `rustc::{session, lint}`.

r? @Zoxc

4 years agoRollup merge of #69899 - ecstatic-morse:const-idx-methods, r=oli-obk
Mazdak Farrokhzad [Wed, 18 Mar 2020 17:03:42 +0000 (18:03 +0100)]
Rollup merge of #69899 - ecstatic-morse:const-idx-methods, r=oli-obk

Make methods declared by `newtype_index` macro `const`

Crates that use the macro to define an `Idx` type need to enable `#![feature(const_if_match, const_panic)]`.

4 years agoRollup merge of #69839 - RalfJung:miri-error-cleanup, r=oli-obk
Mazdak Farrokhzad [Wed, 18 Mar 2020 17:03:40 +0000 (18:03 +0100)]
Rollup merge of #69839 - RalfJung:miri-error-cleanup, r=oli-obk

Miri error reform

Some time ago we started moving Miri errors into a few distinct categories, but we never classified all the old errors. That's what this PR does.

~~This is on top of https://github.com/rust-lang/rust/pull/69762; [relative diff](https://github.com/RalfJung/rust/compare/validity-errors...RalfJung:miri-error-cleanup).~~

r? @oli-obk

Fixes https://github.com/rust-lang/const-eval/issues/4

4 years agoRollup merge of #69838 - Centril:expand-module, r=petrochenkov
Mazdak Farrokhzad [Wed, 18 Mar 2020 17:03:38 +0000 (18:03 +0100)]
Rollup merge of #69838 - Centril:expand-module, r=petrochenkov

Expansion-driven outline module parsing

After this PR, the parser will not do any conditional compilation or loading of external module files when `mod foo;` is encountered. Instead, the parser only leaves `mod foo;` in place in the AST, with no items filled in. Expansion later kicks in and will load the actual files and do the parsing. This entails that the following is now valid:

```rust
#[cfg(FALSE)]
mod foo {
    mod bar {
        mod baz; // `foo/bar/baz.rs` doesn't exist, but no error!
    }
}
```

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

r? @petrochenkov

4 years agoRollup merge of #69837 - jonas-schievink:gen-discr-opt, r=tmandry
Mazdak Farrokhzad [Wed, 18 Mar 2020 17:03:37 +0000 (18:03 +0100)]
Rollup merge of #69837 - jonas-schievink:gen-discr-opt, r=tmandry

Use smaller discriminants for generators

Closes https://github.com/rust-lang/rust/issues/69815

I'm not yet sure about the runtime performance impact of this, so I'll try running this on some benchmarks (if I can find any). (Update: No impact on the benchmarks I've measured on)

* [x] Add test with a generator that has exactly 256 total states
* [x] Add test with a generator that has more than 256 states so that it needs to use a u16 discriminant
* [x] Add tests for the size of `Option<[generator]>`
* [x] Add tests for the `discriminant_value` intrinsic in all cases

4 years agoRollup merge of #69189 - matthewjasper:erase-the-world, r=nikomatsakis
Mazdak Farrokhzad [Wed, 18 Mar 2020 17:03:35 +0000 (18:03 +0100)]
Rollup merge of #69189 - matthewjasper:erase-the-world, r=nikomatsakis

Erase regions in writeback

Regions in `TypeckTables` (except canonicalized user annotations) are now erased. Further, we no longer do lexical region solving on item bodies with `-Zborrowck=mir`.

cc #68261
r? @nikomatsakis

4 years agoRollup merge of #69139 - GuillaumeGomez:cleanup-e0308, r=Dylan-DPC
Mazdak Farrokhzad [Wed, 18 Mar 2020 17:03:33 +0000 (18:03 +0100)]
Rollup merge of #69139 - GuillaumeGomez:cleanup-e0308, r=Dylan-DPC

clean up E0308 explanation

r? @Dylan-DPC

4 years agoRollup merge of #67749 - gilescope:keyword-in, r=Dylan-DPC
Mazdak Farrokhzad [Wed, 18 Mar 2020 17:03:31 +0000 (18:03 +0100)]
Rollup merge of #67749 - gilescope:keyword-in, r=Dylan-DPC

keyword docs for else and inkeyword docs for else and in.

First cut of else and in keyword docs. Comments and suggestions more than welcome.

4 years agoTidy: fix running rustfmt twice
Eric Huss [Wed, 18 Mar 2020 15:15:29 +0000 (08:15 -0700)]
Tidy: fix running rustfmt twice

4 years ago--bless windows test
Mazdak Farrokhzad [Tue, 17 Mar 2020 03:39:22 +0000 (04:39 +0100)]
--bless windows test

4 years agofix rebase fallout
Mazdak Farrokhzad [Sun, 15 Mar 2020 23:56:27 +0000 (00:56 +0100)]
fix rebase fallout

4 years agofix pre-expansion linting infra
Mazdak Farrokhzad [Sun, 15 Mar 2020 23:43:37 +0000 (00:43 +0100)]
fix pre-expansion linting infra

4 years agouse pretty-compare-only in a test
Mazdak Farrokhzad [Tue, 10 Mar 2020 06:21:40 +0000 (07:21 +0100)]
use pretty-compare-only in a test

4 years agotweak outline module parsing spans
Mazdak Farrokhzad [Mon, 9 Mar 2020 10:16:00 +0000 (11:16 +0100)]
tweak outline module parsing spans

4 years agoparser/expand: minor cleanup
Mazdak Farrokhzad [Mon, 9 Mar 2020 09:35:35 +0000 (10:35 +0100)]
parser/expand: minor cleanup

4 years agoadd test for stripped nested outline module
Mazdak Farrokhzad [Sun, 8 Mar 2020 21:48:24 +0000 (22:48 +0100)]
add test for stripped nested outline module

4 years ago{rustc_parse -> rustc_expand}::config
Mazdak Farrokhzad [Sun, 8 Mar 2020 21:32:25 +0000 (22:32 +0100)]
{rustc_parse -> rustc_expand}::config

4 years ago{rustc_parse::parser -> rustc_expand}::module
Mazdak Farrokhzad [Sun, 8 Mar 2020 21:21:37 +0000 (22:21 +0100)]
{rustc_parse::parser -> rustc_expand}::module

4 years agomove Directory -> parser::module
Mazdak Farrokhzad [Sun, 8 Mar 2020 21:10:37 +0000 (22:10 +0100)]
move Directory -> parser::module

4 years agoparse: module parsing -> item.rs
Mazdak Farrokhzad [Sun, 8 Mar 2020 20:50:01 +0000 (21:50 +0100)]
parse: module parsing -> item.rs

4 years agooutline modules: parse -> expand.
Mazdak Farrokhzad [Sun, 8 Mar 2020 12:36:20 +0000 (13:36 +0100)]
outline modules: parse -> expand.

4 years agoextract error_on_circular_module
Mazdak Farrokhzad [Sun, 8 Mar 2020 12:29:37 +0000 (13:29 +0100)]
extract error_on_circular_module

4 years agoextract parse_external_module
Mazdak Farrokhzad [Sun, 8 Mar 2020 11:33:15 +0000 (12:33 +0100)]
extract parse_external_module

4 years agode-fatalize outline module parsing
Mazdak Farrokhzad [Sun, 8 Mar 2020 11:19:27 +0000 (12:19 +0100)]
de-fatalize outline module parsing

4 years agoexpand: use push_directory
Mazdak Farrokhzad [Sun, 8 Mar 2020 10:18:26 +0000 (11:18 +0100)]
expand: use push_directory

4 years agodecouple eval_src_mod from Parser
Mazdak Farrokhzad [Sun, 8 Mar 2020 10:06:30 +0000 (11:06 +0100)]
decouple eval_src_mod from Parser

4 years agodecouple push_directory from Parser
Mazdak Farrokhzad [Sun, 8 Mar 2020 08:54:19 +0000 (09:54 +0100)]
decouple push_directory from Parser

4 years agodetach submod_path from Parser
Mazdak Farrokhzad [Sun, 8 Mar 2020 08:28:46 +0000 (09:28 +0100)]
detach submod_path from Parser

4 years agoextract error_on_circular_module
Mazdak Farrokhzad [Sat, 7 Mar 2020 18:53:25 +0000 (19:53 +0100)]
extract error_on_circular_module

4 years agoextract parse_mod
Mazdak Farrokhzad [Sat, 7 Mar 2020 19:19:52 +0000 (20:19 +0100)]
extract parse_mod

4 years agosubmod_path: use id.span
Mazdak Farrokhzad [Sat, 7 Mar 2020 18:41:24 +0000 (19:41 +0100)]
submod_path: use id.span

4 years agosimplify submod_path
Mazdak Farrokhzad [Sat, 7 Mar 2020 18:20:31 +0000 (19:20 +0100)]
simplify submod_path

4 years agoextract error_decl_mod_in_block
Mazdak Farrokhzad [Sat, 7 Mar 2020 18:15:35 +0000 (19:15 +0100)]
extract error_decl_mod_in_block

4 years agoextract error_cannot_declare_mod_here
Mazdak Farrokhzad [Sat, 7 Mar 2020 18:11:47 +0000 (19:11 +0100)]
extract error_cannot_declare_mod_here

4 years agosubmod_path_from_attr: simplify & document
Mazdak Farrokhzad [Sat, 7 Mar 2020 17:59:44 +0000 (18:59 +0100)]
submod_path_from_attr: simplify & document

4 years agostd: Don't abort process when printing panics in tests
Alex Crichton [Thu, 12 Mar 2020 20:03:48 +0000 (13:03 -0700)]
std: Don't abort process when printing panics in tests

This commit fixes an issue when using `set_print` and friends, notably
used by libtest, to avoid aborting the process if printing panics. This
previously panicked due to borrowing a mutable `RefCell` twice, and this
is worked around by borrowing these cells for less time, instead
taking out and removing contents temporarily.

Closes #69558

4 years agoAuto merge of #69907 - ehuss:update-cargo, r=ehuss
bors [Wed, 18 Mar 2020 06:31:24 +0000 (06:31 +0000)]
Auto merge of #69907 - ehuss:update-cargo, r=ehuss

Update cargo

Update cargo

21 commits in bda50510d1daf6e9c53ad6ccf603da6e0fa8103f..7019b3ed3d539db7429d10a343b69be8c426b576
2020-03-02 18:05:34 +0000 to 2020-03-17 21:02:00 +0000
- Run through clippy (rust-lang/cargo#8015)
- Fix config profiles using "dev" in `cargo test`. (rust-lang/cargo#8012)
- Run CI on all PRs. (rust-lang/cargo#8011)
- Add unit-graph JSON output. (rust-lang/cargo#7977)
- Split workspace/validate() into multiple functions (rust-lang/cargo#8008)
- Use Option::as_deref (rust-lang/cargo#8005)
- De-duplicate edges (rust-lang/cargo#7993)
- Revert "Disable preserving mtimes on archives" (rust-lang/cargo#7935)
- Close the front door for clippy but open the back (rust-lang/cargo#7533)
- Fix CHANGELOG.md typos (rust-lang/cargo#7999)
- Update changelog note about crate-versions flag. (rust-lang/cargo#7998)
- Bump to 0.45.0, update changelog (rust-lang/cargo#7997)
- Bump libgit2 dependencies (rust-lang/cargo#7996)
- Avoid buffering large amounts of rustc output. (rust-lang/cargo#7838)
- Add "Updating" status for git submodules. (rust-lang/cargo#7989)
- WorkspaceResolve: Use descriptive lifetime label. (rust-lang/cargo#7990)
- Support old html anchors in manifest chapter. (rust-lang/cargo#7983)
- Don't create hardlink for library test and integrations tests, fixing rust-lang/cargo#7960 (rust-lang/cargo#7965)
- Partially revert change to filter debug_assertions. (rust-lang/cargo#7970)
- Try to better handle restricted crate names. (rust-lang/cargo#7959)
- Fix bug with new feature resolver and required-features. (rust-lang/cargo#7962)

4 years agoUpdate cargo
Eric Huss [Wed, 11 Mar 2020 06:16:19 +0000 (23:16 -0700)]
Update cargo

4 years agoAuto merge of #68915 - timvermeulen:non_fused_iter, r=Amanieu
bors [Wed, 18 Mar 2020 03:08:52 +0000 (03:08 +0000)]
Auto merge of #68915 - timvermeulen:non_fused_iter, r=Amanieu

Fix bugs in Peekable and Flatten when using non-fused iterators

I fixed a couple of bugs with regard to the `Peekable` and `Flatten`/`FlatMap` iterators when the underlying iterator isn't fused. For testing, I also added a `NonFused` iterator wrapper that panics when `next` or `next_back` is called on an iterator that has returned `None` before, which will hopefully make it easier to spot these mistakes in the future.

### Peekable

`Peekable::next_back` was implemented as
```rust
self.iter.next_back().or_else(|| self.peeked.take().and_then(|x| x))
```
which is incorrect because when the `peeked` field is `Some(None)`, then `None` has already been returned from the inner iterator and what it returns from `next_back` can no longer be relied upon. `test_peekable_non_fused` tests this.

### Flatten

When a `FlattenCompat` instance only has a `backiter` remaining (i.e. `self.frontiter` is `None` and `self.iter` is empty), then `next` will call `self.iter.next()` every time, so the `iter` field needs to be fused. I fixed it by giving it the type `Fuse<I>` instead of `I`, I think this is the only way to fix it. `test_flatten_non_fused_outer` tests this.

Furthermore, previously `FlattenCompat::next` did not set `self.frontiter` to `None` after it returned `None`, which is incorrect when the inner iterator type isn't fused. I just delegated it to `try_fold` because that already handles it correctly. `test_flatten_non_fused_inner` tests this.

r? @scottmcm

4 years agoUse copy bound in atomic operations to generate simpler MIR
Tomasz Miąsko [Tue, 17 Mar 2020 00:00:00 +0000 (00:00 +0000)]
Use copy bound in atomic operations to generate simpler MIR

4 years agoAuto merge of #70020 - matthiaskrgr:submodule_upd, r=ehuss
bors [Tue, 17 Mar 2020 22:10:21 +0000 (22:10 +0000)]
Auto merge of #70020 - matthiaskrgr:submodule_upd, r=ehuss

submodules: update clippy from 8485d40a to d556bb73

Changes:
````
    rustup https://github.com/rust-lang/rust/pull/68944
    rustup https://github.com/rust-lang/rust/pull/69589/
    Rustup to rust-lang/rust#69076
    Don't convert Path to lossy str
    Use `into_path`
    Use pattern matching instead of manually checking condition
    Fix typo
    Remove git2 dependency.
    Document that wildcard_imports doesn't warn about `use ...::prelude::*;`
    Change changelog formatting
    Update changelog_update doc to reflect the actual ordering of the changelog
    Update CHANGELOG.md
````

Fixes #70007

4 years agoUpdate rustdoc test and remove TODO comment
Guillaume Gomez [Tue, 17 Mar 2020 14:08:44 +0000 (15:08 +0100)]
Update rustdoc test and remove TODO comment

4 years agoUpdate pretty tests
Guillaume Gomez [Tue, 17 Mar 2020 14:08:18 +0000 (15:08 +0100)]
Update pretty tests

4 years agoAuto merge of #69519 - 12101111:remove-proc-macro-check, r=nagisa
bors [Tue, 17 Mar 2020 18:27:26 +0000 (18:27 +0000)]
Auto merge of #69519 - 12101111:remove-proc-macro-check, r=nagisa

 Don't use static crt by default when build proc-macro

Don't check value of `crt-static` when build proc-macro crates, since they are always built dynamically.
For more information, see https://github.com/rust-lang/cargo/issues/7563#issuecomment-591965320
I hope this will fix issues about compiling `proc_macro` crates on musl host without bring more issues.
Fix https://github.com/rust-lang/cargo/issues/7563

4 years agoHold index of generator `self` arg in `const`
Dylan MacKenzie [Tue, 10 Mar 2020 20:51:07 +0000 (13:51 -0700)]
Hold index of generator `self` arg in `const`

4 years agoAdd requisite feature gates for const assert
Dylan MacKenzie [Tue, 10 Mar 2020 20:41:33 +0000 (13:41 -0700)]
Add requisite feature gates for const assert

4 years agoRename `from_u32_const` -> `from_u32`
Dylan MacKenzie [Tue, 10 Mar 2020 20:44:53 +0000 (13:44 -0700)]
Rename `from_u32_const` -> `from_u32`

4 years agoMake `newtype_index` methods const
Dylan MacKenzie [Tue, 10 Mar 2020 20:44:40 +0000 (13:44 -0700)]
Make `newtype_index` methods const

4 years agoDon't prepend with space before paren
Guillaume Gomez [Tue, 17 Mar 2020 14:08:11 +0000 (15:08 +0100)]
Don't prepend with space before paren

4 years agoAuto merge of #70072 - Centril:rollup-722hooh, r=Centril
bors [Tue, 17 Mar 2020 15:14:43 +0000 (15:14 +0000)]
Auto merge of #70072 - Centril:rollup-722hooh, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #68746 (Make macro metavars respect (non-)hygiene)
 - #69688 (Move tidy check to mingw-check)
 - #69735 (bootstrap: Use hash to determine if sanitizers needs to be rebuilt)
 - #69922 (implement zeroed and uninitialized with MaybeUninit)
 - #69956 (Ensure HAS_FREE_LOCAL_NAMES is set for ReFree)
 - #70061 (Cosmetic fixes in documentation)
 - #70064 (Update books)

Failed merges:

r? @ghost

4 years agoRollup merge of #70064 - ehuss:update-books, r=ehuss
Mazdak Farrokhzad [Tue, 17 Mar 2020 11:16:21 +0000 (12:16 +0100)]
Rollup merge of #70064 - ehuss:update-books, r=ehuss

Update books

## reference

4 commits in 559e09caa9661043744cf7af7bd88432d966f743..e2f11fe4d6a5ecb471c70323197da43c70cb96b6
2020-03-02 01:17:14 +0100 to 2020-03-10 06:59:24 +0100
- Update rustc-guide to rustc-dev-guide (rust-lang-nursery/reference#777)
- Fix expression and statement grammar. (rust-lang-nursery/reference#776)
- Fix grammar for tuple struct patterns. (rust-lang-nursery/reference#775)
- A typo? (rust-lang-nursery/reference#770)

## rust-by-example

3 commits in db57f899ea2a56a544c8d280cbf033438666273d..cb369ae95ca36b841960182d26f6d5d9b2e3cc18
2020-02-18 17:46:46 -0300 to 2020-03-14 12:13:22 -0500
- Use rust-lang/rust linkchecker on CI. (rust-lang/rust-by-example#1310)
- Rewrite freeze.md (rust-lang/rust-by-example#1314)
- Clarify type suffixing with example (rust-lang/rust-by-example#1312)

## embedded-book

2 commits in b81ffb7a6f4c5aaed92786e770e99db116aa4ebd..d22a9c487c78095afc4584f1d9b4ec43529d713c
2020-02-27 08:06:04 +0000 to 2020-03-04 09:46:30 +0000
- Updated documentation on profile-overrides  (rust-embedded/book#230)
- Update information on Cargo `profile-overrides`  (rust-embedded/book#229)

4 years agoRollup merge of #70061 - JOE1994:patch-2, r=Dylan-DPC
Mazdak Farrokhzad [Tue, 17 Mar 2020 11:16:20 +0000 (12:16 +0100)]
Rollup merge of #70061 - JOE1994:patch-2, r=Dylan-DPC

Cosmetic fixes in documentation

typo fix + markdown fix for consistency

4 years agoRollup merge of #69956 - matthewjasper:fix-region-flags, r=nikomatsakis
Mazdak Farrokhzad [Tue, 17 Mar 2020 11:16:18 +0000 (12:16 +0100)]
Rollup merge of #69956 - matthewjasper:fix-region-flags, r=nikomatsakis

Ensure HAS_FREE_LOCAL_NAMES is set for ReFree

This fixes a bug introduced by #69469.
I don't have any ideas on how to reate a regression test for this.

4 years agoRollup merge of #69922 - RalfJung:less-intrinsic, r=oli-obk
Mazdak Farrokhzad [Tue, 17 Mar 2020 11:16:16 +0000 (12:16 +0100)]
Rollup merge of #69922 - RalfJung:less-intrinsic, r=oli-obk

implement zeroed and uninitialized with MaybeUninit

This is the second attempt of doing such a change (first PR: https://github.com/rust-lang/rust/pull/62150). The last change [got reverted](https://github.com/rust-lang/rust/pull/63343) because it [caused](https://github.com/rust-lang/rust/issues/62825) some [issues](https://github.com/rust-lang/rust/issues/52898#issuecomment-512182438) in [code that incorrectly used these functions](https://github.com/erlepereira/x11-rs/issues/99).

Since then, the [problematic code has been fixed](https://github.com/erlepereira/x11-rs/pull/101), and rustc [gained a lint](https://github.com/rust-lang/rust/pull/63346) that is able to detect many misuses of these functions statically and a [dynamic check that panics](https://github.com/rust-lang/rust/pull/66059) instead of causing UB for some incorrect uses.

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

4 years agoRollup merge of #69735 - tmiasko:bootstrap-sanitizers-hash, r=Mark-Simulacrum
Mazdak Farrokhzad [Tue, 17 Mar 2020 11:16:14 +0000 (12:16 +0100)]
Rollup merge of #69735 - tmiasko:bootstrap-sanitizers-hash, r=Mark-Simulacrum

bootstrap: Use hash to determine if sanitizers needs to be rebuilt

* Rebuild sanitizers runtimes when LLVM submodule commit changes.
* When rebuilding LLVM / sanitizers, remove the stamp file before
  starting the build process to invalidate previous build output.

4 years agoRollup merge of #69688 - JohnTitor:move-tidy, r=Mark-Simulacrum
Mazdak Farrokhzad [Tue, 17 Mar 2020 11:16:12 +0000 (12:16 +0100)]
Rollup merge of #69688 - JohnTitor:move-tidy, r=Mark-Simulacrum

Move tidy check to mingw-check

Fixes #69613

4 years agoRollup merge of #68746 - matthewjasper:metahygiene, r=petrochenkov
Mazdak Farrokhzad [Tue, 17 Mar 2020 11:16:10 +0000 (12:16 +0100)]
Rollup merge of #68746 - matthewjasper:metahygiene, r=petrochenkov

Make macro metavars respect (non-)hygiene

This makes them more consistent with other name resolution while not breaking any code on crater.

4 years agoUpdate tests for erasing regions in typeck
Matthew Jasper [Sat, 15 Feb 2020 12:13:20 +0000 (12:13 +0000)]
Update tests for erasing regions in typeck

4 years agoErase regions in writeback
Matthew Jasper [Sat, 15 Feb 2020 12:11:59 +0000 (12:11 +0000)]
Erase regions in writeback

Also skip duplicated region solving entirely with `-Zborrowck=mir`.

4 years agoDon't use `TypeckTables` in NiceRegionError
Matthew Jasper [Sat, 15 Feb 2020 12:07:20 +0000 (12:07 +0000)]
Don't use `TypeckTables` in NiceRegionError

Regions in TypeckTables will be erased, so are unusable for error
reporting.

4 years agoRemove `free_region_map` from `TypeckTables`
Matthew Jasper [Sat, 30 Nov 2019 10:35:31 +0000 (10:35 +0000)]
Remove `free_region_map` from `TypeckTables`

It was unused.

4 years agoUpdate books
Eric Huss [Tue, 17 Mar 2020 02:09:54 +0000 (19:09 -0700)]
Update books

4 years agoAuto merge of #70062 - Centril:rollup-synwle8, r=Centril
bors [Tue, 17 Mar 2020 02:06:21 +0000 (02:06 +0000)]
Auto merge of #70062 - Centril:rollup-synwle8, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #69811 (resolve: Print import chains on privacy errors)
 - #69870 (expand: Implement something similar to `#[cfg(accessible(path))]`)
 - #69881 (VariantSizeDifferences: bail on SizeOverflow)
 - #70000 (resolve: Fix regression in resolution of raw keywords in paths)
 - #70029 (Bump the bootstrap compiler)
 - #70046 (Use sublice patterns to avoid computing the len)
 - #70049 (Fiddle `ParamEnv` through to a place that used to use `ParamEnv::empty` in a buggy manner)

Failed merges:

r? @ghost

4 years agoRollup merge of #70049 - oli-obk:param_env_empty_considered_unimplemented, r=eddyb
Mazdak Farrokhzad [Tue, 17 Mar 2020 02:05:20 +0000 (03:05 +0100)]
Rollup merge of #70049 - oli-obk:param_env_empty_considered_unimplemented, r=eddyb

Fiddle `ParamEnv` through to a place that used to use `ParamEnv::empty` in a buggy manner

cc https://github.com/rust-lang/rust/pull/69981#discussion_r393048924

r? @eddyb

4 years agoRollup merge of #70046 - lzutao:patch-1, r=Centril
Mazdak Farrokhzad [Tue, 17 Mar 2020 02:05:19 +0000 (03:05 +0100)]
Rollup merge of #70046 - lzutao:patch-1, r=Centril

Use sublice patterns to avoid computing the len

r? @Centril

4 years agoRollup merge of #70029 - jonas-schievink:bootstrap, r=Centril
Mazdak Farrokhzad [Tue, 17 Mar 2020 02:05:17 +0000 (03:05 +0100)]
Rollup merge of #70029 - jonas-schievink:bootstrap, r=Centril

Bump the bootstrap compiler

4 years agoRollup merge of #70000 - petrochenkov:rawkeypars, r=davidtwco
Mazdak Farrokhzad [Tue, 17 Mar 2020 02:05:16 +0000 (03:05 +0100)]
Rollup merge of #70000 - petrochenkov:rawkeypars, r=davidtwco

resolve: Fix regression in resolution of raw keywords in paths

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

4 years agoRollup merge of #69881 - Centril:fix-69485, r=oli-obk
Mazdak Farrokhzad [Tue, 17 Mar 2020 02:05:14 +0000 (03:05 +0100)]
Rollup merge of #69881 - Centril:fix-69485, r=oli-obk

VariantSizeDifferences: bail on SizeOverflow

Fixes #69485.

r? @oli-obk

4 years agoRollup merge of #69870 - petrochenkov:cfgacc, r=matthewjasper
Mazdak Farrokhzad [Tue, 17 Mar 2020 02:05:12 +0000 (03:05 +0100)]
Rollup merge of #69870 - petrochenkov:cfgacc, r=matthewjasper

expand: Implement something similar to `#[cfg(accessible(path))]`

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

The feature is implemented as a `#[cfg_accessible(path)]` attribute macro rather than as `#[cfg(accessible(path))]` because it needs to wait until `path` becomes resolvable, and `cfg` cannot wait, but macros can wait.

Later we can think about desugaring or not desugaring `#[cfg(accessible(path))]` into `#[cfg_accessible(path)]`.

This implementation is also incomplete in the sense that it never returns "false" from `cfg_accessible(path)`, it requires some tweaks to resolve, which is not quite ready to answer queries like this during early resolution.

However, the most important part of this PR is not `cfg_accessible` itself, but expansion infrastructure for retrying expansions.
Before this PR we could say "we cannot resolve this macro path, let's try it later", with this PR we can say "we cannot expand this macro, let's try it later" as well.

This is a pre-requisite for
- turning `#[derive(...)]` into a regular attribute macro,
- properly supporting eager expansion for macros that cannot yet be resolved like
    ```
    fn main() {
        println!(not_available_yet!());
    }

    macro_rules! make_available {
        () => { #[macro_export] macro_rules! not_available_yet { () => { "Hello world!" } }}
    }

    make_available!();
    ```

4 years agoRollup merge of #69811 - petrochenkov:privdiag2, r=estebank
Mazdak Farrokhzad [Tue, 17 Mar 2020 02:05:10 +0000 (03:05 +0100)]
Rollup merge of #69811 - petrochenkov:privdiag2, r=estebank

resolve: Print import chains on privacy errors

A part of https://github.com/rust-lang/rust/pull/67951 that doesn't require hacks.
r? @estebank