Commit Graph

49408 Commits

Author SHA1 Message Date
William Throwe
34fe201c1a Fix some str docs to refer to patterns 2015-12-07 22:29:25 -05:00
William Throwe
e7f3d6eddd Let str::replace take a pattern
It appears this was left out of RFC #528 because it might be useful to
also generalize the second argument in some way.  That doesn't seem to
prevent generalizing the first argument now, however.

This is a [breaking-change] because it could cause type-inference to
fail where it previously succeeded.
2015-12-07 22:08:33 -05: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
Ulrik Sverdrup
0a9c463195 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.
2015-12-07 00:29:21 +01:00
Markus Unterwaditzer
9002600486 Fix typo in make var 2015-12-07 00:20:35 +01:00
Tshepang Lekhonkhobe
8569ef2591 doc: add example for std::net::lookup_addr 2015-12-06 22:12:38 +02:00
bors
64c21f9ee2 Auto merge of #30241 - Manishearth:diag-30236, r=eddyb
r? @eddyb
2015-12-06 17:50:44 +00:00
Manish Goregaokar
050ad0d67e Correct span for unused type parameter error in type alias (fixes #30236) 2015-12-06 22:35:40 +05:30
bors
85b031b3bc Auto merge of #30234 - vyp:doc-typo, r=apasel422 2015-12-06 13:23:43 +00:00
Oliver Schneider
c71dcca452 add test for const eval errors in patterns 2015-12-06 12:59:53 +01:00
Oliver Schneider
5e1276a694 add unit tests for #29927 2015-12-06 12:59:53 +01:00
Oliver Schneider
d23800f3f2 allow const function calls in consts that are used in patterns
closes #30117
2015-12-06 12:59:53 +01:00
xd1le
85a90a3c20 doc(book/error-handling): fix typo 2015-12-06 20:32:49 +11:00
bors
078aff8928 Auto merge of #30221 - thyrgle:concurrency_doc, r=alexcrichton
The example code in the Channels subsection of the rust book give warnings about

    unused result which must be used, #[warn(unused_must_use)] on by default

Added a small pattern match to resolve those warnings.
2015-12-06 08:50:49 +00:00
bors
3ffc6f0450 Auto merge of #30222 - mitaa:fqn#2, r=alexcrichton
I missed this in #30149

fixes #30198

r? @alexcrichton
2015-12-06 06:49:03 +00:00
bors
c4b16384f1 Auto merge of #30187 - alexcrichton:stabilize-1.6, r=aturon
This commit is the standard API stabilization commit for the 1.6 release cycle.
The list of issues and APIs below have all been through their cycle-long FCP and
the libs team decisions are listed below

Stabilized APIs

* `Read::read_exact`
* `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`)
* libcore -- this was a bit of a nuanced stabilization, the crate itself is now
  marked as `#[stable]` and the methods appearing via traits for primitives like
  `char` and `str` are now also marked as stable. Note that the extension traits
  themeselves are marked as unstable as they're imported via the prelude. The
  `try!` macro was also moved from the standard library into libcore to have the
  same interface. Otherwise the functions all have copied stability from the
  standard library now.
* `fs::DirBuilder`
* `fs::DirBuilder::new`
* `fs::DirBuilder::recursive`
* `fs::DirBuilder::create`
* `os::unix::fs::DirBuilderExt`
* `os::unix::fs::DirBuilderExt::mode`
* `vec::Drain`
* `vec::Vec::drain`
* `string::Drain`
* `string::String::drain`
* `vec_deque::Drain`
* `vec_deque::VecDeque::drain`
* `collections::hash_map::Drain`
* `collections::hash_map::HashMap::drain`
* `collections::hash_set::Drain`
* `collections::hash_set::HashSet::drain`
* `collections::binary_heap::Drain`
* `collections::binary_heap::BinaryHeap::drain`
* `Vec::extend_from_slice` (renamed from `push_all`)
* `Mutex::get_mut`
* `Mutex::into_inner`
* `RwLock::get_mut`
* `RwLock::into_inner`
* `Iterator::min_by_key` (renamed from `min_by`)
* `Iterator::max_by_key` (renamed from `max_by`)

