Commit Graph

83331 Commits

Author SHA1 Message Date
Oliver Schneider
8053f6319a Rebase fallout 2018-09-11 12:06:37 +02:00
Oliver Schneider
1ec86708ca Split CrateNum into an enum instead of having magic constants 2018-09-11 11:30:47 +02:00
Oliver Schneider
d1b5231aa7 Fix const eval of ZST index operations to make the static assertion work 2018-09-11 11:27:12 +02:00
Oliver Schneider
24dca6aeca Simplify Scope/ScopeData to have less chance of introducing UB or size increases 2018-09-11 11:27:12 +02:00
Oliver Schneider
88ebb95f46 only allow restricting scalar layouts 2018-09-11 11:25:51 +02:00
Oliver Schneider
833dc7e682 Address attribute naming and use Bound enum 2018-09-11 11:25:51 +02:00
Oliver Schneider
a2c924b5ae Satisfy tidy 2018-09-11 11:25:29 +02:00
Oliver Schneider
3828e9e16f Use the same way to specifiy the SCOPE_DATA_* constants as used for the MAX 2018-09-11 11:25:29 +02:00
Oliver Schneider
06a041cbd3 Forbid the upper indices of IndexVec indices to allow for niche optimizations 2018-09-11 11:25:28 +02:00
Oliver Schneider
d272e2f6e2 Get rid of the non_zero lang item in favour of arbitrary range specifications 2018-09-11 11:19:48 +02:00
bors
1f02f23263 Auto merge of #54113 - alexcrichton:update-cargo, r=Mark-Simulacrum
Update Cargo submodule

Bring in a few last-minute updates before the 1.30.0 release
2018-09-11 06:28:29 +00:00
bors
d6720cc810 Auto merge of #54092 - estebank:gotta-go-fast, r=nikomatsakis
Don't compute padding of braces unless they are unmatched

Follow up to #53949. Attempt to fix # #54083.

r? @nikomatsakis
2018-09-11 01:08:49 +00:00
Alex Crichton
00e6d54609 Update Cargo submodule
Bring in a few last-minute updates before the 1.30.0 release
2018-09-10 16:40:57 -07:00
bors
551244f05b Auto merge of #54093 - petrochenkov:noinner, r=alexcrichton
Feature gate non-builtin attributes in inner attribute position

Closes item 3 from https://github.com/rust-lang/rust/pull/50911#issuecomment-411605393
2018-09-10 17:18:27 +00:00
bors
3c3e372e18 Auto merge of #54000 - jkozlowski:fix-53174, r=cramertj
Allow named lifetimes in async functions.

- Fixes #53174

Code by @eddyb; @cramertj suggested I lift it off another change so we can fix #53174.

r? @cramertj
2018-09-10 12:58:04 +00:00
bors
595345419d Auto merge of #54011 - eddyb:anchored-in-the-future, r=petrochenkov
rustc_resolve: inject `uniform_paths` canaries regardless of the feature-gate, on Rust 2018.

This PR is an attempt at future-proofing "anchored paths" by emitting the same ambiguity errors that `#![feature(uniform_paths)]` would, with slightly changed phrasing (see added UI tests).

Also, on top of #54005, this PR allows this as well:
```rust
use crate_name;
use crate_name::foo;
```
In that any ambiguity between an extern crate and an import *of that same crate* is ignored.

r? @petrochenkov cc @aturon @Centril @joshtriplett
2018-09-10 10:28:53 +00:00
Eduard-Mihai Burtescu
d5da94a3b1 rustc_resolve: ignore uniform_paths canaries that resolve to an import of the same crate. 2018-09-10 11:48:46 +03:00
Eduard-Mihai Burtescu
0a33de04cf rustc_resolve: inject uniform_paths canaries regardless of the feature-gate, on Rust 2018. 2018-09-10 11:48:46 +03:00
bors
b8d45da274 Auto merge of #53565 - PramodBisht:issue/53359_b, r=estebank
#53359: putting multiple unresolved import on single line

r? @estebank
Here is WIP implementation of #53359
this PR have clubbed multiple unresolved imports into a single line.
I think still two things need to improve like giving specific `label message` for each span of multi_span(how we can do this?) and second we are getting a warning while compiling, stating something like `E0432` have been passed before.
2018-09-10 07:48:45 +00:00
bors
fb945f0ebb Auto merge of #53854 - davidtwco:issue-53668, r=nikomatsakis
if- and while-let-chains, take 2 - edition changes

Part of #53668.

r? @nikomatsakis
2018-09-10 04:05:14 +00:00
bors
fdcd4a4a45 Auto merge of #53936 - petrochenkov:2macpre, r=alexcrichton
resolve: Split macro prelude into built-in and user-defined parts

This is a refactoring that will help to remove `unshadowable_attrs` when https://github.com/rust-lang/rust/pull/53410 lands.

