]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoExtend `trans::datum::Lvalue` so that it carrys an optional dropflag hint.
Felix S. Klock II [Fri, 5 Jun 2015 19:34:03 +0000 (21:34 +0200)]
Extend `trans::datum::Lvalue` so that it carrys an optional dropflag hint.

Instrumented calls sites that construct Lvalues to ease tracking down
cases that we might need to change whether or not they carry a hint.

Note that this commit does not do anything to actually *construct*
the `lldropflag_hints` map, nor does it change anything about codegen
itself. Those parts are in follow-on commits.

8 years agodebugflag to turn off nonzeroing move hint optimization.
Felix S. Klock II [Fri, 5 Jun 2015 19:29:18 +0000 (21:29 +0200)]
debugflag to turn off nonzeroing move hint optimization.

(already thumbs-upped pre-rebase by nikomatsakis)

8 years agoPrep for dropflag hints: refactor `trans:_match` to pass around `MatchInput` rather...
Felix S. Klock II [Fri, 5 Jun 2015 12:38:49 +0000 (14:38 +0200)]
Prep for dropflag hints: refactor `trans:_match` to pass around `MatchInput` rather than `ValueRef`.

(already thumbs-upped pre-rebase by nikomatsakis)

The refactoring here is trivial because `trans::datum::Lvalue`
currently carries no payload. However, future commits will start
adding a payload to `Lvalue`, and thus will force us either

 1. to thread the payload through the `_match` code (a long term goal), or

 2. to ensure the payload has some reasonable default value.

8 years agoPrep for dropflag-hints: Clarify trans bindings MoveByRef and MoveIntoCopy.
Felix S. Klock II [Fri, 5 Jun 2015 11:30:41 +0000 (13:30 +0200)]
Prep for dropflag-hints: Clarify trans bindings MoveByRef and MoveIntoCopy.

8 years agoAuto merge of #27319 - diaphore:pr_debug_osstr_escape, r=alexcrichton
bors [Tue, 28 Jul 2015 10:28:45 +0000 (10:28 +0000)]
Auto merge of #27319 - diaphore:pr_debug_osstr_escape, r=alexcrichton

I had to modify some tests : since `wtf8buf_show` and `wtf8_show` were doing the exact same thing, I repurposed `wtf8_show` to `wtf8buf_show_str` which ensures `Wtf8Buf` `Debug`-formats the same as `str`.

`write_str_escaped` might also be shared amongst other `fmt` but I just left it there within `Wtf8::fmt` for review.

8 years agoAuto merge of #27309 - eddyb:snapshot-infdef, r=alexcrichton
bors [Tue, 28 Jul 2015 08:51:21 +0000 (08:51 +0000)]
Auto merge of #27309 - eddyb:snapshot-infdef, r=alexcrichton

FreeBSD i386 snapshot is missing, failed tests (possibly spurious).
r? @alexcrichton

8 years agoAuto merge of #27275 - nrc:save-use, r=brson
bors [Tue, 28 Jul 2015 07:14:55 +0000 (07:14 +0000)]
Auto merge of #27275 - nrc:save-use, r=brson

r? @brson

8 years agoAuto merge of #27280 - bluss:siphash-perf, r=alexcrichton
bors [Tue, 28 Jul 2015 05:38:53 +0000 (05:38 +0000)]
Auto merge of #27280 - bluss:siphash-perf, r=alexcrichton

Improve siphash performance for longer data

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.

Also contains small tweaks that should benefit hashing short data too,
both the commit that removes a variable and the autovectorization of
the hash state initialization (in SipHash::reset).

Benchmarks show that hashing longer data benefits for the improved word loading.

Before (using benchmarks from the first commit in the PR):

The before benchmark is a bit noisy.

