Commit Graph

47097 Commits

Author SHA1 Message Date
Simon Mazur 0294098d8f Implement `size_hint` for `EscapeUnicode` 2015-10-01 20:33:43 +03:00
bors e82faeb655 Auto merge of #28742 - nikomatsakis:def-id-encapsulate, r=eddyb
As described in https://github.com/rust-lang/rfcs/pull/1298, the idea here is to make DefIds independent of changes to the content of other items. They are also *mostly* independent from ordering, so e.g. reordering two functions will change the defids, but it will not change the paths that they expand into (but this is not the case for some things, such as impls).

This is a major refactoring, so I did it in slices. The final commit is in some sense The Big One where most of the work is done. The earlier commits just pave the way by gradually refactoring accesses to the `node` field.

This is a [breaking-change] for plugin authors. The things you need to do to migrate your code are as follows:

1. For local def-ids, rather than do `def_id.node`, call `tcx.map.as_local_node_id(def_id)`.
2. To construct a local def-id, call `tcx.map.local_def_id(node_id)`.
3. Note that you cannot make def-ids for any node, but only for "definitions" -- which include all items, as well as a number of other things, but not e.g. arbitrary expressions.
4. You can get the path to a def-id by calling `tcx.def_path(def_id)`.

One thing that is NOT part of this PR, but which I plan do in a follow-up, is converting uses of the existing `with_path` API to use `def_path`, which is basically the same.

r? @eddyb (or @nrc)
2015-10-01 16:26:28 +00:00
Björn Steinbrink 8a959ad447 Remove one level of indirection for slice-based PartialEq impls
Using the comparison operators already refs the operands, so doing it
ourselves as well just adds an unnecessary level of indirection.
2015-10-01 18:17:49 +02:00
Ms2ger b093060c2a Stop re-exporting AttrStyle's variants and rename them. 2015-10-01 18:03:34 +02:00
Andrew Paseltiner a81dfca190 Add test for #25439
Closes #25439.
2015-10-01 11:30:22 -04:00
Ariel Ben-Yehuda 7aed441ac8 don't emit leading zeros in tagged integers
we *already* need a length, so might as well use it

this saves 3% in libcore

559870 liballoc-bb943c5a.rlib
1425170 liballoc_jemalloc-bb943c5a.rlib
10120 liballoc_system-bb943c5a.rlib
152398 libarena-bb943c5a.rlib
4023670 libcollections-bb943c5a.rlib
18042746 libcore-bb943c5a.rlib
198202 libflate-bb943c5a.rlib
244412 libfmt_macros-bb943c5a.rlib
555750 libgetopts-bb943c5a.rlib
222462 libgraphviz-bb943c5a.rlib
417824 liblibc-bb943c5a.rlib
187804 liblog-bb943c5a.rlib
722742 librand-bb943c5a.rlib
604846 librbml-bb943c5a.rlib
1397814 librustc_back-bb943c5a.rlib
38382616 librustc-bb943c5a.rlib
12826 librustc_bitflags-bb943c5a.rlib
2298772 librustc_borrowck-bb943c5a.rlib
570822 librustc_data_structures-bb943c5a.rlib
9361826 librustc_driver-bb943c5a.rlib
9479914 librustc_front-bb943c5a.rlib
1604576 librustc_lint-bb943c5a.rlib
79190586 librustc_llvm-bb943c5a.rlib
4783104 librustc_mir-bb943c5a.rlib
3534332 librustc_platform_intrinsics-bb943c5a.rlib
592710 librustc_privacy-bb943c5a.rlib
3123792 librustc_resolve-bb943c5a.rlib
14183434 librustc_trans-bb943c5a.rlib
11937016 librustc_typeck-bb943c5a.rlib
1830988 librustc_unicode-bb943c5a.rlib
15611582 librustdoc-bb943c5a.rlib
2892482 libserialize-bb943c5a.rlib
8642922 libstd-bb943c5a.rlib
30590774 libsyntax-bb943c5a.rlib
912678 libterm-bb943c5a.rlib
1369754 libtest-bb943c5a.rlib
2015-10-01 18:21:04 +03:00
Niko Matsakis f0dc7bd1fd remove support method for synthetic default method ids 2015-10-01 11:10:30 -04:00
Ariel Ben-Yehuda 38cd6d40d2 share stored predicates
while most of the duplication in predicates was caused by stubs,
this is still a 5% win on libcore.

