Commit Graph

33634 Commits

Author SHA1 Message Date
Niko Matsakis
450263de4a Tests for method resolution in the face of various ambiguities or non-ambiguities. These
are mostly new tests though I also revamped (and renamed) some of the existing tests.
2014-10-21 12:32:36 -04:00
Niko Matsakis
e09fc03701 Various minor cases where errors are reported in slightly different ways. 2014-10-21 12:32:36 -04:00
Niko Matsakis
7f8ca53669 Test where the old infrastructure failed to detect the (applicable) impl of FnMut for
some reason.
2014-10-21 12:32:36 -04:00
Niko Matsakis
df714cfda7 The new method lookup mechanism typechecks calls against the method type declared in the trait, not in the impl. In some cases that results in tighter rules, and in some cases looser. Correct for that. 2014-10-21 12:32:36 -04:00
Niko Matsakis
98e237a681 Correct case where the old version of method lookup was incorrectly matching,
as far as I can tell.
2014-10-21 12:32:36 -04:00
Niko Matsakis
dad2db7c83 Change method lookup infrastructure to use the trait methods. Instead
of tracking individual candidates per impl, we just track one
candidate for the extension trait itself, and let the trait resolution
handle walking the individual impls and so forth. Also change the
interface to report back a richer notion of error.
2014-10-21 12:32:36 -04:00
Tom Jakubowski
370c9c54c2 rustdoc: hide private traits in strip-private pass
Fix #16563
2014-10-21 08:49:43 -07:00
Niko Matsakis
1562d8cbd8 Generalize the replace-late-bound-regions function to operate
over anything that is foldable, not just fn signatures.
2014-10-21 11:49:38 -04:00
Niko Matsakis
5c505b75b1 Permit DST types to unify like other types.
Also:
1. stop eagerly coercing from `[T, ..n]` to `[T]` only do so if requested.
2. permit error to be interact more freely.

Fixes #17178.
2014-10-21 11:49:38 -04:00
Niko Matsakis
e6a1936d26 Implement "method matching". Similar to trait matching, but with the twist that we
have to take the transformed self type into account, and allow for coercion between
the receiver and the actual type declared on the impl.
2014-10-21 11:49:38 -04:00
Niko Matsakis
04386f4217 Prune unused parameters. 2014-10-21 11:49:37 -04:00
bors
4764c16011 auto merge of #18201 : Gankro/rust/option-what, r=alexcrichton
🐳
2014-10-21 14:52:11 +00:00
John Kleint
f0b7065e6f Guide: articulate the advantages of ownership over garbage collection.
Explain the primary disadvantage of garbage collection is runtime
overhead and unpredictable pauses.  Elucidate where the name "race
condition" comes from.  Emphasize that Rust can guarantee your code is
free of race conditions and other memory errors, with no runtime
overhead.
2014-10-21 09:09:32 -04:00
bors
b69cd73b7b auto merge of #17508 : vberger/rust/stability_lint_for_nested_macros, r=pnkfelix
Finishes the job of #17286.

Now the stability lint will successfully detect patterns such as:
```
first_macro!(second_macro!(deprecated_function()));
```
```
macro_rules! foo (
    ($e: expr) => (bar!($e))
)
foo!(deprected_function());
```
and
```
println!("{}", deprecated_function());
```
even with more levels of nesting, such as
```
println!("{}", foo!(bar!(deprecated_function())));
```
2014-10-21 11:37:14 +00:00
bors
e8cc3f26ec auto merge of #18194 : jmesmon/rust/libbacktrace-env, r=alexcrichton
This was run into while attempting to integrate rust with bitbake's build system. I expect it's caused by some other environment variables being set to gcc but didn't track down the exact cause myself.
2014-10-21 08:22:09 +00:00
Julian Orth
4765bb9cb8 Use strlen in CString::len 2014-10-21 08:12:50 +02:00
Alexis Beingessner
01e8ad6c38 Fix crazy-pants match in Option docs 2014-10-20 21:18:59 -04:00
bors
2fffbe0663 auto merge of #17555 : steveklabnik/rust/module_guide, r=alexcrichton
This is an almost-done draft of a guide on crates and modules. This is a hard guide to get right, I had to remove a chunk of the Guide because it was confusing.