Deprecated APIs

* `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`)
* `OsString::from_bytes`
* `OsStr::to_cstring`
* `OsStr::to_bytes`
* `fs::walk_dir` and `fs::WalkDir`
* `path::Components::peek`
* `slice::bytes::MutableByteVector`
* `slice::bytes::copy_memory`
* `Vec::push_all` (renamed to `extend_from_slice`)
* `Duration::span`
* `IpAddr`
* `SocketAddr::ip`
* `Read::tee`
* `io::Tee`
* `Write::broadcast`
* `io::Broadcast`
* `Iterator::min_by` (renamed to `min_by_key`)
* `Iterator::max_by` (renamed to `max_by_key`)
* `net::lookup_addr`

New APIs (still unstable)

* `<[T]>::sort_by_key` (added to mirror `min_by_key`)

Closes #27585
Closes #27704
Closes #27707
Closes #27710
Closes #27711
Closes #27727
Closes #27740
Closes #27744
Closes #27799
Closes #27801
cc #27801 (doesn't close as `Chars` is still unstable)
Closes #28968
2015-12-06 04:12:54 +00:00
bors
bf79ffada6 Auto merge of #30212 - GuillaumeGomez:css_split, r=brson
r? @brson
2015-12-06 01:40:20 +00:00
Alex Crichton
464cdff102 std: Stabilize APIs for the 1.6 release
This commit is the standard API stabilization commit for the 1.6 release cycle.
The list of issues and APIs below have all been through their cycle-long FCP and
the libs team decisions are listed below

Stabilized APIs

* `Read::read_exact`
* `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`)
* libcore -- this was a bit of a nuanced stabilization, the crate itself is now
  marked as `#[stable]` and the methods appearing via traits for primitives like
  `char` and `str` are now also marked as stable. Note that the extension traits
  themeselves are marked as unstable as they're imported via the prelude. The
  `try!` macro was also moved from the standard library into libcore to have the
  same interface. Otherwise the functions all have copied stability from the
  standard library now.
* The `#![no_std]` attribute
* `fs::DirBuilder`
* `fs::DirBuilder::new`
* `fs::DirBuilder::recursive`
* `fs::DirBuilder::create`
* `os::unix::fs::DirBuilderExt`
* `os::unix::fs::DirBuilderExt::mode`
* `vec::Drain`
* `vec::Vec::drain`
* `string::Drain`
* `string::String::drain`
* `vec_deque::Drain`
* `vec_deque::VecDeque::drain`
* `collections::hash_map::Drain`
* `collections::hash_map::HashMap::drain`
* `collections::hash_set::Drain`
* `collections::hash_set::HashSet::drain`
* `collections::binary_heap::Drain`
* `collections::binary_heap::BinaryHeap::drain`
* `Vec::extend_from_slice` (renamed from `push_all`)
* `Mutex::get_mut`
* `Mutex::into_inner`
* `RwLock::get_mut`
* `RwLock::into_inner`
* `Iterator::min_by_key` (renamed from `min_by`)
* `Iterator::max_by_key` (renamed from `max_by`)

Deprecated APIs

* `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`)
* `OsString::from_bytes`
* `OsStr::to_cstring`
* `OsStr::to_bytes`
* `fs::walk_dir` and `fs::WalkDir`
* `path::Components::peek`
* `slice::bytes::MutableByteVector`
* `slice::bytes::copy_memory`
* `Vec::push_all` (renamed to `extend_from_slice`)
* `Duration::span`
* `IpAddr`
* `SocketAddr::ip`
* `Read::tee`
* `io::Tee`
* `Write::broadcast`
* `io::Broadcast`
* `Iterator::min_by` (renamed to `min_by_key`)
* `Iterator::max_by` (renamed to `max_by_key`)
* `net::lookup_addr`

New APIs (still unstable)

