Commit Graph

98044 Commits

Author SHA1 Message Date
Pascal Hertleif
c9d9616e82 Introduce and use Feature type for feature gates
This replaces the ad-hoc tuples used in the different feature gate files
and unifies their content into a common type, leading to more readable
matches and other good stuff that comes from having named fields. It
also contains the description of each feature as extracted from the doc
comment.
2019-08-25 11:07:16 +02:00
Pascal Hertleif
c9619a4202 Use doc comments for feature gate descriptions
This is just in preparation for future usage of these texts.
2019-08-24 17:47:26 +02:00
Pascal Hertleif
8ca9c7bbe5 Fix tidy feature gate error reporting
Feature gate definitions were split into multiple files in #63824 but
tidy kept reporting the hard-coded path. Now, it shows the full path
to the correct file.
2019-08-24 17:45:03 +02:00
bors
478464570e Auto merge of #63637 - alexcrichton:remove-libtest-step, r=Mark-Simulacrum
bootstrap: Merge the libtest build step with libstd

Since its inception rustbuild has always worked in three stages: one for
libstd, one for libtest, and one for rustc. These three stages were
architected around crates.io dependencies, where rustc wants to depend
on crates.io crates but said crates don't explicitly depend on libstd,
requiring a sysroot assembly step in the middle. This same logic was
applied for libtest where libtest wants to depend on crates.io crates
(`getopts`) but `getopts` didn't say that it depended on std, so it
needed `std` built ahead of time.

Lots of time has passed since the inception of rustbuild, however,
and we've since gotten to the point where even `std` itself is depending
on crates.io crates (albeit with some wonky configuration). This
commit applies the same logic to the two dependencies that the `test`
crate pulls in from crates.io, `getopts` and `unicode-width`. Over the
many years since rustbuild's inception `unicode-width` was the only
dependency picked up by the `test` crate, so the extra configuration
necessary to get crates building in this crate graph is unlikely to be
too much of a burden on developers.

After this patch it means that there are now only two build phasese of
rustbuild, one for libstd and one for rustc. The libtest/libproc_macro
build phase is all lumped into one now with `std`.

This was originally motivated by rust-lang/cargo#7216 where Cargo was
having to deal with synthesizing dependency edges but this commit makes
them explicit in this repository.
2019-08-24 05:39:52 +00:00
bors
c2f3174a27 Auto merge of #63824 - Centril:split-feature_gate, r=oli-obk
Refactor `feature_gate.rs` into modules & cleanup

Split `src/libsyntax/feature_gate.rs` into `src/libsyntax/feature_gate/` with files:
- `accepted.rs` (accepted feature gates)
- `removed.rs` (...)
- `active.rs` (...)
- `builtin_attrs.rs` (definition of builtin attributes and their gates as well as gating `cfg` flags)
- `check.rs` (post expansion checking of feature gates)
- `mod.rs` (just reexports)

Additionally, `tidy.rs` is adjusted to respect the new scheme.

Also, `builtin_attrs.rs` sees some cleanup, organization, and DSL-ification to reduce repetition.

This is probably best read commit-by-commit I think.

r? @oli-obk
2019-08-24 01:50:03 +00:00
Alex Crichton
b47c9690d2 bootstrap: Merge the libtest build step with libstd
Since its inception rustbuild has always worked in three stages: one for
libstd, one for libtest, and one for rustc. These three stages were
architected around crates.io dependencies, where rustc wants to depend
on crates.io crates but said crates don't explicitly depend on libstd,
requiring a sysroot assembly step in the middle. This same logic was
applied for libtest where libtest wants to depend on crates.io crates
(`getopts`) but `getopts` didn't say that it depended on std, so it
needed `std` built ahead of time.

Lots of time has passed since the inception of rustbuild, however,
and we've since gotten to the point where even `std` itself is depending
on crates.io crates (albeit with some wonky configuration). This
commit applies the same logic to the two dependencies that the `test`
crate pulls in from crates.io, `getopts` and `unicode-width`. Over the
many years since rustbuild's inception `unicode-width` was the only
dependency picked up by the `test` crate, so the extra configuration
necessary to get crates building in this crate graph is unlikely to be
too much of a burden on developers.

After this patch it means that there are now only two build phasese of
rustbuild, one for libstd and one for rustc. The libtest/libproc_macro
build phase is all lumped into one now with `std`.

This was originally motivated by rust-lang/cargo#7216 where Cargo was
having to deal with synthesizing dependency edges but this commit makes
them explicit in this repository.
2019-08-23 16:46:11 -07:00
bors
4993524682 Auto merge of #63814 - malbarbo:wasi-error-kind, r=alexcrichton
Implement decode_error_kind for wasi

Based on the implementation for unix targets,
2019-08-23 22:09:07 +00:00
bors
9eae1fc0ea Auto merge of #63819 - najamelan:patch-1, r=Centril
rustc docs: Update single-use-lifetimes

