Commit Graph

48792 Commits

Author SHA1 Message Date
Brian Anderson
c479e4e232 Bump to 1.7 2015-12-09 08:23:35 -08:00
Guillaume Gomez
1671af1394 Add E0269 error explanation 2015-12-09 16:25:17 +01:00
Alex Crichton
0a13f1abaf std: Rename thread::catch_panic to panic::recover
This commit is an implementation of [RFC 1236] and [RFC 1323] which
rename the `thread::catch_panic` function to `panic::recover` while also
replacing the `Send + 'static` bounds with a new `PanicSafe` bound.

[RFC 1236]: https://github.com/rust-lang/rfcs/pull/1236
[RFC 1323]: https://github.com/rust-lang/rfcs/pull/1323

cc #27719
2015-12-09 07:19:17 -08:00
Tianyi Wang
f13f488eb6 fixed a typo in comments
srong -> strong in liballoc/arc.rs
2015-12-09 23:18:24 +08:00
bors
eebf6743d8 Auto merge of #30140 - michaelwoerister:tls-encoding, r=nikomatsakis
With this commit, metadata encoding and decoding can make use of thread-local encoding and decoding contexts. These allow implementers of `serialize::Encodable` and `Decodable` to access information and
datastructures that would otherwise not be available to them. For example, we can automatically translate def-id and span information during decoding because the decoding context knows which crate the data is decoded from. Or it allows to make `ty::Ty` decodable because the context has access to the `ty::ctxt` that is needed for creating `ty::Ty` instances.

Some notes:
- `tls::with_encoding_context()` and `tls::with_decoding_context()` (as opposed to their unsafe versions) try to prevent the TLS data getting out-of-sync by making sure that the encoder/decoder passed in is actually the same as the one stored in the context. This should prevent accidentally reading from the wrong decoder.
- There are no real tests in this PR. I had a unit tests for some of the core aspects of the TLS implementation but it was kind of brittle, a lot of code for mocking `ty::ctxt`, `crate_metadata`, etc and did actually test not so much. The code will soon be tested by the first incremental compilation auto-tests that rely on MIR being properly serialized. However, if people think that some tests should be added before this can land, I'll try to provide some that make sense.

r? @nikomatsakis
2015-12-09 15:10:37 +00:00
Michael Woerister
f65823e39c Add scoped thread-local encoding and decoding contexts to cstore.
With this commit, metadata encoding and decoding can make use of
thread-local encoding and decoding contexts. These allow implementers
of serialize::Encodable and Decodable to access information and
datastructures that would otherwise not be available to them. For
example, we can automatically translate def-id and span information
during decoding because the decoding context knows which crate the
data is decoded from. Or it allows to make ty::Ty decodable because
the context has access to the ty::ctxt that is needed for creating
ty::Ty instances.
2015-12-09 09:47:32 -05:00
James Miller
93154dd29c Fix & ref ident patterns for DSTs
We shouldn't load DSTs when recursing into the sub-pattern of `& ref ident`.

Fixes #30277
2015-12-10 00:35:55 +13:00
bors
2e48b593ca Auto merge of #30266 - oli-obk:expr_type_checked, r=luqmana
r? @eefriedman

It was getting out of hand with my additions to the const evaluator
2015-12-09 11:14:58 +00:00
bors
9cadb2955f Auto merge of #30263 - pnkfelix:rsbegin-rsend-are-window-gnu-only, r=alexcrichton
The `rsbegin.o` and `rsend.o` build products should not be generated
on non WinGnu platforms.