UPDATE: The second commit actually removes `unshadowable_attrs`.
2018-09-10 01:42:11 +00:00
Vadim Petrochenkov
62c7d78a9a resolve: Remove unshadowable_attrs 2018-09-10 04:04:51 +03:00
Vadim Petrochenkov
a25c841e88 resolve: Split macro prelude into built-in and user-defined parts 2018-09-10 04:00:48 +03:00
Vadim Petrochenkov
615eaba14b Feature gate non-builtin attributes in inner attribute position 2018-09-10 03:35:47 +03:00
Esteban Küber
014a56ca9c Don't compute padding of braces unless they are unmatched 2018-09-09 14:55:46 -07:00
bors
2d4e34ca8b Auto merge of #53778 - petrochenkov:shadrelax2, r=nikomatsakis
resolve: Relax shadowing restrictions on macro-expanded macros

Previously any macro-expanded macros weren't allowed to shadow macros from outer scopes.
Now only "more macro-expanded" macros cannot shadow "less macro-expanded" macros.
See comments to `fn may_appear_after` and added tests for more details and examples.

The functional changes are a21f6f588fc28c97533130ae44a6957b579ab58c and 46dd365ce9ca0a6b8653849b80267763c542842a, other commits are refactorings.
2018-09-09 21:00:55 +00:00
bors
f50b7758f4 Auto merge of #54057 - matthiaskrgr:stabilize-edition-plus-clippy, r=Mark-Simulacrum
Stabilize edition 2018; also updates Clippy, RLS and Cargo

Supersedes https://github.com/rust-lang/rust/pull/53999 , https://github.com/rust-lang/rust/pull/53935
Clippy build was failing there because crate_visibility_modifier feature was taken out of edition 2018 and clippy used it.
The clippy update enables the corresponding feature explicitly.

r? @Mark-Simulacrum
2018-09-09 16:09:39 +00:00
bors
40fc8ba5f9 Auto merge of #53902 - dtolnay:group, r=petrochenkov
proc_macro::Group::span_open and span_close

Before this addition, every delimited group like `(`...`)` `[`...`]` `{`...`}` has only a single Span that covers the full source location from opening delimiter to closing delimiter. This makes it impossible for a procedural macro to trigger an error pointing to just the opening or closing delimiter. The Rust compiler does not seem to have the same limitation:

```rust
mod m {
    type T =
}
```

```console
error: expected type, found `}`
 --> src/main.rs:3:1
  |
3 | }
  | ^
```

On that same input, a procedural macro would be forced to trigger the error on the last token inside the block, on the entire block, or on the next token after the block, none of which is really what you want for an error like above.

This commit adds `group.span_open()` and `group.span_close()` which access the Span associated with just the opening delimiter and just the closing delimiter of the group. Relevant to Syn as we implement real error messages for when parsing fails in a procedural macro: https://github.com/dtolnay/syn/issues/476.

```diff
  impl Group {
      fn span(&self) -> Span;
+     fn span_open(&self) -> Span;
+     fn span_close(&self) -> Span;
  }
```

Fixes #48187
r? @alexcrichton
2018-09-09 13:27:44 +00:00
Eric Huss
60be0686e0 merge cargo changes done by https://github.com/rust-lang/rust/pull/53935/
(done by matthiaskrgr, but I authored ehuss)
2018-09-09 12:42:43 +02:00
bors
df6ba0c4ac Auto merge of #53998 - eddyb:issue-53728, r=oli-obk
rustc_codegen_llvm: don't assume offsets are always aligned.

Fixes #53728 by taking into account not just overall type alignment and the field's alignment when determining whether a field is aligned or not ("packed"), but also the field's offset within the type.

Previously, rustc assumed that the offset was always at least as aligned as `min(struct.align, field.align)`. However, there's no real reason to have that assumption, and it obviously can't always be true after we implement `#[repr(align(N), pack(K))]`. There's also a case today where that assumption is not true, involving niche discriminants in enums:

Suppose that we have the code in #53728:
```Rust
#[repr(u16)]
enum DeviceKind {
    Nil = 0,
}

#[repr(packed)]
struct DeviceInfo {
    endianness: u8,
    device_kind: DeviceKind,
}

struct Wrapper {
    device_info: DeviceInfo,
    data: u32
}
```

Observe the layout of `Option<Wrapper>`. It has an alignment of 4 because of the `u32`. `device_info.device_kind` is a good niche field to use, which means the enum ends up with this layout:
```
size = 8
align = 4
fields = [
    { offset=1, type=u16 } // discriminant, .<Some>.device_info.device_kind
]
```

And here we have an discriminant with alignment 2 (`u16`) but offset 1.
2018-09-09 08:54:29 +00:00
David Tolnay
57d6ada91d
Rename sp_lo to sp_open 2018-09-08 23:47:42 -07:00
bors
3d2fc456a9 Auto merge of #53988 - eddyb:issue-53770, r=petrochenkov
rustc_resolve: only prepend CrateRoot to a non-keyword segment.

