Commit Graph

79019 Commits

Author SHA1 Message Date
Niko Matsakis
8a624b737a change PointerKind::Implicit to a note
`PointerKind` is included in `LoanPath` and hence forms part of the
equality check; this led to having two unequal paths that both
represent `*x`, depending on whether the `*` was inserted
automatically or explicitly. Bad mojo. The `note` field, in contrast,
is intended more-or-less primarily for this purpose of adding extra
data.
2018-05-31 10:17:51 -04:00
Matt Brubeck
72ab4b4f01 Add std/core to prelude if extern_prelude enabled
Fixes #50605
2018-05-31 06:37:53 -07:00
bors
ae2f299186 Auto merge of #51203 - nnethercote:obligations-2, r=michaelwoerister
Two minor `obligation_forest` tweaks.

Pretty minimal improvements, but improvements nonetheless.
2018-05-31 13:14:18 +00:00
Johannes Nixdorf
a8be9bdd7b Use builder.cargo() for cargo-vendor.
This makes it go through boostrap/bin/rustc.rs, so it will use
-crt-static if needed.
2018-05-31 12:03:29 +02:00
Johannes Nixdorf
ff8f226cab builder.cargo(): don't add "--target"/"--release" to cargo install
This is required to use builder.cargo for cargo-vendor.
2018-05-31 12:03:29 +02:00
Johannes Nixdorf
81687c4a7f Add a test for issue 36710.
This still expectedly fails for musl targets with +crt-static.
2018-05-31 12:01:50 +02:00
Johannes Nixdorf
665d6673d5 compiletest: escape CXX the same way as CC for MSVC 2018-05-31 12:01:50 +02:00
Johannes Nixdorf
55dab7c820 bootstrap: pass crt-static for the compiler host as well 2018-05-31 12:01:50 +02:00
Johannes Nixdorf
bcab14af3e bootstrap.py: respect crt-static
Bootstrap requires serde_derive, which needs proc-macro crate types, so
it won't work with crt-static.
2018-05-31 12:01:50 +02:00
Johannes Nixdorf
bf3b8df697 musl: don't use the included startfiles with -crt-static
This fixes (only for -crt-static) #36710.
2018-05-31 12:01:50 +02:00
bors
30cae58709 Auto merge of #51182 - eddyb:not-just-visibility, r=nikomatsakis
[MIR] Change "scopes" from "visibility scopes" to "source scopes".

These scopes are already used for source-oriented diagnostics, lint levels and unsafety checks.
This PR generalizes the naming around scopes, making the type `SourceScope`, and flips (across several commits) the relationship/priority between `LocalDecl`'s "visibility" and "syntactic" scopes.

r? @nikomatsakis
2018-05-31 08:55:09 +00:00
Oliver Schneider
06394518f8 Update miri submodule 2018-05-31 10:25:42 +02:00
Oliver Schneider
03474943ec ScalarPair for two element tuples was treated wrongly in closure calls 2018-05-31 10:22:45 +02:00
Oliver Schneider
823013349f Pull a layout computation out of a loop 2018-05-31 10:22:45 +02:00
Oliver Schneider
1236d57d84 Don't invalidate one byte beyond the end 2018-05-31 10:22:45 +02:00
Oliver Schneider
665866d398 Don't store the discriminant with the enum's type size 2018-05-31 10:22:45 +02:00
Oliver Schneider
e9b6355607 Update the miri submodule 2018-05-31 10:22:45 +02:00
bors
a47b2d09d6 Auto merge of #51127 - frewsxcv:frewsxcv-discriminant, r=GuillaumeGomez
Add doc link from discriminant struct to function.

None
2018-05-31 06:38:24 +00:00
Nicholas Nethercote
5adba8e9d9 Avoid an unnecessary match when lexing "<-". 2018-05-31 16:05:39 +10:00
Nicholas Nethercote
3af6291eff Tweak identifer lexing.
By calling `bump()` after getting the first char, to avoid a redundant
`ident_continue()` test on it.
2018-05-31 16:04:33 +10:00
Corey Farwell
1c883d6761 Add doc link from discriminant struct to function. 2018-05-30 23:25:30 -04:00
bors
e38554cd80 Auto merge of #51145 - petrochenkov:npbot, r=alexcrichton
resolve: Make sure indeterminate and inconsistent macro resolutions always generate errors

