]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoFactor out a repeated `config.no_integrated_as` test.
Nicholas Nethercote [Fri, 20 Mar 2020 22:25:20 +0000 (09:25 +1100)]
Factor out a repeated `config.no_integrated_as` test.

4 years agoIntroduce a local variable `config_emit_normal_obj`.
Nicholas Nethercote [Fri, 20 Mar 2020 22:19:21 +0000 (09:19 +1100)]
Introduce a local variable `config_emit_normal_obj`.

This adds a missing `!config.obj_is_bitcode` condition to two places
that should have it.

As a result, when `obj_is_bitcode` and `no_integrated_as` are both true,
the compiler will no longer unnecessarily emit asm, convert it to an
object file, and then overwrite that object file with bitcode.

4 years agoFactor out a repeated `config.obj_is_bitcode` test.
Nicholas Nethercote [Fri, 20 Mar 2020 22:15:07 +0000 (09:15 +1100)]
Factor out a repeated `config.obj_is_bitcode` test.

4 years agoRemove an unnecessary block scope.
Nicholas Nethercote [Fri, 20 Mar 2020 01:46:27 +0000 (12:46 +1100)]
Remove an unnecessary block scope.

4 years agoCombine `ModuleConfig::embed_bitcode{,_marker}`.
Nicholas Nethercote [Fri, 20 Mar 2020 01:34:39 +0000 (12:34 +1100)]
Combine `ModuleConfig::embed_bitcode{,_marker}`.

Because the `(true, true)` combination isn't valid.

4 years agoRemove some local variables.
Nicholas Nethercote [Fri, 20 Mar 2020 01:09:24 +0000 (12:09 +1100)]
Remove some local variables.

I find the code easier to read if the values in `config` are all used
directly, rather than a mix of `config` values and local variables. It
will also faciliate some of the following commits.

Also, use `config.bitcode_needed()` in one place.

4 years agoRemove unused `ModuleConfig::emit_lto_bc` field.
Nicholas Nethercote [Thu, 19 Mar 2020 06:00:41 +0000 (17:00 +1100)]
Remove unused `ModuleConfig::emit_lto_bc` field.

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 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 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 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 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

4 years agoIgnore wasm32
12101111 [Tue, 17 Mar 2020 01:57:11 +0000 (09:57 +0800)]
Ignore wasm32

4 years agoSmall fixes in documentation
Youngsuk Kim [Tue, 17 Mar 2020 01:24:47 +0000 (21:24 -0400)]
Small fixes in documentation

typo fix + markdown fix for consistency

4 years agoAdd tests
Tim Vermeulen [Tue, 4 Feb 2020 23:09:11 +0000 (00:09 +0100)]
Add tests

4 years agoFix FlattenCompat::{next, next_back}
Tim Vermeulen [Thu, 6 Feb 2020 04:58:04 +0000 (05:58 +0100)]
Fix FlattenCompat::{next, next_back}

4 years agoAuto merge of #68970 - matthewjasper:min-spec, r=nikomatsakis
bors [Mon, 16 Mar 2020 20:49:26 +0000 (20:49 +0000)]
Auto merge of #68970 - matthewjasper:min-spec, r=nikomatsakis

Implement a feature for a sound specialization subset

This implements a new feature (`min_specialization`) that restricts specialization to a subset that is reasonable for the standard library to use.

The plan is to then:

* Update `libcore` and `liballoc` to compile with `min_specialization`.
* Add a lint to forbid use of `feature(specialization)` (and other unsound, type system extending features) in the standard library.
* Fix the soundness issues around `specialization`.
* Remove `min_specialization`

The rest of this is an overview from a comment in this PR

## Basic approach

To enforce this requirement on specializations we take the following approach:
1. Match up the substs for `impl2` so that the implemented trait and self-type match those for `impl1`.
2. Check for any direct use of `'static` in the substs of `impl2`.
3. Check that all of the generic parameters of `impl1` occur at most once in the *unconstrained* substs for `impl2`. A parameter is constrained if its value is completely determined by an associated type projection predicate.
4. Check that all predicates on `impl1` also exist on `impl2` (after matching substs).

## Example

Suppose we have the following always applicable impl:

