9645 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
4f9651b854
Rollup merge of #66139 - euclio:pluralize, r=nagisa
use American spelling for `pluralize!`
2019-11-06 07:03:14 +01:00
Mazdak Farrokhzad
167b8fedd6
Rollup merge of #66086 - RalfJung:smallvec, r=nagisa
bump smallvec to 1.0

This includes https://github.com/servo/rust-smallvec/pull/162, fixing an unsoundness in smallvec.

See https://github.com/servo/rust-smallvec/pull/175 for the 1.0 release announcement.

Cc @mbrubeck @emilio
2019-11-06 07:03:08 +01:00
Mazdak Farrokhzad
a0b4b4dafa
Rollup merge of #65776 - nnethercote:rename-LocalInternedString-and-more, r=estebank
Rename `LocalInternedString` and more

This PR renames `LocalInternedString` as `SymbolStr`, removes an unnecessary `impl` from it, improves comments, and cleans up some `SymbolStr` uses.

r? @estebank
2019-11-06 07:03:01 +01:00
Mazdak Farrokhzad
409b2bf941
Rollup merge of #66098 - estebank:path-asciption-typo, r=Centril
Detect `::` -> `:` typo when involving turbofish

Fix #65569.
2019-11-06 03:28:15 +01:00
Mazdak Farrokhzad
f5c54896b9
Rollup merge of #66068 - euclio:null-emitter, r=estebank
use silent emitter for rustdoc highlighting pass

Partially addresses #63284.
2019-11-06 03:28:11 +01:00
Mazdak Farrokhzad
e5da1a12e7
Rollup merge of #66054 - petrochenkov:delspan, r=estebank
syntax: Avoid span arithmetic for delimiter tokens

The +/-1 logic is from the time where the whole group had a single span and the delimiter spans had to be calculated from it.
Now the delimiters have their own spans which are constructed by lexer or proc macro API and can be used directly.
If those spans are not perfect, then it should be fixed by tweaking the corresponding lexer logic rather than by trying to add or substract `1` from the span boundaries.

Fixes https://github.com/rust-lang/rust/issues/62524
r? @estebank
2019-11-06 03:28:09 +01:00
Mazdak Farrokhzad
5910116b17
Rollup merge of #65892 - pnkfelix:trim-special-derives, r=petrochenkov
Remove `PartialEq` and `Eq` from the `SpecialDerives`.

Now that PR #65519 landed, this is the follow-on work of removing `PartialEq` and `Eq` from the set of `SpecialDerives` .
2019-11-06 03:28:05 +01:00
Andy Russell
ad550b8ef3
use American spelling for pluralize! 2019-11-05 15:10:24 -05:00
Esteban Küber
a8ccbf5f2f Account for typo in turbofish and suggest :: 2019-11-05 10:29:54 -08:00
Felix S. Klock II
0dfe0ed8e1 Review feedback: Remove more stuff! Simplify simplify simplify! 2019-11-05 14:59:29 +01:00
Felix S. Klock II
7d7fbcb301 Remove PartialEq and Eq from the SpecialDerives. 2019-11-05 14:58:10 +01:00
Pietro Albini
6ad9f56316
Rollup merge of #66025 - petrochenkov:lohi, r=eddyb
`Span` cannot represent `span.hi < span.lo`

So we can remove the corresponding checks from various code
2019-11-05 14:37:01 +01:00
Esteban Küber
3bbfc7320b Detect :: -> : typo when involving turbofish 2019-11-04 16:19:55 -08:00
Ralf Jung
90b8d34c9f bump smallvec to 1.0 2019-11-04 15:59:09 +01:00
Andy Russell
d06a4ded13
use silent emitter for rustdoc highlighting pass 2019-11-03 22:19:34 -05:00
bors
f49f388713 Auto merge of #65838 - estebank:resilient-recovery, r=Centril
Reduce amount of errors given unclosed delimiter

When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it on a more granular way in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.

Fix #63690.
2019-11-04 02:30:45 +00:00
Vadim Petrochenkov
90f891d8ae syntax: Avoid span arithmetics for delimiter tokens 2019-11-03 14:58:12 +03:00
bors
f39205b5d9 Auto merge of #66004 - eddyb:revert-early-gate, r=petrochenkov
Partially revert the early feature-gatings added in #65742.

The intent here is to address #65860 ASAP (in time for beta, ideally), while leaving as much of #65742 around as possible, to make it easier to re-enable later.

Therefore, I've only kept the parts of the revert that re-add the old (i.e. non-early) feature-gating checks that were removed in #65742, and the test reverts.

