4908017d59
This commit starts out by consolidating all `str` extension traits into one `StrExt` trait to be included in the prelude. This means that `UnicodeStrPrelude`, `StrPrelude`, and `StrAllocating` have all been merged into one `StrExt` exported by the standard library. Some functionality is currently duplicated with the `StrExt` present in libcore. This commit also currently avoids any methods which require any form of pattern to operate. These functions will be stabilized via a separate RFC. Next, stability of methods and structures are as follows: Stable * from_utf8_unchecked * CowString - after moving to std::string * StrExt::as_bytes * StrExt::as_ptr * StrExt::bytes/Bytes - also made a struct instead of a typedef * StrExt::char_indices/CharIndices - CharOffsets was renamed * StrExt::chars/Chars * StrExt::is_empty * StrExt::len * StrExt::lines/Lines * StrExt::lines_any/LinesAny * StrExt::slice_unchecked * StrExt::trim * StrExt::trim_left * StrExt::trim_right * StrExt::words/Words - also made a struct instead of a typedef Unstable * from_utf8 - the error type was changed to a `Result`, but the error type has yet to prove itself * from_c_str - this function will be handled by the c_str RFC * FromStr - this trait will have an associated error type eventually * StrExt::escape_default - needs iterators at least, unsure if it should make the cut * StrExt::escape_unicode - needs iterators at least, unsure if it should make the cut * StrExt::slice_chars - this function has yet to prove itself * StrExt::slice_shift_char - awaiting conventions about slicing and shifting * StrExt::graphemes/Graphemes - this functionality may only be in libunicode * StrExt::grapheme_indices/GraphemeIndices - this functionality may only be in libunicode * StrExt::width - this functionality may only be in libunicode * StrExt::utf16_units - this functionality may only be in libunicode * StrExt::nfd_chars - this functionality may only be in libunicode * StrExt::nfkd_chars - this functionality may only be in libunicode * StrExt::nfc_chars - this functionality may only be in libunicode * StrExt::nfkc_chars - this functionality may only be in libunicode * StrExt::is_char_boundary - naming is uncertain with container conventions * StrExt::char_range_at - naming is uncertain with container conventions * StrExt::char_range_at_reverse - naming is uncertain with container conventions * StrExt::char_at - naming is uncertain with container conventions * StrExt::char_at_reverse - naming is uncertain with container conventions * StrVector::concat - this functionality may be replaced with iterators, but it's not certain at this time * StrVector::connect - as with concat, may be deprecated in favor of iterators Deprecated * StrAllocating and UnicodeStrPrelude have been merged into StrExit * eq_slice - compiler implementation detail * from_str - use the inherent parse() method * is_utf8 - call from_utf8 instead * replace - call the method instead * truncate_utf16_at_nul - this is an implementation detail of windows and does not need to be exposed. * utf8_char_width - moved to libunicode * utf16_items - moved to libunicode * is_utf16 - moved to libunicode * Utf16Items - moved to libunicode * Utf16Item - moved to libunicode * Utf16Encoder - moved to libunicode * AnyLines - renamed to LinesAny and made a struct * SendStr - use CowString<'static> instead * str::raw - all functionality is deprecated * StrExt::into_string - call to_string() instead * StrExt::repeat - use iterators instead * StrExt::char_len - use .chars().count() instead * StrExt::is_alphanumeric - use .chars().all(..) * StrExt::is_whitespace - use .chars().all(..) Pending deprecation -- while slicing syntax is being worked out, these methods are all #[unstable] * Str - while currently used for generic programming, this trait will be replaced with one of [], deref coercions, or a generic conversion trait. * StrExt::slice - use slicing syntax instead * StrExt::slice_to - use slicing syntax instead * StrExt::slice_from - use slicing syntax instead * StrExt::lev_distance - deprecated with no replacement Awaiting stabilization due to patterns and/or matching * StrExt::contains * StrExt::contains_char * StrExt::split * StrExt::splitn * StrExt::split_terminator * StrExt::rsplitn * StrExt::match_indices * StrExt::split_str * StrExt::starts_with * StrExt::ends_with * StrExt::trim_chars * StrExt::trim_left_chars * StrExt::trim_right_chars * StrExt::find * StrExt::rfind * StrExt::find_str * StrExt::subslice_offset
135 lines
3.1 KiB
Rust
135 lines
3.1 KiB
Rust
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
|
// file at the top-level directory of this distribution and at
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
// option. This file may not be copied, modified, or distributed
|
|
// except according to those terms.
|
|
|
|
//! The Rust compiler.
|
|
//!
|
|
//! # Note
|
|
//!
|
|
//! This API is completely unstable and subject to change.
|
|
|
|
#![crate_name = "rustc"]
|
|
#![experimental]
|
|
#![crate_type = "dylib"]
|
|
#![crate_type = "rlib"]
|
|
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
|
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
|
|
html_root_url = "http://doc.rust-lang.org/nightly/")]
|
|
|
|
#![feature(default_type_params, globs, macro_rules, phase, quote)]
|
|
#![feature(slicing_syntax, unsafe_destructor)]
|
|
#![feature(rustc_diagnostic_macros)]
|
|
#![feature(unboxed_closures)]
|
|
|
|
extern crate arena;
|
|
extern crate flate;
|
|
extern crate getopts;
|
|
extern crate graphviz;
|
|
extern crate libc;
|
|
extern crate rustc_llvm;
|
|
extern crate rustc_back;
|
|
extern crate serialize;
|
|
extern crate rbml;
|
|
extern crate collections;
|
|
#[phase(plugin, link)] extern crate log;
|
|
#[phase(plugin, link)] extern crate syntax;
|
|
|
|
#[cfg(test)]
|
|
extern crate test;
|
|
|
|
pub use rustc_llvm as llvm;
|
|
|
|
mod diagnostics;
|
|
|
|
pub mod back {
|
|
pub use rustc_back::abi;
|
|
pub use rustc_back::archive;
|
|
pub use rustc_back::arm;
|
|
pub use rustc_back::mips;
|
|
pub use rustc_back::mipsel;
|
|
pub use rustc_back::rpath;
|
|
pub use rustc_back::svh;
|
|
pub use rustc_back::target_strs;
|
|
pub use rustc_back::x86;
|
|
pub use rustc_back::x86_64;
|
|
}
|
|
|
|
pub mod middle {
|
|
pub mod astconv_util;
|
|
pub mod astencode;
|
|
pub mod cfg;
|
|
pub mod check_const;
|
|
pub mod check_static_recursion;
|
|
pub mod check_loop;
|
|
pub mod check_match;
|
|
pub mod check_rvalues;
|
|
pub mod check_static;
|
|
pub mod const_eval;
|
|
pub mod dataflow;
|
|
pub mod dead;
|
|
pub mod def;
|
|
pub mod dependency_format;
|
|
pub mod effect;
|
|
pub mod entry;
|
|
pub mod expr_use_visitor;
|
|
pub mod fast_reject;
|
|
pub mod graph;
|
|
pub mod intrinsicck;
|
|
pub mod infer;
|
|
pub mod lang_items;
|
|
pub mod liveness;
|
|
pub mod mem_categorization;
|
|
pub mod pat_util;
|
|
pub mod privacy;
|
|
pub mod reachable;
|
|
pub mod region;
|
|
pub mod recursion_limit;
|
|
pub mod resolve_lifetime;
|
|
pub mod stability;
|
|
pub mod subst;
|
|
pub mod traits;
|
|
pub mod ty;
|
|
pub mod ty_fold;
|
|
pub mod weak_lang_items;
|
|
}
|
|
|
|
pub mod metadata;
|
|
|
|
pub mod session;
|
|
|
|
pub mod plugin;
|
|
|
|
pub mod lint;
|
|
|
|
pub mod util {
|
|
pub use rustc_back::fs;
|
|
pub use rustc_back::sha2;
|
|
|
|
pub mod common;
|
|
pub mod ppaux;
|
|
pub mod nodemap;
|
|
pub mod snapshot_vec;
|
|
pub mod lev_distance;
|
|
}
|
|
|
|
pub mod lib {
|
|
pub use llvm;
|
|
}
|
|
|
|
__build_diagnostic_array! { DIAGNOSTICS }
|
|
|
|
// A private module so that macro-expanded idents like
|
|
// `::rustc::lint::Lint` will also work in `rustc` itself.
|
|
//
|
|
// `libstd` uses the same trick.
|
|
#[doc(hidden)]
|
|
mod rustc {
|
|
pub use lint;
|
|
}
|