Commit Graph

48582 Commits

Author SHA1 Message Date
Felix S. Klock II
5299441954 Regression tests for Issue 29793. 2015-12-15 15:18:45 +01:00
Felix S. Klock II
c00574848b Ensure borrows of fn/closure params do not outlive invocations.
resolve_lifetime.rs: Switch from BlockScope to FnScope in ScopeChain
construction. Lifetimes introduced by a fn signature are scoped to the
call-site for that fn. (Note `add_scope_and_walk_fn` must only add
FnScope for the walk of body, *not* of the fn signature.)

region.rs: Introduce new CodeExtentData::CallSiteScope variant. Use
CodeExtentData as the cx.parent, rather than just a NodeId.  Change
DestructionScopeData to CallSiteScopeData.

regionck.rs: Thread call_site_scope via Rcx; constrain fn return
values.

(update; incorporated review feedback from niko.)
2015-12-15 15:18:40 +01: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
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
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
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
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
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
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
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
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
bors
d49e365528 Auto merge of #30205 - alexcrichton:fix-dist, r=brson
Now that AUTHORS.txt no longer exists we shouldn't try to package it.
2015-12-05 00:42:37 +00:00
bors
e22a64e8d8 Auto merge of #30130 - tbu-:pr_array_clone, r=alexcrichton
[breaking-change]
2015-12-04 22:52:02 +00:00
Felix S. Klock II
288034bda2 Expand run-make test with regression tests for #30204
Fix #30204.
2015-12-04 22:02:48 +01:00
Felix S. Klock II
5bb1e648cd Change internal getopts so --a=b=c acts like --a b=c rather than --a b.
This is an adaption of

 8ec916b86a

including its unit test.
2015-12-04 22:02:09 +01:00
bors
55a4e05092 Auto merge of #30173 - sgrif:sg-fix-time-bug, r=alexcrichton
Currently if you add a duration which should lead to 0 nanos and 1
additional second, we end up with no additional seconds, and 1000000000
nanos.
2015-12-04 21:01:03 +00:00
Simonas Kazlauskas
deccd93531 Tweak manpage’s emit section 2015-12-04 21:11:04 +02:00
bors
68c15be8b5 Auto merge of #30084 - oli-obk:const_fn, r=pnkfelix 2015-12-04 17:47:18 +00:00
Jake Worth
2217cf1af2 Fix typo 2015-12-04 12:32:36 -05:00
Alex Crichton
086f02d3d1 mk: Fix make dist
Now that AUTHORS.txt no longer exists we shouldn't try to package it.
2015-12-04 08:55:02 -08:00
Sean Griffin
07471423a2 Fix the time overflow on mac as well 2015-12-04 09:49:35 -07:00
bors
ac0e845224 Auto merge of #30192 - jwworth:pull-request-1449185301, r=alexcrichton
This fixes a double word typo, 'of'.
2015-12-04 11:46:44 +00:00
Tobias Bucher
6dff9d03d9 Don't use an explicit temporary for cloning an array 2015-12-04 09:16:48 +00:00
Tobias Bucher
7867de02e3 Implement Clone for arrays without using slice patterns 2015-12-04 09:16:48 +00:00
Tobias Bucher
19b9ad7444 Implement Clone for [T; 0] to [T; 32] if T: Clone 2015-12-04 09:16:22 +00:00
bors
77ed39cfe3 Auto merge of #29850 - Kimundi:attributes_that_make_a_statement, r=pnkfelix
See https://github.com/rust-lang/rfcs/pull/16 and https://github.com/rust-lang/rust/issues/15701

- Added syntax support for attributes on expressions and all syntax nodes in statement position.
- Extended `#[cfg]` folder to allow removal of statements, and
of expressions in optional positions like expression lists and trailing
block expressions.
- Extended lint checker to recognize lint levels on expressions and
locals.
- As per RFC, attributes are not yet accepted on `if` expressions.

Examples:
  ```rust
let x = y;
{
        ...
}
assert_eq!((1, #[cfg(unset)] 2, 3), (1, 3));

let FOO = 0;
```

Implementation wise, there are a few rough corners and open questions:
- The parser work ended up a bit ugly.
- The pretty printer change was based mostly on guessing.
- Similar to the `if` case, there are some places in the grammar where a new `Expr` node starts,
  but where it seemed weird to accept attributes and hence the parser doesn't. This includes:
  - const expressions in patterns
  - in the middle of an postfix operator chain (that is, after `.`, before indexing, before calls)
  - on range expressions, since `#[attr] x .. y` parses as  `(#[attr] x) .. y`, which is inconsistent with
    `#[attr] .. y` which would parse as `#[attr] (.. y)`
- Attributes are added as additional `Option<Box<Vec<Attribute>>>` fields in expressions and locals.
- Memory impact has not been measured yet.
- A cfg-away trailing expression in a block does not currently promote the previous `StmtExpr` in a block to a new trailing expr. That is to say, this won't work:
```rust
let x = {
    #[cfg(foo)]
    Foo { data: x }
    #[cfg(not(foo))]
    Foo { data: y }
};
```
- One-element tuples can have their inner expression removed to become Unit, but just Parenthesis can't. Eg, `(#[cfg(unset)] x,) == ()` but `(#[cfg(unset)] x) == error`. This seemed reasonable to me since tuples and unit are type constructors, but could probably be argued either way.
- Attributes on macro nodes are currently unconditionally dropped during macro expansion, which seemed fine since macro disappear at that point?
- Attributes on `ast::ExprParens` will be prepend-ed to the inner expression in the hir folder.
- The work on pretty printer tests for this did trigger, but not fix errors regarding macros:
  - expression `foo![]` prints as `foo!()`
  - expression `foo!{}` prints as `foo!()`
  - statement `foo![];` prints as `foo!();`
  - statement `foo!{};` prints as `foo!();`
  - statement `foo!{}` triggers a `None` unwrap ICE.
2015-12-04 08:46:29 +00:00
bors
5673a7b374 Auto merge of #30189 - crumblingstatue:patch-1, r=alexcrichton
Replace the old link pointing to an out-of-date gist with a
link to the lazy_static crate on crates.io.

We also don't need to state the author, as the crates.io page
shows the authors and owners.
2015-12-04 06:05:08 +00:00
bors
4cedff7be6 Auto merge of #30190 - tshepang:dir_builder-example, r=alexcrichton 2015-12-04 03:26:46 +00:00
Marvin Löbel
d06f48054c Ignore rpass-fulldeps test in cross compile tests 2015-12-04 03:47:53 +01:00
bors
5854fed4ae Auto merge of #30183 - retep998:min-align, r=alexcrichton
This fixes it so the Rust allocator on Windows 32-bit doesn't think the system allocator is aligned to 16 when it is really only aligned to 8.
2015-12-04 01:42:10 +00:00