Commit Graph

43891 Commits

Author SHA1 Message Date
Simonas Kazlauskas
09ed27c05e Remove superfluous variable 2015-06-16 22:29:41 +03:00
Simonas Kazlauskas
ca72d7fe3f Add a test for issue 26322 2015-06-16 22:23:01 +03:00
Simonas Kazlauskas
7ff55eaf25 Fix file!(), line!() and column!() macros
These used to return wrong results in case they were expanded inside compiler’s
iternal syntax sugar (closures, if-let) expansions

Fixes #26322
2015-06-16 21:47:09 +03:00
bors
10356458a7 Auto merge of #24738 - joliv:patch-2, r=steveklabnik
The "unit value" is a value of the "unit type," not the "unit value type." Regardless of correctness, this straight syntax is easier to grok.

Part of #16676

Sorry if something's off here, it's my first pull request to rust!
2015-06-16 17:08:36 +00:00
Niko Matsakis
957935a002 Fix merge errors 2015-06-16 12:08:37 -04:00
Steve Klabnik
5a63326442 One more consistency fix in the reference
https://github.com/rust-lang/rust/pull/26323/files#r32503568
2015-06-16 11:29:20 -04:00
Björn Steinbrink
cabd0682e9 Avoid deref/ref cycles for no-op coercions between unsafe pointers
Unlike coercing from reference to unsafe pointer, coercing between two
unsafe pointers doesn't need an AutoDerefRef, because there is no region
that regionck would need to know about.

In unoptimized libcore, this reduces the number of "auto_deref" allocas
from 174 to 4.
2015-06-16 14:10:52 +02:00
Ulrik Sverdrup
04315949fb test: Fix a bug in bench result formatting
It would skip the middle part if it was 0, displaying a number a 1000
times too small. The MB/s number next to it gave it away.

Fixed it looks like this:

```
test h ... bench:   1,000,129 ns/iter (+/- 4,730)
```
2015-06-16 13:10:27 +02:00
bors
520a471bc5 Auto merge of #26323 - steveklabnik:gh26320, r=alexcrichton
Fixes #26320
2015-06-16 10:40:33 +00:00
bors
4806210db9 Auto merge of #26318 - steveklabnik:gh26268, r=alexcrichton
Fixes #26268
2015-06-16 08:20:57 +00:00
bors
00382a592b Auto merge of #26317 - steveklabnik:gh25956, r=alexcrichton
It isn't really neccesary, but is pretty dense.

Fixes #25956
2015-06-16 06:44:56 +00:00
bors
f6d53af85f Auto merge of #24719 - :patch-1, r=steveklabnik 2015-06-16 05:08:13 +00:00
joliv
b87056fa31 Add unit type info and update associated link
Fixes #25244
2015-06-15 23:04:55 -04:00
bors
af8a4a0805 Auto merge of #26313 - steveklabnik:fix_str_docs, r=alexcrichton
Because these structures are created by a macro, the doc comments
don't quite work: the leading /// isn't stripped. Instead, just
use #[doc] so that they render correctly.
2015-06-16 01:57:34 +00:00
bors
906ad72462 Auto merge of #26311 - jooert:fix25855, r=steveklabnik
Use result of the computation to prevent the compiler from optimising
too much. Change `_x` to `x` and therefore remove the paragraph about
the underscore.

Fixes #25855.

r? @steveklabnik
2015-06-15 23:48:39 +00:00
Niko Matsakis
13cee1e198 This new caching sometimes suppresses duplicate errors that occur in
different parts of the crate, so modify the test cases that were relying
on that to test distinct types etc.
2015-06-15 17:31:27 -04:00
Niko Matsakis
f0f13f86ef Rather than expanding the where-clauses in the environment over and over
again, do it once and then just remember the expanded form. At the same
time, filter globally nameable predicates out of the environment, since
they can cause cache errors (and they are not necessary in any case).
2015-06-15 17:31:27 -04:00
Niko Matsakis
ff89fcf83b Add a (somewhat hacky) cache to the tcx that tracks "global" trait refs
that are known to have been satisfied *somewhere*. This means that if
one fn finds that `SomeType: Foo`, then every other fn can just consider
that to hold.

Unfortunately, there are some complications:

1. If `SomeType: Foo` includes dependent conditions, those conditions
   may trigger an error. This error will be repored in the first fn
   where `SomeType: Foo` is evaluated, but not in the other fns, which
   can lead to uneven error reporting (which is sometimes confusing).

