Commit Graph

40120 Commits

Author SHA1 Message Date
Vadim Petrochenkov
d2cccd07bc Fix byte string literal patterns in match 2015-03-18 00:40:59 +03:00
Vadim Petrochenkov
3c31794d31 Avoid metadata bloat by using trait FixedSizeArray 2015-03-18 00:40:59 +03:00
Vadim Petrochenkov
b98255cbd2 Add and fix more tests 2015-03-18 00:40:59 +03:00
Vadim Petrochenkov
1e9bef916f Fixed-size byte string literals (RFC 339) 2015-03-18 00:40:59 +03:00
Niko Matsakis
0947f4076d Move unsafety out of the subtyping relation and into coercion. 2015-03-17 17:29:07 -04:00
bors
ea8b82e90c Auto merge of #23376 - eddyb:die-tydesc-die, r=nikomatsakis
Final remnant of reflection is gone. Also, virtual `Trait` destructors are no longer tied to `Box`.
That means they can be used to drop any instance of the type (used in libarena to replace TyDesc).

This is [breaking-change] for direct users of intrinsics:
* use `intrinsics::type_name::<T>()` instead of `(*intrinsics::get_tydesc::<T>()).name`
* the only way to get the destructor is from a trait object's vtable (see libarena changes)

r? @pcwalton f? @dotdash
2015-03-17 21:23:02 +00:00
Kevin Butler
34c48db837 Fix documentation for StrExt::trim_matches 2015-03-17 20:37:20 +00:00
Niko Matsakis
1b0f0ad280 Extract out mts into combine using tys_with_variance 2015-03-17 15:57:30 -04:00
Eduard Burtescu
e256b7f049 Replace TyDesc and its uses with trait vtables and a type_name intrinsic. 2015-03-17 21:00:23 +02:00
Eduard Burtescu
3e98ab560a rustc_trans: use the drop glue of T instead of Box<T> in Trait's vtable, be it &Trait or Box<Trait>. 2015-03-17 21:00:21 +02:00
Alex Crichton
71982c2124 libc: Fix definition of sockaddr_storage on 32-bit linux
The alignment field is actually a "pointer sized" type instead of always i64,
requiring that the size of the padding field is also calculated slightly
differently.

Closes #23425
2015-03-17 10:33:13 -07:00
bors
bfac337daa Auto merge of #23330 - alexcrichton:thread-sleep, r=aturon
This function is the current replacement for `std::old_io::timer` which will
soon be deprecated. This function is unstable and has its own feature gate as it
does not yet have an RFC nor has it existed for very long.
2015-03-17 17:15:54 +00:00
kjpgit
5429f94405 book: improve pointer box borrowing examples
These two borrowing examples were confusing/misleading.  This changes it
to more clearly show how you _can_ borrow a box, and also uses & instead
of &*.
2015-03-17 11:52:14 -05:00
Alex Crichton
04cf534411 std: Implement thread::sleep
This function is the current replacement for `std::old_io::timer` which will
soon be deprecated. This function is unstable and has its own feature gate as it
does not yet have an RFC nor has it existed for very long.
2015-03-17 09:34:42 -07:00
Ricardo Martins
730defc9d1 Fix IPv6 address format in documentation
Very minor fix: in `std::net::Ipv6Addr::new`, the documentation had an incomplete representation of the resulting address, missing the last two groups.
2015-03-17 14:56:27 +00:00
bors
c64d671671 Auto merge of #23423 - nikomatsakis:issue-18737-trait-subtyping, r=nrc
This upcast coercion currently never requires vtable changes. It should be generalized. 

This is a [breaking-change] -- if you have an impl on an object type like `impl SomeTrait`, then this will no longer be applicable to object types like `SomeTrait+Send`. In the standard library, this primarily affected `Any`, and this PR adds impls for `Any+Send` as to keep the API the same in practice. An alternate workaround is to use UFCS form or standalone fns. For more details, see <https://github.com/rust-lang/rust/issues/18737#issuecomment-78450798>.