567924 liballoc-bb943c5a.rlib
1425564 liballoc_jemalloc-bb943c5a.rlib
10520 liballoc_system-bb943c5a.rlib
154842 libarena-bb943c5a.rlib
4113790 libcollections-bb943c5a.rlib
18513674 libcore-bb943c5a.rlib
199466 libflate-bb943c5a.rlib
249548 libfmt_macros-bb943c5a.rlib
560488 libgetopts-bb943c5a.rlib
226772 libgraphviz-bb943c5a.rlib
442966 liblibc-bb943c5a.rlib
189884 liblog-bb943c5a.rlib
736764 librand-bb943c5a.rlib
609874 librbml-bb943c5a.rlib
1411678 librustc_back-bb943c5a.rlib
38770354 librustc-bb943c5a.rlib
12868 librustc_bitflags-bb943c5a.rlib
2327196 librustc_borrowck-bb943c5a.rlib
582178 librustc_data_structures-bb943c5a.rlib
9379344 librustc_driver-bb943c5a.rlib
9540324 librustc_front-bb943c5a.rlib
1614996 librustc_lint-bb943c5a.rlib
79217876 librustc_llvm-bb943c5a.rlib
4833518 librustc_mir-bb943c5a.rlib
3535794 librustc_platform_intrinsics-bb943c5a.rlib
603190 librustc_privacy-bb943c5a.rlib
3158032 librustc_resolve-bb943c5a.rlib
14300126 librustc_trans-bb943c5a.rlib
12024054 librustc_typeck-bb943c5a.rlib
1834852 librustc_unicode-bb943c5a.rlib
15611582 librustdoc-bb943c5a.rlib
2926594 libserialize-bb943c5a.rlib
8780060 libstd-bb943c5a.rlib
30772000 libsyntax-bb943c5a.rlib
917984 libterm-bb943c5a.rlib
1369754 libtest-bb943c5a.rlib
2015-10-01 18:02:42 +03:00
Ariel Ben-Yehuda d98165941d add a cross-reference index
it still does not *do* anything
2015-10-01 17:45:41 +03:00
Ariel Ben-Yehuda 67e60bf283 remove unneeded tags from metadata
stage1 release rlib sizes:
580890 liballoc-bb943c5a.rlib
1425558 liballoc_jemalloc-bb943c5a.rlib
10514 liballoc_system-bb943c5a.rlib
157192 libarena-bb943c5a.rlib
4316234 libcollections-bb943c5a.rlib
19580128 libcore-bb943c5a.rlib
199498 libflate-bb943c5a.rlib
249328 libfmt_macros-bb943c5a.rlib
560406 libgetopts-bb943c5a.rlib
233620 libgraphviz-bb943c5a.rlib
442964 liblibc-bb943c5a.rlib
190178 liblog-bb943c5a.rlib
778488 librand-bb943c5a.rlib
621972 librbml-bb943c5a.rlib
1415040 librustc_back-bb943c5a.rlib
38849082 librustc-bb943c5a.rlib
12862 librustc_bitflags-bb943c5a.rlib
2331690 librustc_borrowck-bb943c5a.rlib
616880 librustc_data_structures-bb943c5a.rlib
9386582 librustc_driver-bb943c5a.rlib
9600440 librustc_front-bb943c5a.rlib
1615058 librustc_lint-bb943c5a.rlib
79218480 librustc_llvm-bb943c5a.rlib
5020974 librustc_mir-bb943c5a.rlib
3535448 librustc_platform_intrinsics-bb943c5a.rlib
603640 librustc_privacy-bb943c5a.rlib
3163628 librustc_resolve-bb943c5a.rlib
14326646 librustc_trans-bb943c5a.rlib
12033174 librustc_typeck-bb943c5a.rlib
1838202 librustc_unicode-bb943c5a.rlib
15611582 librustdoc-bb943c5a.rlib
3056280 libserialize-bb943c5a.rlib
8954312 libstd-bb943c5a.rlib
30906736 libsyntax-bb943c5a.rlib
925480 libterm-bb943c5a.rlib
1377952 libtest-bb943c5a.rlib
2015-10-01 17:43:15 +03:00
Niko Matsakis 6bfdf37250 remove code for re-exports of static methods 2015-10-01 10:43:07 -04:00
Niko Matsakis 52a02832b8 convert the creepy case to just return None -- in practice, it would
have always been returning None anyway, since it was comparing node-ids
across crates incorrectly -- and remove the now unused map
`extern_const_variants`
2015-10-01 10:43:07 -04:00
Niko Matsakis 01f32ace03 Convert DefId to use DefIndex, which is an index into a list of
paths, and construct paths for all definitions. Also, stop rewriting
DefIds for closures, and instead just load the closure data from
the original def-id, which may be in another crate.
2015-10-01 10:43:07 -04:00
Niko Matsakis a6fee06741 rename ast_map to hir_map 2015-10-01 10:42:37 -04:00
Niko Matsakis 34a25db45f stop updating `parent_node_id` when there is no corresponding map entry 2015-10-01 10:42:37 -04:00
Niko Matsakis d7b0eb0f39 build up a set of node-ids that we can construct def-ids from 2015-10-01 10:42:37 -04:00
Niko Matsakis a0dc2d9a29 Introduce semi-duplicate DefIds into DefLocal/DefUpvar to remove use
of xxx_local.
2015-10-01 10:37:19 -04:00
Niko Matsakis 3b1399df2d Make calling def_id on a DefSelfTy an error; the previous defids that
were returned, either the trait or the *self type itself*, were not
particularly representative of what the Def is (a type parameter).
Rewrite paths to handle this case specially, just as they handle the
primitive case specifically. This entire `def_id` codepath is kind of a
mess.
2015-10-01 10:37:19 -04:00
Niko Matsakis 95ce1ebe7c Move DefLabel out from the def_id() results 2015-10-01 10:37:19 -04:00
Niko Matsakis cb784b70ba Remove DefRegion, which is not used 2015-10-01 10:37:19 -04:00
Niko Matsakis 1dd5ffa405 Rename `node_id` to `var_id` and limit to the cases that are actually used 2015-10-01 10:37:19 -04:00
Niko Matsakis 5600c6282e move direct accesses of `node` to go through `as_local_node_id`, unless
they are being used as an opaque "position identifier"
2015-10-01 10:37:19 -04:00
Niko Matsakis aa40a1cad0 change creepy case to call span_bug instead of doing something clearly wrong 2015-10-01 10:28:28 -04:00
Niko Matsakis 9ff4f57cd0 move job of creating local-def-ids to ast-map (with a few stragglers) 2015-10-01 10:28:28 -04:00
Cristian Kubis 25c21342c6 replaced *_ptr with *_raw methods in docs 2015-10-01 16:02:35 +02:00
Niko Matsakis 2dd139f5fd add some XXX markers 2015-10-01 09:44:28 -04:00
Niko Matsakis dc4a4ada58 move LOCAL_CRATE to cstore 2015-10-01 09:44:28 -04:00
Björn Steinbrink bda083fa70 Avoid unnecessary temporaries when ref'ing a DST value
A DST value and a fat pointer to it have the same representation, all we
have to do is to adjust the type of the datum holding the pointer.
2015-10-01 15:24:23 +02:00
Ariel Ben-Yehuda 0706ac0fae use the *adjusted* callee type in effect checking
Fixes #28776
2015-10-01 16:06:50 +03:00
bors 24202c6431 Auto merge of #28131 - arielb1:static-upvars, r=pnkfelix
Fixes #23057 
Fixes #27890
Fixes #28099
Fixes #28113