I've also pushed up https://github.com/steveklabnik/phrases which has matching code. Whenever we finish this guide, I think it'd be good to have a sample crate like this in the rust-lang org for people to compare against. The hardest part of a guide like this is that it depends on multiple files being correct, and being able to point to a repository would be very helpful.

Things yet to do:

1. external crates via cargo
2. documentation

I'm super open to still revising this if it's still confusing. There's been a lot of Reddit discussion about the module system, and I tried to incorporate those posts and the comments into this.
2014-10-21 00:07:33 +00:00
bors
6ef8392b3f auto merge of #17453 : steveklabnik/rust/gh17340, r=alexcrichton
/cc @huonw
2014-10-20 22:17:49 +00:00
Victor Berger
dd55c8003c Stability lint checker now handles nested macros.
Closes #17185.
2014-10-20 23:48:29 +02:00
Steve Klabnik
8851ec647a New Guide: crates and modules 2014-10-20 17:29:57 -04:00
bors
b2e5773655 auto merge of #18145 : neilpa/rust/master, r=steveklabnik
Noticed a type while reading through the intro
2014-10-20 20:27:32 +00:00
Steve Klabnik
f358407dcf Some String Guide improvements.
Fixes #17340
2014-10-20 16:25:35 -04:00
Cody P Schafer
d75ff2ff93 mk/rt: "export CC" does not seem to work (gcc observed), use explicit shell variables instead 2014-10-20 15:35:38 -04:00
bors
6353465f4d auto merge of #18186 : cakebaker/rust/fix_test_count, r=alexcrichton 2014-10-20 17:57:39 +00:00
bors
7d0cc44f87 auto merge of #18070 : alexcrichton/rust/spring-cleaning, r=aturon
This is a large spring-cleaning commit now that the 0.12.0 release has passed removing an amount of deprecated functionality. This removes a number of deprecated crates (all still available as cargo packages in the rust-lang organization) as well as a slew of deprecated functions. All `#[crate_id]` support has also been removed.

I tried to avoid anything that was recently deprecated, but I may have missed something! The major pain points of this commit is the fact that rustc/syntax have `#[allow(deprecated)]`, but I've removed that annotation so moving forward they should be cleaned up as we go.
2014-10-20 16:07:43 +00:00
Alex Crichton
96445a533e Test fixes and rebase conflicts 2014-10-20 08:17:33 -07:00
Daniel Hofstetter
555ab2b3a4 Guide: Fix test count 2014-10-20 16:17:59 +02:00
bors
dcbd49ff88 auto merge of #18184 : cakebaker/rust/typo_in_path, r=steveklabnik 2014-10-20 14:17:10 +00:00
Daniel Hofstetter
cf3d3dc486 Guide: Fix typo in path 2014-10-20 15:26:09 +02:00
bors
ddfe24d641 auto merge of #18174 : huonw/rust/fix-sqrt, r=alexcrichton
Closes #9987.
2014-10-20 10:17:09 +00:00
Huon Wilson
a1d5cd204d Handle negative numbers in sqrt properly.
Closes #9987.
2014-10-20 21:10:13 +11:00
bors
045bc283ec auto merge of #18108 : mahkoh/rust/buffered_reader, r=alexcrichton
This optimizes `read` for the case in which the number of bytes
requested is larger than the internal buffer. Note that the first
comparison occurs again right afterwards and should thus be free. The
second comparison occurs only in the cold branch.
2014-10-20 03:27:12 +00:00
Julian Orth
3839696529 Optimize BufferedReader::read for large buffers.
This optimizes `read` for the case in which the number of bytes
requested is larger than the internal buffer. Note that the first
comparison occurs again right afterwards and should thus be free. The
second comparison occurs only in the cold branch.
2014-10-20 01:47:33 +02:00
bors
aff4f11cdd auto merge of #18160 : koshlo/rust/to-source-fix, r=alexcrichton
Fix for issue #18091 

