Commit graph

45924 commits

Author SHA1 Message Date
Manish Goregaokar
a3b32ebda4 Rollup merge of #28010 - GuillaumeGomez:patch-2, r=Manishearth
r? @Manishearth
2015-08-28 03:38:36 +05:30
bors
abfa081c10 Auto merge of #27999 - dotdash:lt, r=eddyb
The major change here is in the tiny commit at the end and makes it so that we no longer emit lifetime intrinsics for allocas for function arguments. They are live for the whole function anyway, so the intrinsics add no value. This makes the resulting IR more clear, and reduces the peak memory usage and LLVM times by about 1-4%, depending on the crate.

The remaining changes are just preparatory cleanups and fixes for missing lifetime intrinsics.
2015-08-27 20:09:15 +00:00
bors
17b6fcd458 Auto merge of #28031 - durka:patch-6, r=alexcrichton
It was pointing at the issue for `placement_new_protocol`.
2015-08-27 18:30:47 +00:00
Guillaume Gomez
fbbd874171 Comment out unused error codes in librustc_typeck/diagnostics.rs 2015-08-27 19:16:40 +02:00
bors
b28f0b1887 Auto merge of #28030 - tshepang:improve-example, r=alexcrichton 2015-08-27 16:51:57 +00:00
bors
ccf8317694 Auto merge of #28016 - ranma42:mini-rem-in-core, r=alexcrichton
The implementation of the remainder operation belongs to
librustc_trans, but it is also stubbed out in libcore in order to
expose it as a trait on primitive types. Instead of exposing some
implementation details (like the upcast to `f64` in MSVC), use a
minimal implementation just like that of the `Div` trait.
2015-08-27 15:13:30 +00:00
bors
40fd4d6787 Auto merge of #28028 - tshepang:add-size_hint-example, r=alexcrichton 2015-08-27 10:29:26 +00:00
bors
f663286f26 Auto merge of #28027 - tshepang:improve-sentence, r=alexcrichton 2015-08-27 08:51:15 +00:00
Andrea Canciani
4653a8b3fd Restore removed code and mark it for usage in stage0
The old code is temporarily needed in order to keep the MSVC build
working. It should be possible to remove this code after the bootstrap
compiler is updated to contain the MSVC workaround from #27875.
2015-08-27 10:12:48 +02:00
bors
d6a65cd3fe Auto merge of #27975 - sfackler:iter-order-methods, r=aturon
This does cause some breakage due to deficiencies in resolve -
`path::Components` is both an `Iterator` and implements `Eq`, `Ord`,
etc. If one calls e.g. `partial_cmp` on a `Components` and passes a
`&Components` intending to target the `PartialOrd` impl, the compiler
will select the `partial_cmp` from `Iterator` and then error out. I
doubt anyone will run into breakage from `Components` specifically, but
we should see if there are third party types that will run into issues.

`iter::order::equals` wasn't moved to `Iterator` since it's exactly the
same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound,
which doensn't seem very useful.

I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop
the extra `PartialEq` bound.

cc #27737 

r? @alexcrichton
2015-08-27 07:13:02 +00:00
Steven Fackler
651c42f11f Make iter::order functions into methods on Iterator
This does cause some breakage due to deficiencies in resolve -
`path::Components` is both an `Iterator` and implements `Eq`, `Ord`,
etc. If one calls e.g. `partial_cmp` on a `Components` and passes a
`&Components` intending to target the `PartialOrd` impl, the compiler
will select the `partial_cmp` from `Iterator` and then error out. I
doubt anyone will run into breakage from `Components` specifically, but
we should see if there are third party types that will run into issues.

`iter::order::equals` wasn't moved to `Iterator` since it's exactly the
same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound,
which doensn't seem very useful.

I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop
the extra `PartialEq` bound.

cc #27737
2015-08-26 23:23:57 -07:00
bors
0d5142f9b8 Auto merge of #28023 - jmesmon:llvm-path-native-only, r=alexcrichton
This fixes the case where we try to re-build & re-install rust to the
same prefix (without uninstalling) while using an llvm-root that is the
same as the prefix.

Without this, builds like that fail with:
	'error: multiple dylib candidates for `std` found'

See https://github.com/jmesmon/meta-rust/issues/6 for some details.