r? @pnkfelix
2015-10-01 13:06:48 +00:00
Robin Kruppe 4df35ba454 Stop probing for pandoc and xelatex, they are not used any more. 2015-10-01 14:34:31 +02:00
Ariel Ben-Yehuda c01e0502e7 check upvars in closures that are in statics
Fixes #27890
Fixes #28099
Fixes #28113
2015-10-01 15:22:57 +03:00
bors 8719f504ee Auto merge of #28780 - steveklabnik:doc_from_str, r=alexcrichton
@marchelzo pointed out on IRC that this doesn't have docs, so, let's
change that.
2015-10-01 11:18:48 +00:00
Cristian Kubis 566dc9cf93 doc: fixed swapped docs for from_ptr and from_raw 2015-10-01 12:43:00 +02:00
Florian Hahn d76010f3d9 Add link to Florian Wilkens's Bachelor's Thesis 2015-10-01 11:36:26 +02:00
bors 78edd4f3a0 Auto merge of #28778 - arielb1:no-source, r=eddyb
this simplifies the code while reducing the size of libcore.rlib by
3.3 MiB (~1M of which is bloat a separate patch of mine removes
too), while reducing rustc memory usage on small crates by 18MiB.

This also simplifies the code considerably.

I have measured a small, but possibly insignificant, bootstrap performance improvement, and the memory savings grow to about 30M for larger crates (but that is still less as a percentage).