The problem seems to be that `ast_util::int_ty_to_string` takes unsigned number, and no one adds `-` to result string. I've fixed it by putting `-` before result string using `format!`.

I've also added `test_signed_int_to_string()` to check if implementation is valid.
2014-10-19 23:32:07 +00:00
bors
5cba29d334 auto merge of #18142 : arielb1/rust/return-type-sized, r=eddyb
Fixes #18107 

r? @eddyb
2014-10-19 21:42:05 +00:00
Ariel Ben-Yehuda
0eb17e3f31 Ensure that the return type of a function is Sized
While no real rvalue of an unsized type can exist, a diverging function
can still "return" a value of such a type, which causes an ICE.

Fixes #18107.
2014-10-19 23:54:45 +03:00
Alex Crichton
9d5d97b55d Remove a large amount of deprecated functionality
Spring cleaning is here! In the Fall! This commit removes quite a large amount
of deprecated functionality from the standard libraries. I tried to ensure that
only old deprecated functionality was removed.

This is removing lots and lots of deprecated features, so this is a breaking
change. Please consult the deprecation messages of the deleted code to see how
to migrate code forward if it still needs migration.

[breaking-change]
2014-10-19 12:59:40 -07:00
Alex Crichton
fb169d5543 Remove a number of deprecated crates
All of these crates have been deprecated for some time and properly live in the
rust-lang organization as cargo-based crates.

To update your code, depend on the rust-lang/foo repository via cargo.

[breaking-change]
2014-10-19 12:59:40 -07:00
Aleksandr Koshlo
49ec356c60 fix printing signed literal in print_literal 2014-10-19 18:39:51 +03:00
bors
c121cbab35 auto merge of #18139 : JelteF/rust-1/patch-1, r=steveklabnik
The explanation of fold talks about three elements that should be summed, but it uses different values in the provided code.
2014-10-19 13:52:06 +00:00
bors
18062c1e96 auto merge of #18138 : rclanan/rust/mark-lt-partialord-inline, r=sfackler
Fixes issue #18090
2014-10-19 10:57:09 +00:00
bors
e99dd205f8 auto merge of #18136 : mprobinson/rust/example-warning, r=alexcrichton
let mut value = mutex.lock();
warning: variable does not need to be mutable
2014-10-19 09:07:10 +00:00
bors
4bb21f37ef auto merge of #18135 : EduardoBautista/rust/fix-misaligned-carot, r=steveklabnik 2014-10-19 07:17:15 +00:00
bors
a572b74cc0 auto merge of #18124 : pnkfelix/rust/fsk-add-check-of-borrow-local-static, r=thestinger
Check for borrow of local variable introduced within static block.

(Rather than ICE on it.)

Fix #18118.
2014-10-19 05:12:14 +00:00
bors
dc2b9dba27 auto merge of #18123 : dotdash/rust/llvm_memcpy, r=alexcrichton 2014-10-19 02:52:36 +00:00
bors
c46812f659 auto merge of #18120 : jrincayc/rust/match_exp, r=thestinger
Use a match expression directly in the println statement, instead of creating a second variable.  It seems weird that the current guide.md complains about creating an extra variable, when the same feature could be demonstrated without creating the extra variable.
2014-10-19 00:47:18 +00:00
Neil Pankey
66939dfe64 [Docs] more intro typos 2014-10-18 17:40:57 -07:00
Neil Pankey
e1389530cf [Docs] intro typo 2014-10-18 17:37:54 -07:00
bors
d8cf023971 auto merge of #18109 : bkoropoff/rust/issue-16939, r=aturon
Closes #16939
2014-10-18 22:57:16 +00:00