Commit Graph

5315 Commits

Author SHA1 Message Date
Mazdak Farrokhzad 76db2e3cc4
Rollup merge of #67487 - GuillaumeGomez:rustdoc-mutability-removal, r=Centril
Rustdoc mutability removal

Fixes #67470.

As discussed in another PR, the `clean::Mutability` type in rustdoc is useless. So let's remove it!

r? @Centril
2019-12-22 19:46:10 +01:00
Mazdak Farrokhzad 97bee3a793
Rollup merge of #66877 - skinny121:const-eval-entry-points, r=oli-obk
Add simpler entry points to const eval for common usages.

I found the `tcx.const_eval` API to be complex/awkward to work with, because of the inherent complexity from all of the different situations it is called from. Though it mainly used in one of the following ways:
- Evaluates the value of a constant without any substitutions, e.g. evaluating a static, discriminant, etc.
- Evaluates the value of a resolved instance of a constant. this happens when evaluating unevaluated constants or normalising trait constants.
- Evaluates a promoted constant.

This PR adds three new functions `const_eval_mono`, `const_eval_resolve`, and `const_eval_promoted` to `TyCtxt`, which each cater to one of the three ways `tcx.const_eval`
 is normally used.
2019-12-22 19:46:07 +01:00
Guillaume Gomez 0d7a49d356 Implement PrintWithSpace trait on hir::Mutability 2019-12-22 13:31:47 +01:00
bors 26286c7ad0 Auto merge of #66931 - cjgillot:hirene-preamble, r=eddyb
Allocate HIR on an arena 1/4

This PR is the first in a series of 4, aiming at allocating the HIR on an arena, as a memory optimisation.

1. This first PR lays the groundwork and migrates some low-hanging fruits.
2. The second PR will migrate `hir::Expr`, `hir::Pat` and related.
3. The third PR will migrate `hir::Ty` and related.
4. The final PR will be dedicated to eventual cleanups.

In order to make the transition as gradual as possible, some lowering routines receive `Box`-allocated data and move it into the arena. This is a bit wasteful, but hopefully temporary.
Nonetheless, special care should be taken to avoid double arena allocations.

Work mentored by @Zoxc.
2019-12-22 10:30:51 +00:00
Camille GILLOT 42c03e4bb4 Use Arena inside hir::Mod. 2019-12-21 23:34:34 +01:00
Camille GILLOT e2526120f2 Use Arena inside hir::StructField. 2019-12-21 23:33:42 +01:00
Camille GILLOT 4f1c88be46 Use Arena inside hir::EnumDef. 2019-12-21 23:32:42 +01:00
Camille GILLOT 5fec1ca0ff Use Arena inside hir::ImplItem. 2019-12-21 23:31:47 +01:00
Camille GILLOT 0f7d77363b Use Arena inside hir::TraitItem. 2019-12-21 23:30:52 +01:00
Camille GILLOT acf33f2d6b Use Arena inside hir::ForeignItem. 2019-12-21 23:29:27 +01:00
Camille GILLOT 084e6722f9 Use Arena inside hir::Item. 2019-12-21 23:17:29 +01:00
Ben Lewis c010d843aa Add simpler entry points to const eval for common usages. 2019-12-22 11:15:16 +13:00
Camille GILLOT 4dc79f1f7d Use Arena inside hir::Crate. 2019-12-21 23:12:44 +01:00
Guillaume Gomez 5a0d747eef Remove clean::Mutability enum 2019-12-21 21:19:03 +01:00
Mazdak Farrokhzad b50c3b7ddf
Rollup merge of #67160 - matthewjasper:gat-generics, r=nikomatsakis
Make GATs less ICE-prone.

After this PR simple lifetime-generic associated types can now be used in a compiling program. There are two big limitations:

* #30472 has not been addressed in any way (see src/test/ui/generic-associated-types/iterable.rs)
* Using type- and const-generic associated types errors because bound types and constants aren't handled by trait solving.
    * The errors are technically non-fatal, but they happen in a [part of the compiler](4abb0ad273/src/librustc_typeck/lib.rs (L298)) that fairly aggressively stops compiling on errors.

closes #47206
closes #49362
closes #62521
closes #63300
closes #64755
closes #67089
2019-12-21 19:07:31 +01:00
Matthew Jasper e7b8bfe5b9 Fix rustdoc 2019-12-21 12:35:28 +00:00
Mazdak Farrokhzad a7aec3f207 1. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.
2. mir::Mutability -> ast::Mutability.
2019-12-20 22:22:44 +01:00
Mazdak Farrokhzad 55753a62cc
Rollup merge of #67336 - GuillaumeGomez:fix-js-error, r=Dylan-DPC
Fix JS error when loading page with search

For example when you load this page: https://doc.rust-lang.org/nightly/std/num/struct.NonZeroI8.html?search=foo, you get a nice JS error:

```
TypeError: ev is undefined
```

r? @kinnison
2019-12-16 17:33:13 +01:00
Guillaume Gomez 5f68732b04 Fix JS error when loading page with search 2019-12-15 21:27:25 +01:00
Niko Matsakis d286113024 Revert "Stabilize the `never_type`, written `!`."
This reverts commit 15c30ddd69.
2019-12-14 09:01:09 -05:00
Andy Russell 94630d4c8b
replace serialize with serde in rustdoc 2019-12-12 16:33:25 -05:00
Mazdak Farrokhzad 4c3e95e84b
Rollup merge of #67074 - ehuss:extern-options, r=petrochenkov
Add options to --extern flag.