r? @nrc
2015-03-17 13:29:48 +00:00
Niko Matsakis
277b4f035a Fix soundness hole when unsizing boxes. 2015-03-17 08:34:25 -04:00
Niko Matsakis
5f5ed62298 Remove subtyping for object types and replace with an *upcast* coercion.
This upcast coercion currently preserves the vtable for the object, but
eventually it can be used to create a derived vtable. The upcast
coercion is not introduced into method dispatch; see comment on #18737
for information about why. Fixes #18737.
2015-03-17 08:34:25 -04:00
Niko Matsakis
bd2096c497 Only test predicates if this is a default method, as a simple optimization. 2015-03-17 07:36:42 -04:00
bors
31ba21228e Auto merge of #23436 - Manishearth:rollup, r=Manishearth
r? @Manishearth
2015-03-17 10:54:50 +00:00
Manish Goregaokar
dcec88cca3 Re-bork whitespace for text file (fixup #23385) 2015-03-17 16:00:39 +05:30
Niko Matsakis
99a508bc17 Check that predicates hold before emitting an entry for the vtable.
Fixes #23435.
2015-03-17 06:24:11 -04:00
Manish Goregaokar
2e083063e7 Rollup merge of #23432 - mzabaluev:io-into-inner-doc, r=alexcrichton
Resolves #23386.
2015-03-17 15:21:56 +05:30
Manish Goregaokar
fad4c380e8 Rollup merge of #23385 - tamird:cleanup-whitespace, r=alexcrichton
r? @alexcrichton

Conflicts:
	src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs
2015-03-17 15:21:22 +05:30
Manish Goregaokar
0b463b075e Rollup merge of #23329 - jbcrail:rm-syntax-highlight, r=sanxiyn
As suggested by @steveklabnik in #23254, I removed the redundant Rust syntax highlighting from the documentation.
2015-03-17 15:20:27 +05:30
Manish Goregaokar
46200e5090 Rollup merge of #23427 - tshepang:dur-becomes-duration, r=steveklabnik
Also:

- italize the binding name
- complete a sentence
2015-03-17 15:20:19 +05:30
Manish Goregaokar
e8889c9404 Rollup merge of #23417 - padenot:patch-1, r=steveklabnik
This looks like the most logical target to give to this link, or at least what I would expect as someone that want to integrate with a native library.

r? @steveklabnik
2015-03-17 15:20:11 +05:30
Manish Goregaokar
925d5ad715 Rollup merge of #23415 - alexcrichton:stabilize-flush, r=aturon
The [associated RFC][rfc] for possibly splitting out `flush` has been closed and
as a result there are no more blockers for stabilizing this method, so this
commit marks the method as such.

[rfc]: https://github.com/rust-lang/rfcs/pull/950
2015-03-17 15:20:03 +05:30
Manish Goregaokar
c2671b59cc Rollup merge of #23409 - GBGamer:patch-2, r=alexcrichton
To the correct MAP_NORESERVE. Every other instance is known as MAP_NORESERVE, so this is just a basic typo.

I really doubt this will break anybody's but my own code.

[breaking-change]
2015-03-17 15:19:57 +05:30
Manish Goregaokar
a4b57bebd0 Rollup merge of #23402 - tamird:needstest-tests, r=jakub-
@alexcrichton @jakub-
2015-03-17 15:19:51 +05:30
Manish Goregaokar
74adeda78a Rollup merge of #23400 - nrc:pub_use, r=eddyb
r? @eddyb
2015-03-17 15:19:45 +05:30
Manish Goregaokar
285cb8e6d8 Rollup merge of #23399 - tbu-:pr_libflate_error, r=huonw
This removes the error case of the compression functions, the only errors that
can occur are incorrect parameters or an out-of-memory condition, both of which
are handled with panics in Rust.

Also introduces an extensible `Error` type instead of returning an `Option`.
The type implements a destructor so you can't destructure it.
2015-03-17 15:19:38 +05:30
Niko Matsakis
88b65c9e2b Refactor the emit_vtable_methods code to be a bit cleaner in its use of
iterators.
2015-03-17 05:18:01 -04:00
bors
883551b1d7 Auto merge of #23429 - rprichard:fix-linux-build, r=alexcrichton
The RUST_TARGET_STAGE_N rule uses LLVM_LIBDIR_RUSTFLAGS_<target-triple>,
which expands to -L "$(llvm-config --libdir)" when the target-triple is
also a host-triple. Rather than expand to -L "" if llvm-config has not yet
been built, add a dependency on the target llvm-config.

When the target-triple is not a host-triple, the new LLVM_CONFIG_$(2)
dependency should expand to nothing.

r? alexcrichton
2015-03-17 05:57:14 +00:00
Mikhail Zabaluev
e3aefaaa4d std::io::buffered: Don't use 'flush' in documentation of into_inner
The word 'flush' may be misinterpreted as if `flush` is called on the
underlying writer, which is not the case.
2015-03-17 06:33:47 +02:00
Ryan Prichard
b07a1dfcd1 Fix the Linux nightly build by adding a LLVM_CONFIG_<target-triple> dep.
The RUST_TARGET_STAGE_N rule uses LLVM_LIBDIR_RUSTFLAGS_<target-triple>,
which expands to -L "$(llvm-config --libdir)" when the target-triple is
also a host-triple. Rather than expand to -L "" if llvm-config has not yet
been built, add a dependency on the target llvm-config.

When the target-triple is not a host-triple, the new LLVM_CONFIG_$(2)
dependency should expand to nothing.
2015-03-16 21:13:36 -07:00
bors
e46610966f Auto merge of #23104 - japaric:inherent, r=nikomatsakis
- Allow inherent implementations on `char`, `str`, `[T]`, `*const T`, `*mut T` and all the numeric primitives.
- copy `unicode::char::CharExt` methods into `impl char`
- remove `unicode::char::CharExt`, its re-export `std::char::CharExt` and `CharExt` from the prelude
- copy `collections::str::StrExt` methods into `impl str`
- remove `collections::str::StrExt` its re-export `std::str::StrExt`, and `StrExt` from the prelude
- copy `collections::slice::SliceExt` methods into `impl<T> [T]`
- remove `collections::slice::SliceExt` its re-export `std::slice::SliceExt`, and `SliceExt` from the prelude
- copy `core::ptr::PtrExt` methods into `impl<T> *const T`
- remove `core::ptr::PtrExt` its re-export `std::ptr::PtrExt`, and `PtrExt` from the prelude
- copy `core::ptr::PtrExt` and `core::ptr::MutPtrExt` methods into `impl<T> *mut T`
- remove `core::ptr::MutPtrExt` its re-export `std::ptr::MutPtrExt`, and `MutPtrExt` from the prelude
- copy `core::num::Int` and `core::num::SignedInt` methods into `impl i{8,16,32,64,size}`
- copy `core::num::Int` and `core::num::UnsignedInt` methods into `impl u{8,16,32,64,size}`
- remove `core::num::UnsignedInt` and its re-export `std::num::UnsignedInt`
- move `collections` tests into its own crate: `collectionstest`
- copy `core::num::Float` methods into `impl f{32,64}`

Because this PR removes several traits, this is a [breaking-change], however functionality remains unchanged and breakage due to unresolved imports should be minimal. If you encounter an error due to an unresolved import, simply remove the import:

``` diff
  fn main() {
-     use std::num::UnsignedInt;  //~ error: unresolved import `std::num::UnsignedInt`.
-
      println!("{}", 8_usize.is_power_of_two());
  }
```

---

cc  #16862
[preview docs](http://japaric.github.io/inherent/std/index.html)
[unicode::char](http://japaric.github.io/inherent/unicode/primitive.char.html)
[collections::str](http://japaric.github.io/inherent/collections/primitive.str.html)
[std::f32](http://japaric.github.io/inherent/std/primitive.f32.html)
2015-03-17 03:23:50 +00:00
Jorge Aparicio
b65ebc4094 better document the hacks required to test libcollections 2015-03-16 21:57:43 -05:00
Jorge Aparicio
8256241d3a impl f{32,64} 2015-03-16 21:57:43 -05:00
Jorge Aparicio
3ab26f8469 join lines in makefile 2015-03-16 21:57:43 -05:00
Jorge Aparicio
59749087f8 fix after rebase 2015-03-16 21:57:42 -05:00
Jorge Aparicio
6d49476e7b preemptively fix windows compilation errors 2015-03-16 21:57:42 -05:00
Jorge Aparicio
cb5e429291 move some tests back to libcollections 2015-03-16 21:57:42 -05:00
Jorge Aparicio
e09bf82a31 enable enum_set tests 2015-03-16 21:57:42 -05:00
Jorge Aparicio
a079d5e4d2 remove imports 2015-03-16 21:57:42 -05:00
Jorge Aparicio
6453fcd4cc extract libcollections tests into libcollectionstest 2015-03-16 21:57:42 -05:00
Jorge Aparicio
3ff84fc5fd impl {i,u}{8,16,32,64,size} 2015-03-16 21:57:42 -05:00
Jorge Aparicio
8afcaabee3 impl<T> *const T, impl<T> *mut T 2015-03-16 21:57:42 -05:00
Jorge Aparicio
633c593bc3 impl<T> [T] 2015-03-16 21:56:31 -05:00
Jorge Aparicio
5b118f5ecd impl str 2015-03-16 21:56:31 -05:00