When using this, rustc emits a warning that the lint has been renamed (to having an 's' at the end)
2019-08-23 16:22:06 +00:00
Marco A L Barbosa
c8838efe35 Implement decode_error_kind for wasi
Based on the implementation for unix targets
2019-08-23 10:48:38 -03:00
bors
3def0f3d5b Auto merge of #63815 - sebastinez:sebastinez-doc-#63792, r=jonas-schievink
Update occurences of as_slice to as_str in comments

Fix #63792
2019-08-23 12:40:32 +00:00
bors
f834695781 Auto merge of #63521 - newpavlov:redox_builder, r=pietroalbini
Re-enable Redox builder (take 2)

Closes: #63160
2019-08-23 08:58:24 +00:00
bors
0507d49755 Auto merge of #63808 - Rosto75:master, r=KodrAus
A bunch of minor documentation tweaks and fixes.
2019-08-23 05:11:41 +00:00
bors
a71e32e407 Auto merge of #63801 - jeremystucki:patch-1, r=jonas-schievink
Update .mailmap
2019-08-23 01:27:58 +00:00
Mazdak Farrokhzad
3e061f7c49 --bless some tests due to message format change. 2019-08-23 01:42:05 +02:00
Mazdak Farrokhzad
3cfb6bc73a Fix tidy fallout due to feature_gate.rs refactoring. 2019-08-23 01:41:54 +02:00
Mazdak Farrokhzad
6febb75ec8 syntax: move feature_gate.rs. 2019-08-23 01:41:54 +02:00
Mazdak Farrokhzad
87eafd6c1b syntax: extract check.rs. 2019-08-23 01:41:49 +02:00
Mazdak Farrokhzad
e5aa2dd1ff builtin_attrs.rs: retain FIXMEs. 2019-08-23 01:41:13 +02:00
Mazdak Farrokhzad
d286fe0b8d builtin_attrs.rs: organize! 2019-08-23 01:41:04 +02:00
Mazdak Farrokhzad
584388c4aa builtin_attrs.rs: cleanup with (un)gated!. 2019-08-23 01:40:52 +02:00
Mazdak Farrokhzad
0d19d1d775 builtin_attrs.rs: refactor rustc_attrs entries. 2019-08-23 01:40:37 +02:00
Mazdak Farrokhzad
1c979ad552 builtin_attrs.rs: simplify cfg_fn. 2019-08-23 01:39:59 +02:00
Mazdak Farrokhzad
332a77e621 syntax: extract builin_attrs.rs. 2019-08-23 01:39:54 +02:00
Mazdak Farrokhzad
7afb2a82ec syntax: extract active.rs feature gates. 2019-08-23 01:39:44 +02:00
Mazdak Farrokhzad
975455b37d syntax: extract removed.rs feature gates. 2019-08-23 01:39:38 +02:00
Mazdak Farrokhzad
b873743c02 syntax: extract accepted.rs feature gates. 2019-08-23 01:39:29 +02:00
Naja Melan
98bd60c281
Update single-use-lifetimes
When using this, rustc emits a warning that the lint has been renamed (to having an 's' at the end)
2019-08-22 22:39:21 +00:00
bors
ee7161db98 Auto merge of #63522 - topecongiro:rustfmt-1.4.5, r=Centril
Update rustfmt to 1.4.5

This update includes a bug fix that fixes generating invalid code when formatting an impl block with const generics inside a where clause.

**Changes**
0462008de8...1de58ce46d
2019-08-22 21:51:14 +00:00
Sebastian Martinez
03507a1688
Update occurences of as_slice
Update occurences of as_slice to as_str
2019-08-22 16:16:22 -03:00
bors
760226733e Auto merge of #63807 - Centril:rollup-b8lo8ct, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #63624 (When declaring a declarative macro in an item it's only accessible inside it)
 - #63737 (Fix naming misspelling)
 - #63767 (Use more optimal Ord implementation for integers)
 - #63782 (Fix confusion in theme picker functions)
 - #63788 (Add amanjeev to rustc-guide toolstate)
 - #63796 (Tweak E0308 on opaque types)
 - #63805 (Apply few Clippy suggestions)

Failed merges:

r? @ghost
2019-08-22 18:06:31 +00:00
Tomasz Różański
d9f3258186 Fix for 7e13679. 2019-08-22 19:27:16 +02:00
Jeremy Stucki
2f790ee5d2
Update .mailmap 2019-08-22 16:47:42 +02:00
Mazdak Farrokhzad
3068064430
Rollup merge of #63805 - mati865:clippy, r=Centril
Apply few Clippy suggestions

Somewhat follow-up of https://github.com/rust-lang/rust/pull/62806

Changes per commit are rather small so I can squash them if that's preferred.
2019-08-22 15:15:45 +02:00
Mazdak Farrokhzad
aa9490bd7b
Rollup merge of #63796 - estebank:opaque_future, r=Centril
Tweak E0308 on opaque types

