Commit Graph

42943 Commits

Author SHA1 Message Date
bors
8a872943ff Auto merge of #25778 - econoplas:master, r=pnkfelix
A regression was introduced by commit 7b1916d253 #25612.  Negative signed integer literals less than -9223372036854775808i64 were no longer properly reported as #[warn(overflowing_literals)].

Also adding missing test cases to test/compile-fail/lint-type-overflow.rs which could have detected the regression.

Further explanation:

The expression `(negative && v > max as u64 + 1)` relies on the fact that algebraically speaking `-min == max + 1` to avoid negation and removing the need for `min` completely.

If i128 or i256 are ever added, it should also work for these types without requiring a change to `min != i64::MIN &&` also simplifying maintenance.

r? @pnkfelix
2015-05-26 09:49:36 +00:00
bors
7cb9914fce Auto merge of #25767 - mystor:patch-1, r=Gankro
By the same logic that `mem::forget` is safe, `boxed::into_raw` is actually a safe function.

Fixes #25755.
2015-05-25 23:02:52 +00:00
bors
cc156c2f38 Auto merge of #25771 - killercup:trpl/cleanup-markdown-links, r=steveklabnik
In all other places the IDs of link references are without spaces (and explicitly set).

These are just some cleanups I did for the PDF version.

r? @steveklabnik
2015-05-25 21:28:51 +00:00
bors
1d0002887e Auto merge of #25698 - mdinger:flat_map, r=steveklabnik
I'm not sure why `core` is on but it's blocking the playpen. Doesn't seem to be needed but I'm not sure. It's not on the playpen template and playpen works on release and nightly.

