Commit Graph

51313 Commits

Author SHA1 Message Date
Steve Klabnik
c5ec055d1f Rollup merge of #32148 - steveklabnik:gh31912, r=apasel422
Small grammar fix in Guessing Game

When it was Option.expect(), there was an .ok().expect(), but now that it uses Result.expect(), there's only one method, not two.

Fixes #31912
2016-03-10 14:01:54 +03:00
Steve Klabnik
76bcf6430f Rollup merge of #32147 - steveklabnik:gh31950, r=bluss
Clarify that try_unwrap needs exactly one

Fixes #31950
2016-03-10 14:01:54 +03:00
Steve Klabnik
d6c4b53df1 Rollup merge of #32136 - nathankleyn:improve-docs-for-btreeset, r=steveklabnik
Add missing documentation examples for BTreeSet.

As part of the ongoing effort to document all methods with examples,
this commit adds the missing examples for the `BTreeSet` collection
type.

This is part of issue #29348.

r? @steveklabnik
2016-03-10 14:01:53 +03:00
Steve Klabnik
3820d38e90 Rollup merge of #32125 - pyfisch:patch-2, r=steveklabnik
Remove final note from testing chapter.

The information that documentation tests cannot be run in binary crates is already given at the beginning of the section.
2016-03-10 14:01:53 +03:00
Steve Klabnik
3e764efef7 Rollup merge of #32091 - dirk:dirk/siphasher-docs-clarification, r=alexcrichton
Clarify documentation of hash::SipHasher

The docs were making assertions/recommendations they shouldn't have. This clarifies them and adds some helpful links.

Fixes #32043.

r? @sfackler
2016-03-10 14:01:53 +03:00
Steve Klabnik
09e08bac93 Rollup merge of #31830 - frewsxcv:assoc-func, r=steveklabnik
Prefer 'associated function' over 'static method' in msg.

TRPL seems to refer to 'static functions' as 'associated functions'.
This terminology should be used consistently.
2016-03-10 14:01:53 +03:00
bors
25a23271f4 Auto merge of #32100 - SimonSapin:patch-6, r=alexcrichton
"can be built on Ref::map"… how?

Now that `std::cell::Ref::filter_map` and `RefMut::filter_map` are deprecated, using them gives a warning like:
```
script/dom/element.rs:754:9: 754:24 warning: use of deprecated item: can be built on Ref::map, #[warn(deprecated)] on by default
```

But it’s not at all obvious *how* the functionality can be built on `Ref::map`. This PR adds to the warning message a crates.io URL for a crate that does.
2016-03-10 02:45:14 -08:00
Niko Matsakis
0ddc17d5bb Add comment explaining purpose of test 2016-03-10 05:21:00 -05:00
Corey Farwell
410333be64 Differentiate "line" and "line number" variable names. 2016-03-09 23:36:39 -08:00
Corey Farwell
e1048b5ab6 Prefer Option::expect over explicit unwrapping. 2016-03-09 23:24:50 -08:00
bors
3ac4076ac0 Auto merge of #32097 - jseyfried:fix_resolution_regression, r=nikomatsakis
Fix a regression in import resolution

This fixes #32089 (caused by #31726) by deducing that name resolution has failed (as opposed to being determinate) in more cases.

r? @nikomatsakis
2016-03-09 22:41:48 -08:00
Corey Farwell
d9dba7699f Prefer 'associated function' over 'static method' in msg.
TRPL seems to refer to 'static functions' as 'associated functions'.
This terminology should be used consistently.
2016-03-09 21:29:39 -08:00
bors
bcda58f491 Auto merge of #31710 - eddyb:reify, r=nikomatsakis
Distinguish fn item types to allow reification from nothing to fn pointers.

The first commit is a rebase of #26284, except for files that have moved since.

This is a [breaking-change], due to:
* each FFI function has a distinct type, like all other functions currently do
* all generic parameters on functions are recorded in their item types, e.g.:
`size_of::<u8>` & `size_of::<i8>`'s types differ despite their identical signature.
* function items are zero-sized, which will stop transmutes from working on them