2. This kind of caching can be unsound in the presence of
   unsatisfiable where clauses. For example, suppose that the first fn
   has a where-clause like `i32: Bar<u32>`, which in fact does not
   hold. This will "fool" trait resolution into thinking that `i32:
   Bar<u32>` holds. This is ok currently, because it means that the
   first fn can never be calle (since its where clauses cannot be
   satisfied), but if the first fn's successful resolution is cached, it
   can allow other fns to compile that should not. This problem is fixed
   in the next commit.
2015-06-15 17:31:26 -04:00
bors
c656e99e43 Auto merge of #26282 - arielb1:probe-leak, r=nikomatsakis
It can introduce obligations to the fulfillment context, which would
incorrectly still remain after the probe finished.

Fixes #25679.

r? @eddyb
2015-06-15 21:27:43 +00:00
Steve Klabnik
22b6a5dc2a Significantly simplify generic example
Fixes #26320
2015-06-15 16:38:05 -04:00
bors
73fb19c04a Auto merge of #26275 - arielb1:unconstrained-projection, r=nikomatsakis
Fixes #26262

Because this rejects code that previously compiled, this is a [breaking-change]

r? @nikomatsakis
2015-06-15 19:52:15 +00:00
Steven Walter
85be7c5f75 src/rt/arch/i386/morestack.S: call rust_stack_exhausted via plt
This prevents a relocation in the text section.  Text relocations are
incompatible with hardened kernels.

https://github.com/rust-lang/rust/issues/5714
2015-06-15 14:56:50 -04:00
bors
a53a098b72 Auto merge of #26293 - mihneadb:rustdoc-search-orphan-methods, r=alexcrichton
In https://github.com/rust-lang/rust/pull/23289, I did not include the type information for searching for orphan methods (methods that are defined in a module and implemented in another - doing this causes rustdoc sometimes to first find the impl before the actual type).

This PR fixes this. By merging this, searches for `char -> bool` will also find `is_alphabetic`, for example (which otherwise was only found for `charext -> bool`).


cc @alexcrichton
2015-06-15 18:17:22 +00:00
Steve Klabnik
1792ef6ae4 Clarify that the following will error
Fixes #26268
2015-06-15 13:18:07 -04:00
Steve Klabnik
75ffcd8e59 Remove confusing paragraph from Trait Objects
It isn't really neccesary, but is pretty dense.

Fixes #25956
2015-06-15 13:16:16 -04:00
Johannes Oertel
3e7ab1b5cb Update example in "Rust Inside Other Languages"
Use result of the computation to prevent the compiler from optimising
too much. Change `_x` to `x` and therefore remove the paragraph about
the underscore.

Fixes #25855.
2015-06-15 19:12:34 +02:00
Steve Klabnik
3db26db24a remove confusing 1i32
The font can make this hard to read, and we don't even strictly need
the annotation, so let's just remove it

Fixes #26287
2015-06-15 12:42:07 -04:00
Steve Klabnik
f84ad0a001 Fix broken link in TRPL: introduction
Fixes #26312
2015-06-15 12:31:40 -04:00
Steve Klabnik
759a5d1022 Fix up Split docs
Because these structures are created by a macro, the doc comments
don't quite work: the leading /// isn't stripped. Instead, just
use #[doc] so that they render correctly.
2015-06-15 12:25:10 -04:00
Ariel Ben-Yehuda
6cdccc5a78 Make impl-trait-ref associated types work in methods 2015-06-15 18:27:35 +03:00
Ariel Ben-Yehuda
1af72660a7 Don't call instantiate_type_scheme during method probing
It can introduce obligations to the fulfillment context, which would
incorrectly still remain after the probe finished.

Fixes #25679.
2015-06-15 18:27:35 +03:00
bors
d9b8015828 Auto merge of #26302 - aidanhs:aphs-fix-musl-libc, r=alexcrichton
musl may not be available on the target user's machine, and even if it is, we may not be able to find it because of how static libraries are searched for.
Instead, use the liblibc archive created at rust compile time which already contains libc.a.

---

To be honest, my brain is bending a bit at this point and I wonder if I'm doing something a bit stupid.

Problem: building the libc crate with target musl. It says "could not find native static library `c`, perhaps an -L flag is missing?".

Some pondering: the key problem is the way static archives are searched for (note that a musl build attempts to statically link to libc) - they aren't. There are three locations which are checked (including `$PREFIX/lib/rustlib/x86_64-unknown-linux-musl/lib`), but this does not include `$PREFIX/lib`...and it probably shouldn't - rustc is mimicking the way native lib generation works by forcing you to provide the path yourself. You can make it work `cargo rustc` with `-L native=/path/to/musl/lib`, but even if this went in a build script for the libc crate, it wouldn't work if musl isn't installed by the end user.

I've sprinkled `not(test)` around but I've no idea if I've done it right.

