Commit Graph

44938 Commits

Author SHA1 Message Date
Jared Roesch
8ea9672f82 Address nit 2015-07-25 20:05:42 -07:00
Jared Roesch
55621b6199 Add feature gate 2015-07-25 20:05:42 -07:00
Jared Roesch
9da04b2bd1 Make default error reporting deterministic 2015-07-25 19:57:59 -07:00
Jared Roesch
d732f7323b Add cross-crate error message tests 2015-07-25 19:57:59 -07:00
Jared Roesch
77165415b7 Address tidy 2015-07-25 19:57:59 -07:00
Jared Roesch
99a12933fb Rework cross crate error messages 2015-07-25 19:57:59 -07:00
Jared Roesch
ed3fbba797 Fix error message spans 2015-07-25 19:57:59 -07:00
Jared Roesch
fbfbdd7d14 Correctly subst defaults with the in-scope substs 2015-07-25 19:57:58 -07:00
Jared Roesch
b75f215e82 Remove second transaction 2015-07-25 19:57:58 -07:00
Jared Roesch
ee43920410 Rebase fixes 2015-07-25 19:57:58 -07:00
Jared Roesch
e85787102f Clean up test cases 2015-07-25 19:57:58 -07:00
Jared Roesch
01dcb3bdf0 Refactor the default type parameter algorithm
The algorithm was not correctly detecting conflicts after moving
defaults into TypeVariableValue. The updated algorithm
correctly detects and reports conflicts with information about
where the conflict occured and which items the defaults were
introduced by. The span's for said items are not being correctly
attached and still need to be patched.
2015-07-25 19:57:58 -07:00
Jared Roesch
d782e35c30 Fix bug with defaults not being restored 2015-07-25 19:57:58 -07:00
Jared Roesch
49eb2c6763 Remove defaults table and attach defaults directly to tyvars 2015-07-25 19:57:58 -07:00
Jared Roesch
bbdca2c8ad Correctly collect defaults from type alises in astconv 2015-07-25 19:57:57 -07:00
Jared Roesch
91de8e6c28 Fix tidy 2015-07-25 19:57:57 -07:00
Jared Roesch
bbcb13da88 Implement Default TyParam fallback
This patch allows type parameter defaults to influence type inference. This is a possible breaking change since it effects the way type inference works and will have different behavior when mixing defaults and literal fallback.
2015-07-25 19:57:57 -07:00
Leif Arne Storset
95c7f306c7 Mention pub for structs and fields 2015-07-25 21:20:27 +02:00
Leif Arne Storset
7bec320e6e Default methods example: Show "(in)valid" case
Instead of bar/baz, use valid/invalid as default methods. This
illustrates why you might want default methods, and shows that you can
call other trait methods from a default method.
2015-07-25 20:53:57 +02:00
Ariel Ben-Yehuda
11aa8756c1 Substitute free lifetimes in Self::T
Fixes #27281
2015-07-25 21:25:51 +03:00
bors
7276d8b761 Auto merge of #27258 - nikomatsakis:issue-26952, r=eddyb
Correct regression in type-inference caused by failing to reconfirm that
the object trait matches the required trait during trait selection.  The
existing code was checking that the object trait WOULD match (in a
probe), but never executing the match outside of a probe.

This corrects various regressions observed in the wild, including
issue #26952. Fixes #26952.

r? @eddyb 
cc @frankmcsherry
2015-07-25 18:16:51 +00:00
Kornel Lesiński
c20e3fc1e4 Document Unicode complications in chars iterator 2015-07-25 16:01:48 +01:00
bors
e333e6a0dc Auto merge of #26630 - eefriedman:recursive-static, r=pnkfelix
***Edit: Fixed now.*** I'm pretty sure the way I'm using LLVMReplaceAllUsesWith here is
unsafe... but before I figure out how to fix that, I'd like a
reality-check: is this actually useful?
2015-07-25 14:50:13 +00:00
bors
04badd6a97 Auto merge of #27253 - bossmc:unbalanced-delimiters-cause-ice, r=nikomatsakis
This introduces a test for #23389 and improves the error behaviour to treat the malformed LHS as an error, not a compiler bug.