Seems easier to understand without `take()`.
2015-05-25 19:52:45 +00:00
Michael Layzell
d416fc1d40 Remove unsafe block around boxed::into_raw() as it is now safe 2015-05-25 14:44:22 -04:00
bors
6770253c67 Auto merge of #25742 - thombles:tk/StringCoercion, r=steveklabnik
A few of us [over on the forum](https://users.rust-lang.org/t/string-type-coercion-in-rust/1439) have been tripped up by this distinction, which I don't think is mentioned. It's kind of logical if you read the "Deref coercions" page and squint a bit but I think it would be nice to explain it directly. Here's one way we could clarify it.
2015-05-25 18:18:11 +00:00
bors
45001c0ef8 Auto merge of #25773 - dotdash:deref_dst, r=eddyb
Fat pointers aren't immediate, so in a datum, they're not actually
ByValue but ByRef.

Fixes #24589
2015-05-25 15:54:39 +00:00
Björn Steinbrink
efd3e75503 Fix auto_ref for fat pointers
Fat pointers aren't immediate, so in a datum, they're not actually
ByValue but ByRef.

Fixes #24589
2015-05-25 17:25:41 +02:00
econoplas
43502adf07 - Fix regression of literal out of range check for negative i64 values which was introduced by commit 7b1916d253.
- Add missing test cases to test/compile-fail/lint-type-overflow.rs which would have detected the regression.
2015-05-25 07:42:16 -06:00
Pascal Hertleif
6bb56b4fa7 TRPL: Clean up some Markdown links
In all other places the IDs of link references are without spaces (and
explicitly set).
2015-05-25 15:10:50 +02:00
bors
38c943f7ef Auto merge of #25770 - dotdash:bool_transmute, r=eddyb
Fixes #25746
2015-05-25 12:20:24 +00:00
Björn Steinbrink
8527c7f43b Fix transmutes with boolean source values
Fixes #25746
2015-05-25 13:08:31 +02:00
Björn Steinbrink
860448f070 Fix interchanged names of to_arg_ty and from_arg_ty 2015-05-25 12:58:19 +02:00
Thomas Karpiniec
2b3354cbf8 book: add no_run and use statement to strings no-coercion example 2015-05-25 18:38:17 +10:00
bors
2bc0bf2586 Auto merge of #25764 - tshepang:typo, r=steveklabnik 2015-05-25 05:19:11 +00:00
bors
e9005fb43e Auto merge of #25761 - ralexstokes:master, r=steveklabnik
Typo in explanation of difference between stack and heap values.  

`baz` is called at the end of a call to `bar` inside another call to `foo`.  `baz` takes a copy of the value `e` which should have a value of 9 if following the rest of the stack trace.

This PR fixes this typo and should close #25635.
2015-05-25 03:40:31 +00:00
bors
0d64659c30 Auto merge of #25736 - tshepang:path-nits, r=steveklabnik 2015-05-25 01:56:48 +00:00
Michael Layzell
04ab4a3471 Mark boxed::into_raw as safe
By the same logic that `mem::forget` is safe, `boxed::into_raw` is actually a safe function. Fixes #25755.
2015-05-24 21:45:29 -04:00
bors
7c4eedc21e Auto merge of #25756 - tshepang:needless-cloned, r=steveklabnik 2015-05-25 00:15:24 +00:00
Tshepang Lekhonkhobe
1bb16fcd5f doc: fix io::Write::write typo 2015-05-25 01:59:04 +02:00
bors
893e416933 Auto merge of #25758 - tshepang:add-cloned-example, r=Gankro 2015-05-24 22:42:00 +00:00
Tshepang Lekhonkhobe
2d5d6fbca4 doc: add example for Iterator::cloned() 2015-05-25 00:22:44 +02:00
Alex Stokes
c7f92018ac Fix typo in diagram demonstrating stack vs. heap values 2015-05-24 15:18:43 -07:00
Tshepang Lekhonkhobe
02b951f66c doc: cloned() and mut not needed 2015-05-24 22:55:34 +02:00
bors
820b1d8393 Auto merge of #25464 - zaeleus:trpl-riol, r=pnkfelix
r? @steveklabnik
2015-05-24 15:52:17 +00:00
bors
ba0e1cd814 Auto merge of #25609 - nikomatsakis:const-fn, r=pnkfelix
This is a port of @eddyb's `const-fn` branch. I rebased it, tweaked a few things, and added tests as well as a feature gate. The set of tests is still pretty rudimentary, I'd appreciate suggestions on new tests to write. Also, a double-check that the feature-gate covers all necessary cases.

One question: currently, the feature-gate allows the *use* of const functions from stable code, just not the definition. This seems to fit our usual strategy, and implies that we might (perhaps) allow some constant functions in libstd someday, even before stabilizing const-fn, if we were willing to commit to the existence of const fns but found some details of their impl unsatisfactory.

r? @pnkfelix
2015-05-24 11:12:34 +00:00
bors
cc56c20ba4 Auto merge of #25168 - Manishearth:register_attr, r=eddyb
This lets plugin authors opt attributes out of the `custom_attribute`
and `unused_attribute` checks.


cc @thepowersgang
2015-05-24 09:38:26 +00:00
Thomas Karpiniec
49597fcbf2 book: explanation that String -> &str coercion doesn't happen for &str traits 2015-05-24 13:54:05 +10:00
bors
0fc0476e6a Auto merge of #25719 - brson:crosslink, r=eddyb
The recent MSVC patch made the build system pass explicit linkers to
rustc, but did not set that up for anything other than MSVC.

This is blocking nightlies.
2015-05-24 00:36:56 +00:00
bors
0c2642a571 Auto merge of #25666 - tshepang:better-path-docs, r=steveklabnik 2015-05-23 22:07:58 +00:00
Tshepang Lekhonkhobe
462829cb13 doc: fix Windows test failure 2015-05-23 23:13:57 +02:00
Tshepang Lekhonkhobe
d59546d07d path: make this bit follow idiom 2015-05-23 19:51:52 +02:00
Tshepang Lekhonkhobe
d233c28e76 doc: missing words 2015-05-23 19:51:07 +02:00
bors
a33b808ac0 Auto merge of #25735 - oli-obk:rollup, r=steveklabnik
- Successful merges: #25681, #25687, #25695, #25697, #25702, #25703, #25709, #25710, #25714, #25715, #25716, #25722
- Failed merges:
2015-05-23 17:33:54 +00:00
Oliver Schneider
a650075f89 Rollup merge of #25722 - nickdesaulniers:configureClang37, r=brson
Was able to successfully configure.  Building and testing now.
2015-05-23 19:03:20 +02:00
Oliver Schneider
59820fcf61 Rollup merge of #25716 - steveklabnik:remove_bad_docs, r=Gankro 2015-05-23 19:03:20 +02:00
Oliver Schneider
962b132fe3 Rollup merge of #25715 - nero-luci:patch-1, r=steveklabnik
I consider that this version has a better reading fluency, instead of having a period between clauses
2015-05-23 19:03:19 +02:00
Oliver Schneider
0b70f27b64 Rollup merge of #25714 - brianquinlan:patch-1, r=huonw 2015-05-23 19:03:19 +02:00
Oliver Schneider
04fe212e1f Rollup merge of #25710 - Manishearth:no_decorator_clone, r=sfackler
fixes #25683

I have a very nonscientific measurement of the data via valgrind/massif [here](https://gist.github.com/Manishearth/4c47f15f6835cb3957c4)

I measured the memory usage for both --pretty=expanded and -Z no-trans

It *seems* like there's a 20-25MB decrease during expansion on stage2 librustc; but I'm not quite sure.

r? @eddyb

(have not yet run tests, but it compiles fine, might want to wait before giving r+)

cc @nrc @huon
2015-05-23 19:03:19 +02:00
Oliver Schneider
d5985d3036 Rollup merge of #25709 - MatejLach:stdlib_style, r=steveklabnik
Sounds better to me this way.
r @steveklabnik ?
2015-05-23 19:03:19 +02:00
Oliver Schneider
9aa88c99f7 Rollup merge of #25703 - eddyb:lazier-loads, r=pnkfelix
Reduces pre-trans heap baseline (tested on `fn main() {}`) from 1.2MB to 696kB.
Most of the remaining allocations are used by imported macros.
While it might be possible to also load macros lazily, doing so is non-trivial and this PR doesn't tackle that.
2015-05-23 19:03:19 +02:00
Oliver Schneider
d21f41ce6b Rollup merge of #25702 - killercup:rustdoc/search-primitives, r=Gankro
This minimally changes rustdoc's search as described in #25167.

Additionally, I also cleaned up some parts of the JS code.

There is one more change I made: After each result for a primitive type, I added "(Overview of primitive type)". This further differentiates the result from the module (previously, the only difference was that the module's link was blue). I'm not this is the way to go (this seems to be the only place where we do this) and it's no problem for me to remove that commit.

![std__str_-_rust](https://cloud.githubusercontent.com/assets/20063/7770589/67e8cb26-0090-11e5-8f99-c2a3af9fa37f.png)

cc @steveklabnik (it concerns docs) and @alexcrichton (who made changes to rustdoc previously)
2015-05-23 19:03:18 +02:00
Oliver Schneider
a72ddbc2d0 Rollup merge of #25697 - geofft:configure-friendliness, r=brson
Make the error message about missing dependencies clearer, since "need program file" is pretty confusing, and make full commands get logged, since that seems to have been the intention.
2015-05-23 19:03:18 +02:00
Oliver Schneider
691c75a54f Rollup merge of #25695 - mbrubeck:reference, r=brson
r? @steveklabnik
2015-05-23 19:03:18 +02:00
Oliver Schneider
657efde2c6 Rollup merge of #25687 - tamird:num-self-cleanup, r=Gankro
Cleanup extracted from #25684. r? @alexcrichton
2015-05-23 19:03:18 +02:00
Oliver Schneider
0c74a73bd5 Rollup merge of #25681 - steveklabnik:gender, r=nmatsakis
Also, when checking for common gendered words elsewhere, I found one 'he', moved to 'they' as well.

https://github.com/rust-lang/rust/pull/25640#issuecomment-104304643
2015-05-23 19:03:18 +02:00
bors
4ee6820911 Auto merge of #25667 - lambda:rename-soft_link-to-symlink-landed-in-1.1, r=aturon
The change to split up soft_link to OS-specific symlink, symlink_file,
and symlink_dir didn't actually land in 1.0.0.  Update the stability and
deprecation attributes to correctly indicate that these changes happend
in 1.1.0.
2015-05-23 15:57:48 +00:00
bors
88e6976acf Auto merge of #25653 - dotdash:unsize_c, r=luqmana
Fixes #25581
2015-05-23 14:22:35 +00:00
bors
d11399039c Auto merge of #25632 - alexcrichton:dt-dir, r=brson
This "fast path" in `DirEntry::file_type` on Unix wasn't turning out to be so
much of a fast path as the `DT_DIR` case wasn't handled, so directories fell
back to using `lstat` instead. This commit adds the missing case to return
quickly if a path is a directory and `DirEntry::file_type` is used.
2015-05-23 12:47:16 +00:00
bors
4c2ebc3947 Auto merge of #25416 - kballard:ffi-cstr-to-str-convenience, r=alexcrichton
This was motivated by http://www.evanmiller.org/a-taste-of-rust.html.

A common problem when working with FFI right now is converting from raw
C strings into `&str` or `String`. Right now you're required to say
something like

    let cstr = unsafe { CStr::from_ptr(ptr) };
    let result = str::from_utf8(cstr.to_bytes());

This is slightly awkward, and is not particularly intuitive for people
who haven't used the ffi module before. We can do a bit better by
providing some convenience methods on CStr:

    fn to_str(&self) -> Result<&str, str::Utf8Error>
    fn to_string_lossy(&self) -> Cow<str>

This will make it immediately apparent to new users of CStr how to get a
string from a raw C string, so they can say:

    let s = unsafe { CStr::from_ptr(ptr).to_string_lossy() };
2015-05-23 11:12:02 +00:00