Commit Graph

108770 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
7a7ca8238f
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
2020-03-17 12:16:16 +01:00
Mazdak Farrokhzad
c4a900f57c
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.
2020-03-17 12:16:14 +01:00
Mazdak Farrokhzad
91426e9666
Rollup merge of #69688 - JohnTitor:move-tidy, r=Mark-Simulacrum
Move tidy check to mingw-check

Fixes #69613
2020-03-17 12:16:12 +01:00
Mazdak Farrokhzad
8cf9e9efca
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.
2020-03-17 12:16:10 +01:00
Matthew Jasper
1ee5829575 Update tests for erasing regions in typeck 2020-03-17 09:07:56 +00:00
Matthew Jasper
0a7f16e7d8 Erase regions in writeback
Also skip duplicated region solving entirely with `-Zborrowck=mir`.
2020-03-17 09:07:56 +00:00
Matthew Jasper
cefd0305b1 Don't use TypeckTables in NiceRegionError
Regions in TypeckTables will be erased, so are unusable for error
reporting.
2020-03-17 08:46:56 +00:00
Matthew Jasper
5a9ccc9ce7 Remove free_region_map from TypeckTables
It was unused.
2020-03-17 08:46:56 +00:00
Eric Huss
194de274d3 Update books 2020-03-16 19:09:54 -07:00
bors
5e9ebf4da3 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
2020-03-17 02:06:21 +00:00
Mazdak Farrokhzad
f118fee02b
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
2020-03-17 03:05:20 +01:00
Mazdak Farrokhzad
4d7ec704cc
Rollup merge of #70046 - lzutao:patch-1, r=Centril
Use sublice patterns to avoid computing the len

r? @Centril
2020-03-17 03:05:19 +01:00
Mazdak Farrokhzad
f907598ba4
Rollup merge of #70029 - jonas-schievink:bootstrap, r=Centril
Bump the bootstrap compiler
2020-03-17 03:05:17 +01:00
Mazdak Farrokhzad
3d25622537
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.
2020-03-17 03:05:16 +01:00
Mazdak Farrokhzad
1b0c73baff
Rollup merge of #69881 - Centril:fix-69485, r=oli-obk
VariantSizeDifferences: bail on SizeOverflow

Fixes #69485.

r? @oli-obk
2020-03-17 03:05:14 +01:00
Mazdak Farrokhzad
9fc5c2d00d
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!();
    ```
2020-03-17 03:05:12 +01:00
Mazdak Farrokhzad
b691145bd4
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
2020-03-17 03:05:10 +01:00
12101111
afd374ff36 Ignore wasm32 2020-03-17 09:57:11 +08:00
Youngsuk Kim
442e5ff982
Small fixes in documentation
typo fix + markdown fix for consistency
2020-03-16 21:24:47 -04:00
Tim Vermeulen
8cf33b0d9d Add tests 2020-03-17 00:03:43 +01:00
Tim Vermeulen
cff1182bcd Fix FlattenCompat::{next, next_back} 2020-03-17 00:03:43 +01:00
Guillaume Gomez
9b85213610 Add missing variable to load in non-std tester as well 2020-03-16 21:50:04 +01:00
bors
e24252a12c 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
2020-03-16 20:49:26 +00:00
rojamd
f8870bfd63 Build dist-android with --enable-profiler 2020-03-16 15:29:10 -04:00
Matthias Krüger
7e2ebb0789 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
2020-03-16 19:06:15 +01:00
Oliver Scherer
7894509b00 Fiddle ParamEnv through to a place that used to use ParamEnv::empty in a buggy manner 2020-03-16 18:51:55 +01:00
Guillaume Gomez
496256c561 Update src/librustdoc/html/static/main.js
Fix variable name

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-03-16 18:30:26 +01:00
Guillaume Gomez
d964e60e4f Rename render::Type to improve naming 2020-03-16 18:30:26 +01:00
Guillaume Gomez
5654cde729 formatting 2020-03-16 18:30:26 +01:00
Guillaume Gomez
e78c451733 Add tests for new of variables 2020-03-16 18:30:26 +01:00
Guillaume Gomez
2f44857735 Update JS results tester 2020-03-16 18:29:19 +01:00
Guillaume Gomez
b9167e6c7d Support type search for arguments and returned types 2020-03-16 18:29:19 +01:00
Matthew Jasper
ec862703fd Make macro metavars respect (non-)hygiene 2020-03-16 17:13:48 +00:00
lzutao
e1bc9af9eb
Fix wrong deref 2020-03-16 23:54:32 +07:00
lzutao
ce5e49f86f
Use sublice patterns to avoid computing the len 2020-03-16 23:43:42 +07:00
Ralf Jung
a2160e6a4a make mem::{zeroed,uninitialized} inline(always) 2020-03-16 17:37:26 +01:00
bors
dd67187965 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
2020-03-16 16:31:23 +00:00
DutchGhost
0760803c06 rather than removing const_forget_box, stick an attribute on it and explain it cant be called in ctfe yet 2020-03-16 14:45:37 +01:00
Ralf Jung
996a51bcd0 init-large-type test needs optimizations 2020-03-16 14:38:33 +01:00
bors
59f4ba9504 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
2020-03-16 13:22:56 +00:00
DutchGhost
dcc23217b7 The const_forget_box was unused, and doesns't add anything to test by itself. 2020-03-16 13:24:59 +01:00
Dylan DPC
d8dbb3c041
Rollup merge of #70036 - mark-i-m:describe-it-4, r=eddyb
Make article_and_description primarily use def_kind

r? @eddyb

cc @matthewjasper
2020-03-16 13:16:45 +01:00
Dylan DPC
8872d90572
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
2020-03-16 13:16:44 +01:00
Dylan DPC
8f2482b801
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
2020-03-16 13:16:42 +01:00
Dylan DPC
0d7c82e7f2
Rollup merge of #69738 - mark-i-m:assoc-fn-2, r=eddyb
More Method -> AssocFn renaming

r? @Centril @eddyb

cc #60163

Blocked on #69674
2020-03-16 13:16:40 +01:00
Dylan DPC
1685264f12
Rollup merge of #69520 - kornelski:e69492, r=cramertj
Make error message clearer about creating new module

This is a partial improvement for #69492
2020-03-16 13:16:38 +01:00
Dylan DPC
2443eb46cf
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.
2020-03-16 13:16:35 +01:00
Dylan DPC
59b0058c0c
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
2020-03-16 13:16:30 +01:00
Camille GILLOT
5557407fbb Remove QueryState type alias. 2020-03-16 11:06:53 +01:00
Camille GILLOT
3abd4753b7 Make QueryCache parameters associated types. 2020-03-16 11:06:50 +01:00