```
test hash::sip::bench_bytes_4                              ... bench:          41 ns/iter (+/- 0) = 97 MB/s
test hash::sip::bench_bytes_7                              ... bench:          49 ns/iter (+/- 2) = 142 MB/s
test hash::sip::bench_bytes_8                              ... bench:          42 ns/iter (+/- 4) = 190 MB/s
test hash::sip::bench_bytes_a_16                           ... bench:          57 ns/iter (+/- 14) = 280 MB/s
test hash::sip::bench_bytes_b_32                           ... bench:          85 ns/iter (+/- 74) = 376 MB/s
test hash::sip::bench_bytes_c_128                          ... bench:         278 ns/iter (+/- 33) = 460 MB/s
test hash::sip::bench_long_str                             ... bench:         825 ns/iter (+/- 103)
test hash::sip::bench_str_of_8_bytes                       ... bench:         151 ns/iter (+/- 66)
test hash::sip::bench_str_over_8_bytes                     ... bench:          59 ns/iter (+/- 3)
test hash::sip::bench_str_under_8_bytes                    ... bench:          47 ns/iter (+/- 56)
test hash::sip::bench_u32                                  ... bench:          39 ns/iter (+/- 93) = 205 MB/s
test hash::sip::bench_u32_keyed                            ... bench:          40 ns/iter (+/- 88) = 200 MB/s
test hash::sip::bench_u64                                  ... bench:          54 ns/iter (+/- 96) = 148 MB/s
```

After:

```
test hash::sip::bench_bytes_4                              ... bench:          41 ns/iter (+/- 3) = 97 MB/s
test hash::sip::bench_bytes_7                              ... bench:          48 ns/iter (+/- 0) = 145 MB/s
test hash::sip::bench_bytes_8                              ... bench:          35 ns/iter (+/- 1) = 228 MB/s
test hash::sip::bench_bytes_a_16                           ... bench:          45 ns/iter (+/- 1) = 355 MB/s
test hash::sip::bench_bytes_b_32                           ... bench:          60 ns/iter (+/- 0) = 533 MB/s
test hash::sip::bench_bytes_c_128                          ... bench:         161 ns/iter (+/- 5) = 795 MB/s
test hash::sip::bench_long_str                             ... bench:         514 ns/iter (+/- 5)
test hash::sip::bench_str_of_8_bytes                       ... bench:          44 ns/iter (+/- 0)
test hash::sip::bench_str_over_8_bytes                     ... bench:          51 ns/iter (+/- 0)
test hash::sip::bench_str_under_8_bytes                    ... bench:          52 ns/iter (+/- 6)
test hash::sip::bench_u32                                  ... bench:          40 ns/iter (+/- 2) = 200 MB/s
test hash::sip::bench_u32_keyed                            ... bench:          39 ns/iter (+/- 1) = 205 MB/s
test hash::sip::bench_u64                                  ... bench:          36 ns/iter (+/- 1) = 222 MB/s
```

8 years agoAuto merge of #26914 - alexcrichton:deprecate-easy, r=aturon
bors [Tue, 28 Jul 2015 01:12:39 +0000 (01:12 +0000)]
Auto merge of #26914 - alexcrichton:deprecate-easy, r=aturon

Many of these have long since reached their stage of being obsolete, so this
commit starts the removal process for all of them. The unstable features that
were deprecated are:

* box_heap
* cmp_partial
* fs_time
* hash_default
* int_slice
* iter_min_max
* iter_reset_fuse
* iter_to_vec
* map_in_place
* move_from
* owned_ascii_ext
* page_size
* read_and_zero
* scan_state
* slice_chars
* slice_position_elem
* subslice_offset

8 years agostd: Deprecate a number of unstable features
Alex Crichton [Wed, 8 Jul 2015 15:33:13 +0000 (08:33 -0700)]
std: Deprecate a number of unstable features

Many of these have long since reached their stage of being obsolete, so this
commit starts the removal process for all of them. The unstable features that
were deprecated are:

* cmp_partial
* fs_time
* hash_default
* int_slice
* iter_min_max
* iter_reset_fuse
* iter_to_vec
* map_in_place
* move_from
* owned_ascii_ext
* page_size
* read_and_zero
* scan_state
* slice_chars
* slice_position_elem
* subslice_offset

8 years agoAuto merge of #27250 - alexcrichton:ucrt, r=brson
bors [Mon, 27 Jul 2015 23:38:04 +0000 (23:38 +0000)]
Auto merge of #27250 - alexcrichton:ucrt, r=brson

Visual Studio 2015, recently released, includes the Universal CRT, a different
flavor than was provided before. The binaries and header files for this library
are included in new locations not previously known about by gcc-rs, and this
commit adds support for the necessary probing to find these.

Unfortunately there are no prior examples of this probing to be found in
frameworks like CMake or clang, so this is done is a bit of a sketchy method
today. It assumes that the installation is in a relatively standard format and
then blindly looks for the location of the UCRT. I'd love to switch this over to
using registry keys for probing, but I was currently unable to find such keys.