```rust
impl<T> SpecExtend<T> for std::vec::IntoIter<T> { /* specialized impl */ }
impl<T, I: Iterator<Item=T>> SpecExtend<T> for I { /* default impl */ }
```

We get that the subst for `impl2` are `[T, std::vec::IntoIter<T>]`. `T` is constrained to be `<I as Iterator>::Item`, so we check only `std::vec::IntoIter<T>` for repeated parameters, which it doesn't have. The predicates of `impl1` are only `T: Sized`, which is also a predicate of impl2`. So this specialization is sound.

## Extensions

Unfortunately not all specializations in the standard library are allowed by this. So there are two extensions to these rules that allow specializing on some traits.

### rustc_specialization_trait

If a trait is always applicable, then it's sound to specialize on it. We check trait is always applicable in the same way as impls, except that step 4 is now "all predicates on `impl1` are always applicable". We require that `specialization` or `min_specialization` is enabled to implement these traits.

### rustc_specialization_marker

There are also some specialization on traits with no methods, including the `FusedIterator` trait which is advertised as allowing optimizations. We allow marking marker traits with an unstable attribute that means we ignore them in point 3 of the checks above. This is unsound but we allow it in the short term because it can't cause use after frees with purely safe code in the same way as specializing on traits methods can.

r? @nikomatsakis
cc #31844 #67194

4 years agosubmodules: update clippy from 8485d40a to 23549a8c
Matthias Krüger [Mon, 16 Mar 2020 18:06:04 +0000 (19:06 +0100)]
submodules: update clippy from 8485d40a to 23549a8c

Changes:
````
rustup https://github.com/rust-lang/rust/pull/69738
rustup https://github.com/rust-lang/rust/pull/68944
Make use of `or_patterns` feature
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 agoFiddle `ParamEnv` through to a place that used to use `ParamEnv::empty` in a buggy...
Oliver Scherer [Mon, 16 Mar 2020 17:51:55 +0000 (18:51 +0100)]
Fiddle `ParamEnv` through to a place that used to use `ParamEnv::empty` in a buggy manner

4 years agoMake macro metavars respect (non-)hygiene
Matthew Jasper [Wed, 11 Mar 2020 20:05:19 +0000 (20:05 +0000)]
Make macro metavars respect (non-)hygiene

4 years agoFix wrong deref
lzutao [Mon, 16 Mar 2020 16:54:32 +0000 (23:54 +0700)]
Fix wrong deref

4 years agoUse sublice patterns to avoid computing the len
lzutao [Mon, 16 Mar 2020 16:43:42 +0000 (23:43 +0700)]
Use sublice patterns to avoid computing the len

4 years agomake mem::{zeroed,uninitialized} inline(always)
Ralf Jung [Mon, 16 Mar 2020 16:37:26 +0000 (17:37 +0100)]
make mem::{zeroed,uninitialized} inline(always)

4 years agoAuto merge of #67133 - oli-obk:it_must_be_a_sign, r=eddyb
bors [Mon, 16 Mar 2020 16:31:23 +0000 (16:31 +0000)]
Auto merge of #67133 - oli-obk:it_must_be_a_sign, r=eddyb

Deduplicate pretty printing of constants

r? @eddyb for the pretty printing logic
cc @RalfJung

4 years agoinit-large-type test needs optimizations
Ralf Jung [Mon, 16 Mar 2020 13:38:33 +0000 (14:38 +0100)]
init-large-type test needs optimizations

4 years agoAuto merge of #70040 - Dylan-DPC:rollup-id1k6lz, r=Dylan-DPC
bors [Mon, 16 Mar 2020 13:22:56 +0000 (13:22 +0000)]
Auto merge of #70040 - Dylan-DPC:rollup-id1k6lz, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #67335 (Refactor the `Qualif` trait)
 - #69122 (Backtrace Debug tweaks)
 - #69520 (Make error message clearer about creating new module)
 - #69738 (More Method -> AssocFn renaming)
 - #69867 (Add long error explanation for E0628 )
 - #69989 (resolve/hygiene: `macro_rules` are not "legacy")
 - #70036 (Make article_and_description primarily use def_kind)

Failed merges:

r? @ghost