The parse phase that precedes the call to `check_lhs_nt_follows` could possibly be enhanced to police the format itself (which the old code suggests was the original intention), but I'm not sure that's any nicer than just parsing the matcher as generic rust code and then policing the specific requirements for being a macro matcher afterwards (as this does).

Fixes #23389
2015-07-25 11:20:15 +00:00
Ulrik Sverdrup
27c44ce9c3 siphash: Reorder hash state in the struct
If they are ordered v0, v2, v1, v3, the compiler can find just a few
simd optimizations itself.

The new optimization I could observe on x86-64 was using 128 bit
registers for the v = key ^ constant operations in new / reset.
2015-07-25 12:26:18 +02:00
Ulrik Sverdrup
5f6a61e165 siphash: Remove one variable
Without this temporary variable, codegen improves slightly and less
registers are spilled to the stack in SipHash::write.
2015-07-25 12:26:18 +02:00
Ulrik Sverdrup
f910d27f87 siphash: Use ptr::copy_nonoverlapping for efficient data loading
Use `ptr::copy_nonoverlapping` (aka memcpy) to load an u64 from the
byte stream. This is correct for any alignment, and the compiler will
use the appropriate instruction to load the data.

Use unchecked indexing.

This results in a large improvement of throughput (hashed bytes
/ second) for long data. Maximum improvement benches at a 70% increase
in throughput for large values (> 256 bytes) but already values of 16
bytes or larger improve.

Introducing unchecked indexing is motivated to reach as good throughput
as possible. Using ptr::copy_nonoverlapping without unchecked indexing
would land the improvement some 20-30 pct units lower.

We use a debug assertion so that the test suite checks our use of
unchecked indexing.
2015-07-25 12:26:18 +02:00
Ulrik Sverdrup
381d2ed70d siphash: Add more benchmarks 2015-07-25 12:26:17 +02:00
bors
f0b7ede78a Auto merge of #26960 - Manishearth:wrapper-types, r=steveklabnik
@steveklabnik had suggested I do this.

This needs much review -- I tried reducing the informal tone but there's room for improvement.


r? @steveklabnik
2015-07-25 07:54:48 +00:00
John Hodge
e3e6bf89df Reference issue #27277 on Result::expect 2015-07-25 15:02:21 +08:00
Nick Cameron
f91a20bbfb save-analysis: return an Option from get_path_data 2015-07-25 17:47:26 +12:00
Manish Goregaokar
8484aca046 Move wrapper types blog post into trpl 2015-07-25 11:02:41 +05:30
Nick Cameron
52fd69c933 save-analysis: add references to paths to get_path_data 2015-07-25 17:05:34 +12:00
Tshepang Lekhonkhobe
89c302eb6c reference: "those" feels misplaced there
Also, join the 2 sentences to improve flow
2015-07-25 06:56:26 +02:00
bors
e4f044662b Auto merge of #27233 - tbu-:pr_wtf8, r=alexcrichton 2015-07-25 04:25:33 +00:00
Eli Friedman
0eea0f6e90 Allow writing types which "can't" be instantiated.
The borrow checker doesn't allow constructing such a type at runtime
using safe code, but there isn't any reason to ban them in the type checker.

Included in this commit is an example of a neat static doubly-linked list.

Feature-gated under the static_recursion gate to be on the safe side, but
there are unlikely to be any reasons this shouldn't be turned on by
default.
2015-07-24 19:18:16 -07:00
Eli Friedman
742e1242d9 Add static_recursion feature gate. 2015-07-24 19:17:58 -07:00
Eli Friedman
8ebf95257b Allow recursive static variables.
There isn't any particularly good reason for this restriction, so just
get rid of it, and fix trans to handle this case.
2015-07-24 19:17:45 -07:00
bors
d38e8a05b5 Auto merge of #26963 - Manishearth:improve-diag, r=steveklabnik
I'll be adding more commits to this PR as the weekend progresses. Was hoping to make this a mega-PR, but getting some eyes on this early would be nice too.

