Commit Graph

37890 Commits

Author SHA1 Message Date
Alex Crichton
425f2328d0 rollup merge of #21754: semarie/openbsd-rebased
Hi.

Here a commit in order to add OpenBSD support to rust.

- tests status:
run-pass: test result: ok. 1879 passed; 0 failed; 24 ignored; 0 measured
run-fail: test result: ok. 81 passed; 0 failed; 5 ignored; 0 measured
compile-fail: test result: ok. 1634 passed; 0 failed; 22 ignored; 0 measured
run-pass-fulldeps: test result: ok. 22 passed; 0 failed; 1 ignored; 0 measured
compile-fail-fulldeps: test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured

- The current implementation of load_self function (src/libstd/sys/unix/os.rs) isn't optimal as under OpenBSD I haven't found a reliable method to get the filename of a running process. The current implementation is enought for bootstrapping purpose.

- I have disable `run-pass/tcp-stress.rs` test under openbsd. When run manually, the test pass, but when run under `compiletest`, it timeout and echo continuoulsy `Too many open files`.

- For building with jemalloc, a more recent version of jemalloc would be mandatory. See https://github.com/jemalloc/jemalloc/pull/188 for more details.
2015-02-02 10:56:57 -08:00
Alex Crichton
9529ab0e7e rollup merge of #21710: alfie/libsyntax
Conflicts:
	src/libsyntax/parse/parser.rs
2015-02-02 10:56:55 -08:00
Alex Crichton
8c468b69ae rollup merge of #21567: steveklabnik/doc_char 2015-02-02 10:56:11 -08:00
Alex Crichton
5e25d11ebf rollup merge of #21509: lucab/lucab/copyright-update
valgrind files moved and modpath.iss deleted. Both entries updated in
COPYRIGHT file.

Signed-off-by: Luca Bruno <lucab@debian.org>
2015-02-02 10:56:10 -08:00
Alex Crichton
a392d9131e rollup merge of #21362: aochagavia/copy_rawptr
Fixes #21272 and #21296

r? @cmr
2015-02-02 10:56:07 -08:00
Alex Crichton
ddcfb158fd rollup merge of #21223: P1start/expected-token-improvements
Fixes #21153.
2015-02-02 10:56:05 -08:00
Adolfo Ochagavía
8b84f097fb Add test for #21296 2015-02-02 16:28:08 +01:00
Adolfo Ochagavía
b9a67e3236 Do not warn when deriving Copy for raw pointers
Fixes #21272 and #21296
2015-02-02 16:28:07 +01:00
bors
eaf4c5c784 Auto merge of #21864 - sanxiyn:no-chain, r=nikomatsakis
This avoids triggering #21694. It probably is a better way to do it anyway.
2015-02-02 15:04:54 +00:00
Steve Klabnik
fcf1a57cea Documenting libcore/char.rs 2015-02-02 09:08:51 -05:00
bors
758a296e27 Auto merge of #21647 - alfie:suffix-medium, r=alexcrichton 2015-02-02 11:52:34 +00:00
Seo Sanghyeon
6a1a46e8d7 Avoid an excessive use of iterator chain 2015-02-02 18:33:24 +09:00
Alfie John
9683745fed Omit integer suffix when unnecessary
See PR # 21378 for context
2015-02-02 04:05:54 +00:00
P1start
597b4fa984 Tweak some ‘expected…’ error messages
Fixes #21153.
2015-02-02 15:30:35 +13:00
bors
ca4b9674c2 Auto merge of #21318 - stepancheg:box-fns, r=alexcrichton
Functions are needed for safety and convenience.

It is a common pattern to use `mem::transmute` to convert between
`Box` and raw pointer, like this:

```
let b = Box::new(3);
let p = mem::transmute(b);
// pass `p` to some C library
```

After this commit, conversion can be written as:

```
let p = b.into_raw();
```

`into_raw` and `from_raw` functions are still unsafe, but they are
much safer than `mem::transmute`, because *raw functions do not
convert between incompatible pointers. For example, this likely
incorrect code can be successfully compiled:

```
let p: *mut u64 = ...
let b: Box<u32> = mem::transmute(p);
```

Using `from_raw` results in compile-time error:

```
let p: *mut u64 = ...
let b: Box<u32> = Box::from_raw(p); // compile-time error
```

`into_raw` and `from_raw` functions are similar to C++ `std::unique_ptr`
`release` function [1] and constructor from pointer [2].

[1] http://en.cppreference.com/w/cpp/memory/unique_ptr/release
[2] http://en.cppreference.com/w/cpp/memory/unique_ptr/unique_ptr
2015-02-01 21:53:53 +00:00
bors
c2bda2a5bb Auto merge of #21806 - edwardw:new-range-impl, r=alexcrichton
The new `::ops::Range` has separated implementations for each of the
numeric types, while the old `::iter::Range` has one for type `Int`.
However, we do not take output bindings into account when selecting
traits. So it confuses `typeck` and makes the new range does not work as
good as the old one when it comes to type inference.