4 years agoRollup merge of #70036 - mark-i-m:describe-it-4, r=eddyb
Dylan DPC [Mon, 16 Mar 2020 12:16:45 +0000 (13:16 +0100)]
Rollup merge of #70036 - mark-i-m:describe-it-4, r=eddyb

Make article_and_description primarily use def_kind

r? @eddyb

cc @matthewjasper

4 years agoRollup merge of #69989 - petrochenkov:nolegacy, r=eddyb,matthewjasper
Dylan DPC [Mon, 16 Mar 2020 12:16:44 +0000 (13:16 +0100)]
Rollup merge of #69989 - petrochenkov:nolegacy, r=eddyb,matthewjasper

resolve/hygiene: `macro_rules` are not "legacy"

The "modern" vs "legacy" naming was introduced by jseyfried during initial implementation of macros 2.0.
At this point it's clear that `macro_rules` are not going anywhere and won't be deprecated in the near future.
So this PR changes the naming "legacy" (when it implies "macro_rules") to "macro_rules".
This should also help people reading this code because it's wasn't obvious that "legacy" actually meant "macro_rules" in these contexts.

The most contentious renaming here is probably
```
fn modern -> fn normalize_to_macros_2_0
fn modern_and_legacy -> fn normalize_to_macro_rules
```
Other alternatives that I could think of are `normalize_to_opaque`/`normalize_to_semitransparent`, or `strip_non_opaque`/`strip_transparent`, but they seemed less intuitive.
The documentation to these functions can be found in `symbol.rs`.

r? @matthewjasper

4 years agoRollup merge of #69867 - ayushmishra2005:doc/61137-add-long-error-code-e0628, r=Dylan-DPC
Dylan DPC [Mon, 16 Mar 2020 12:16:42 +0000 (13:16 +0100)]
Rollup merge of #69867 - ayushmishra2005:doc/61137-add-long-error-code-e0628, r=Dylan-DPC

Add long error explanation for E0628

Add long explanation for the E0628 error code
Part of #61137

r? @GuillaumeGomez

4 years agoRollup merge of #69738 - mark-i-m:assoc-fn-2, r=eddyb
Dylan DPC [Mon, 16 Mar 2020 12:16:40 +0000 (13:16 +0100)]
Rollup merge of #69738 - mark-i-m:assoc-fn-2, r=eddyb

More Method -> AssocFn renaming

r? @Centril @eddyb

cc #60163

Blocked on #69674

4 years agoRollup merge of #69520 - kornelski:e69492, r=cramertj
Dylan DPC [Mon, 16 Mar 2020 12:16:38 +0000 (13:16 +0100)]
Rollup merge of #69520 - kornelski:e69492, r=cramertj

Make error message clearer about creating new module

This is a partial improvement for #69492

4 years agoRollup merge of #69122 - dtolnay:backtrace, r=cramertj
Dylan DPC [Mon, 16 Mar 2020 12:16:35 +0000 (13:16 +0100)]
Rollup merge of #69122 - dtolnay:backtrace, r=cramertj

Backtrace Debug tweaks

- Change Debug representation of disabled and unsupported backtraces to use \<placeholder\> style, same as what we do for debug printing locked mutexes and mutably borrowed refcells;

    ```diff
    - Error { msg: "...", backtrace: disabled backtrace }
    + Error { msg: "...", backtrace: <disabled> }
    ```

- Remove quotes around unresolved symbol names;

    ```diff
    - Backtrace [{ fn: "<unknown>" }]
    + Backtrace [{ fn: <unknown> }]
    ```

- Add quotes around file paths;

    ```diff
    - Backtrace [{ fn: "krate::main", file: /path/to/main.rs, line: 10 }]
    + Backtrace [{ fn: "krate::main", file: "/path/to/main.rs", line: 10 }]
    ```

- Add test.

4 years agoRollup merge of #67335 - ecstatic-morse:qualif-refactor, r=eddyb
Dylan DPC [Mon, 16 Mar 2020 12:16:30 +0000 (13:16 +0100)]
Rollup merge of #67335 - ecstatic-morse:qualif-refactor, r=eddyb

Refactor the `Qualif` trait

This PR attempts to preserve the existing semantics of the `Qualif` trait while reducing its API to two significant methods with descriptive names, `in_any_value_of_ty` and `in_adt_inherently`. The other `in_*` methods have been made into free functions, since they should never be overloaded. Finally, I changed the bounds on the `in_local` argument to be less restrictive (`FnMut` instead of `Fn`), which addresses a FIXME in the const-checker.

