about summary refs log tree commit diff
path: root/src/test/run-pass/thinlto
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-10-27 18:18:56 -0700
committerGitHub <noreply@github.com>2016-10-27 18:18:56 -0700
commit5530030420d09588f32d6317cdd868e755621302 (patch)
treeeff8148f0d9f49d8a091c570eb67b539a3113fa3 /src/test/run-pass/thinlto
parent3f4408347d2109803edbf53c89c8bce575de4b67 (diff)
parent8a38928b44e26d4d7b9bdacb207a85878058cac8 (diff)
downloadrust-5530030420d09588f32d6317cdd868e755621302.tar.gz
rust-5530030420d09588f32d6317cdd868e755621302.zip
Auto merge of #37035 - petrochenkov:selfstruct, r=eddyb
Support `Self` in struct expressions and patterns

Struct expressions and patterns generally support type aliases `Alias { field: 10 }` i.e. they already have to work with `ty::Ty` to do their job. `Self` is a type alias (when it's not a type parameter) => struct expressions and patterns should support `Self`.

Typical example:
```
impl MyStruct {
    fn new() -> Self {
        Self { a: 10, b: "Hello" }
    }
}
```

The first commit does some preparations and cleanups, see the commit message for  details.
This also fixes couple of bugs related to aliases in struct paths (fixes https://github.com/rust-lang/rust/issues/36286).

EDIT:
Since struct expressions and patterns always work with `ty::Ty` now, associated paths in them are also supported. If associated type `A::B` successfully resolves to a struct (or union) type, then `A::B { /* fields */ }` is a valid expression/pattern. This will become more important when enum variants are treated as [associated items](https://github.com/rust-lang/rust/issues/26264#issuecomment-250603946).

r? @eddyb
Diffstat (limited to 'src/test/run-pass/thinlto')
0 files changed, 0 insertions, 0 deletions