May also be related to #20342.
2015-08-27 05:35:02 +00:00
bors
ab21fe59e9 Auto merge of #28020 - dotdash:ref_fat_ptr_be_gone, r=eddyb
r? @eddyb -- we talked about this on IRC a while back but I only now managed to get the change done.
2015-08-27 03:57:21 +00:00
bors
af83d98d24 Auto merge of #28001 - arielb1:dtor-fixes, r=pnkfelix
r? @pnkfelix
2015-08-27 02:19:09 +00:00
bors
fd302a95e1 Auto merge of #27808 - SimonSapin:utf16decoder, r=alexcrichton
* Rename `Utf16Items` to `Utf16Decoder`. "Items" is meaningless.
* Generalize it to any `u16` iterator, not just `[u16].iter()`
* Make it yield `Result` instead of a custom `Utf16Item` enum that was isomorphic to `Result`. This enable using the `FromIterator for Result` impl.
* Replace `Utf16Item::to_char_lossy` with a `Utf16Decoder::lossy` iterator adaptor.

This is a [breaking change], but only for users of the unstable `rustc_unicode` crate.

I’d like this functionality to be stabilized and re-exported in `std` eventually, as the "low-level equivalent" of `String::from_utf16` and `String::from_utf16_lossy` like #27784 is the low-level equivalent of #27714.