The first two cases are handled in most cases with the new coerce-unify logic,
which will combine incompatible function item types into function pointers,
at the outer-most level of if-else chains, match arms and array literals.

The last case is specially handled during type-checking such that transmutes
from a function item type to a pointer or integer type will continue to work for
another release cycle, but are being linted against. To get rid of warnings and
ensure your code will continue to compile, cast to a pointer before transmuting.
2016-03-09 20:16:20 -08:00
mitaa
7c983991d9 Remove feature(globs) since they are stable 2016-03-10 03:29:55 +01:00
mitaa
a20e6bb162 Consider doc(hidden) for crate-local inlining 2016-03-10 03:29:46 +01:00
bors
0b9995b24c Auto merge of #31618 - alexcrichton:no-thread-spawns, r=brson
Optimize some functions in std::process

* Be sure that `read_to_end` gets directed towards `read_to_end_uninitialized` for all handles
* When spawning a child that guaranteed doesn't need a stdin, don't actually create a stdin pipe for that process, instead just redirect it to /dev/null
* When calling `wait_with_output`, don't spawn threads to read out the pipes of the child. Instead drain all pipes on the calling thread and *then* wait on the process.

Functionally, it is intended that nothing changes as part of this PR

---

Note that this was the same as #31613, and even after that it turned out that fixing Windows was easier than I thought! To copy a comment from over there:

> As some rationale for this as well, it's always bothered me that we've spawned threads in the standard library for this (seems a bit overkill), and I've also been curious lately as to our why our build times for Windows are so much higher than Unix (on the buildbots we have). I have done basically 0 investigation into why, but I figured it can't help to try to optimize Command::output which I believe is called quite a few times during the test suite.
2016-03-09 18:18:10 -08:00
bors
cc62db802f Auto merge of #32165 - alexcrichton:fix-broken-master, r=alexcrichton
collections: Fix broken doc example

PR #32135 was accidentally merged without tests passing, and unfortunately one
of the tests added was broken, so this fixes that.
2016-03-09 16:21:32 -08:00
Alex Crichton
752f2796ba collections: Fix broken doc example
PR #32135 was accidentally merged without tests passing, and unfortunately one
of the tests added was broken, so this fixes that.
2016-03-09 16:20:32 -08:00
Niko Matsakis
59279b5abb Do not report errors from regionck if other errors were already
reported during the lifetime of this inferencer. Fixes #30580.
2016-03-09 17:44:57 -05:00
Steve Klabnik
996f818105 Merge pull request #32135 from nathankleyn/improve-docs-for-btreemap
Add missing documentation examples for BTreeMap.
2016-03-10 01:14:40 +03:00
Sean McArthur
ca129e376e lint: mark associated types as live for the dead_code pass 2016-03-09 11:36:05 -08:00
Alex Crichton
7c3038f824 std: Don't spawn threads in wait_with_output
Semantically there's actually no reason for us to spawn threads as part of the
call to `wait_with_output`, and that's generally an incredibly heavyweight
operation for just reading a few bytes (especially when stderr probably rarely
has bytes!). An equivalent operation in terms of what's implemented today would
be to just drain both pipes of all contents and then call `wait` on the child
process itself.

On Unix we can implement this through some convenient use of the `select`
function, whereas on Windows we can make use of overlapped I/O. Note that on
Windows this requires us to use named pipes instead of anonymous pipes, but
they're semantically the same under the hood.
2016-03-09 10:12:36 -08:00
Nathan Kleyn
6799895b6d Add missing "basic usage" sections to docs, fix review comments. 2016-03-09 16:39:23 +00:00
Eduard Burtescu
3855fa99ca trans: Keep transmutes from fn item types working, but lint them. 2016-03-09 18:35:27 +02:00
Nathan Kleyn
04436fb65b Address review comments to add "basic usage" sections to docs. 2016-03-09 16:18:31 +00:00
bors
ef3d051630 Auto merge of #32073 - jseyfried:fix_another_trait_privacy_error, r=nikomatsakis
Fix incorrect trait privacy error