r? @eddyb
cc @pnkfelix @oli-obk

4 years agoAuto merge of #70010 - Amanieu:fix-opt-catch, r=Mark-Simulacrum
bors [Mon, 16 Mar 2020 08:08:51 +0000 (08:08 +0000)]
Auto merge of #70010 - Amanieu:fix-opt-catch, r=Mark-Simulacrum

Add a workaround for catch_unwind in stage1 mingw target

Fixes #70001

cc @petrochenkov

r? @Mark-Simulacrum

4 years agomake article_and_description primarily use def_kind
mark [Mon, 16 Mar 2020 04:31:17 +0000 (23:31 -0500)]
make article_and_description primarily use def_kind

4 years agoAuto merge of #70034 - Dylan-DPC:rollup-5yg771j, r=Dylan-DPC
bors [Mon, 16 Mar 2020 02:52:47 +0000 (02:52 +0000)]
Auto merge of #70034 - Dylan-DPC:rollup-5yg771j, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #69686 (Use `pprust` to print attributes in rustdoc)
 - #69858 (std: on Windows, use GetSystemTimePreciseAsFileTime if it is available)
 - #69917 (Cleanup E0412 and E0422)
 - #69964 (Add Node.js to PR CI image)
 - #69992 (Block version-specific docs from search engines)
 - #69995 (Add more context to the literal overflow message)
 - #69998 (Add long error explanation for E0634)
 - #70014 (Small fixes in rustdoc book)

Failed merges:

r? @ghost

4 years agoMethodData -> AssocFnData
Mark Mansi [Sun, 15 Mar 2020 16:19:17 +0000 (11:19 -0500)]
MethodData -> AssocFnData

4 years agoupdate comment
Mark Mansi [Sat, 7 Mar 2020 00:00:46 +0000 (18:00 -0600)]
update comment

4 years agoRollup merge of #70014 - TimotheeGerber:small-fix-rustdoc-book, r=Dylan-DPC
Dylan DPC [Mon, 16 Mar 2020 00:30:41 +0000 (01:30 +0100)]
Rollup merge of #70014 - TimotheeGerber:small-fix-rustdoc-book, r=Dylan-DPC

Small fixes in rustdoc book

I read the `rustdoc` book today and noticed some small typos/problems. Mainly:

 - `# fn foo() {}` was displayed when not needed because fenced block code type was `text` instead of `rust`;
 - two path separators were missing and some Windows-style separators were not consistent with the rest of them (mainly Linux-style).

Here are my proposed fixes. It is my first PR for the rust project. Don't hesitate to tell me if I am doing it wrong or if you need anything else.

Have a nice day!

4 years agoRollup merge of #69998 - ayushmishra2005:doc/61137-add-long-error-code-e0634, r=Dylan...
Dylan DPC [Mon, 16 Mar 2020 00:30:38 +0000 (01:30 +0100)]
Rollup merge of #69998 - ayushmishra2005:doc/61137-add-long-error-code-e0634, r=Dylan-DPC,GuillaumeGomez

Add long error explanation for E0634

Add long explanation for the E0634 error code
Part of #61137

r? @GuillaumeGomez

4 years agoRollup merge of #69995 - contrun:add-context-to-literal-overflow, r=ecstatic-morse
Dylan DPC [Mon, 16 Mar 2020 00:30:37 +0000 (01:30 +0100)]
Rollup merge of #69995 - contrun:add-context-to-literal-overflow, r=ecstatic-morse

Add more context to the literal overflow message

related to issue https://github.com/rust-lang/rust/issues/63733

4 years agoRollup merge of #69992 - kornelski:robots, r=steveklabnik
Dylan DPC [Mon, 16 Mar 2020 00:30:35 +0000 (01:30 +0100)]
Rollup merge of #69992 - kornelski:robots, r=steveklabnik

Block version-specific docs from search engines

Latest stable, beta and nightly URLs remain accessible because their URLs don't start with a version number. Robots.txt uses simple path prefixes, so it's OK that the disallow rules aren't full directory paths.