I've disabled the new early feature-gating checks from #65742 entirely for now, but it would be easy to put them behind a `-Z` flag, or turn them into warnings, which would allow us to keep tests for both the early and late versions of the checks - assuming that's desirable.

cc @nikomatsakis @Mark-Simulacrum @Centril
2019-11-02 10:48:59 +00:00
Nicholas Nethercote
d0db290039 Remove the AsRef impl for SymbolStr.
Because it's highly magical, which goes against the goal of keeping
`SymbolStr` simple. Plus it's only used in a handful of places that
only require minor changes.
2019-11-02 09:01:02 +11:00
Nicholas Nethercote
b9cef6984b Simplify various Symbol use points.
Including removing a bunch of unnecessary `.as_str()` calls, and a bunch
of unnecessary sigils.
2019-11-02 09:01:02 +11:00
Nicholas Nethercote
5bc7084f7e Convert x.as_str().to_string() to x.to_string() where possible. 2019-11-02 09:01:00 +11:00
Vadim Petrochenkov
ecaa96418b Span cannot represent span.hi < span.lo
So we can remove the corresponding checks from various code
2019-11-01 23:40:07 +03:00
Tyler Mandry
1ea66850af
Rollup merge of #65995 - GuillaumeGomez:add-err-code-E0743, r=estebank
Add error code E0743 for "C-variadic has been used on a non-foreign function"

Fixes https://github.com/rust-lang/rust/issues/65967
2019-11-01 11:20:24 -07:00
Eduard-Mihai Burtescu
27e01a1f88 syntax: disable the new early feature-gatings added in #65742. 2019-10-31 19:34:06 +02:00
Eduard-Mihai Burtescu
803616a73d Revert "pre-expansion gate trait_alias."
This reverts commit 2d182b82ce5ecfe8090ba3d4e78f1cd72c072ef1.
2019-10-31 19:08:13 +02:00
Eduard-Mihai Burtescu
56d7bb2133 Revert "pre-expansion gate associated_type_bounds"
This reverts commit c17a1fd7d0ef0f1f546445d0c8bdb11be55e4be7.
2019-10-31 19:08:12 +02:00
Eduard-Mihai Burtescu
b05d36228e Revert "pre-expansion gate crate_visibility_modifier"
This reverts commit 04c661ba021730bc13d33c6d55cb9aad05026f36.
2019-10-31 19:08:12 +02:00
Eduard-Mihai Burtescu
8f1eb345ea Revert "pre-expansion gate const_generics"
This reverts commit 49cbfa1a6f6469ddbc0e88161e52104cc87aea9b.
2019-10-31 19:08:12 +02:00
Eduard-Mihai Burtescu
ada4a6430d Revert "pre-expansion gate decl_macro"
This reverts commit 1f470ceac2202ecffe8a15acc1139edb9ad4a03b.
2019-10-31 19:08:12 +02:00
Eduard-Mihai Burtescu
680089c2d9 Revert "pre-expansion gate box_patterns"
This reverts commit 2aff6b36d7ed5c25700669a92b4a43200ee0fe6b.
2019-10-31 19:08:11 +02:00
Eduard-Mihai Burtescu
4c48355c69 Revert "pre-expansion gate exclusive_range_pattern"
This reverts commit 665a876e307933c6480a6c55a3e38e88937aff2c.
2019-10-31 19:08:11 +02:00
Eduard-Mihai Burtescu
8645ac4218 Revert "pre-expansion gate try_blocks"
This reverts commit 1935ba658c576f14397c2c7a26a6642cf08f26a6.
2019-10-31 19:08:11 +02:00
Eduard-Mihai Burtescu
73bde2f0ce Revert "pre-expansion gate label_break_value"
This reverts commit 137ded8ab1edf5112c45e0b6854272ae2e9d3a6d.
2019-10-31 19:08:10 +02:00
Eduard-Mihai Burtescu
20bfff66a9 Revert "pre-expansion gate box_syntax"
This reverts commit e4ed8865786a787a7b0c045f7674569b6be0e9bc.
2019-10-31 19:08:10 +02:00
Eduard-Mihai Burtescu
4c947a26f2 Revert "pre-expansion gate type_ascription"
This reverts commit 15a6c09b6e8a977f2c6f5a73de01a20d00b37930.
2019-10-31 19:08:10 +02:00
Guillaume Gomez
5dfb167bf3 Create new error E0743 2019-10-31 10:39:38 +01:00
Esteban Küber
454e2aa8c9 Do not complain about missing fn main() in some cases 2019-10-30 12:05:26 -07:00
Esteban Küber
053a09529a Reduce ammount of errors given unclosed delimiter
When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it more granularly in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.
2019-10-30 12:05:17 -07:00
Guillaume Gomez
a212960a4b stabilize cfg(doctest) 2019-10-29 13:42:55 +01:00
Mazdak Farrokhzad
46063ed23f
Rollup merge of #65809 - roblabla:eficall-abi, r=nagisa
Add new EFIAPI ABI

