5530030420
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 |
||
---|---|---|
.. | ||
bootstrap | ||
build_helper | ||
compiler-rt@f03ba5a4e8 | ||
doc | ||
driver | ||
etc | ||
grammar | ||
jemalloc@e058ca6616 | ||
liballoc | ||
liballoc_jemalloc | ||
liballoc_system | ||
libarena | ||
libbacktrace | ||
libcollections | ||
libcollectionstest | ||
libcompiler_builtins | ||
libcore | ||
libcoretest | ||
libflate | ||
libfmt_macros | ||
libgetopts | ||
libgraphviz | ||
liblibc@c95defce07 | ||
liblog | ||
libpanic_abort | ||
libpanic_unwind | ||
libproc_macro | ||
libproc_macro_plugin | ||
librand | ||
librustc | ||
librustc_back | ||
librustc_bitflags | ||
librustc_borrowck | ||
librustc_const_eval | ||
librustc_const_math | ||
librustc_data_structures | ||
librustc_driver | ||
librustc_errors | ||
librustc_incremental | ||
librustc_lint | ||
librustc_llvm | ||
librustc_metadata | ||
librustc_mir | ||
librustc_passes | ||
librustc_platform_intrinsics | ||
librustc_plugin | ||
librustc_privacy | ||
librustc_resolve | ||
librustc_save_analysis | ||
librustc_trans | ||
librustc_typeck | ||
librustc_unicode | ||
librustdoc | ||
libserialize | ||
libstd | ||
libsyntax | ||
libsyntax_ext | ||
libsyntax_pos | ||
libterm | ||
libtest | ||
libunwind | ||
llvm@8c9961a9cc | ||
rt | ||
rtstartup | ||
rust-installer@4f99485080 | ||
rustc | ||
rustllvm | ||
test | ||
tools | ||
Cargo.lock | ||
Cargo.toml | ||
stage0.txt |