Direct links to old docs remain accessible to users, because robots.txt only affects crawlers.

With this change old docs for specific old versions of Rust won't pop up in search results. This is good, because users won't be getting obsolete documentation by accident.

4 years agoRollup merge of #69964 - ollie27:ci_nodejs, r=Mark-Simulacrum,GuillaumeGomez
Dylan DPC [Mon, 16 Mar 2020 00:30:33 +0000 (01:30 +0100)]
Rollup merge of #69964 - ollie27:ci_nodejs, r=Mark-Simulacrum,GuillaumeGomez

Add Node.js to PR CI image

This should allow the `rustdoc-js` and `rustdoc-js-std` test suites to run automatically on PRs.

4 years agoRollup merge of #69917 - GuillaumeGomez:cleanup-e0412, r=Dylan-DPC
Dylan DPC [Mon, 16 Mar 2020 00:30:31 +0000 (01:30 +0100)]
Rollup merge of #69917 - GuillaumeGomez:cleanup-e0412, r=Dylan-DPC

Cleanup E0412 and E0422

r? @Dylan-DPC

4 years agoRollup merge of #69858 - da-x:windows-precise-time, r=Dylan-DPC
Dylan DPC [Mon, 16 Mar 2020 00:30:28 +0000 (01:30 +0100)]
Rollup merge of #69858 - da-x:windows-precise-time, r=Dylan-DPC

std: on Windows, use GetSystemTimePreciseAsFileTime if it is available

This implements #67266.

4 years agoRollup merge of #69686 - varkor:rustdoc-attributes, r=GuillaumeGomez
Dylan DPC [Mon, 16 Mar 2020 00:30:24 +0000 (01:30 +0100)]
Rollup merge of #69686 - varkor:rustdoc-attributes, r=GuillaumeGomez

Use `pprust` to print attributes in rustdoc

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

I'm not sure what the original motivation was for the `render_attribute`, so I may be missing something, but replacing it with `pprust::attribute_to_string` seems to give the intended output (modulo some spacing idiosyncrasies).

r? @GuillaumeGomez

4 years agoMore Method->Fn renaming
Mark Mansi [Thu, 5 Mar 2020 15:57:34 +0000 (09:57 -0600)]
More Method->Fn renaming

4 years agohygiene: `modern` -> `normalize_to_macros_2_0`
Vadim Petrochenkov [Fri, 13 Mar 2020 22:36:46 +0000 (01:36 +0300)]
hygiene: `modern` -> `normalize_to_macros_2_0`

`modern_and_legacy` -> `normalize_to_macro_rules`

4 years agoOther `legacy` -> `macro_rules`
Vadim Petrochenkov [Fri, 13 Mar 2020 22:23:24 +0000 (01:23 +0300)]
Other `legacy` -> `macro_rules`

4 years agoresolve: `Legacy(Scope,Binding)` -> `MacroRules(Scope,Binding)`
Vadim Petrochenkov [Fri, 13 Mar 2020 22:06:36 +0000 (01:06 +0300)]
resolve: `Legacy(Scope,Binding)` -> `MacroRules(Scope,Binding)`

4 years agoast/hir: `MacroDef::legacy` -> `MacroDef::macro_rules`
Vadim Petrochenkov [Fri, 13 Mar 2020 21:52:24 +0000 (00:52 +0300)]
ast/hir: `MacroDef::legacy` -> `MacroDef::macro_rules`

4 years agoAuto merge of #68944 - Zoxc:hir-map, r=eddyb
bors [Sun, 15 Mar 2020 20:40:16 +0000 (20:40 +0000)]
Auto merge of #68944 - Zoxc:hir-map, r=eddyb

Use queries for the HIR map

r? @eddyb cc @michaelwoerister

4 years agoBump the bootstrap compiler
Jonas Schievink [Sun, 15 Mar 2020 18:43:25 +0000 (19:43 +0100)]
Bump the bootstrap compiler

4 years agoVariantSizeDifferences: bail on SizeOverflow
Mazdak Farrokhzad [Tue, 10 Mar 2020 09:10:10 +0000 (10:10 +0100)]
VariantSizeDifferences: bail on SizeOverflow