r? @eddyb
2015-10-01 09:30:54 +00:00
bors e5ba127734 Auto merge of #28741 - alexcrichton:fix-msvc-32, r=vadimcn
Turns out the symbol names are slightly different on 32-bit than on 64, so the
prefix needs to be tweaked just a bit!
2015-10-01 06:18:59 +00:00
bors 587be42d0b Auto merge of #28605 - alexcrichton:link-native-first, r=brson
This commit swaps the order of linking local native libraries and upstream
native libraries on the linker command line. Detail of bugs this can cause can
be found in #28595, and this change also invalidates the test case that was
added for #12446 which is now considered a bug because the downstream dependency
would need to declare that it depends on the native library somehow.

Closes #28595
[breaking-change]
2015-10-01 04:29:04 +00:00
Alex Crichton 9502df5798 rustc: Swap link order of native libs/rust deps
This commit swaps the order of linking local native libraries and upstream
native libraries on the linker command line. Detail of bugs this can cause can
be found in #28595, and this change also invalidates the test case that was
added for #12446 which is now considered a bug because the downstream dependency
would need to declare that it depends on the native library somehow.

Closes #28595
2015-09-30 20:17:54 -07:00
bors 031dd9c381 Auto merge of #28577 - jethrogb:topic/ast-stmt-debug, r=pcwalton
This enables the Debug trait to work on syntax::ast::Stmt.
2015-10-01 02:38:25 +00:00
bors f5a0158927 Auto merge of #28732 - Eljay:fix-unused-attr, r=alexcrichton
Closes #28709.
2015-10-01 00:47:06 +00:00
bors d14dba1227 Auto merge of #28782 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #28753, #28760, #28764, #28770, #28771, #28772
- Failed merges:
2015-09-30 22:27:53 +00:00
Steve Klabnik f8c8c8c07d Rollup merge of #28772 - tshepang:improve-paragraph, r=steveklabnik 2015-09-30 18:20:04 -04:00
Steve Klabnik 0f6cea9a86 Rollup merge of #28771 - tshepang:upper-case, r=steveklabnik 2015-09-30 18:20:04 -04:00
Steve Klabnik bc41536bb4 Rollup merge of #28770 - tshepang:awkward, r=steveklabnik 2015-09-30 18:20:03 -04:00
Steve Klabnik 4ab1ac5bc1 Rollup merge of #28764 - steveklabnik:gh28706, r=alexcrichton
Fixes #28706 

I am pretty sure that this is accurate, bout would love a double check.
2015-09-30 18:20:03 -04:00
Steve Klabnik 8382bc915c Rollup merge of #28760 - steveklabnik:gh28166, r=alexcrichton
Fixes #28166
2015-09-30 18:20:03 -04:00
Steve Klabnik b6449eba51 Rollup merge of #28753 - steveklabnik:gh28572, r=alexcrichton
This is part of #28572, but doesn't complete it. Amongst other things,
this patch:

* Increases consistency in the way feature flags are used with other
  docs.
* Removes the ignores, which is nice: we actually had some syntax errors
  in the examples 😭.
* Mentions #![no_core]

Realistically, this document used to be in the order of least to most:
nothing, then adding core. But with the changes in RFC 1184, this is
backwards: it now shows stuff that uses core from the beginning. In the
future, I'd like to revamp this to go from 'most to least', but I'd like
to see the discussion in https://github.com/rust-lang/rust/issues/27701
goes before I write more.
2015-09-30 18:20:03 -04:00
Eli Friedman 1763fcb36d Don't crash on non-existent path in constant.
The behavior here isn't really ideal, but we can't really do much better
given the current state of constant evaluation.

Fixes #28670, and probably a bunch of duplicates.
2015-09-30 15:04:21 -07:00
Steve Klabnik 80130005da Add some docs for FromString::from_str
@marchelzo pointed out on IRC that this doesn't have docs, so, let's
change that.
2015-09-30 17:42:41 -04:00