This is another path to resolving #30063 for non win-gnu targets.
(And it won't require a snapshot, unlike PR #30208.)

r? @alexcrichton
2015-12-09 09:32:18 +00:00
bors
8951b3834b Auto merge of #30246 - untitaker:insaller, r=alexcrichton
None
2015-12-09 07:48:58 +00:00
bors
6f95ae6124 Auto merge of #30278 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #30201, #30224, #30261, #30273, #30274
- Failed merges:
2015-12-09 06:05:08 +00:00
Steve Klabnik
e78629eb5a Rollup merge of #30274 - tshepang:mere-renames, r=steveklabnik 2015-12-09 00:01:18 -05:00
Steve Klabnik
1f0f7d6fba Rollup merge of #30273 - Xmasreturns:patch-1, r=steveklabnik
Changes to readability and some clarifications for beginners
2015-12-09 00:01:17 -05:00
Steve Klabnik
7fc9a66a1c Rollup merge of #30261 - oli-obk:add_regression_test, r=pnkfelix
see https://github.com/rust-lang/rust/pull/30202/files#r46819188

r? @pnkfelix

the only difference between the tests is that one has the const_indexing feature enabled.
2015-12-09 00:01:17 -05:00
Steve Klabnik
ac2cb1fb7d Rollup merge of #30224 - matklad:super-docs, r=steveklabnik
Make clear that `super` may be included in the path several times.

r? @steveklabnik
2015-12-09 00:01:17 -05:00
Steve Klabnik
24a163344a Rollup merge of #30201 - GuillaumeGomez:patch-3, r=Manishearth
r? @Manishearth
2015-12-09 00:01:17 -05:00
bors
4005d43765 Auto merge of #30245 - Aatch:dynamic-align-dst, r=pnkfelix
Fixes #26403

This adjusts the pointer, if needed, to the correct alignment by using the alignment information in the vtable.

Handling zero might not be necessary, as it shouldn't actually occur. I've left it as it's own commit so it can be removed fairly easily if people don't think it's worth doing. The way it's handled though means that there shouldn't be much impact on performance.
2015-12-09 04:22:05 +00:00
bors
56a1f51ef0 Auto merge of #30208 - pnkfelix:fix-issue-30063, r=alexcrichton
When given `rustc -C codegen-units=4 --emit=obj`, reset units back to 1.

Fix #30063

Note: while this code is careful to handle the case of mutliple emit types (e.g. `--emit=asm,obj`) by reporting all the emit types that conflict with codegen units in its warnings, an invocation with multiple emit types *and* `-o PATH` will continue to ignore the requested target path (with a warning), as it already does today, since the code that checks for that is further downstream.  (Multiple emit types without `-o PATH` will "work", though it will downgrade codegen-units to 1 just like all the other cases.)

r? @alexcrichton
2015-12-09 02:38:57 +00:00
bors
462ec05764 Auto merge of #30145 - petrochenkov:hyg, r=nrc
Instead of `ast::Ident`, bindings, paths and labels in HIR now keep a new structure called `hir::Ident` containing mtwt-renamed `name` and the original not-renamed `unhygienic_name`. `name` is supposed to be used by default, `unhygienic_name` is rarely used.

This is not ideal, but better than the status quo for two reasons:
- MTWT tables can be cleared immediately after lowering to HIR
- This is less bug-prone, because it is impossible now to forget applying `mtwt::resolve` to a name. It is still possible to use `name` instead of `unhygienic_name` by mistake, but `unhygienic_name`s are used only in few very special circumstances, so it shouldn't be a problem.

Besides name resolution `unhygienic_name` is used in some lints and debuginfo. `unhygienic_name` can be very well approximated by "reverse renaming" `token::intern(name.as_str())` or even plain string `name.as_str()`, except that it would break gensyms like `iter` in desugared `for` loops. This approximation is likely good enough for lints and debuginfo, but not for name resolution, unfortunately (see https://github.com/rust-lang/rust/issues/27639), so `unhygienic_name` has to be kept.

cc https://github.com/rust-lang/rust/issues/29782

r? @nrc
2015-12-09 00:41:26 +00:00
Tshepang Lekhonkhobe
33d43c1e34 doc: these are just renames, so avoid duplication 2015-12-09 01:30:08 +02:00
Xmasreturns
88c407c74f Update traits.md 2015-12-08 14:56:42 -08:00
Xmasreturns
f5a4383b21 Update traits.md
Changes to readability and some clarifications for beginners
2015-12-08 14:38:55 -08:00
bors
37b35e962a Auto merge of #30271 - steveklabnik:reorder_book, r=aturon
This ordering was significantly more confusing.
2015-12-08 22:01:44 +00:00
Alex Crichton
9e0ff773ad std: Use mem::replace in TLS initialization
Due to #30228 it's not currently sound to do `*ptr = Some(value)`, so instead
use `mem::replace` which fixes the soundness hole for now.
2015-12-08 12:23:22 -08:00
bors
461c46052b Auto merge of #30036 - mitaa:doc_id, r=alexcrichton
This expands the code which generates unique IDs for Markdown headers within a single block to each rendered page.

fixes #25001
fixes #29449
2015-12-08 20:15:53 +00:00
Steve Klabnik
de39b2cada Re-order the sections in TRPL
This ordering was significantly more confusing.
2015-12-08 15:14:56 -05:00
Richard Diamond
3a6fd55fd1 Fix a typo in fd.rs. Fixes #30231. 2015-12-08 12:38:37 -06:00
bors
6941b2569a Auto merge of #29995 - DanielJCampbell:Expanded-Span-Printing, r=nrc
r? @nrc
2015-12-08 18:23:57 +00:00
Seo Sanghyeon
55ffc33b10 Warn no_mangle on generic functions 2015-12-09 01:48:40 +09:00
Oliver Schneider
240f68659a shorten common if let patterns to function calls 2015-12-08 16:05:41 +01:00
Oliver Schneider
b85311506d prettify some statements 2015-12-08 16:00:35 +01:00
Oliver Schneider
9a63bb6661 move ConstVal -> ValueRef translation to trans::consts 2015-12-08 14:59:45 +01:00
Felix S. Klock II
31d383fcd2 Remove STARTUP_OBJS from Makefile deps for non win-gnu targets.
The `rsbegin.o` and `rsend.o` build products should not be generated
on non WinGnu platforms.

This is another path to resolving #30063 for non win-gnu targets.
(And it won't require a snapshot, unlike PR #30208.)
2015-12-08 14:56:22 +01:00
Oliver Schneider
ace6fc3646 add tests for ensuring const indexing does not cause compile-time errors in runtime code 2015-12-08 11:10:50 +01:00
Felix S. Klock II
9b5b2e3f59 regression test for issue #30063 2015-12-08 05:39:00 +01:00
Felix S. Klock II
f90c21a417 When given rustc -C codegen-units=4 -o output --emit=obj, reset units back to 1.
Fix #30063

Note: while this code is careful to handle the case of mutliple emit
types (e.g. `--emit=asm,obj`) by reporting all the emit types that
conflict with codegen units in its warnings, an invocation with
multiple emit types *and* `-o PATH` will continue to ignore the
requested target path (with a warning), as it already does today,
since the code that checks for that is further downstream.
2015-12-08 05:37:04 +01:00
James Miller
d6eb063fe8 Fix unsized structs with destructors
The presence of the drop flag caused the offset calculation to be
incorrect, leading to the pointer being incorrect. This has been fixed
by calculating the offset based on the field index (and not assuming
that the field is always the last one).

However, I've also stopped the drop flag from being added to the end of
unsized structs to begin with. Since it's not actually accessed for
unsized structs, and isn't actually where we would say it is, this made
more sense.
2015-12-08 15:55:00 +13:00
Daniel Campbell
6b6fb7bbcb Added pretty-printing for span expansion chains through span_to_expanded_string. 2015-12-08 15:35:28 +13:00
bors
acf4e0be22 Auto merge of #30087 - petrochenkov:indi, r=nrc
I've measured the time/memory consumption before and after - the difference is lost in statistical noise, so it's mostly a code simplification.
Sizes of `enum`s are not affected.

r? @nrc

I wonder if AST/HIR visitors could run faster if `P`s are systematically removed (except for cases where they control `enum` sizes). Theoretically they should.
Remaining unnecessary `P`s can't be easily removed because many folders accept `P<X>`s as arguments, but these folders can be converted to accept `X`s instead without loss of efficiency.
When I have a mood for some mindless refactoring again, I'll probably try to convert the folders, remove remaining `P`s and measure again.
2015-12-07 22:28:45 +00:00
bors
8864f2c83a Auto merge of #30256 - GuillaumeGomez:patch-5, r=Manishearth
r? @Manishearth
2015-12-07 19:31:33 +00:00
Ariel Ben-Yehuda
80e191fba0 introduce a region unification table and use it in dropck
Fixes #29844
2015-12-07 19:36:28 +02:00
Vadim Petrochenkov
c1d3164700 Add comments for Ident::from_name and identifiers in path segments 2015-12-07 20:19:36 +03:00
Guillaume Gomez
1b984b501d Add E0264 error explanation 2015-12-07 15:56:36 +01:00
Vadim Petrochenkov
ca88e9c536 Remove some unnecessary indirection from HIR structures 2015-12-07 17:17:41 +03:00
bors
4dbdfb4933 Auto merge of #30202 - oli-obk:fix/const_index_feature_gate, r=Aatch
see https://github.com/rust-lang/rust/issues/29947#issuecomment-161781257

I also added some missing tests
2015-12-07 11:36:57 +00:00
James Miller
a2557d472e Align pointers to DST fields properly
DST fields, being of an unknown type, are not automatically aligned
properly, so a pointer to the field needs to be aligned using the
information in the vtable.

Fixes #26403 and a number of other DST-related bugs discovered while
implementing this.
2015-12-08 00:03:45 +13:00
bors
7b77f67d19 Auto merge of #30188 - tshepang:lookup_addr-example, r=alexcrichton 2015-12-07 07:11:19 +00:00
bors
e819d8aa3c Auto merge of #30247 - bluss:revert-array-clone, r=alexcrichton
Revert "PR #30130 Implement `Clone` for more arrays"

This reverts commit e22a64e8d8.

This caused a regression such that types like `[[u8; 256]; 4]`
no longer implemented Clone. This previously worked due to Clone
for `[T; N]` (N in 0 to 32) being implemented for T: Copy.

Due to fixed size arrays not implementing Clone for sizes above 32,
the new implementation requiring T: Clone would not allow
`[[u8; 256]; 4]` to be Clone.

Fixes #30244

Due to changing back, this is technically a [breaking-change],
albeit for a behavior that existed for a very short time.
2015-12-07 02:16:13 +00:00
Ulrik Sverdrup
0ca2a9e71a Add regression test for Clone for [[T; 256]; 4] where T: Copy and not Clone 2015-12-07 01:55:00 +01:00
petevine
5294f2080b README.md - RAM requirement on 32-bit *nix
Running `/usr/bin/time -v make` to build rust (using local llvm) shows the maximum memory usage at 715 megabytes on 32-bit x86 (on arm linux it's even less @ 580M).

Reworded according to @brson's input.
2015-12-07 01:12:53 +01:00