4 years agoAuto merge of #70024 - Centril:rollup-cppmaxr, r=Centril
bors [Sun, 15 Mar 2020 17:27:47 +0000 (17:27 +0000)]
Auto merge of #70024 - Centril:rollup-cppmaxr, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #69528 (Add undo_leak to reset RefCell borrow state)
 - #69589 (ast: `Mac`/`Macro` -> `MacCall`)
 - #69661 (Implement From<&mut str> for String)
 - #69988 (rustc_metadata: Remove `rmeta::MacroDef`)
 - #70006 (resolve: Fix two issues in fresh binding disambiguation)
 - #70011 (def_collector: Fully visit async functions)
 - #70013 (Return feature gate as a `Symbol` )
 - #70018 (Fix "since" field for `Once::is_complete`'s `#[stable]` attribute)

Failed merges:

r? @ghost

4 years agoAdd FIXME note
varkor [Tue, 3 Mar 2020 23:47:13 +0000 (23:47 +0000)]
Add FIXME note

4 years agoRender full attributes in rustdoc
varkor [Tue, 3 Mar 2020 23:41:32 +0000 (23:41 +0000)]
Render full attributes in rustdoc

4 years agoRollup merge of #70018 - LukasKalbertodt:fix-once-is-complete-since, r=Centril
Mazdak Farrokhzad [Sun, 15 Mar 2020 14:40:15 +0000 (15:40 +0100)]
Rollup merge of #70018 - LukasKalbertodt:fix-once-is-complete-since, r=Centril

Fix "since" field for `Once::is_complete`'s `#[stable]` attribute

It was accidentally merged with the wrong version in #68945.  Thanks @jplatte for noticing.

This also needs to be beta backported.

4 years agoRollup merge of #70013 - ecstatic-morse:check-consts-feature-gate, r=oli-obk
Mazdak Farrokhzad [Sun, 15 Mar 2020 14:40:13 +0000 (15:40 +0100)]
Rollup merge of #70013 - ecstatic-morse:check-consts-feature-gate, r=oli-obk

Return feature gate as a `Symbol`

A minor refactoring that will be needed for #68940. That PR is blocked on me changing the error comments in a whole lot of UI tests.

r? @oli-obk

4 years agoRollup merge of #70011 - petrochenkov:asyncice, r=Centril
Mazdak Farrokhzad [Sun, 15 Mar 2020 14:40:12 +0000 (15:40 +0100)]
Rollup merge of #70011 - petrochenkov:asyncice, r=Centril

def_collector: Fully visit async functions

We forgot to visit attributes previously, it caused ICEs.

Special treatment of async functions is also moved from `visit_item` to `visit_fn` to reuse more of the default visitor.

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

4 years agoRollup merge of #70006 - petrochenkov:fresh, r=Centril
Mazdak Farrokhzad [Sun, 15 Mar 2020 14:40:10 +0000 (15:40 +0100)]
Rollup merge of #70006 - petrochenkov:fresh, r=Centril

resolve: Fix two issues in fresh binding disambiguation

Prevent fresh bindings from shadowing ambiguity items.
Fixes https://github.com/rust-lang/rust/issues/46079

Correctly treat const generic parameters in fresh binding disambiguation.
Fixes https://github.com/rust-lang/rust/issues/68853

4 years agoRollup merge of #69988 - petrochenkov:nomacrodef, r=Centril
Mazdak Farrokhzad [Sun, 15 Mar 2020 14:40:08 +0000 (15:40 +0100)]
Rollup merge of #69988 - petrochenkov:nomacrodef, r=Centril

rustc_metadata: Remove `rmeta::MacroDef`

And other related cleanups.

Follow-up to https://github.com/rust-lang/rust/pull/66364.
r? @Centril

4 years agoRollup merge of #69661 - lopopolo:string-from-mut-str, r=sfackler
Mazdak Farrokhzad [Sun, 15 Mar 2020 14:40:07 +0000 (15:40 +0100)]
Rollup merge of #69661 - lopopolo:string-from-mut-str, r=sfackler

Implement From<&mut str> for String

I ran into this missing impl when trying to do `String::from` on the result returned from this API in the `uuid` crate:

https://docs.rs/uuid/0.8.1/uuid/adapter/struct.Hyphenated.html#method.encode_lower

I wasn't sure what to put in the stability annotation. I'd appreciate some help with that :)