Fixes #54527

Adds a new ABI, "efiapi", which reflects the calling convention as specified by [the current spec UEFI spec](https://uefi.org/sites/default/files/resources/UEFI%20Spec%202_7_A%20Sept%206.pdf#G6.999903). When compiling for x86_64, we should select the `win64` ABI, while on all other architectures (Itanium, x86, ARM and ARM64 and RISC-V), we should select the `C` ABI.

Currently, this is done by just turning it into the C ABI everywhere except on x86_64, where it's turned into the win64 ABI. Should we prevent this ABI from being used on unsupported architectures, and if so, how would this be done?
2019-10-29 04:08:23 +01:00
Mazdak Farrokhzad
42d4e261a1
Rollup merge of #65294 - varkor:lint-inline-prototype, r=matthewjasper
Lint ignored `#[inline]` on function prototypes

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

- Adds a `unused_attribute` lint for `#[inline]` on function prototypes.
- As a consequence, foreign items, impl items and trait items now have their attributes checked, which could cause some code to no longer compile (it was previously erroneously ignored).
2019-10-29 04:08:18 +01:00
Esteban Küber
e8016c2b13 review comments 2019-10-28 10:53:13 -07:00
Esteban Küber
1b0836df6f Tweak unexpected token wording 2019-10-28 10:53:13 -07:00
Esteban Küber
d673d0ac84 Use heuristics to recover parsing of missing ;
- Detect `,` and `:` typos where `;` was intended.
- When the next token could have been the start of a new statement,
  detect a missing semicolon.
2019-10-28 10:53:13 -07:00
bors
03a50ae9b8 Auto merge of #65188 - matthewjasper:stabilize-const-constructor, r=Centril
Stabilize `const_constructor`

# Stabilization proposal

I propose that we stabilize `#![feature(const_constructor)]`.

Tracking issue: https://github.com/rust-lang/rust/issues/61456
Version target: 1.40 (2019-11-05 => beta, 2019-12-19 => stable).

## What is stabilized

### User guide

Tuple struct and tuple variant constructors are now considered to be constant functions. As such a call expression where the callee has a tuple struct or variant constructor "function item" type can be called:

```rust
const fn make_options() {
    // These already work because they are special cased:
    Some(0);
    (Option::Some)(1);
    // These also work now:
    let f = Option::Some;
    f(2);
    {Option::Some}(3);
    <Option<_>>::Some(5);
}
```

### Motivation

Consistency with other `const fn`. Consistency between syntactic path forms.

This should also ensure that constructors implement `const Fn` traits and can be coerced to `const fn` function pointers, if they are introduced.

## Tests

* [ui/consts/const_constructor/const-construct-call.rs](0d75ab2293/src/test/ui/consts/const_constructor/const-construct-call.rs) - Tests various syntactic forms, use in both `const fn` and `const` items, and constructors in both the current and extern crates.
* [ui/consts/const_constructor/const_constructor_qpath.rs](1850dfcdab/src/test/ui/consts/const_constructor/const_constructor_qpath.rs) - Tests that type qualified paths to enum variants are also considered to be `const fn`.(#64247)

r? @oli-obk

Closes #61456
Closes  #64247
2019-10-28 07:38:49 +00:00
Mazdak Farrokhzad
83260d5c43
Rollup merge of #65792 - Centril:split-syntax-2, r=petrochenkov
rustc, rustc_passes: reduce deps on rustc_expand

Part of #65324.

r? @petrochenkov
2019-10-28 04:53:07 +01:00
Matthew Jasper
170718c93f Stabilize const_constructor 2019-10-27 21:25:35 +00:00
Mazdak Farrokhzad
fb12c70852 rustc, rustc_passes: don't depend on syntax_expand.
This is done by moving some data definitions to syntax::expand.
2019-10-27 17:05:57 +01:00
Mazdak Farrokhzad
16329402bf syntax/attr: reduce reliance on parser 2019-10-27 16:54:12 +01:00
Esteban Küber
93bb780e38 review comments and tweaks 2019-10-26 15:26:08 -07:00