Addresses the issue described in https://github.com/rust-lang/rust/pull/50911#issuecomment-392560525

I haven't come up with a minimized reproduction yet, but confirmed that `npbot` now generates the correct error with `![feature(use_extern_macros)]`.
2018-05-31 03:18:00 +00:00
bors
c1287c0183 Auto merge of #51220 - nikomatsakis:issue-51008-false-positive-lifetime-must-be-declared, r=cramertj
reset anonymous-lifetime-mode as we enter `()` scopes

Background:

The anonymous lifetime mode is used to prohibit elided lifetimes where
they didn't used to be permitted, and instead require that `'_` be
used. For example:

```rust
impl Trait for Ref<T> { .. }
//             ^^^^^^ ERROR: should be `Ref<'_, T>`
```

When we are parsing the parts of the impl header, we enter into an alternate mode called `CreateParameter`. In this mode, we give an error for things like `Ref<T>`, but for elided lifetimes in a reference type like `&T` we make the elided lifetime into an in-band lifetime:

4f99f37b7e/src/librustc/hir/lowering.rs (L4017-L4035)

This was not intended to change behavior because we only enter into that mode in contexts where elision was not historically permitted. However, the problem is that we fail to reset the mode when we enter into bounds like `Fn(&u32)`, where elision *was* allowed -- the same occurs for fn types like `fn(&u32`). This PR restores the original mode in those contexts.

Fixes #51008

r? @cramertj
2018-05-31 01:06:33 +00:00
Nicholas Nethercote
a5ffcf6dd8 Inline NodeIndex methods.
Because they are small and hot.
2018-05-31 09:22:07 +10:00
Nicholas Nethercote
f46d0213e4 Remove ObligationForest::cache_list.
It's never used in a meaningful way.
2018-05-31 09:22:07 +10:00
bors
e1eed38fed Auto merge of #51138 - spastorino:add-polonius-compare-mode, r=pnkfelix
Add polonius compare mode

**This is now ready to review/merge**
2018-05-30 22:59:21 +00:00
bors
5d0631a643 Auto merge of #51215 - eddyb:visit-for-a-lifetime, r=nikomatsakis
rustc: don't visit lifetime parameters through visit_lifetime.

Ideally we'd also not use the `Lifetime` struct for parameters, but I'll leave that to @varkor (#48149).
Fixes #51185 (discovered while auditing all the `visit_lifetime` implementations).
r? @nikomatsakis
2018-05-30 20:34:23 +00:00
uuttff8
d6b8c67ee6
mod.rs isn't beautiful 2018-05-30 22:24:24 +03:00
Vadim Petrochenkov
345e7c3597 resolve: Make sure indeterminate and inconsistent macro resolutions always generate errors 2018-05-30 22:21:50 +03:00
gnzlbg
6c3ebcd223 make Layout's align a NonZeroUsize 2018-05-30 21:00:37 +02:00
Niko Matsakis
da69bbce68 also reset anon-param-mode for fn() types 2018-05-30 14:54:51 -04:00
Niko Matsakis
9acb351f57 reset the "anonymous lifetime mode" for parenthesized where clauses
Background:

The anonymous lifetime mode is used to prohibit elided lifetimes where
they didn't used to be permitted, and instead require that `'_` be
used. For example:

```rust
impl Trait for Ref<T> { .. }
//             ^^^^^^ ERROR: should be `Ref<'_, T>`
```

When we are parsing the parts of the impl header, we enter into an
alternate mode called `CreateParameter`. In this mode, we give an
error for things like `Ref<T>`, but for elided lifetimes in a
reference type like `&T` we make the elided lifetime into an in-band
lifetime:

4f99f37b7e/src/librustc/hir/lowering.rs (L4017-L4035)

This was not intended to change behavior because we only enter into
that mode in contexts where elision was not historically
permitted. However, the problem is that we fail to reset the mode when
we enter into bounds like `Fn(&u32)`, where elision *was* allowed --
the same occurs for fn types like `fn(&u32`). This PR restores the
original mode in those contexts.
2018-05-30 14:54:51 -04:00
Guillaume Girol
cb2a0d61ad std::fs::DirEntry.metadata(): use fstatat instead of lstat when possible 2018-05-30 20:52:30 +02:00
Santiago Pastorino
b39a1d6f1a
Run rustfmt 2018-05-30 14:36:23 -03:00
Santiago Pastorino
b970feedc2
Add compare-mode to x.py 2018-05-30 14:35:43 -03:00
Eduard-Mihai Burtescu
06d88cda08 rustc: rename mir::LocalDecl's syntactic_source_info to source_info. 2018-05-30 20:30:10 +03:00
Eduard-Mihai Burtescu
6c53972478 rustc: turn mir::LocalDecl's visibility_source_info into a SourceScope. 2018-05-30 20:30:10 +03:00
Eduard-Mihai Burtescu
3da186b67f rustc: use syntactic (instead of visibility) source info where appropriate. 2018-05-30 20:30:10 +03:00
Eduard-Mihai Burtescu
0895590c53 rustc: rename mir::LocalDecl's source_info to visibility_source_info. 2018-05-30 20:30:10 +03:00
Eduard-Mihai Burtescu
b10c157bd8 rustc: turn mir::LocalDecl's syntactic_scope into a SourceInfo. 2018-05-30 20:30:10 +03:00
Eduard-Mihai Burtescu
ca1ac6b6fb rustc: rename mir::SourceScopeInfo to mir::SourceScopeLocalData. 2018-05-30 20:30:09 +03:00
Eduard-Mihai Burtescu
85d44c4276 rustc: rename mir::VisibilityScope to mir::SourceScope. 2018-05-30 20:30:09 +03:00
Eduard-Mihai Burtescu
5c76b64546 rustc: don't visit lifetime parameters through visit_lifetime. 2018-05-30 20:29:38 +03:00
Eduard-Mihai Burtescu
a1433f2f88 syntax: remove overloading of fold_lifetime{,_def}{,s}. 2018-05-30 20:29:38 +03:00
Santiago Pastorino
9df0a41321
Add polonius compare mode 2018-05-30 14:03:31 -03:00
bors
fddb46eda3 Auto merge of #51100 - estebank:as-ref, r=oli-obk
Suggest using `as_ref` on some borrow errors [hack]

When encountering the following code:

```rust
struct Foo;
fn takes_ref(_: &Foo) {}
let ref opt = Some(Foo);

opt.map(|arg| takes_ref(arg));
```

Suggest using `opt.as_ref().map(|arg| takes_ref(arg));` instead.

This is a stop gap solution until we expand typeck to deal with these
cases in a more graceful way.

#43861
2018-05-30 16:48:53 +00:00
Esteban Küber
a19a03a31f Suggest using as_ref on some borrow errors [hack]
When encountering the following code:

```rust
struct Foo;
fn takes_ref(_: &Foo) {}
let ref opt = Some(Foo);

opt.map(|arg| takes_ref(arg));
```

Suggest using `opt.as_ref().map(|arg| takes_ref(arg));` instead.

This is a stop gap solution until we expand typeck to deal with these
cases in a more graceful way.
2018-05-30 09:47:09 -07:00
bors
74d09399c1 Auto merge of #50955 - steveklabnik:update-libbacktrace, r=alexcrichton
Update libbacktrace

We haven't updated libbacktrace in two years. This is just blindly updating to the latest HEAD; I'd like to see what travis says. It at least builds on my machine, running some tests...

This perpetuates the patches from https://github.com/rust-lang/rust/pull/30908
2018-05-30 14:19:15 +00:00
Alex Crichton
7c14a54bc8 Replace libbacktrace with a submodule
While we're at it update the `backtrace` crate from crates.io. It turns out that
the submodule's configure script has gotten a lot more finnicky as of late so
also switch over to using the `cc` crate manually which allows to avoid some
hacks around the configure script as well
2018-05-30 05:58:23 -07:00
Alex Crichton
1402a106bd std: Delete bundled libbacktrace module 2018-05-30 05:58:20 -07:00