4 years agoRollup merge of #69589 - petrochenkov:maccall, r=Centril
Mazdak Farrokhzad [Sun, 15 Mar 2020 14:40:05 +0000 (15:40 +0100)]
Rollup merge of #69589 - petrochenkov:maccall, r=Centril

ast: `Mac`/`Macro` -> `MacCall`

It's now obvious that these refer to macro calls rather than to macro definitions.

It's also a single name instead of two different names in different places.

`rustc_expand` usually calls macro calls in a wide sense (including attributes and derives) "macro invocations", but structures and variants renamed in this PR are only relevant to fn-like macros, so it's simpler and clearer to just call them calls.

cc https://github.com/rust-lang/rust/pull/63586#discussion_r314232513
r? @eddyb

4 years agoRollup merge of #69528 - HeroicKatora:finalize-ref-cell, r=dtolnay
Mazdak Farrokhzad [Sun, 15 Mar 2020 14:40:03 +0000 (15:40 +0100)]
Rollup merge of #69528 - HeroicKatora:finalize-ref-cell, r=dtolnay

Add undo_leak to reset RefCell borrow state

This method is complementary for the feature cell_leak added in an
earlier PR. It allows *safely* reverting the effects of leaking a borrow guard by
statically proving that such a guard could not longer exist. This was
not added to the existing `get_mut` out of concern of impacting the
complexity of the otherwise pure pointer cast and because the name
`get_mut` poorly communicates the intent of resetting remaining borrows.

