Commit Graph

54669 Commits

Author SHA1 Message Date
bors
a9234c11e0 Auto merge of #34086 - srinivasreddy:rustfmt_liballoc_jemalloc, r=nagisa
run rustfmt on liballoc_jemalloc folder
2016-06-10 00:19:09 -07:00
bors
c09d546ee5 Auto merge of #34046 - Vtec234:fix-atomic-doc, r=steveklabnik
Fix wrong statement in compare_exchange doc

The documentation for `core::sync::atomic::AtomicSomething::compare_exchange` contains a wrong, or imprecise, statement about the return value. It goes:

The return value is a result indicating whether the new value was written and containing
the previous value. On success this value is guaranteed to be equal to `new`.

In the second sentence, `this value` is gramatically understood as referring to `return value` from the first sentence. Due to how CAS works, the returned value is always what was in the atomic variable _before_ the operation occurred, not what was written into it during the operation. Hence, the fixed doc should say:

The return value is a result indicating whether the new value was written and containing
the previous value. On success this value is guaranteed to be equal to `current`.

This version is confirmed by the runnable examples in variants of `AtomicSomething`, e.g.

    assert_eq!(some_bool.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed),
    Ok(true));

where the returned value is `Ok(current)`. This PR fixes all occurrences of this bug I could find.

An alternative solution would be to modify the second sentence so that it refers to the value _written_ into the Atomic rather than what was there before, in which case it would be correct. Example alternative formulation:

On success the value written into the `bool`/`usize`/`whatever` is guaranteed to be equal to `new`.

r? @steveklabnik
2016-06-09 21:29:26 -07:00
bors
2798772b51 Auto merge of #34173 - srinivasreddy:rm_redundant, r=alexcrichton
remove redundant  assert statements
2016-06-09 18:38:46 -07:00
bors
7d2f75a953 Auto merge of #34095 - petrochenkov:pathir2, r=jseyfried
Improvements to pattern resolution + some refactoring

Continuation of https://github.com/rust-lang/rust/pull/33929
First commit is a careful rewrite of `resolve_pattern`, pattern path resolution and new binding creation logic is factored out in separate functions, some minor bugs are fixed. Also, `resolve_possibly_assoc_item` doesn't swallow modules now.
Later commits are refactorings, see the comment descriptions.

I intend to continue this work later with better support for `Def::Err` in patterns in post-resolve stages and cleanup of pattern resolution code in type checker.

Fixes https://github.com/rust-lang/rust/issues/32086
Fixes https://github.com/rust-lang/rust/issues/34047 ([breaking-change])
Fixes https://github.com/rust-lang/rust/issues/34074

cc @jseyfried
r? @eddyb
2016-06-09 15:48:37 -07:00
Vadim Petrochenkov
6d7b35bd98 Address review comments + fix rebase 2016-06-10 01:06:37 +03:00
Ariel Ben-Yehuda
e783a0a5e3 make all pattern bindings with the same name resolve to the first one
This simplifies the code considerably, removing one of the
last uses of hygienic matching out of resolution.
2016-06-10 01:06:37 +03:00
Vadim Petrochenkov
392b6e7c81 Add tests 2016-06-10 01:03:54 +03:00
Vadim Petrochenkov
ee4e55398b Introduce TyCtxt::expect_def/expect_resolution helpers and use them where possible 2016-06-10 01:03:54 +03:00
Vadim Petrochenkov
4c30f6405c Move the hack with fake partial resolution for <A>::B from typeck to resolve 2016-06-10 01:03:54 +03:00
Vadim Petrochenkov
91b9dabdeb resolve: Rewrite resolve_pattern 2016-06-10 01:03:54 +03:00
Oliver Middleton
ee469058e1 Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T> 2016-06-09 23:03:14 +01:00
Tshepang Lekhonkhobe
3dfc8c1869 doc: intro should be 1 sentence
Also, do not repeat name of type
2016-06-09 23:23:09 +02:00
Jake Goulding
e51958ba72 Support getting the minimum 16-bit isize value 2016-06-09 17:02:20 -04:00
Andy Russell
300a5d7d71 fix indentation in README 2016-06-09 16:12:12 -04:00
Jake Goulding
f3d9de4528 Remove unneeded indirection of GET_ARCHIVE 2016-06-09 15:59:27 -04:00
Jake Goulding
4f01329e0e Reflect supporting only LLVM 3.7+ in the LLVM wrappers 2016-06-09 15:59:26 -04:00
Alex Burka
53618c3629 test traits defined on ranges 2016-06-09 15:32:43 -04:00
bors
ee00760a14 Auto merge of #34149 - arielb1:remove-remove-dead-blocks, r=nikomatsakis
MIR cleanups and predecessor cache

This PR cleans up a few things in MIR and adds a predecessor cache to allow graph algorithms to be run easily.

r? @nikomatsakis
2016-06-09 12:07:38 -07:00
Ariel Ben-Yehuda
ce4fdefbd8 fix issues 2016-06-09 21:47:58 +03:00
Alex Burka
9e78cd73b5 make RangeInclusive Hash and !Copy
[breaking-change] due to the removal of Copy which shouldn't have been there in the first place, as per policy set forth in #27186.
2016-06-09 13:26:02 -04:00
Alex Burka
85e76e804d derive Hash for ranges
Fixes #34170.
2016-06-09 10:52:36 -04:00
bors
0740a93cc2 Auto merge of #33895 - AndrewBrinker:master, r=steveklabnik
Rewrote "How Safe and Unsafe Interact" Nomicon chapter.

The previous version of the chapter covered a lot of ground, but was a little meandering and hard to follow at times. This draft is intended to be clearer and more direct, while still providing the same information as the previous version.