Fixes #53770 by treating `use` paths as absolute in a finer-grained manner, specifically:
```rust
use {a, crate::b, self::c, super::d};
```
Used to be interpreted as if it were (when `uniform_paths` is not enabled):
```rust
use ::{a, crate::b, self::c, super::d};
```
With this PR, the `CrateRoot` pseudo-keyword indicating an absolute path is only inserted when the first path segment is found (if it's not a keyword), i.e. the example behaves like:
```rust
use {::a, crate::b, self::c, super::d};
```
This should (finally) make `use {path};` fully equivalent to `use path;`.

r? @petrochenkov cc @cramertj @joshtriplett @nikomatsakis
2018-09-09 06:25:13 +00:00
bors
dac76020a5 Auto merge of #53960 - estebank:issue-51303, r=nagisa
Fix incorrect outer function type parameter message

Fix #51303.
2018-09-09 04:00:21 +00:00
David Tolnay
a1dd39e724
Track distinct spans for open and close delimiter 2018-09-08 19:01:48 -07:00
bors
004bc5a33c Auto merge of #53949 - estebank:unclosed-delim, r=nikomatsakis
Improve messages for un-closed delimiter errors
2018-09-09 01:36:58 +00:00
Matthias Krüger
3387f80ce3 submodules: update clippy, rls with crate visibility patches, also update cargo 2018-09-09 03:00:00 +02:00
Mark Rousskov
5af06768a9 Remove crate_visibility_modifier from 2018 edition 2018-09-09 02:28:13 +02:00
Mark Rousskov
4d1ec81811 Stabilize the 2018 edition 2018-09-09 02:28:13 +02:00
bors
0198a1ea45 Auto merge of #53909 - mikhail-m1:53643, r=nikomatsakis
Skip a shared borrow of a immutable local variables

issue #53643

r? @nikomatsakis
2018-09-08 19:57:14 +00:00
bors
968d95e940 Auto merge of #53903 - GabrielMajeri:opt-miri-array-slice, r=oli-obk
Optimize miri checking of integer array/slices

This pull request implements the optimization described in #53845 (the  `E-easy` part of that issue, not the refactoring). Instead of checking every element of an integral array, we can check the whole memory range at once.

r? @RalfJung
2018-09-08 17:36:09 +00:00
Pramod Bisht
21ba03e2b9 Fixed 53359: E0432 unresolved import on the same line is now emiting one diagnostic
Addressed estebank's comments for 53359
2018-09-08 15:11:04 +00:00
bors
b24330fb7d Auto merge of #53705 - ms2300:tmp, r=oli-obk
#53576 Renaming TyAnon -> TyOpaque

Fixes #53576
2018-09-08 14:16:37 +00:00
bors
05cb29e96f Auto merge of #54051 - kennytm:rollup, r=kennytm
Rollup of 10 pull requests

Successful merges:

 - #53315 (use `NonZeroU32` in `newtype_index!`macro, change syntax)
 - #53932 ([NLL] Remove base_place)
 - #53942 (Rewrite `precompute_borrows_out_of_scope` for fewer hash table lookups.)
 - #53973 (Have rust-lldb look for the rust-enabled lldb)
 - #53981 (Implement initializer() for FileDesc)
 - #53987 (rustbuild: allow configuring llvm version suffix)
 - #53993 (rustc_resolve: don't record uniform_paths canaries as reexports.)
 - #54007 (crates that provide a `panic_handler` are exempt from the `unused_extern_crates` lint)
 - #54040 (update books for next release)
 - #54050 (Update `petgraph` dependency to 0.4.13 to fix build with nightly)
2018-09-08 11:53:21 +00:00
Vadim Petrochenkov
2dce3779bb resolve: More precise spans for ambiguous resolution errors
Add labels to ambiguous resolution errors
2018-09-08 14:15:11 +03:00
Vadim Petrochenkov
9beb5c3ef3 Add checks for expected macro output in restricted shadowing tests 2018-09-08 14:15:11 +03:00
Vadim Petrochenkov
ae2e5aa1c7 resolve: Further simplify legacy scopes, add comments 2018-09-08 14:15:11 +03:00
Vadim Petrochenkov
e00993a1ab Add test cases for possible restricted shadowing configurations
Whitelist `#[rustc_transparent_macro]` so it's not interpreted as a potential attribute macro
2018-09-08 14:15:11 +03:00
Vadim Petrochenkov
d26ae20507 resolve: Rename some fields related to legacy macro scopes 2018-09-08 14:15:11 +03:00
Vadim Petrochenkov
c057d579ab resolve: Relax shadowing restriction on macro-expanded macros
... for both legacy and modern macros.
Fix previously introduced regressions, add tests.
2018-09-08 14:15:11 +03:00
Vadim Petrochenkov
27235698f5 resolve: Introduce "may appear after" abstraction for macro path resolutions 2018-09-08 14:15:11 +03:00