This patch implements `Iterator` for the new range for one type `Int`.
This limitation could be lifted, however, if we ever reconsider the
output types' role in type inference.

Closes #21595
Closes #21649
Closes #21672
2015-02-01 19:07:11 +00:00
Stepan Koltsov
5a722f8632 box: into_raw, from_raw functions
Functions are needed for safety and convenience.

It is a common pattern to use `mem::transmute` to convert between
`Box` and raw pointer, like this:

```
let b = Box::new(3);
let p = mem::transmute(b);
// pass `p` to some C library
```

After this commit, conversion can be written as:

```
let p = boxed::into_raw(b);
```

`into_raw` and `from_raw` functions are still unsafe, but they are
much safer than `mem::transmute`, because *raw functions do not
convert between incompatible pointers. For example, this likely
incorrect code can be successfully compiled:

```
let p: *mut u64 = ...
let b: Box<u32> = mem::transmute(p);
```

Using `from_raw` results in compile-time error:

```
let p: *mut u64 = ...
let b: Box<u32> = Box::from_raw(p); // compile-time error
```

`into_raw` and `from_raw` functions are similar to C++ `std::unique_ptr`
`release` function [1] and constructor from pointer [2].

[1] http://en.cppreference.com/w/cpp/memory/unique_ptr/release
[2] http://en.cppreference.com/w/cpp/memory/unique_ptr/unique_ptr
2015-02-01 20:15:44 +03:00
bors
76ce1ea421 Auto merge of #21811 - tbu-:pr_more_isize, r=alexcrichton
Remove more `isize` stuff. Also fix the manual a bit about integer inference.
2015-02-01 15:49:20 +00:00
Sébastien Marie
f6414b0187 openbsd: rebase to master
- incoporate changes introduced by #21678
2015-02-01 15:34:59 +01:00
Sébastien Marie
fdb5d77d09 openbsd: remove specific block and cleanup linkage
- the specific block for dl* function isn't need for openbsd if libdl
  isn't marked to be linked here. remove them.

- remove the linkage for libdl: it should already specified in `rtdeps.rs`.

the code of `dynamic_lib.rs` include libdl for:
 - linux (already defined in rtdeps.rs)
 - android (already defined in rtdeps.rs)
 - macos (not needed for macos)
 - ios (probably the same as macos)
 - freebsd (libdl is a stub)
 - dragonfly (libdl is a stub)
2015-02-01 14:41:41 +01:00
Sébastien Marie
3430578460 openbsd: remove unused openbsd code
This code is in a block (libc::consts::os) that openbsd don't include
This one is for freebsd and dragonfly. There is another block for openbsd below.

Remove the unneed declaration.
2015-02-01 14:41:41 +01:00
Sébastien Marie
568a451a90 openbsd: incoporate remarks
- consolidate target_record_sp_limit and target_get_sp_limit functions
  for aarch64, powerpc, arm-ios and openbsd as there are all without
  segmented stacks (no need to duplicate functions).

- rename __load_self function to rust_load_self

- use a mutex inner load_self() as underline implementation is not thread-safe
2015-02-01 14:41:40 +01:00
Sébastien Marie
3096784a3b openbsd: break lines too long 2015-02-01 14:41:39 +01:00
Sébastien Marie
fcb30a0b67 openbsd support 2015-02-01 14:41:38 +01:00
bors
0ab8d5dadd Auto merge of #21805 - nikomatsakis:closure-inference-refactor-1, r=eddyb
Currently, we only infer the kind of a closure based on the expected type or explicit annotation. If neither applies, we currently report an error. This pull request changes that case to defer the decision until we are able to analyze the actions of the closure: closures which mutate their environment require `FnMut`, closures which move out of their environment require `FnOnce`.

This PR is not the end of the story:

- It does not remove the explicit annotations nor disregard them. The latter is the logical next step to removing them (we'll need a snapshot before we can do anything anyhow). Disregarding explicit annotations might expose more bugs since right now all closures in libstd/rustc use explicit annotations or the expected type, so this inference never kicks in.
- The interaction with instantiating type parameter fallbacks leaves something to be desired. This is mostly just saying that the algorithm from https://github.com/rust-lang/rfcs/pull/213 needs to be implemented, which is a separate bug. There are some semi-subtle interactions though because not knowing whether a closure is `Fn` vs `FnMut` prevents us from resolving obligations like `F : FnMut(...)`, which can in turn prevent unification of some type parameters, which might (in turn) lead to undesired fallback. We can improve this situation however -- even if we don't know whether (or just how) `F : FnMut(..)` holds or not for some closure type `F`, we can still perform unification since we *do* know the argument and return types. Once kind inference is done, we can complete the `F : FnMut(..)` analysis -- which might yield an error if (e.g.) the `F` moves out of its environment. 

r? @nick29581
2015-02-01 13:01:57 +00:00
Niko Matsakis
870aea216b Do not ICE when e.g. call_mut() is called on a closure whose kind is not yet known. 2015-02-01 06:13:07 -05:00
Niko Matsakis
a9c3841a50 Fix handling of move closures -- since they have one fewer deref, we weren't properly adjusting the closure kind in that case. 2015-02-01 06:13:06 -05:00
Niko Matsakis
e778ea4070 Tweak comments per eddyb's suggestion. 2015-02-01 06:13:06 -05:00
Niko Matsakis
5a39a0d266 To handle more complex cases, modify the deferred call handler to be
specialized to closures, and invoke them as soon as we know the
closure kind. I thought initially we would need a fixed-point
inference algorithm but it appears I was mistaken, so we can do this.
2015-02-01 06:13:06 -05:00
Niko Matsakis
e1f54f01d6 Implement basic inference for closure kinds and some simple tests.
Trickier cases not yet handled.
2015-02-01 06:13:06 -05:00
Niko Matsakis
2f465869fd Separate out the unboxed closure table into two tables, so that we can
generate the closure type and closure kind separately.
2015-02-01 06:13:06 -05:00
Niko Matsakis
92f94765ec Adjust the handling of trait obligations and defaults to account for
upvar inference.  Upvar inference can cause some obligations to be
deferred, notably things like `F : Sized` where `F` is a closure type,
or `F : FnMut`. Adjust the ordering therefore so that we process all
traits and apply fallback, do upvar inference, and only then start
reporting errors for outstanding obligations.
2015-02-01 06:13:06 -05:00
Niko Matsakis
f5281e2bb5 Do not make fake types for upvars if we haven't yet inferred whether they are borrowed
or by value.
2015-02-01 06:13:05 -05:00
Niko Matsakis
bc41cc0ec9 Make unboxed_closure_kind return Option to allow for the possibility that its value is not yet known. 2015-02-01 06:13:05 -05:00
Niko Matsakis
53c1956cfb Introduce the notion of deferred resolutions and use it to hold off on
doing the final checking for closure calls until after trait inference
is performed. This isn't important now, but it's essential if we are to
delay inferring the closure kind.
2015-02-01 06:13:05 -05:00
Alfie John
00a933f9ec More deprecating of i/u suffixes in libraries 2015-02-01 10:34:16 +00:00
bors
f1f9cb705d Auto merge of #21809 - japaric:no-copy, r=alexcrichton
Removes `Copy` from `ops::Range` (`a..b`) and `ops::RangeFrom` (`a..`)

[breaking-change]

---

I forgot about these two in #20790, this PR also adds `Clone` to the `Peekable` adapter which used to be `Copy`able.

r? @nikomatsakis or anyone
2015-02-01 10:14:51 +00:00
bors
fe4340ab18 Auto merge of #21788 - carllerche:master, r=alexcrichton
The implementation is similar to `Thread::park`
2015-02-01 07:21:14 +00:00
Edward Wang
b9c055cc70 Fix fallout 2015-02-01 14:29:42 +08:00
Edward Wang
cd977ee217 Make sure type inference with a..b as good as range(a,b)
The new `::ops::Range` has separated implementations for each of the
numeric types, while the old `::iter::Range` has one for type `Int`.
However, we do not take output bindings into account when selecting
traits. So it confuses `typeck` and makes the new range does not work as
good as the old one when it comes to type inference.

This patch implements `Iterator` for the new range for one type `Int`.
This limitation could be lifted, however, if we ever reconsider the
output types' role in type inference.

Closes #21595
Closes #21649
Closes #21672
2015-02-01 14:08:14 +08:00
bors
a2aee6290a Auto merge of #21768 - Gankro:hash-send, r=alexcrichton
Fixes #21763 

(untested)
2015-02-01 04:21:09 +00:00
bors
e8489d3cc7 Auto merge of #21792 - nikomatsakis:orphan-ordered-first, r=aturon
Update the coherence rules to "covered first" -- the first type parameter to contain either a local type or a type parameter must contain only covered type parameters.

cc #19470.
Fixes #20974.
Fixes #20749.

r? @aturon
2015-02-01 01:34:08 +00:00
bors
f1398d2736 Auto merge of #21760 - brson:snaps, r=alexcrichton 2015-01-31 20:21:02 +00:00
Alexis
998599187f make Send/Sync impl of RawTable manual 2015-01-31 14:11:53 -05:00
Tobias Bucher
b4a43f3864 Kill more isizes 2015-01-31 17:40:40 +01:00
Jorge Aparicio
c3841b9c9f remove Copy impls from remaining iterators 2015-01-31 09:09:22 -05:00
Tobias Bucher
105bfd3001 Reference: Purge isize from non-memory-related examples
Also explain integer fallback to `i32`.
2015-01-31 12:23:26 +01:00
Niko Matsakis
2c2879bbce Adjust error message not to mention the self type 2015-01-31 04:39:16 -05:00
bors
474b324eda Auto merge of #21791 - alexcrichton:rollup, r=alexcrichton 2015-01-31 03:57:01 +00:00
Alex Crichton
e8fd9d3d0b Merge remote-tracking branch 'origin/master' into rollup 2015-01-30 19:55:37 -08:00