This patch allows `cargo build --target x86_64-unknown-linux-musl` to work on a crate with a dependency on libc, where the musl-enabled rust was compiled before this patch. I've not yet kicked off the long process to build a musl-enabled rust with this patch, so it might be broken there.

Sorry for the rambling.

r? @alexcrichton
2015-06-15 14:07:48 +00:00
Aidan Hobson Sayers
52862e4cda When building libc crate with musl, don't look for libc.a
musl may not be available on the target user's machine, and even if
it is, we may not be able to find it because of how static libraries
are searched for.
Instead, use the transitively included liblibc which includes libc.a.
2015-06-15 13:42:18 +01:00
bors
0d82fb55db Auto merge of #26307 - nrc:save-bugs, r=cmr
r? @brson (or anyone, really)
2015-06-15 09:02:31 +00:00
bors
7517ecf4fc Auto merge of #26168 - sfackler:stdout-panic, r=alexcrichton
Closes #25977

The various `stdfoo_raw` methods in std::io now return `io::Result`s,
since they may not exist on Windows. They will always return `Ok` on
Unix-like platforms.

[breaking-change]
2015-06-15 06:44:42 +00:00
Nick Cameron
a54bbac99a save-analysis: fix a couple of span bugs 2015-06-15 18:10:49 +12:00
bors
a54a809219 Auto merge of #25359 - thepowersgang:result-expect-2, r=alexcrichton
As it says in the title. I've added an `expect` method to `Result` that allows printing both an error message (e.g. what operation was attempted), and the error value. This is separate from the `unwrap` and `ok().expect("message")` behaviours.
2015-06-15 05:11:53 +00:00
John Hodge
0937c10f3c libcore/Result - RFC#1119 Add an 'expect' method to Result 2015-06-15 12:00:16 +08:00
Steven Fackler
a7bbd7da4e Implement RFC 1014
Closes #25977

The various `stdfoo_raw` methods in std::io now return `io::Result`s,
since they may not exist on Windows. They will always return `Ok` on
Unix-like platforms.

[breaking-change]
2015-06-14 20:17:06 -07:00
bors
7d04623033 Auto merge of #26290 - michaelsproul:url-line-limit, r=alexcrichton
The plugin that enforces error explanation line-length is a bit restrictive, particularly when attempting to use URLs in explanations (cf #26163).

Jashank will still have to do some mucking around with `#[cfg(not(stage0))]` attributes or else wait until a snapshot with this commit lands.
2015-06-15 01:57:17 +00:00
bors
8937ec1004 Auto merge of #26265 - retep998:heapalloc, r=alexcrichton
This removes our dependency on the CRT for memory allocation.
2015-06-15 00:24:31 +00:00
bors
4f3c19f547 Auto merge of #26110 - nrc:save-api-3, r=brson
r? @huonw
2015-06-14 22:47:55 +00:00
Nick Cameron
718268398e Rebasing and bug fixing 2015-06-15 10:06:01 +12:00
bors
b26eeffacb Auto merge of #26213 - semarie:openbsd-morestack, r=alexcrichton
don't try to bind __morestack symbol under OpenBSD as the platform don't
have morestack support.

r? @alexcrichton 

it unbreak build under OpenBSD. Does some others platforms don't have morestack too ? They should be impacted by this problem too.
2015-06-14 21:15:32 +00:00
Nick Cameron
92d6676412 save-analysis: use a macro for 'downcasting' 2015-06-15 08:16:35 +12:00
Nick Cameron
788fdddf37 save-analysis: API-ify struct lits 2015-06-15 08:16:35 +12:00
Nick Cameron
04b32cecac save-analysis: merge StructRef and TypeRef 2015-06-15 08:15:29 +12:00
Nick Cameron
78c25eabd5 save-analysis: API-ify impls 2015-06-15 08:15:29 +12:00
Nick Cameron
abe5f7b95a save-analysis: move fields to the API 2015-06-15 08:14:50 +12:00
bors
e89bb24cb2 Auto merge of #26071 - petrochenkov:assert1, r=alexcrichton
`assert_eq!` has better diagnostics than `assert!` and is more helpful when something actually breaks, but the diagnostics has it's price - `assert_eq!` generate some formatting code which is slower to compile and possibly run.
[My measurements](https://internals.rust-lang.org/t/assert-a-b-or-assert-eq-a-b/1367/12?u=petrochenkov) show that presence of this formatting code doesn't affect compilation + execution time of the test suite significantly, so `assert_eq!` can be used instead of `assert!` consistently.

(Some tests doesn't reside in src/test, they are not affected by these changes, I'll probably open a separate PR for them later)
2015-06-14 19:42:26 +00:00