This PR fixes #21670 by using the crate metadata instead of `ExternalExports` to determine if an external item is public.

r? @nikomatsakis
2016-03-09 07:14:05 -08:00
Eduard Burtescu
eb926dd4b7 typeck: Unify if-else blocks, match arms and array elements by coercing where possible. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
d2c6bef493 typeck: Remove the redundant "unifier" from check_expr_with_unifier. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
ad91f19957 typeck: Support multiple expressions getting coerced at the same type. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
3ff4c347c7 typeck: don't wastefully clone expressions for cast checks. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
dbab236a9e typeck: Remove Coerce::unpack_actual_value. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
dc37664c94 infer: Take the origin in report_mismatched_types. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
871a1e1cf8 typeck: rename mk_assignty to coercion::try. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
2b1bd80f34 infer: Remove redundant commit_if_ok calls. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
1b7fb17745 Test that function types are actually zero-sized. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
61a77b38e2 tests: Avoid transmuting from fn item types. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
644d6390be typeck: Use TyFnDef for methods. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
847f00738b typeck: Introduce reification for fn ptr casts. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
8f07f8a4fa trans: Reify functions & methods to fn ptrs only where necessary. 2016-03-09 16:45:28 +02:00
Eduard Burtescu
c284099f56 trans: Remove unused ref_id from monomorphic_fn. 2016-03-09 16:45:28 +02:00
Eduard Burtescu
0c01f6e149 trans: Move type_of_fn_from_ty callers to type_of. 2016-03-09 16:45:28 +02:00
Eduard Burtescu
e4e1242769 Print fn type parameters for TyFnDef. 2016-03-09 16:45:28 +02:00
Eduard Burtescu
ffa0860467 Track fn type and lifetime parameters in TyFnDef. 2016-03-09 16:45:28 +02:00
Eli Friedman
b423a0f9ef Split TyBareFn into TyFnDef and TyFnPtr.
There's a lot of stuff wrong with the representation of these types:
TyFnDef doesn't actually uniquely identify a function, TyFnPtr is used to
represent method calls, TyFnDef in the sub-expression of a cast isn't
correctly reified, and probably some other stuff I haven't discovered yet.
Splitting them seems like the right first step, though.
2016-03-09 16:45:28 +02:00
bors
cbbd3d9b92 Auto merge of #31631 - jonas-schievink:agoraphobia, r=nrc
[breaking-batch] Move more uses of `panictry!` out of libsyntax
2016-03-09 05:25:48 -08:00
bors
4b868411af Auto merge of #30804 - shssoichiro:deny-warnings-msg, r=nrc
Show clearer error message when #![deny(warnings)] escalates a warning

Addresses #30730
2016-03-09 03:34:55 -08:00
bors
bb868f17fa Auto merge of #32071 - jseyfried:parse_pub, r=nikomatsakis
Make errors for unnecessary visibility qualifiers consistent

This PR refactors away `syntax::parse::parser::ParsePub` so that unnecessary visibility qualifiers on variant fields are reported not by the parser but by `privacy::SanePrivacyVisitor` (thanks to @petrochenkov's drive-by improvements in #31919).

r? @nikomatsakis
2016-03-09 01:45:33 -08:00
Steve Klabnik
78484696fc Remove inaccurate claim about inline assembly
It's not like GCC's.

Fixes #20213
2016-03-09 03:52:35 -05:00
Steve Klabnik
aaca3175ba Add other primitive types to the reference
Fixes #31628
2016-03-09 03:42:36 -05:00
Steve Klabnik
0f426aa916 Small grammar fix in Guessing Game
When it was Option.expect(), there was an .ok().expect(), but now that it uses Result.expect(), there's only one method, not two.

Fixes #31912
2016-03-09 03:37:19 -05:00