r? @steveklabnik

r? @eddyb on the object safety bits

cc @michaelsproul

Part of #24407
2015-07-25 01:01:32 +00:00
Eli Friedman
eefeba08f8 Fix an ICE with a closure in a constant.
Fixes issue #27268.
2015-07-24 17:00:37 -07:00
Ariel Ben-Yehuda
7f9953b974 refactor has_dtor_of_interest 2015-07-24 23:46:57 +03:00
Ariel Ben-Yehuda
bfbc7bc45d handle all type variants correctly in dropck
This fixes a few soundness bugs in dropck, so to anyone who relied on them,
this is a
[breaking-change]

Fixes #24086.
Fixes #25389.
Fixes #25598.
Fixes #25750.
Fixes #26641.
Fixes #26657.
Fixes #27240.
Fixes #27241.
2015-07-24 23:46:17 +03:00
Tamir Duberstein
847fba06c3 Fix improper_ctypes fallout 2015-07-24 16:16:56 -04:00
bors
82d40cb2ba Auto merge of #27265 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #27137, #27145, #27177, #27193, #27212, #27220, #27229, #27235, #27238, #27244, #27251
- Failed merges:
2015-07-24 19:04:31 +00:00
Steve Klabnik
427238ce24 Rollup merge of #27251 - dhuseby:adding_snapshots, r=alexcrichton
@alexcrichton please upload the following snapshot files along with this PR:

https://github.com/dhuseby/rust-manual-snapshots/raw/master/rust-stage0-2015-07-17-d4432b3-bitrig-x86_64-af77768e0eb0f4c7ec5a8e36047a08053b54b230.tar.bz2
https://github.com/dhuseby/rust-manual-snapshots/raw/master/rust-stage0-2015-07-17-d4432b3-freebsd-i386-b049325e5b2efe5f4884f3dafda448c1dac49b4f.tar.bz2
https://github.com/dhuseby/rust-manual-snapshots/raw/master/rust-stage0-2015-07-17-d4432b3-freebsd-x86_64-a59e397188dbfe67456a6301df5ca13c7e238ab9.tar.bz2
2015-07-24 14:56:04 -04:00
Steve Klabnik
628654b198 Rollup merge of #27244 - Detegr:master, r=eddyb
Hi all.
This is my first contribution to Rust and fixes an issue causing an invalid error message to be presented to the user when using unit struct as length of a repeat expression, issue #27008. The solution is based on suggestions by @oli-obk, but as I'm a complete newbie to this, I have no clue if I got them right :)
The biggest concern I have is that if the `NodeId` I'm returning is the correct one or not (it's not meaningful in this case but I think it would be nice to get it right).
2015-07-24 14:56:04 -04:00
Steve Klabnik
47c9c49602 Rollup merge of #27238 - steveklabnik:gh26927, r=huonw
FIxes #26927
2015-07-24 14:56:03 -04:00
Steve Klabnik
8b6b6c678b Rollup merge of #27235 - tbu-:pr_catch_panic_doc, r=steveklabnik
Fixes #27027.
2015-07-24 14:56:03 -04:00
Steve Klabnik
a160203e30 Rollup merge of #27229 - AlisdairO:diagnostics371, r=Manishearth
As title!

Part of #24407.
r? @Manishearth
2015-07-24 14:56:03 -04:00
Steve Klabnik
a75c21fc9c Rollup merge of #27220 - AlisdairO:diagnostics120, r=Manishearth
As title!

I should probably be bunching these up a bit more, but I'm not sure when my time is going to disappear on me.  Once my schedule stabilises I'll try to start batching them into larger PRs.

Part of #24407.
r? @Manishearth
2015-07-24 14:56:02 -04:00