Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #36030

Merged
merged 17 commits into from
Aug 27, 2016
Merged

Rollup of 7 pull requests #36030

merged 17 commits into from
Aug 27, 2016

Conversation

Aatch and others added 16 commits August 23, 2016 18:23
We want to catch this error:

```
if (foo)
    bar;
```

as it's valid syntax in other languages, and say how to fix it.
Unfortunately it didn't care if the suggestion made sense and just
highlighted the unexpected token.

Now it attempts to parse a statement, and if it succeeds, it shows the
help message.

Fixes rust-lang#35907
We originally imported this into the repository with the intent of
fixing it up. Instead, nothing happened.

Its appearance on rust-lang.org makes it seem semi-official, but it's
not. The rustfmt strike team will end up producing something like this
anyway, and leaving it around does nothing but mislead people.
Remove style guide.

We originally imported this into the repository with the intent of
fixing it up. Instead, nothing happened.

Its appearance on rust-lang.org makes it seem semi-official, but it's
not. The rustfmt strike team will end up producing something like this
anyway, and leaving it around does nothing but mislead people.

r? @aturon
Fix ICE when arg types can't be found in impl/trait methods while comparing

Fixes rust-lang#35869.
…=nrc

Improve error message when failing to parse a block

We want to catch this error:

```
if (foo)
    bar;
```

as it's valid syntax in other languages, and say how to fix it.
Unfortunately it didn't care if the suggestion made sense and just
highlighted the unexpected token.

Now it attempts to parse a statement, and if it succeeds, it shows the
help message.

Fixes rust-lang#35907
…akis

Combine types and regions in Substs into one interleaved list.

Previously, `Substs` would contain types and regions, in two separate vectors, for example:
```rust
<X as Trait<'a, 'b, A, B>>::method::<'p, 'q, T, U>
/* corresponds to */
Substs { regions: ['a, 'b, 'p, 'q], types: [X, A, B, T, U] }
```

This PR continues the work started in rust-lang#35605 by further removing the distinction.
A new abstraction over types and regions is introduced in the compiler, `Kind`.
Each `Kind` is a pointer (`&TyS` or `&Region`), with the lowest two bits used as a tag.
Two bits were used instead of just one (type = `0`, region = `1`) to allow adding more kinds.

`Substs` contain only a `Vec<Kind>`, with `Self` first, followed by regions and types (in the definition order):
```rust
Substs { params: [X, 'a, 'b, A, B, 'p, 'q, T, U] }
```
The resulting interleaved list has the property of being the concatenation of parameters for the (potentially) nested generic items it describes, and can be sliced back into those components:
```rust
params[0..5] = [X, 'a, 'b, A, B] // <X as Trait<'a, 'b, A, B>>
params[5..9] = ['p, 'q, T, U] // <_>::method::<'p, 'q, T, U>
```

r? @nikomatsakis
rustc_borrowck: Don't hash types in loan paths

1) Types for equal loan paths are not always equal, they can sometimes differ in lifetimes, making equal loan paths hash differently.

Example:
https://github.com/rust-lang/rust/blob/71bdeea561355ba5adbc9a1f44f4f866a75a15c4/src/libcollections/linked_list.rs#L835-L856

One of `self.list`s has type
```
&ReFree(CodeExtent(15013/CallSiteScope { fn_id: 18907, body_id: 18912 }), BrNamed(0:DefIndex(3066), 'a(397), WontChange)) mut linked_list::LinkedList<T>
```
and other has type
```
&ReScope(CodeExtent(15018/Remainder(BlockRemainder { block: 18912, first_statement_index: 0 }))) mut linked_list::LinkedList<T>
```
(... but I'm not sure it's not a bug actually.)

2) Not hashing types is faster than hashing types.

r? @arielb1
Replace unnecessary uses of `TraitObject` with casts

r? @alexcrichton
@rust-highfive
Copy link
Collaborator

r? @arielb1

(rust_highfive has picked a reviewer for you, use r? to override)

@Manishearth
Copy link
Member Author

@bors r+ p=20

@bors
Copy link
Contributor

bors commented Aug 27, 2016

📌 Commit 2b3921e has been approved by Manishearth

@bors
Copy link
Contributor

bors commented Aug 27, 2016

⌛ Testing commit 2b3921e with merge 0453d60...

@bors
Copy link
Contributor

bors commented Aug 27, 2016

💔 Test failed - auto-win-gnu-32-opt-rustbuild

@Manishearth
Copy link
Member Author

@bors r+

@bors
Copy link
Contributor

bors commented Aug 27, 2016

📌 Commit 96d523d has been approved by Manishearth

@Manishearth
Copy link
Member Author

@bors force

@bors
Copy link
Contributor

bors commented Aug 27, 2016

⌛ Testing commit 96d523d with merge bb2deff...

@bors
Copy link
Contributor

bors commented Aug 27, 2016

💔 Test failed - auto-win-msvc-32-opt

@Manishearth
Copy link
Member Author

@bors retry

@bors
Copy link
Contributor

bors commented Aug 27, 2016

⌛ Testing commit 96d523d with merge 6aac8b4...

@bors
Copy link
Contributor

bors commented Aug 27, 2016

💔 Test failed - auto-win-msvc-64-opt-rustbuild

@Manishearth
Copy link
Member Author

@bors retry

@Manishearth
Copy link
Member Author

@bors r+ force

@bors
Copy link
Contributor

bors commented Aug 27, 2016

📌 Commit 668d631 has been approved by Manishearth

@bors
Copy link
Contributor

bors commented Aug 27, 2016

⌛ Testing commit 668d631 with merge 099b9fd...

bors added a commit that referenced this pull request Aug 27, 2016
Rollup of 7 pull requests

- Successful merges: #35124, #35877, #35953, #36002, #36004, #36005, #36014
- Failed merges:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup
Projects
None yet
Development

Successfully merging this pull request may close these issues.