]> git.lizzy.rs Git - rust.git/log
rust.git
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 agoAdd issue reference
Jonas Schievink [Tue, 17 Mar 2020 21:19:11 +0000 (22:19 +0100)]
Add issue reference

4 years agoDon't create AST fragments when lowering to HIR
Jonas Schievink [Wed, 4 Mar 2020 13:53:47 +0000 (14:53 +0100)]
Don't create AST fragments when lowering to HIR

4 years agoClarify comment
Jonas Schievink [Tue, 3 Mar 2020 16:04:35 +0000 (17:04 +0100)]
Clarify comment

4 years agoMake `ResumeTy` contents private
Jonas Schievink [Tue, 3 Mar 2020 15:05:11 +0000 (16:05 +0100)]
Make `ResumeTy` contents private

4 years agoSplit up large `FnDecl` expression
Jonas Schievink [Tue, 11 Feb 2020 11:03:52 +0000 (12:03 +0100)]
Split up large `FnDecl` expression

4 years agoRemove useless derives on `GenFuture`
Jonas Schievink [Tue, 11 Feb 2020 10:51:58 +0000 (11:51 +0100)]
Remove useless derives on `GenFuture`

Not sure why these were there, I guess because this type used
to kind of be part of public API?

4 years agoImprove comments in HIR lowering code
Jonas Schievink [Mon, 10 Feb 2020 17:59:21 +0000 (18:59 +0100)]
Improve comments in HIR lowering code

4 years agoFormat
Jonas Schievink [Mon, 10 Feb 2020 17:20:22 +0000 (18:20 +0100)]
Format

4 years agoTest that async/await compiles with `#![no_std]`
Jonas Schievink [Mon, 10 Feb 2020 16:35:58 +0000 (17:35 +0100)]
Test that async/await compiles with `#![no_std]`

4 years agoMake async/await lowering use resume arguments
Jonas Schievink [Mon, 10 Feb 2020 16:23:09 +0000 (17:23 +0100)]
Make async/await lowering use resume arguments

4 years agoImprove debug log in MIR type check
Jonas Schievink [Mon, 10 Feb 2020 16:22:29 +0000 (17:22 +0100)]
Improve debug log in MIR type check

4 years agoAdd futures scaffolding to libcore
Jonas Schievink [Mon, 10 Feb 2020 16:21:50 +0000 (17:21 +0100)]
Add futures scaffolding to libcore

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

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 agoAdd missing variable to load in non-std tester as well
Guillaume Gomez [Mon, 16 Mar 2020 20:50:04 +0000 (21:50 +0100)]
Add missing variable to load in non-std tester as well

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 agoUpdate src/librustdoc/html/static/main.js
Guillaume Gomez [Mon, 9 Mar 2020 13:47:24 +0000 (14:47 +0100)]
Update src/librustdoc/html/static/main.js

Fix variable name

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoRename render::Type to improve naming
Guillaume Gomez [Tue, 3 Mar 2020 14:53:16 +0000 (15:53 +0100)]
Rename render::Type to improve naming

4 years agoformatting
Guillaume Gomez [Sun, 23 Feb 2020 18:09:00 +0000 (19:09 +0100)]
formatting

4 years agoAdd tests for new of variables
Guillaume Gomez [Sun, 23 Feb 2020 17:23:52 +0000 (18:23 +0100)]
Add tests for new of variables

4 years agoUpdate JS results tester
Guillaume Gomez [Sun, 23 Feb 2020 17:23:09 +0000 (18:23 +0100)]
Update JS results tester

4 years agoSupport type search for arguments and returned types
Guillaume Gomez [Sun, 23 Feb 2020 01:38:33 +0000 (02:38 +0100)]
Support type search for arguments and returned types

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 agorather than removing const_forget_box, stick an attribute on it and explain it cant...
DutchGhost [Mon, 16 Mar 2020 13:45:37 +0000 (14:45 +0100)]
rather than removing const_forget_box, stick an attribute on it and explain it cant be called in ctfe yet

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 agoThe const_forget_box was unused, and doesns't add anything to test by itself.
DutchGhost [Mon, 16 Mar 2020 12:24:59 +0000 (13:24 +0100)]
The const_forget_box was unused, and doesns't add anything to test by itself.

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 agoRemove the call that makes miri fail
DutchGhost [Mon, 16 Mar 2020 09:51:00 +0000 (10:51 +0100)]
Remove the call that makes miri fail

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 agouse direct imports for `rustc::{lint, session}`.
Mazdak Farrokhzad [Wed, 11 Mar 2020 11:49:08 +0000 (12:49 +0100)]
use direct imports for `rustc::{lint, session}`.

4 years agoremove unnecessary hir::map imports
Mazdak Farrokhzad [Wed, 11 Mar 2020 11:05:32 +0000 (12:05 +0100)]
remove unnecessary hir::map imports

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 agorustc: tweak comments on InstanceDef.
Ana-Maria Mihalache [Wed, 11 Mar 2020 15:20:31 +0000 (15:20 +0000)]
rustc: tweak comments on InstanceDef.

4 years agorustc: don't resolve Instances which would produce malformed shims.
Eduard-Mihai Burtescu [Sun, 9 Feb 2020 00:39:14 +0000 (02:39 +0200)]
rustc: don't resolve Instances which would produce malformed shims.

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