This changes the `--extern` flag so that it can take a series of options that changes its behavior. The general syntax is `[opts ':'] name ['=' path]` where `opts` is a comma separated list of options. Two options are supported, `priv` which replaces `--extern-private` and `noprelude` which avoids adding the crate to the extern prelude.

```text
--extern priv:mylib=/path/to/libmylib.rlib
--extern noprelude:alloc=/path/to/liballoc.rlib
```

`noprelude` is to be used by Cargo's build-std feature in order to use `--extern` to reference standard library crates.

This also includes a second commit which adds the `aux-crate` directive to compiletest. I can split this off into a separate PR if desired, but it helps with defining these kinds of tests. It is based on #54020, and can be used in the future to replace and simplify some of the Makefile tests.
2019-12-11 10:10:44 +01:00
Yuki Okushi 5a2af97e77
Rollup merge of #67178 - GuillaumeGomez:move-non-clean-impls, r=kinnison
Move non clean impls items

This is another (and should be the last for the `clean` module) rustdoc cleanup.

I tried to follow the same commit pattern as the last one to make the review as easy as possible.

r? @kinnison
2019-12-11 04:33:03 +09:00
Yuki Okushi 071acdf88e
Rollup merge of #67152 - GuillaumeGomez:sort-auto-impls, r=kinnison
Sort auto trait and blanket implementations display

Fixes #63042

r? @kinnison
2019-12-11 04:32:59 +09:00
Guillaume Gomez f0babc8be4 Remove tidy comment 2019-12-10 10:42:03 +01:00
Guillaume Gomez 26b0bcb47c Remove useless comment 2019-12-09 18:06:11 +01:00
Guillaume Gomez e57338140d Move RegionTarget and RegionDeps where they into clean/auto_trait 2019-12-09 18:03:23 +01:00
Guillaume Gomez 8749550d5c Remove unused imports 2019-12-09 18:00:51 +01:00
Guillaume Gomez bc68976472 Fix usage of variants in clean/utils 2019-12-09 17:58:46 +01:00
Guillaume Gomez ae7e808f42 Make utils module public 2019-12-09 17:57:02 +01:00
Guillaume Gomez 596705b42f Fix missing imports 2019-12-09 17:53:42 +01:00
Guillaume Gomez 0c3067fcff Remove functions from clean/mod.rs 2019-12-09 17:46:35 +01:00
Guillaume Gomez 5d906ed971 Move clean functions to another file 2019-12-09 17:46:20 +01:00
Eric Huss 590dd7dfef Add options to --extern flag. 2019-12-09 08:08:13 -08:00
bors 14195e1f1d Auto merge of #66984 - GuillaumeGomez:move-clean-types, r=kinnison
Move clean types into their own file

This PR is just about moving clean types into their own files to make the code more clear and keep all `Clean` trait implementations on their own.

r? @kinnison
2019-12-08 22:44:01 +00:00
Guillaume Gomez 9e3e421ab3 Sort auto trait and blanket implementations display 2019-12-08 14:24:06 +01:00
Yuki Okushi afd9e95b8b
Rollup merge of #66959 - GuillaumeGomez:cfg-duplicates, r=eddyb
Remove potential cfgs duplicates

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

Before going any further (the issue seems to be linked to metadata as far as I can tell). Do you think this is the good place to do it or should it be done before?

r? @eddyb
2019-12-07 00:09:54 +09:00
bors 710a362dc7 Auto merge of #66828 - GuillaumeGomez:less-minification, r=kinnison
Less minification

The goal of this PR is to remove the minification process on the `search-index.js` file. It provides great result in term of space reduction but the computation time is far too long. I'll work on this issue and will put it back once it's fast enough.

cc @nox @lqd
r? @kinnison
2019-12-05 17:45:31 +00:00
Guillaume Gomez 12a267134e Remove unused constant 2019-12-04 13:13:59 +01:00
Guillaume Gomez e14eebb6bb Make Lifetime struct field public 2019-12-04 13:13:59 +01:00
Guillaume Gomez f5e0d0cc18 Make some formatting improvements 2019-12-04 13:13:59 +01:00
Guillaume Gomez 91e021a59c Make some private methods public 2019-12-04 13:13:59 +01:00
Guillaume Gomez db0e6cd562 fixup clean/types.rs imports 2019-12-04 13:13:59 +01:00
Guillaume Gomez 81e549cc76 remove code that doesn't belong in clean/types.rs 2019-12-04 13:13:59 +01:00
Guillaume Gomez a8ec6200df Remove potential cfgs duplicates 2019-12-04 11:53:33 +01:00
Guillaume Gomez 72fdce2d86 remove code that doesn't belong in clean/mod.rs anymore 2019-12-03 22:03:38 +01:00
Guillaume Gomez c0e78d6124 Create new types.rs file 2019-12-03 22:03:19 +01:00
Vadim Petrochenkov 537895535d syntax: Use `ast::MacArgs` for macro definitions 2019-12-02 21:56:34 +03:00
Guillaume Gomez 2d0f0ca25b Add missing backline 2019-12-02 11:25:27 +01:00
Guillaume Gomez 852079fbf2 minify theme.js as well 2019-12-02 10:25:36 +01:00