This is a follow-up to #68712 and uses the same tracking issue, #69099,
as these methods deal with the same mechanism and the idea came up
[in a review comment](https://github.com/rust-lang/rust/pull/68712#discussion_r384670041).

@dtolnay who reviewed the prior PR.
cc @RalfJung

4 years agoAuto merge of #69961 - RalfJung:miri, r=RalfJung
bors [Sun, 15 Mar 2020 14:18:14 +0000 (14:18 +0000)]
Auto merge of #69961 - RalfJung:miri, r=RalfJung

update miri

r? @ghost
Cc @oli-obk

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

4 years agoConsider well-formed predicates in min-specialization
Matthew Jasper [Mon, 9 Mar 2020 21:59:13 +0000 (21:59 +0000)]
Consider well-formed predicates in min-specialization

4 years agoUse min_specialization in libstd and libproc_macro
Matthew Jasper [Sat, 8 Feb 2020 20:54:33 +0000 (20:54 +0000)]
Use min_specialization in libstd and libproc_macro

4 years agoImplement soundness check for min_specialization
Matthew Jasper [Sat, 8 Feb 2020 20:14:02 +0000 (20:14 +0000)]
Implement soundness check for min_specialization

4 years agoAvoid ICEs when we emit errors constructing the specialization graph
Matthew Jasper [Sat, 8 Feb 2020 20:10:06 +0000 (20:10 +0000)]
Avoid ICEs when we emit errors constructing the specialization graph

4 years agoAdd attributes to allow specializing on traits
Matthew Jasper [Sat, 8 Feb 2020 17:56:25 +0000 (17:56 +0000)]
Add attributes to allow specializing on traits

4 years agoAdd `min_specialization` feature
Matthew Jasper [Sat, 8 Feb 2020 17:07:36 +0000 (17:07 +0000)]
Add `min_specialization` feature

Currently the only difference between it and `specialization` is that
it only allows specializing functions.

4 years agoAuto merge of #70016 - Dylan-DPC:rollup-5k7lxs3, r=Dylan-DPC
bors [Sun, 15 Mar 2020 10:52:37 +0000 (10:52 +0000)]
Auto merge of #70016 - Dylan-DPC:rollup-5k7lxs3, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #69357 (Emit 1-based column numbers in debuginfo)
 - #69471 (Remove `sip::Hasher::short_write`.)
 - #69498 (Change "method" to "associated function")
 - #69967 (Remove a few `Rc`s from RegionInferenceCtxt)
 - #69987 (Add self to .mailmap)
 - #69991 (fix E0117 message out of sync)
 - #69993 (Add long error explanation for E0693)

Failed merges:

r? @ghost

4 years agoupdate miri
Ralf Jung [Sun, 15 Mar 2020 10:51:09 +0000 (11:51 +0100)]
update miri

4 years agoresolve: Prevent fresh bindings from shadowing ambiguity items
Vadim Petrochenkov [Sat, 14 Mar 2020 16:44:11 +0000 (19:44 +0300)]
resolve: Prevent fresh bindings from shadowing ambiguity items

Correctly treat const generic parameters in fresh binding disambiguation

4 years agoFix "since" field for `Once::is_complete`'s `#[stable]` attribute
Lukas Kalbertodt [Sun, 15 Mar 2020 09:19:26 +0000 (10:19 +0100)]
Fix "since" field for `Once::is_complete`'s `#[stable]` attribute

It was accidentally merged with the wrong version.

4 years agoAdd more context to the literal overflow message
YI [Sat, 14 Mar 2020 03:57:04 +0000 (11:57 +0800)]
Add more context to the literal overflow message

4 years agoRollup merge of #69993 - ayushmishra2005:doc/61137-add-long-error-code-e0693, r=Dylan-DPC
Dylan DPC [Sun, 15 Mar 2020 01:44:23 +0000 (02:44 +0100)]
Rollup merge of #69993 - ayushmishra2005:doc/61137-add-long-error-code-e0693, r=Dylan-DPC

Add long error explanation for E0693

Add long explanation for the E0693 error code
Part of #61137

r? @GuillaumeGomez

4 years agoRollup merge of #69991 - contrun:fix-69980, r=Dylan-DPC
Dylan DPC [Sun, 15 Mar 2020 01:44:22 +0000 (02:44 +0100)]
Rollup merge of #69991 - contrun:fix-69980, r=Dylan-DPC

fix E0117 message out of sync

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

4 years agoRollup merge of #69987 - kraai:mailmap, r=nikomatsakis
Dylan DPC [Sun, 15 Mar 2020 01:44:20 +0000 (02:44 +0100)]
Rollup merge of #69987 - kraai:mailmap, r=nikomatsakis

Add self to .mailmap

The variants are only used for [rust-lang/rust-clippy](https://github.com/rust-lang/rust-clippy), but it seems like <https://thanks.rust-lang.org/> only uses this `.mailmap`.

4 years agoRollup merge of #69967 - mark-i-m:rinfctx, r=matthewjasper
Dylan DPC [Sun, 15 Mar 2020 01:44:18 +0000 (02:44 +0100)]
Rollup merge of #69967 - mark-i-m:rinfctx, r=matthewjasper

Remove a few `Rc`s from RegionInferenceCtxt

fixes https://github.com/rust-lang/rust/issues/55853

r? @matthewjasper

4 years agoRollup merge of #69498 - mark-i-m:describe-it-2, r=matthewjasper
Dylan DPC [Sun, 15 Mar 2020 01:44:17 +0000 (02:44 +0100)]
Rollup merge of #69498 - mark-i-m:describe-it-2, r=matthewjasper

Change "method" to "associated function"

r? @matthewjasper

cc @Centril @eddyb #67742

I'm opening this mostly as a test to see what the diagnostic changes would be. It seems that this makes them somewhat more verbose, and I'm not sure it's worth it...

The relevant changes are the last two commits (it is rebased on top of #67742)

4 years agoRollup merge of #69471 - nnethercote:rm-sip-Hasher-short_write, r=dtolnay
Dylan DPC [Sun, 15 Mar 2020 01:44:15 +0000 (02:44 +0100)]
Rollup merge of #69471 - nnethercote:rm-sip-Hasher-short_write, r=dtolnay

Remove `sip::Hasher::short_write`.

`sip::Hasher::short_write` is currently unused. It is called by
`sip::Hasher::write_{u8,usize}`, but those methods are also unused,
because `DefaultHasher`, `SipHasher` and `SipHasher13` don't implement
any of the `write_xyz` methods, so all their write operations end up
calling `sip::Hasher::write`.

(I confirmed this by inserting a `panic!` in `sip::Hasher::short_write`
and running the tests -- they all passed.)

The alternative would be to add all the missing `write_xyz` methods.
This does give some significant speed-ups, but it hurts compile times a
little in some cases. See #69152 for details. This commit does the
conservative thing and doesn't change existing behaviour.

r? @rust-lang/libs