* `<[T]>::sort_by_key` (added to mirror `min_by_key`)

Closes #27585
Closes #27704
Closes #27707
Closes #27710
Closes #27711
Closes #27727
Closes #27740
Closes #27744
Closes #27799
Closes #27801
cc #27801 (doesn't close as `Chars` is still unstable)
Closes #28968
2015-12-05 15:09:44 -08:00
Christopher Sumnicht
bfb7361540 Uses unwrap instead of pattern matching 2015-12-05 15:01:05 -08:00
mitaa
fb7008c0a0 Add tests 2015-12-05 23:11:07 +01:00
bors
aad4e5665e Auto merge of #30177 - retep998:handling-threads, r=alexcrichton
Allows a `HANDLE` to be extracted from a `JoinHandle` on Windows.
Allows a `pthread_t` to be extracted from a `JoinHandle` everywhere else.

Because https://github.com/rust-lang/rust/pull/29461 was closed.

r? @alexcrichton
2015-12-05 20:49:16 +00:00
Aleksey Kladov
c8b7e24b14 DOCS: update reference about paths 2015-12-05 21:55:34 +03:00
bors
9f715e9892 Auto merge of #30215 - SimonSapin:ipv6-display-alloc, r=brson 2015-12-05 17:58:46 +00:00
Oliver Schneider
baa8ce7efd fix const index feature-gate regression 2015-12-05 16:52:33 +01:00
bors
d75f861518 Auto merge of #30102 - jFransham:feature/better-lifetime-errors, r=Manishearth
Fixes #30086
2015-12-05 12:52:30 +00:00
mitaa
f69cedb0d5 Reuse record_extern_fqn
These locations erroneously used the local item-path instead of the
extern item-path.
2015-12-05 13:35:33 +01:00
Christopher Sumnicht
658f91a0cc Resolved warnings about unused result 2015-12-05 03:17:18 -08:00
bors
427514f550 Auto merge of #30207 - jwworth:pull-request-1449250353, r=apasel422
This fixes a double word typo, 'can'.
2015-12-05 10:58:37 +00:00
Amanieu d'Antras
65707dfc00 Use a struct instead of a tuple for inline asm output operands 2015-12-05 10:11:20 +00:00
Simon Sapin
507d8caf6d Remove allocations in impl Display for Ipv6Addr 2015-12-05 10:09:34 +01:00
bors
f41f327f7f Auto merge of #30185 - fhahn:improve-borrowck-public-accessibility, r=pnkfelix
This PR makes `AnalysisData` and`BorrowckCtxt` public. Those types are returned by the public function `build_borrowck_dataflow_data_for_fn` and are needed if a caller wants to pass on the return values.

It also removes `FnPartsWithCFG`, which required callers of  `build_borrowck_dataflow_data_for_fn` to have a reference to a `CFG` with the same lifetime as `FnParts`, which is more limiting than required.
2015-12-05 09:08:14 +00:00
Amanieu d'Antras
ce5b0351a5 Fix liveness analysis for read-write inline asm operands 2015-12-05 08:18:30 +00:00
Amanieu d'Antras
9d7b113b44 Add proper support for indirect output constraints in inline asm 2015-12-05 08:18:30 +00:00
bors
e70c733250 Auto merge of #30211 - pnkfelix:fix-getopts-for-issue-30204, r=alexcrichton
Fix internal `getopts` so `--a=b=c` acts like `--a b=c` rather than `--a b`.

Fix #30204
2015-12-05 05:30:47 +00:00
bors
3e2ebaa918 Auto merge of #30210 - nagisa:tweak-man, r=alexcrichton
r? @alexcrichton
2015-12-05 03:39:45 +00:00
Peter Atashian
9749a193d6 Add JoinHandleExt to get the pthread_t on unix platforms
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-12-04 20:09:32 -05:00
Peter Atashian
95cdada99a AsRawHandle and IntoRawHandle for JoinHandle
This allows users to get the HANDLE of a spawned thread on Windows

Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-12-04 20:09:30 -05:00