This should enable the compiler to work outside VS 2015 dev tools prompts.

8 years agoAuto merge of #26216 - azerupi:doc-experiments, r=steveklabnik
bors [Mon, 27 Jul 2015 21:20:11 +0000 (21:20 +0000)]
Auto merge of #26216 - azerupi:doc-experiments, r=steveklabnik

So I have tried to improve the rustbook engine:

- The sidebar now looks a lot more like gitbook (I thinks it cleaner)
- Added the Open Sans font, in my opinion more readable for prolonged periods of time
- Changed the style for code blocks a little

I encountered 1 problem. In `build.rs` I added this google font url (I commented out the non-relevant parts for clarity)

```rust
let rustdoc_args: &[String] = &[
    //"".to_string(),
    //preprocessed_path.display().to_string(),
    //format!("-o{}", out_path.display()),
    //format!("--html-before-content={}", prelude.display()),
    //format!("--html-after-content={}", postlude.display()),
    //format!("--markdown-playground-url=http://play.rust-lang.org"),
    //format!("--markdown-css={}", item.path_to_root.join("rust-book.css").display()),
    format!("--markdown-css=http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700"),
    //"--markdown-no-toc".to_string(),
];
```
As you can see, I had to escape `=` with `=` because the string would get truncated if I didn't. Is that normal behaviour? Is that for security measures? If it is, isn't it a little weak if you can circumvent it by escaped characters? I don't know the reason behind, but I thought it was at least worth mentioning :)

Take your time for this PR, I still want to add multiple improvements:

- Like gitbook, possibility to change font by user
- Put `css` and `js` in their respective files (not hardcoded in rust)
- button to hide sidebar
- ...

So I'm not in a hurry to get this merged ;) But if you think it's good enough to be merged, go ahead. I will make another PR when I have other improvements.

In the image below is a screen of the improvements

