about summary refs log tree commit diff
path: root/src/libcore/char.rs
AgeCommit message (Collapse)AuthorLines
2015-01-05Stabilization of impls and fallout from stabilizationAaron Turon-0/+2
2015-01-05char: small tweak since `is_some` > equivalent `match`.Huon Wilson-4/+1
2015-01-05Rename `core::char::Char` to `CharExt` to match prelude guidelines.Huon Wilson-1/+1
Imports may need to be updated so this is a [breaking-change]
2015-01-05Mark the contents of `char` stable.Huon Wilson-21/+25
2015-01-05Switch encode_utf* to by-value self.Huon Wilson-6/+6
2015-01-03Remove deprecated functionalityAlex Crichton-121/+0
This removes a large array of deprecated functionality, regardless of how recently it was deprecated. The purpose of this commit is to clean out the standard libraries and compiler for the upcoming alpha release. Some notable compiler changes were to enable warnings for all now-deprecated command line arguments (previously the deprecated versions were silently accepted) as well as removing deriving(Zero) entirely (the trait was removed). The distribution no longer contains the libtime or libregex_macros crates. Both of these have been deprecated for some time and are available externally.
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-4/+4
2015-01-03core: use assoc types in Iterator et alJorge Aparicio-2/+6
2014-12-30Implement `Clone` for a large number of iterators & other adaptors.Huon Wilson-1/+4
It's useful to be able to save state.
2014-12-17rollup merge of #19885: alexcrichton/char-escapeAlex Crichton-75/+68
This changes the `escape_unicode` method on a `char` to use the new style of unicode escapes in the language. Closes #19811 Closes #19879
2014-12-17rollup merge of #19830: mchaput/patch-1Alex Crichton-1/+1
Error message has wrong spelling ("radix is to high").
2014-12-16std: Change escape_unicode to use new escapesAlex Crichton-75/+68
This changes the `escape_unicode` method on a `char` to use the new style of unicode escapes in the language. Closes #19811 Closes #19879
2014-12-14std: Collapse SlicePrelude traitsAlex Crichton-1/+1
This commit collapses the various prelude traits for slices into just one trait: * SlicePrelude/SliceAllocPrelude => SliceExt * CloneSlicePrelude/CloneSliceAllocPrelude => CloneSliceExt * OrdSlicePrelude/OrdSliceAllocPrelude => OrdSliceExt * PartialEqSlicePrelude => PartialEqSliceExt
2014-12-14Fix mispelling in char.rs error messagemchaput-1/+1
Error message has wrong spelling ("radix is to high").
2014-12-13libcore: use unboxed closures in the `char` moduleJorge Aparicio-2/+3
2014-12-11Register new snapshotsAlex Crichton-6/+6
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-0/+1
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-05Utilize fewer reexportsCorey Farwell-1/+2
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-11-26Update docstrings for UnicodeChar::is_digit => is_numeric renameSimon Sapin-3/+3
2014-11-21core: Convert a 'failure' to 'panic' in docsBrian Anderson-2/+2
2014-11-21core: Update docs for escape_unicode, escape_defaultBrian Anderson-3/+4
2014-11-21core: Convert Char::escape_default, escape_unicode to iteratorsBrian Anderson-34/+95
[breaking-change]
2014-11-21core: Convert Char methods to by-val selfBrian Anderson-27/+27
Methods on primitmive Copy types generally should take `self`. [breaking-change]
2014-11-21Fix various deprecation warnings from char changesBrian Anderson-56/+66
2014-11-21core: Mark remaining Char methods unstableBrian Anderson-0/+16
The `Char` trait itself may go away in favor of primitive inherent methods. Still some questions about whether the preconditions are following the final error handling conventions.
2014-11-21core: Deprecated remaining free functions in `char`Brian Anderson-0/+5
Prefer the methods.
2014-11-21core: Add stability attributes to char::from_digit and from_u32Brian Anderson-0/+6
For now we are preferring free functions for primitive ctors, so they are marked 'unstable' pending final decision. The methods on `Char` are 'deprecated'.
2014-11-21core: Add Char::len_utf16Brian Anderson-0/+10
Missing method to pair with len_utf8.
2014-11-21core: Rename Char::len_utf8_bytes to Char::len_utf8Brian Anderson-0/+9
"bytes" is redundant. Deprecate the old.
2014-11-21core: Rename Char::is_digit_radix to is_digitBrian Anderson-0/+19
This fits the naming of `to_digit` and `from_digit`. Leave the old name deprecated.
2014-11-21char: Mark the MAX constant stableBrian Anderson-0/+1
2014-11-21core: Mark Char trait experimentalBrian Anderson-0/+2
2014-11-21core: Add from_u32 to the Char traitBrian Anderson-0/+6
This is the only free function not part of the trait.
2014-11-12Fix remaining documentation to reflect fail!() -> panic!()Barosl Lee-12/+12
Throughout the docs, "failure" was replaced with "panics" if it means a task panic. Otherwise, it remained as is, or changed to "errors" to clearly differentiate it from a task panic.
2014-11-06Prelude: rename and consolidate extension traitsAaron Turon-1/+1
This commit renames a number of extension traits for slices and string slices, now that they have been refactored for DST. In many cases, multiple extension traits could now be consolidated. Further consolidation will be possible with generalized where clauses. The renamings are consistent with the [new `-Prelude` suffix](https://github.com/rust-lang/rfcs/pull/344). There are probably a few more candidates for being renamed this way, but that is left for API stabilization of the relevant modules. Because this renames traits, it is a: [breaking-change] However, I do not expect any code that currently uses the standard library to actually break. Closes #17917
2014-11-04libsyntax: Forbid escapes in the inclusive range `\x80`-`\xff` inPatrick Walton-1/+1
Unicode characters and strings. Use `\u0080`-`\u00ff` instead. ASCII/byte literals are unaffected. This PR introduces a new function, `escape_default`, into the ASCII module. This was necessary for the pretty printer to continue to function. RFC #326. Closes #18062. [breaking-change]
2014-11-01collections: Remove all collections traitsAlex Crichton-1/+1
As part of the collections reform RFC, this commit removes all collections traits in favor of inherent methods on collections themselves. All methods should continue to be available on all collections. This is a breaking change with all of the collections traits being removed and no longer being in the prelude. In order to update old code you should move the trait implementations to inherent implementations directly on the type itself. Note that some traits had default methods which will also need to be implemented to maintain backwards compatibility. [breaking-change] cc #18424
2014-10-29Rename fail! to panic!Steve Klabnik-2/+2
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-13Fix typo in char's from_digit error messageStefan Bucur-1/+1
2014-10-09core: Convert statics to constantsAlex Crichton-1/+1
2014-09-30librustc: Forbid `..` in range patterns.Patrick Walton-5/+5
This breaks code that looks like: match foo { 1..3 => { ... } } Instead, write: match foo { 1...3 => { ... } } Closes #17295. [breaking-change]
2014-09-03Fix spelling errors and capitalization.Joseph Crail-2/+2
2014-08-30Unify non-snake-case lints and non-uppercase statics lintsP1start-1/+1
This unifies the `non_snake_case_functions` and `uppercase_variables` lints into one lint, `non_snake_case`. It also now checks for non-snake-case modules. This also extends the non-camel-case types lint to check type parameters, and merges the `non_uppercase_pattern_statics` lint into the `non_uppercase_statics` lint. Because the `uppercase_variables` lint is now part of the `non_snake_case` lint, all non-snake-case variables that start with lowercase characters (such as `fooBar`) will now trigger the `non_snake_case` lint. New code should be updated to use the new `non_snake_case` lint instead of the previous `non_snake_case_functions` and `uppercase_variables` lints. All use of the `non_uppercase_pattern_statics` should be replaced with the `non_uppercase_statics` lint. Any code that previously contained non-snake-case module or variable names should be updated to use snake case names or disable the `non_snake_case` lint. Any code with non-camel-case type parameters should be changed to use camel case or disable the `non_camel_case_types` lint. [breaking-change]
2014-08-16Optimized IR generation for UTF-8 and UTF-16 encodingMarvin Löbel-31/+36
- Both can now be inlined and constant folded away - Both can no longer cause failure - Both now return an `Option` instead Removed debug `assert!()`s over the valid ranges of a `char` - It affected optimizations due to unwinding - Char handling is now sound enought that they became uneccessary
2014-08-08Register new snapshot 12e0f72Niko Matsakis-3/+0
2014-08-06Char::from_digit signature fixfort-1/+1
2014-07-24librustc: Stop desugaring `for` expressions and translate them directly.Patrick Walton-1/+4
This makes edge cases in which the `Iterator` trait was not in scope and/or `Option` or its variants were not in scope work properly. This breaks code that looks like: struct MyStruct { ... } impl MyStruct { fn next(&mut self) -> Option<int> { ... } } for x in MyStruct { ... } { ... } Change ad-hoc `next` methods like the above to implementations of the `Iterator` trait. For example: impl Iterator<int> for MyStruct { fn next(&mut self) -> Option<int> { ... } } Closes #15392. [breaking-change]
2014-07-07Add libunicode; move unicode functions from corekwantam-238/+3
- created new crate, libunicode, below libstd - split Char trait into Char (libcore) and UnicodeChar (libunicode) - Unicode-aware functions now live in libunicode - is_alphabetic, is_XID_start, is_XID_continue, is_lowercase, is_uppercase, is_whitespace, is_alphanumeric, is_control, is_digit, to_uppercase, to_lowercase - added width method in UnicodeChar trait - determines printed width of character in columns, or None if it is a non-NULL control character - takes a boolean argument indicating whether the present context is CJK or not (characters with 'A'mbiguous widths are double-wide in CJK contexts, single-wide otherwise) - split StrSlice into StrSlice (libcore) and UnicodeStrSlice (libunicode) - functionality formerly in StrSlice that relied upon Unicode functionality from Char is now in UnicodeStrSlice - words, is_whitespace, is_alphanumeric, trim, trim_left, trim_right - also moved Words type alias into libunicode because words method is in UnicodeStrSlice - unified Unicode tables from libcollections, libcore, and libregex into libunicode - updated unicode.py in src/etc to generate aforementioned tables - generated new tables based on latest Unicode data - added UnicodeChar and UnicodeStrSlice traits to prelude - libunicode is now the collection point for the std::char module, combining the libunicode functionality with the Char functionality from libcore - thus, moved doc comment for char from core::char to unicode::char - libcollections remains the collection point for std::str The Unicode-aware functions that previously lived in the Char and StrSlice traits are no longer available to programs that only use libcore. To regain use of these methods, include the libunicode crate and use the UnicodeChar and/or UnicodeStrSlice traits: extern crate unicode; use unicode::UnicodeChar; use unicode::UnicodeStrSlice; use unicode::Words; // if you want to use the words() method NOTE: this does *not* impact programs that use libstd, since UnicodeChar and UnicodeStrSlice have been added to the prelude. closes #15224 [breaking-change]
2014-06-29Extract tests from libcore to a separate crateSteven Fackler-202/+0
Libcore's test infrastructure is complicated by the fact that many lang items are defined in the crate. The current approach (realcore/realstd imports) is hacky and hard to work with (tests inside of core::cmp haven't been run for months!). Moving tests to a separate crate does mean that they can only test the public API of libcore, but I don't feel that that is too much of an issue. The only tests that I had to get rid of were some checking the various numeric formatters, but those are also exercised through normal format! calls in other tests.
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-0/+1
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]