Commit Graph

40 Commits

Author SHA1 Message Date
Daniel Micay 6a90e80b62 option: rewrite the API to use composition 2013-10-09 09:17:29 -04:00
Alex Crichton a8ba31dbf3 std: Remove usage of fmt! 2013-09-30 23:21:18 -07:00
Alex Crichton 46aaf5128d Register new snapshots 2013-09-27 00:44:32 -07:00
Alex Crichton eb2b25dd6d Refactor the logging system for fewer allocations
This lifts various restrictions on the runtime, for example the character limit
when logging a message. Right now the old debug!-style macros still involve
allocating (because they use fmt! syntax), but the new debug2! macros don't
involve allocating at all (unless the formatter for a type requires allocation.
2013-09-25 16:30:05 -07:00
Alex Crichton 817576ee70 Register new snapshots 2013-09-18 11:07:22 -07:00
Marvin Löbel 76c3e8a38c Add an SendStr type
A SendStr is a string that can hold either a ~str or a &'static str.
This can be useful as an optimization when an allocation is sometimes needed but the common case is statically known.

Possible use cases include Maps with both static and owned keys, or propagating error messages across task boundaries.

SendStr implements most basic traits in a way that hides the fact that it is an enum; in particular things like order and equality are only determined by the content of the wrapped strings.

Replaced std::rt:logging::SendableString with SendStr
Added tests for using an SendStr as key in Hash- and Treemaps
2013-09-16 16:57:50 +02:00
blake2-ppc 830ac37ca2 std::logging: Use a more specific enum than Either 2013-09-14 04:07:43 +02:00
Florian Hahn de39874801 Rename str::from_bytes to str::from_utf8, closes #8985 2013-09-05 14:17:24 +02:00
Alex Crichton 97f61e7bbe Remove @io::Writer from sys/repr/reflect
At the same time, this updates the TyVisitor to use a mutable self because it's
probably going to be mutating state as it goes along anyway.
2013-08-28 23:00:46 -07:00
Patrick Walton 8693943676 librustc: Ensure that type parameters are in the right positions in paths.
This removes the stacking of type parameters that occurs when invoking
trait methods, and fixes all places in the standard library that were
relying on it. It is somewhat awkward in places; I think we'll probably
want something like the `Foo::<for T>::new()` syntax.
2013-08-27 18:47:57 -07:00
Kevin Ballard 03ef71e262 Add ToCStr method .with_c_str()
.with_c_str() is a replacement for the old .as_c_str(), to avoid
unnecessary boilerplate.

Replace all usages of .to_c_str().with_ref() with .with_c_str().
2013-08-15 01:33:10 -07:00
bors 60f5011005 auto merge of #8296 : erickt/rust/remove-str-trailing-nulls, r=erickt
This PR fixes #7235 and #3371, which removes trailing nulls from `str` types. Instead, it replaces the creation of c strings with a new type, `std::c_str::CString`, which wraps a malloced byte array, and respects:

*  No interior nulls
* Ends with a trailing null
2013-08-09 21:56:17 -07:00
Erick Tryzelaar ee59aacac4 Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls 2013-08-09 18:48:01 -07:00
Brian Anderson b75915d0ca Remove the C++ runtime. Sayonara 2013-08-09 16:45:50 -07:00
Brian Anderson d392556160 std: Fix perf of local allocations in newsched
Mostly optimizing TLS accesses to bring local heap allocation performance
closer to that of oldsched. It's not completely at parity but removing the
branches involved in supporting oldsched and optimizing pthread_get/setspecific
to instead use our dedicated TCB slot will probably make up for it.
2013-08-09 01:15:31 -07:00
Erick Tryzelaar 8567611adf Merge commit 'd89ff7eef969aee6b493bc846b64d68358fafbcd' into remove-str-trailing-nulls 2013-08-06 16:18:58 -07:00
Erick Tryzelaar 3102b1797e std: replace str::as_c_str with std::c_str 2013-08-04 14:13:17 -07:00
Brian Anderson ea84c1fd69 std: Remove gc and stackwalk
These are both obsoleted by the forthcoming new GC.
2013-08-03 23:39:04 -07:00
Patrick Walton 9457ebee55 librustc: Disallow "unsafe" for external functions 2013-08-02 21:57:59 -07:00
Ben Blum 2e6dc161b6 Give tasks useful names. #2891 2013-07-31 14:37:22 -04:00
Alex Crichton 5aaaca0c6a Consolidate raw representations of rust values
This moves the raw struct layout of closures, vectors, boxes, and strings into a
new `unstable::raw` module. This is meant to be a centralized location to find
information for the layout of these values.

As safe method, `repr`, is provided to convert a rust value to its raw
representation. Unsafe methods to convert back are not provided because they are
rarely used and too numerous to write an implementation for each (not much of a
common pattern).
2013-07-26 09:53:03 -07:00
Erick Tryzelaar 3b818edeba std and extra: use as_c_str instead of as_buf in a couple places
These uses are assuming the strings are null terminated, so it
should be using `as_c_str` instead of `as_buf`
2013-07-23 16:56:22 -07:00
Erick Tryzelaar 9fdec67a67 std: move str::as_buf into StrSlice 2013-07-23 16:56:22 -07:00
Patrick Walton 06594ed96b librustc: Remove pub extern and priv extern from the language.
Place `pub` or `priv` on individual items instead.
2013-07-20 17:39:38 -07:00
Brian Anderson 1098d6980b Merge remote-tracking branch 'mozilla/master'
Conflicts:
	src/libextra/test.rs
	src/libstd/at_vec.rs
	src/libstd/cleanup.rs
	src/libstd/rt/comm.rs
	src/libstd/rt/global_heap.rs
	src/libstd/task/spawn.rs
	src/libstd/unstable/lang.rs
	src/libstd/vec.rs
	src/rt/rustrt.def.in
	src/test/run-pass/extern-pub.rs
2013-07-03 14:49:13 -07:00
Brian Anderson f8a4d09f7e std: Use the same task failure message as C++ rt 2013-07-02 16:04:45 -07:00
Brian Anderson 5e7c5d6c3d std: Make box annihilator work with newsched 2013-06-24 17:07:03 -07:00
Philipp Brüschweiler 976c0b3dfb Remove rust_call_tydesc_glue
Towards #4812. Also includes some minor cleanups.
2013-06-23 12:49:16 +02:00
Philipp Brüschweiler 469f394b25 Remove intrinsic module
To achieve this, the following changes were made:
* Move TyDesc, TyVisitor and Opaque to std::unstable::intrinsics
* Convert TyDesc, TyVisitor and Opaque to lang items instead of specially
  handling the intrinsics module
* Removed TypeDesc, FreeGlue and get_type_desc() from sys

Fixes #3475.
2013-06-23 12:49:16 +02:00
Brian Anderson 357f087786 Merge remote-tracking branch 'brson/io' into io-upstream
Conflicts:
	src/rt/rust_builtin.cpp
	src/rt/rustrt.def.in
2013-06-20 12:17:00 -07:00
Brian Anderson 391bb0b4e7 std: Make newsched failures log correctly 2013-06-19 18:37:50 -07:00
Graydon Hoare d904c72af8 replace #[inline(always)] with #[inline]. r=burningtree. 2013-06-18 14:48:48 -07:00
Brian Anderson 319cf6e465 Merge remote-tracking branch 'brson/io'
Conflicts:
	src/libstd/rt/comm.rs
	src/libstd/rt/mod.rs
	src/libstd/rt/sched.rs
	src/libstd/rt/task.rs
	src/libstd/rt/test.rs
	src/libstd/rt/tube.rs
	src/libstd/rt/uv/uvio.rs
	src/libstd/rt/uvio.rs
	src/libstd/task/spawn.rs
2013-06-16 15:09:25 -07:00
Brian Anderson 90fbe38f00 std::rt: Tasks must have an unwinder. Simpler 2013-06-13 23:18:49 -07:00
Huon Wilson 98ba91f81b remove unused import warnings 2013-06-09 02:22:23 +10:00
Daniel Micay 5148e2f78b sys: get rid of shape functions
borrowed pointers already implement Eq and Ord with deep comparisons
2013-06-04 19:00:19 -04:00
Alex Crichton 007651cd26 Require documentation by default for libstd
Adds documentation for various things that I understand.
Adds #[allow(missing_doc)] for lots of things that I don't understand.
2013-05-30 01:02:55 -05:00
Patrick Walton 0c820d4123 libstd: Rename libcore to libstd and libstd to libextra; update makefiles.
This only changes the directory names; it does not change the "real"
metadata names.
2013-05-22 21:57:05 -07:00
Graydon Hoare dde5860380 Remove some duplicated unused parts of std now that they're present in core. 2011-12-14 18:04:45 -08:00
Graydon Hoare 447414f007 Establish 'core' library separate from 'std'. 2011-12-06 12:13:04 -08:00