r? @steveklabnik
2016-06-09 07:13:34 -07:00
Ariel Ben-Yehuda
f5b1ba6e90 use the type name as the pass name 2016-06-09 15:24:46 +03:00
Ariel Ben-Yehuda
065a264976 refactor simplify_cfg and split off simplify_branches 2016-06-09 15:24:43 +03:00
Ariel Ben-Yehuda
2ee00e6d9d add hook infrastructure for automatically dumping MIR on every pass 2016-06-09 15:21:43 +03:00
Ariel Ben-Yehuda
798be90648 introduce an unreachable terminator
Use it instead of a `panic` for inexhaustive matches and correct the
comment. I think we trust our match-generation algorithm enough to
generate these blocks, and not generating an `unreachable` means that
LLVM won't optimize `match void() {}` to an `unreachable`.
2016-06-09 15:16:15 +03:00
Ariel Ben-Yehuda
6405527ded add a cache for MIR predecessors 2016-06-09 15:01:45 +03:00
Ariel Ben-Yehuda
e3af9fa490 make the basic_blocks field private 2016-06-09 14:55:19 +03:00
Ariel Ben-Yehuda
bc1eb67721 introduce the type-safe IdxVec and use it instead of loose indexes 2016-06-09 14:26:08 +03:00
bors
33c8992b80 Auto merge of #34109 - pnkfelix:fix-issue-34101, r=arielb1
Fix issue #34101

Fix issue #34101: do not track subcontent of type with dtor nor gather flags for untracked content.

(Includes a regression test, which needed to go into `compile-fail/`
due to weaknesses when combining `#[deny(warnings)]` with
`tcx.sess.span_warn(..)`)
2016-06-09 04:24:50 -07:00
Ariel Ben-Yehuda
e9003c5574 merge the RemoveDeadBlocks pass into the SimplifyCfg pass 2016-06-09 13:23:00 +03:00
bors
24526cc3cc Auto merge of #34108 - jseyfried:refactor_prelude_injection, r=nrc
Refactor away the prelude injection fold

Instead, just inject `#[prelude_import] use [core|std]::prelude::v1::*;` at the crate root while injecting `extern crate [core|std];` and process `#[no_implicit_prelude]` attributes in `resolve`.

r? @nrc
2016-06-09 01:35:26 -07:00
bors
dc77c5ebe8 Auto merge of #34032 - jseyfried:load_macros_in_expansion, r=nrc
Support `#[macro_use]` on macro-expanded crates

This PR loads macros from `#[macro_use]` crates during expansion so that
 - macro-expanded `#[macro_use]` crates work (fixes #33936, fixes #28071), and
 - macros imported from crates have the same scope as macros imported from modules.

This is a [breaking-change]. For example, this will break:
```rust
macro_rules! m {
    () => { #[macro_use(foo)] extern crate core; } //~ ERROR imported macro not found
}
m!();
```
Also, this will break:
```rust
macro_rules! try { () => {} }
// #[macro_use] mod bar { macro_rules! try { ... } } //< ... just like this would ...
fn main() { try!(); } //< ... making this an error
```

r? @nrc
2016-06-08 22:45:35 -07:00
Pavel Pravosud
8180a910f9 Fix BTreeMap example typo
The whole example is made around movies reviews, but that one line says "review some books".
2016-06-08 20:32:24 -07:00
Srinivas Reddy Thatiparthy
c605480521 clean up for test cases 2016-06-09 08:20:08 +05:30
Srinivas Reddy Thatiparthy
c6ed7adf7a remove redundant assert statements 2016-06-09 08:12:31 +05:30
bors
bb4b3fb7f9 Auto merge of #32202 - arielb1:slice-patterns, r=nikomatsakis
Implement RFC495 semantics for slice patterns

non-MIR translation is still not supported for these and will happily ICE.

This is a [breaking-change] for many uses of slice_patterns.

[RFC 495 text](https://github.com/rust-lang/rfcs/blob/master/text/0495-array-pattern-changes.md)
2016-06-08 19:30:33 -07:00
Jeffrey Seyfried
dbf0326ddc Add comment and clean up expand_annotatable 2016-06-09 00:49:42 +00:00
Jeffrey Seyfried
13e3925e8d Add regression test 2016-06-09 00:45:04 +00:00
Jeffrey Seyfried
51499b6e1f Load macros from extern crates during expansion. 2016-06-09 00:44:17 +00:00
Jeffrey Seyfried
c751ec626d Add regression test 2016-06-09 00:31:19 +00:00
Jeffrey Seyfried
8254e55760 Avoid configuring interpolated items. 2016-06-09 00:26:35 +00:00
bors
34505e2228 Auto merge of #34167 - eddyb:fix-pairs-for-real, r=nikomatsakis
trans: don't misuse C_nil for ZSTs other than ().

`C_nil` is actually `C_null` for `()` so `TempRef::new_operand` was treating all ZSTs as `()`.
This should allow running Servo with `RUSTFLAGS=-Zorbit`, assuming there are no other bugs.
2016-06-08 16:41:01 -07:00
Ariel Ben-Yehuda
2de6ea7a35 fix Cargo.lock 2016-06-09 01:05:37 +03:00
Ariel Ben-Yehuda
f0174fcbee use the slice_pat hack in libstd too 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
9b1abf5c65 remove residual slice pattern junk from mem_categorization 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
fcabfa9735 add an help message when using an old-style slice pattern 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
5cf4139d21 fix tests 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
a673cedf7b fix stdtest 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
b2100cc7b5 fix damage in librustc 2016-06-09 00:38:38 +03:00