![rustbook](https://cloud.githubusercontent.com/assets/7647338/8105345/bf545c74-1038-11e5-962e-b04ebfaf8257.png)

8 years agoAuto merge of #27230 - GuillaumeGomez:patch-1, r=brson
bors [Mon, 27 Jul 2015 19:44:22 +0000 (19:44 +0000)]
Auto merge of #27230 - GuillaumeGomez:patch-1, r=brson

Part of #24407.
cc @Manishearth

8 years agoFix the relative path issue by including the files using include_bytes!
Mathieu David [Mon, 27 Jul 2015 18:46:01 +0000 (20:46 +0200)]
Fix the relative path issue by including the files using include_bytes!

8 years agoAuto merge of #27304 - alexcrichton:revert-picky-dllimport, r=brson
bors [Mon, 27 Jul 2015 18:09:22 +0000 (18:09 +0000)]
Auto merge of #27304 - alexcrichton:revert-picky-dllimport, r=brson

This reverts commit a0efd3a3d99a98e3399a4f07abe6a67cf0660335.

This commit caused a lot of unintended breakage for many Cargo builds. The problem is that Cargo compiles build scripts with `-C prefer-dynamic`, so the standard library is always dynamically linked and hence any imports need to be marked with `dllimport`. Dependencies of build scripts, however, were compiled as rlibs and did not have their imports tagged with `dllimport`, so build scripts would fail to link.

While known that this situation would break, it was unknown that it was a common scenario in the wild. As a result I'm just reverting these heuristics for now.

8 years agoFix escaping of characters in Debug for OsStr
diaphore [Sun, 26 Jul 2015 17:32:13 +0000 (19:32 +0200)]
Fix escaping of characters in Debug for OsStr

Fixes #27211

Fix Debug for {char, str} in core::fmt

8 years agoAuto merge of #27284 - lastorset:default-methods, r=Gankro
bors [Mon, 27 Jul 2015 16:34:40 +0000 (16:34 +0000)]
Auto merge of #27284 - lastorset:default-methods, r=Gankro

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.

r? @steveklabnik

8 years agoTurn on `box(PLACE) expr` deprecation warning post-snapshot.
Eduard Burtescu [Mon, 27 Jul 2015 15:11:43 +0000 (18:11 +0300)]
Turn on `box(PLACE) expr` deprecation warning post-snapshot.

8 years agoAuto merge of #27317 - midinastasurazz:patch-1, r=Gankro
bors [Mon, 27 Jul 2015 14:59:27 +0000 (14:59 +0000)]
Auto merge of #27317 - midinastasurazz:patch-1, r=Gankro

r? @steveklabnik

8 years agoAuto merge of #27278 - thepowersgang:result-expect-issue, r=alexcrichton
bors [Mon, 27 Jul 2015 13:24:34 +0000 (13:24 +0000)]
Auto merge of #27278 - thepowersgang:result-expect-issue, r=alexcrichton

8 years agoAuto merge of #27315 - eefriedman:improper-ctypes-void-ret, r=alexcrichton
bors [Mon, 27 Jul 2015 11:49:45 +0000 (11:49 +0000)]
Auto merge of #27315 - eefriedman:improper-ctypes-void-ret, r=alexcrichton

Fixes issue #27302.

8 years agoRegister new snapshots (2015-07-26 a5c12f4).
Eduard Burtescu [Mon, 27 Jul 2015 10:31:48 +0000 (13:31 +0300)]
Register new snapshots (2015-07-26 a5c12f4).

8 years agoAuto merge of #27310 - akiss77:fix-aarch64-getrandom, r=alexcrichton
bors [Mon, 27 Jul 2015 09:34:05 +0000 (09:34 +0000)]
Auto merge of #27310 - akiss77:fix-aarch64-getrandom, r=alexcrichton

8 years agoAuto merge of #27308 - sstewartgallus:standardize-nonzero-check, r=alexcrichton
bors [Mon, 27 Jul 2015 05:55:25 +0000 (05:55 +0000)]
Auto merge of #27308 - sstewartgallus:standardize-nonzero-check, r=alexcrichton

It's odd that "! -z" was used instead of "-n" in some places.  Is perhaps, "! -z" more portable or something?

8 years agoFix typo: yur -> your
midinastasurazz [Mon, 27 Jul 2015 05:20:54 +0000 (07:20 +0200)]
Fix typo: yur -> your

8 years agoAuto merge of #26876 - liigo:patch-3, r=Gankro
bors [Mon, 27 Jul 2015 04:20:27 +0000 (04:20 +0000)]
Auto merge of #26876 - liigo:patch-3, r=Gankro

8 years agoAuto merge of #27274 - tshepang:not-needed-word, r=steveklabnik
bors [Mon, 27 Jul 2015 02:45:35 +0000 (02:45 +0000)]
Auto merge of #27274 - tshepang:not-needed-word, r=steveklabnik

Also, join the 2 sentences to improve flow

8 years agoIn improper-ctypes lint, handle functions which explicitly return `()`.
Eli Friedman [Mon, 27 Jul 2015 00:51:03 +0000 (17:51 -0700)]
In improper-ctypes lint, handle functions which explicitly return `()`.

Fixes issue #27302.

8 years agoAuto merge of #27311 - kballard:thread-mod-desc-remove-scoped, r=huonw
bors [Mon, 27 Jul 2015 01:10:32 +0000 (01:10 +0000)]
Auto merge of #27311 - kballard:thread-mod-desc-remove-scoped, r=huonw

It's deprecated and unsafe, so we shouldn't be encouraging people to use
it. Move it to `std::thread::scoped` instead, since it's still useful
information to anyone who is using the API.

8 years agoAuto merge of #27294 - eddyb:deep-unsize-hinting, r=nrc
bors [Sun, 26 Jul 2015 23:35:38 +0000 (23:35 +0000)]
Auto merge of #27294 - eddyb:deep-unsize-hinting, r=nrc

`Rc::new(RefCell::new(x)): Rc<RefCell<Trait>>` should not mean `RefCell::new(x): RefCell<Trait>`.
The latter is impossible, as an rvalue can't have an unsized type.
We were already handling unsized argument hints, but not when dealing with unsized structures.

8 years agoRemove the module-level documentation for thread::scoped
Kevin Ballard [Sun, 26 Jul 2015 22:26:47 +0000 (15:26 -0700)]
Remove the module-level documentation for thread::scoped

It's deprecated and unsafe, so we shouldn't be encouraging people to use
it. Move it to `std::thread::scoped` instead, since it's still useful
information to anyone who is using the API.

8 years agoAuto merge of #27267 - tamird:fix-ios-improper-ctypes, r=alexcrichton
bors [Sun, 26 Jul 2015 22:00:53 +0000 (22:00 +0000)]
Auto merge of #27267 - tamird:fix-ios-improper-ctypes, r=alexcrichton

Fixes #27263.

8 years agoFix getrandom syscall number for aarch64-unknown-linux-gnu
Akos Kiss [Sun, 26 Jul 2015 10:19:35 +0000 (10:19 +0000)]
Fix getrandom syscall number for aarch64-unknown-linux-gnu

8 years agotypeck: handle unsized structs in type hints by recursing into their last field.
Eduard Burtescu [Sun, 26 Jul 2015 00:55:35 +0000 (03:55 +0300)]
typeck: handle unsized structs in type hints by recursing into their last field.

8 years agoStandardize on non-zero checks for configure
Steven Stewart-Gallus [Sun, 26 Jul 2015 21:18:30 +0000 (14:18 -0700)]
Standardize on non-zero checks for configure

8 years agoAuto merge of #27012 - pornel:master, r=Gankro
bors [Sun, 26 Jul 2015 20:18:39 +0000 (20:18 +0000)]
Auto merge of #27012 - pornel:master, r=Gankro

Fixes #26689

This PR tries to clarify uses of "character" where it means "code point" or "UTF-8 sequence", which are almost, but not quite the same. Edge cases added to some examples to demonstrate this.

However, I've kept use of the term "code point" instead of "Unicode scalar value", because in UTF-8 they're the same, and "code point" is more widely known.

8 years agoAuto merge of #27272 - eefriedman:closure-const-crash, r=nikomatsakis
bors [Sun, 26 Jul 2015 17:51:30 +0000 (17:51 +0000)]
Auto merge of #27272 - eefriedman:closure-const-crash, r=nikomatsakis

Fixes issue #27268.

r? @nikomatsakis

8 years agoRevert "trans: Be a little more picky about dllimport"
Alex Crichton [Sun, 26 Jul 2015 17:19:11 +0000 (10:19 -0700)]
Revert "trans: Be a little more picky about dllimport"

This reverts commit a0efd3a3d99a98e3399a4f07abe6a67cf0660335.

8 years agoAuto merge of #27297 - mitaa:cleanup_E0005, r=alexcrichton
bors [Sun, 26 Jul 2015 15:17:24 +0000 (15:17 +0000)]
Auto merge of #27297 - mitaa:cleanup_E0005, r=alexcrichton

This does two things:
* removes ast::LocalSource, where only one variant was used because for-loop expansion has changed. One reason that this slipped into here is because the code in `check_local` which checks for `LocalSource::LocalFor` would report the same error as in `check_exhaustive` while using the wrong error code (E0005 instead of E0297).
* silences the warning about already used diagnostic code E0005 (fixes #27279)

passes `make check` locally.

8 years agoAuto merge of #26870 - jroesch:default-typaram-fallback, r=nikomatsakis
bors [Sun, 26 Jul 2015 10:39:18 +0000 (10:39 +0000)]
Auto merge of #26870 - jroesch:default-typaram-fallback, r=nikomatsakis

This PR completes [RFC 213](https://github.com/rust-lang/rfcs/blob/master/text/0213-defaulted-type-params.md) by allowing default type parameters to influence inference. This is almost certainly a breaking change due to interactions between default type parameters and the old fallback algorithm used for integral and floating point literals.

The error messages still require polish but I wanted to get early review and feedback from others on the the changes, error messages, and test cases. I also imagine we will want to run anywhere from 1-3 versions of this on crater and evaluate the impact, and it would be best to get that ball rolling.

The only outstanding issue I'm aware of is that type alias defaults don't work. It seems this may require significant restructuring, since during inference type aliases have already been expanded. @nikomatsakis might be able to provide some clarity here.

r? @nikomatsakis

cc @eddyb @Gankro @aturon @brson

8 years agoAuto merge of #27283 - arielb1:free-self-2, r=eddyb
bors [Sun, 26 Jul 2015 07:58:43 +0000 (07:58 +0000)]
Auto merge of #27283 - arielb1:free-self-2, r=eddyb

Fixes #27281

r? @eddyb

8 years agoSidestep warning about repeated E0005 `span_err!` invocation.
mitaa [Sat, 25 Jul 2015 22:01:28 +0000 (00:01 +0200)]
Sidestep warning about repeated E0005 `span_err!` invocation.

Fixes #27279

8 years agoRemove `ast::LocalSource` with only one used variant
mitaa [Sat, 25 Jul 2015 20:43:35 +0000 (22:43 +0200)]
Remove `ast::LocalSource` with only one used variant

`LocalSource` indicated wether a let binding originated from for-loop desugaring to enable specialized error messages, but for-loop expansion has changed and this is now achieved through `MatchSource::ForLoopDesugar`.

8 years agoAdd omitted trailing comma
Jared Roesch [Sun, 26 Jul 2015 04:22:38 +0000 (21:22 -0700)]
Add omitted trailing comma

8 years agoAddress nit
Jared Roesch [Sun, 26 Jul 2015 02:27:15 +0000 (19:27 -0700)]
Address nit

8 years agoAdd feature gate
Jared Roesch [Fri, 24 Jul 2015 20:39:11 +0000 (13:39 -0700)]
Add feature gate

8 years agoMake default error reporting deterministic
Jared Roesch [Tue, 21 Jul 2015 21:52:21 +0000 (14:52 -0700)]
Make default error reporting deterministic

8 years agoAdd cross-crate error message tests
Jared Roesch [Mon, 20 Jul 2015 19:49:03 +0000 (12:49 -0700)]
Add cross-crate error message tests

8 years agoAddress tidy
Jared Roesch [Mon, 20 Jul 2015 19:48:24 +0000 (12:48 -0700)]
Address tidy

8 years agoRework cross crate error messages
Jared Roesch [Mon, 20 Jul 2015 19:39:34 +0000 (12:39 -0700)]
Rework cross crate error messages

8 years agoFix error message spans
Jared Roesch [Thu, 16 Jul 2015 18:26:02 +0000 (11:26 -0700)]
Fix error message spans

8 years agoCorrectly subst defaults with the in-scope substs
Jared Roesch [Tue, 14 Jul 2015 01:12:18 +0000 (18:12 -0700)]
Correctly subst defaults with the in-scope substs

8 years agoRemove second transaction
Jared Roesch [Mon, 13 Jul 2015 08:49:13 +0000 (01:49 -0700)]
Remove second transaction

8 years agoRebase fixes
Jared Roesch [Mon, 13 Jul 2015 04:43:13 +0000 (21:43 -0700)]
Rebase fixes

8 years agoClean up test cases
Jared Roesch [Mon, 13 Jul 2015 04:02:16 +0000 (21:02 -0700)]
Clean up test cases

8 years agoRefactor the default type parameter algorithm
Jared Roesch [Mon, 13 Jul 2015 03:33:17 +0000 (20:33 -0700)]
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.

8 years agoFix bug with defaults not being restored
Jared Roesch [Thu, 9 Jul 2015 23:04:37 +0000 (16:04 -0700)]
Fix bug with defaults not being restored

8 years agoRemove defaults table and attach defaults directly to tyvars
Jared Roesch [Thu, 9 Jul 2015 19:15:48 +0000 (12:15 -0700)]
Remove defaults table and attach defaults directly to tyvars

8 years agoCorrectly collect defaults from type alises in astconv
Jared Roesch [Wed, 8 Jul 2015 20:42:46 +0000 (13:42 -0700)]
Correctly collect defaults from type alises in astconv

8 years agoFix tidy
Jared Roesch [Tue, 7 Jul 2015 23:06:35 +0000 (16:06 -0700)]
Fix tidy

8 years agoImplement Default TyParam fallback
Jared Roesch [Tue, 7 Jul 2015 22:50:02 +0000 (15:50 -0700)]
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.

8 years agoDefault methods example: Show "(in)valid" case
Leif Arne Storset [Sat, 25 Jul 2015 16:18:47 +0000 (18:18 +0200)]
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.

8 years agoSubstitute free lifetimes in `Self::T`
Ariel Ben-Yehuda [Sat, 25 Jul 2015 18:25:51 +0000 (21:25 +0300)]
Substitute free lifetimes in `Self::T`

Fixes #27281

8 years agoAuto merge of #27258 - nikomatsakis:issue-26952, r=eddyb
bors [Sat, 25 Jul 2015 18:16:51 +0000 (18:16 +0000)]
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

8 years agoDocument Unicode complications in chars iterator
Kornel Lesiński [Sat, 25 Jul 2015 15:01:48 +0000 (16:01 +0100)]
Document Unicode complications in chars iterator

8 years agoAuto merge of #26630 - eefriedman:recursive-static, r=pnkfelix
bors [Sat, 25 Jul 2015 14:50:13 +0000 (14:50 +0000)]
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?

8 years agoAuto merge of #27253 - bossmc:unbalanced-delimiters-cause-ice, r=nikomatsakis
bors [Sat, 25 Jul 2015 11:20:15 +0000 (11:20 +0000)]
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

8 years agosiphash: Reorder hash state in the struct
Ulrik Sverdrup [Sat, 25 Jul 2015 09:59:06 +0000 (11:59 +0200)]
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.

8 years agosiphash: Remove one variable
Ulrik Sverdrup [Sat, 25 Jul 2015 09:57:02 +0000 (11:57 +0200)]
siphash: Remove one variable

Without this temporary variable, codegen improves slightly and less
registers are spilled to the stack in SipHash::write.

8 years agosiphash: Use ptr::copy_nonoverlapping for efficient data loading
Ulrik Sverdrup [Sat, 25 Jul 2015 09:55:26 +0000 (11:55 +0200)]
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.

8 years agosiphash: Add more benchmarks
Ulrik Sverdrup [Sat, 25 Jul 2015 09:52:58 +0000 (11:52 +0200)]
siphash: Add more benchmarks

8 years agoAuto merge of #26960 - Manishearth:wrapper-types, r=steveklabnik
bors [Sat, 25 Jul 2015 07:54:48 +0000 (07:54 +0000)]
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

8 years agoReference issue #27277 on Result::expect
John Hodge [Sat, 25 Jul 2015 07:02:21 +0000 (15:02 +0800)]
Reference issue #27277 on Result::expect

8 years agosave-analysis: return an Option from get_path_data
Nick Cameron [Sat, 25 Jul 2015 05:47:26 +0000 (17:47 +1200)]
save-analysis: return an Option from get_path_data

8 years agoMove wrapper types blog post into trpl
Manish Goregaokar [Sat, 11 Jul 2015 07:08:50 +0000 (12:38 +0530)]
Move wrapper types blog post into trpl

8 years agosave-analysis: add references to paths to get_path_data
Nick Cameron [Sat, 25 Jul 2015 05:05:34 +0000 (17:05 +1200)]
save-analysis: add references to paths to get_path_data

8 years agoreference: "those" feels misplaced there
Tshepang Lekhonkhobe [Sat, 25 Jul 2015 04:56:21 +0000 (06:56 +0200)]
reference: "those" feels misplaced there

Also, join the 2 sentences to improve flow

8 years agoAuto merge of #27233 - tbu-:pr_wtf8, r=alexcrichton
bors [Sat, 25 Jul 2015 04:25:33 +0000 (04:25 +0000)]
Auto merge of #27233 - tbu-:pr_wtf8, r=alexcrichton

8 years agoAllow writing types which "can't" be instantiated.
Eli Friedman [Sun, 28 Jun 2015 17:38:28 +0000 (10:38 -0700)]
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.

8 years agoAdd static_recursion feature gate.
Eli Friedman [Thu, 2 Jul 2015 21:07:42 +0000 (14:07 -0700)]
Add static_recursion feature gate.

8 years agoAllow recursive static variables.
Eli Friedman [Sun, 28 Jun 2015 17:36:46 +0000 (10:36 -0700)]
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.

8 years agoAuto merge of #26963 - Manishearth:improve-diag, r=steveklabnik
bors [Sat, 25 Jul 2015 01:01:32 +0000 (01:01 +0000)]
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

8 years agoFix an ICE with a closure in a constant.
Eli Friedman [Fri, 24 Jul 2015 22:51:54 +0000 (15:51 -0700)]
Fix an ICE with a closure in a constant.

Fixes issue #27268.

8 years agoFix `improper_ctypes` fallout
Tamir Duberstein [Fri, 24 Jul 2015 20:03:43 +0000 (16:03 -0400)]
Fix `improper_ctypes` fallout

8 years agoAuto merge of #27265 - steveklabnik:rollup, r=steveklabnik
bors [Fri, 24 Jul 2015 19:04:31 +0000 (19:04 +0000)]
Auto merge of #27265 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #27137, #27145, #27177, #27193, #27212, #27220, #27229, #27235, #27238, #27244, #27251
- Failed merges:

8 years agoRollup merge of #27251 - dhuseby:adding_snapshots, r=alexcrichton
Steve Klabnik [Fri, 24 Jul 2015 18:56:04 +0000 (14:56 -0400)]
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

8 years agoRollup merge of #27244 - Detegr:master, r=eddyb
Steve Klabnik [Fri, 24 Jul 2015 18:56:04 +0000 (14:56 -0400)]
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).

8 years agoRollup merge of #27238 - steveklabnik:gh26927, r=huonw
Steve Klabnik [Fri, 24 Jul 2015 18:56:03 +0000 (14:56 -0400)]
Rollup merge of #27238 - steveklabnik:gh26927, r=huonw

FIxes #26927

8 years agoRollup merge of #27235 - tbu-:pr_catch_panic_doc, r=steveklabnik
Steve Klabnik [Fri, 24 Jul 2015 18:56:03 +0000 (14:56 -0400)]
Rollup merge of #27235 - tbu-:pr_catch_panic_doc, r=steveklabnik

Fixes #27027.

8 years agoRollup merge of #27229 - AlisdairO:diagnostics371, r=Manishearth
Steve Klabnik [Fri, 24 Jul 2015 18:56:03 +0000 (14:56 -0400)]
Rollup merge of #27229 - AlisdairO:diagnostics371, r=Manishearth

As title!

Part of #24407.
r? @Manishearth

8 years agoRollup merge of #27220 - AlisdairO:diagnostics120, r=Manishearth
Steve Klabnik [Fri, 24 Jul 2015 18:56:02 +0000 (14:56 -0400)]
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

8 years agoRollup merge of #27212 - AlisdairO:diagnostics225, r=Manishearth
Steve Klabnik [Fri, 24 Jul 2015 18:56:02 +0000 (14:56 -0400)]
Rollup merge of #27212 - AlisdairO:diagnostics225, r=Manishearth

As title!

Part of #24407.
r? @Manishearth

8 years agoRollup merge of #27193 - aidanhs:aphs-advanced-linking-doc, r=steveklabnik
Steve Klabnik [Fri, 24 Jul 2015 18:56:02 +0000 (14:56 -0400)]
Rollup merge of #27193 - aidanhs:aphs-advanced-linking-doc, r=steveklabnik

Continuation of #25685.

8 years agoRollup merge of #27177 - echochamber:master, r=steveklabnik
Steve Klabnik [Fri, 24 Jul 2015 18:56:01 +0000 (14:56 -0400)]
Rollup merge of #27177 - echochamber:master, r=steveklabnik

Was browsing somebody else's code and came across a snippet using labels. Looking around, it seems like there was an example for this in [rustbyexample](http://rustbyexample.com/flow_control/loop/nested.html) but none in trpl.

8 years agoRollup merge of #27145 - apasel422:diagnostic-407-437-438, r=Manishearth
Steve Klabnik [Fri, 24 Jul 2015 18:56:01 +0000 (14:56 -0400)]
Rollup merge of #27145 - apasel422:diagnostic-407-437-438, r=Manishearth

8 years agoRollup merge of #27137 - dhuseby:fixing_bitrig_linking, r=alexcrichton
Steve Klabnik [Fri, 24 Jul 2015 18:56:01 +0000 (14:56 -0400)]
Rollup merge of #27137 - dhuseby:fixing_bitrig_linking, r=alexcrichton

fixes the linking error on bitrig.

8 years agoAddress comments
Manish Goregaokar [Thu, 23 Jul 2015 06:41:04 +0000 (12:11 +0530)]
Address comments

8 years agoAdd long diagnostic for E0276
Manish Goregaokar [Wed, 22 Jul 2015 15:49:24 +0000 (21:19 +0530)]
Add long diagnostic for E0276

8 years agoAdd long diagnostic explanation for E0275
Manish Goregaokar [Wed, 22 Jul 2015 15:43:22 +0000 (21:13 +0530)]
Add long diagnostic explanation for E0275

8 years agoAdd long diagnostics for E0272-274 (on_unimplemented)
Manish Goregaokar [Wed, 22 Jul 2015 15:31:19 +0000 (21:01 +0530)]
Add long diagnostics for E0272-274 (on_unimplemented)