CC @aturon, @alexcrichton
2015-08-27 00:41:13 +00:00
Alex Burka
2367cafe9d fix unstable issue ref for Unsize
It was pointing at the issue for `placement_new_protocol`.
2015-08-26 19:07:44 -04:00
bors
80b971a9b8 Auto merge of #28003 - nkondratyev:patch-1, r=steveklabnik 2015-08-26 23:03:24 +00:00
Tshepang Lekhonkhobe
0ca1caee93 doc: add Iterator::size_hint example 2015-08-26 23:59:30 +02:00
Tshepang Lekhonkhobe
469620fd8e doc: I had to read this twice before understanding it 2015-08-26 23:48:45 +02:00
Tshepang Lekhonkhobe
cf3d6b569c doc: improve as_path example 2015-08-26 23:40:36 +02:00
bors
1c3b19d69d Auto merge of #28021 - steveklabnik:gh27958, r=alexcrichton
Fixes #27958
2015-08-26 21:25:13 +00:00
bors
a48c29dcea Auto merge of #27992 - wthrowe:dead-main-2, r=alexcrichton
* Suppresses warnings that main is unused when testing (#12327)
* Makes `--test` work with explicit `#[start]` (#11766)
* Fixes some cases where the normal main would not be disabled by `--test`, resulting in compilation failures.
2015-08-26 18:29:02 +00:00
Steve Klabnik
dec43510f1 Any docs: as_ref doesn't exist anymore
Fixes #27958
2015-08-26 13:59:39 -04:00
Cody P Schafer
2d0cb31d30 mk: tell rustc that we're only looking for native libs in the LLVM_LIBDIR
This fixes the case where we try to re-build & re-install rust to the
same prefix (without uninstalling) while using an llvm-root that is the
same as the prefix.

Without this, builds like that fail with:
	'error: multiple dylib candidates for `std` found'

See https://github.com/jmesmon/meta-rust/issues/6 for some details.

May also be related to #20342.
2015-08-26 13:43:15 -04:00
Björn Steinbrink
05d36965df Avoid an extra alloca/memcpy when auto-ref'ing fat pointers
auto_ref() handles fat pointers just fine and unlike ref_fat_ptr() does so
without creating an unnecessary copy of the pointer.
2015-08-26 19:41:27 +02:00
bors
685332c8d3 Auto merge of #27998 - birkenfeld:patch-1, r=alexcrichton
These have been removed and should not be documented here.

Should the replacement crates on crates.io be linked to, or is that not wanted in the core docs?
2015-08-26 15:50:52 +00:00
Guillaume Gomez
acafe3b730 Add E0370 error explanation 2015-08-26 14:43:28 +02:00
Guillaume Gomez
805e4e6fd1 Remove unnecessary empty lines 2015-08-26 14:28:42 +02:00
Guillaume Gomez
dfb0677bee Remove unnecessary whitespace 2015-08-26 14:23:51 +02:00
Guillaume Gomez
9f15b28119 Add missing ';' in E0132 2015-08-26 14:21:46 +02:00
Guillaume Gomez
0c4faf2a07 Add erroneous code example for E0131 2015-08-26 14:21:03 +02:00
Guillaume Gomez
af02bccb41 Fix typo in E0087 2015-08-26 14:16:12 +02:00
Guillaume Gomez
5d8dc9076b Improve E0025 error explanation 2015-08-26 13:38:27 +02:00
Guillaume Gomez
612221ff80 Improve E0063 error explanation 2015-08-26 13:30:34 +02:00
Guillaume Gomez
9e51cee69a Improve E0062 error explanation 2015-08-26 13:22:55 +02:00
Guillaume Gomez
dddc4ca90b Improve E0046 2015-08-26 13:13:18 +02:00
bors
ef3255b063 Auto merge of #27991 - bluss:chain-rev, r=alexcrichton
Correct iterator adaptor Chain

The iterator protocol specifies that the iteration ends with the return
value `None` from `.next()` (or `.next_back()`) and it is unspecified
what further calls return. The chain adaptor must account for this in
its DoubleEndedIterator implementation.

It uses three states:

- Both `a` and `b` are valid
- Only the Front iterator (`a`) is valid
- Only the Back iterator (`b`) is valid

The fourth state (neither iterator is valid) only occurs after Chain has
returned None once, so we don't need to store this state.

Fixes #26316
2015-08-26 00:27:00 +00:00
Nikolay Kondratyev
424d9c2778 Fix docs typo 2015-08-26 05:06:00 +05:00
bors
14b7591ee5 Auto merge of #28000 - mbrubeck:reference, r=steveklabnik
See #19466 for background.  r? @steveklabnik
2015-08-25 18:58:07 +00:00
Ariel Ben-Yehuda
277eeb95c3 move destructors_for_type into AdtDef 2015-08-25 21:52:15 +03:00
Ariel Ben-Yehuda
d07ee255d0 handle dtors having generics in an order different from their ADT
Fixes #27997.
2015-08-25 20:50:30 +03:00
Ulrik Sverdrup
35eb3e8b79 Correct iterator adaptor Chain
The iterator protocol specifies that the iteration ends with the return
value `None` from `.next()` (or `.next_back()`) and it is unspecified
what further calls return. The chain adaptor must account for this in
its DoubleEndedIterator implementation.

It uses three states:

- Both `a` and `b` are valid
- Only the Front iterator (`a`) is valid
- Only the Back iterator (`b`) is valid

The fourth state (neither iterator is valid) only occurs after Chain has
returned None once, so we don't need to store this state.

Fixes #26316
2015-08-25 19:07:24 +02:00
Matt Brubeck
93616af42f Document the recursion_limit crate attribute 2015-08-25 10:02:58 -07:00
Björn Steinbrink
9a15d664a6 Omit lifetime intrinsics for function arguments and similar top-level items
Function arguments are live for the whole function scope, so adding
lifetime intrinsics around them adds no value. The same is true for drop
hint allocas and everything else that goes directly through
lvalue_scratch_datum. So the easiest fix is to emit lifetime intrinsics
only for lvalue datums that are created in to_lvalue_datum_in_scope().

The reduces peak memory usage and LLVM times by about 1-4%, depending on
the crate.
2015-08-25 18:37:02 +02:00
Björn Steinbrink
727a5d543d Prefer alloc_ty() instead of alloca() where possible 2015-08-25 18:37:01 +02:00
Björn Steinbrink
95337a2978 Add missing lifetime intrinsics in a few places 2015-08-25 18:36:10 +02:00
Björn Steinbrink
6c512dc52b Separate lifetime starts from alloca()
Combining them seemed like a good idea at the time, but turns out that
handling lifetimes separately makes it somewhat easier to handle cases
where we don't want the intrinsics, and let's you see more easily where
the start/end pairs are.
2015-08-25 18:36:10 +02:00
Björn Steinbrink
f3bd14ab11 Turn some alloca_no_lifetime() calls into plain alloca() calls
The issues that the comments referred to were fixed before the PR even
landed but we never got around to remove the hack of skipping the
lifetime start.
2015-08-25 18:36:10 +02:00
Björn Steinbrink
6e60fdba17 Remove unnecessary temporaries from compare_values() 2015-08-25 18:36:10 +02:00
bors
b339f38fa2 Auto merge of #27995 - nagisa:windows-error-message, r=alexcrichton
According to https://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx:

> If the function succeeds, the return value is the number of TCHARs stored in the output buffer,
> excluding the terminating null character.

_**Completely untested**_… since I have no Windows machine or anything of a sort to test this on.

r? @aturon
2015-08-25 16:22:17 +00:00