```
error[E0308]: if and else have incompatible types
  --> file.rs:21:9
   |
18 | /     if true {
19 | |         thing_one()
   | |         ----------- expected because of this
20 | |     } else {
21 | |         thing_two()
   | |         ^^^^^^^^^^^ expected opaque type, found a different opaque type
22 | |     }.await
   | |_____- if and else have incompatible types
   |
   = note: expected type `impl std::future::Future` (opaque type)
              found type `impl std::future::Future` (opaque type)
   = note: distinct uses of `impl Trait` result in different opaque types
   = help: if both futures resolve to the same type, consider `await`ing on both of them
```

r? @Centril
CC #63167
2019-08-22 15:15:43 +02:00
Mazdak Farrokhzad
6c1cdb75ab
Rollup merge of #63788 - mark-i-m:rustc-guide-toolstate-add, r=ehuss
Add amanjeev to rustc-guide toolstate

cc @amanjeev @spastorino

r? @ehuss
2019-08-22 15:15:42 +02:00
Mazdak Farrokhzad
1f56441a00
Rollup merge of #63782 - GuillaumeGomez:theme-switch-fix, r=kinnison
Fix confusion in theme picker functions

To reproduce the bug currently: click on the theme picker button twice (to show it then hide it). Then click anywhere else: the dropdown menu appears again.

The problem was coming from a confusion of what the `hideThemeButtonState` and `showThemeButtonState` were supposed to do. I switched their codes and updated the `switchThemeButtonState` function. It now works as expected.

r? @kinnison
2019-08-22 15:15:40 +02:00
Mazdak Farrokhzad
30fd79cb6c
Rollup merge of #63767 - lzutao:integer-ord-suboptimal, r=nagisa
Use more optimal Ord implementation for integers

Closes #63758
r? @nagisa

### Compare results

([godbolt link](https://godbolt.org/z/dsbczy))

Old assembly:
```asm
example::cmp1:
  mov eax, dword ptr [rdi]
  mov ecx, dword ptr [rsi]
  cmp eax, ecx
  setae dl
  add dl, dl
  add dl, -1
  xor esi, esi
  cmp eax, ecx
  movzx eax, dl
  cmove eax, esi
  ret
```

New assembly:
```asm
example::cmp2:
  mov eax, dword ptr [rdi]
  xor ecx, ecx
  cmp eax, dword ptr [rsi]
  seta cl
  mov eax, 255
  cmovae eax, ecx
  ret
```

Old llvm-mca statistics:
```
Iterations:        100
Instructions:      1100
Total Cycles:      243
Total uOps:        1300

Dispatch Width:    6
uOps Per Cycle:    5.35
IPC:               4.53
Block RThroughput: 2.2
```

New llvm-mca statistics:
```
Iterations:        100
Instructions:      700
Total Cycles:      217
Total uOps:        1100

Dispatch Width:    6
uOps Per Cycle:    5.07
IPC:               3.23
Block RThroughput: 1.8
```
2019-08-22 15:15:38 +02:00
Mazdak Farrokhzad
0784395912
Rollup merge of #63737 - HowJMay:fix_naming, r=jonas-schievink
Fix naming misspelling

Fixes #63734
2019-08-22 15:15:36 +02:00
Mazdak Farrokhzad
8a26ba77ef
Rollup merge of #63624 - estebank:unreachable-macro, r=petrochenkov
When declaring a declarative macro in an item it's only accessible inside it

Fix #63164.
r? @petrochenkov
2019-08-22 15:15:35 +02:00
Tomasz Różański
eae5d77995 Change variables names to be more consistent.
Changed all instances of `c_str` into `cstr` in the documentation examples. This is also consistent with the module source code.
2019-08-22 15:09:03 +02:00
Tomasz Różański
cdedd268d2 Make use of existing constants.
f32::consts::PI / 2.0 -> f32::consts::FRAC_PI_2
f32::consts::PI / 4.0 -> f32::consts::FRAC_PI_4
f64::consts::PI / 2.0 -> f64::consts::FRAC_PI_2
f64::consts::PI / 4.0 -> f64::consts::FRAC_PI_4
2019-08-22 14:59:31 +02:00
Tomasz Różański
3b04e91d27 Change code formatting for readability. 2019-08-22 14:27:51 +02:00
Tomasz Różański
49dce2935f Fix punctuation. 2019-08-22 13:14:42 +02:00
Tomasz Różański
7e13679cde Remove redundant mut. 2019-08-22 13:12:31 +02:00
Tomasz Różański
4ee6ee0daa Fix formatting. 2019-08-22 13:06:39 +02:00
Tomasz Różański
a078a34f05 Fix a typo. 2019-08-22 13:04:32 +02:00
Mateusz Mikuła
edabcddf4d Apply clippy::let_and_return suggestion 2019-08-22 12:02:02 +02:00
Mateusz Mikuła
7f4aba40fc Apply clippy::needless_return suggestions 2019-08-22 12:02:02 +02:00
Mateusz Mikuła
b7ad3f9fc4 Apply clippy::redundant_field_names suggestion 2019-08-22 12:02:02 +02:00
Jeremy Stucki
6ce242fb6e
Update .mailmap 2019-08-22 10:06:25 +02:00