about summary refs log tree commit diff
path: root/src/libsyntax/util/interner.rs
AgeCommit message (Collapse)AuthorLines
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-1/+1
[breaking-change]
2014-05-11core: Remove the cast moduleAlex Crichton-2/+2
This commit revisits the `cast` module in libcore and libstd, and scrutinizes all functions inside of it. The result was to remove the `cast` module entirely, folding all functionality into the `mem` module. Specifically, this is the fate of each function in the `cast` module. * transmute - This function was moved to `mem`, but it is now marked as #[unstable]. This is due to planned changes to the `transmute` function and how it can be invoked (see the #[unstable] comment). For more information, see RFC 5 and #12898 * transmute_copy - This function was moved to `mem`, with clarification that is is not an error to invoke it with T/U that are different sizes, but rather that it is strongly discouraged. This function is now #[stable] * forget - This function was moved to `mem` and marked #[stable] * bump_box_refcount - This function was removed due to the deprecation of managed boxes as well as its questionable utility. * transmute_mut - This function was previously deprecated, and removed as part of this commit. * transmute_mut_unsafe - This function doesn't serve much of a purpose when it can be achieved with an `as` in safe code, so it was removed. * transmute_lifetime - This function was removed because it is likely a strong indication that code is incorrect in the first place. * transmute_mut_lifetime - This function was removed for the same reasons as `transmute_lifetime` * copy_lifetime - This function was moved to `mem`, but it is marked `#[unstable]` now due to the likelihood of being removed in the future if it is found to not be very useful. * copy_mut_lifetime - This function was also moved to `mem`, but had the same treatment as `copy_lifetime`. * copy_lifetime_vec - This function was removed because it is not used today, and its existence is not necessary with DST (copy_lifetime will suffice). In summary, the cast module was stripped down to these functions, and then the functions were moved to the `mem` module. transmute - #[unstable] transmute_copy - #[stable] forget - #[stable] copy_lifetime - #[unstable] copy_mut_lifetime - #[unstable] [breaking-change]
2014-05-08libsyntax: Remove uses of `~str` from libsyntax, and fix falloutPatrick Walton-3/+3
2014-05-07core: Inherit possible string functionalityAlex Crichton-5/+0
This moves as much allocation as possible from teh std::str module into core::str. This includes essentially all non-allocating functionality, mostly iterators and slicing and such. This primarily splits the Str trait into only having the as_slice() method, adding a new StrAllocating trait to std::str which contains the relevant new allocation methods. This is a breaking change if any of the methods of "trait Str" were overriden. The old functionality can be restored by implementing both the Str and StrAllocating traits. [breaking-change]
2014-03-31syntax: Switch field privacy as necessaryAlex Crichton-5/+5
2014-03-23std: remove the `equals` method from `TotalEq`.Huon Wilson-5/+1
`TotalEq` is now just an assertion about the `Eq` impl of a type (i.e. `==` is a total equality if a type implements `TotalEq`) so the extra method is just confusing. Also, a new method magically appeared as a hack to allow deriving to assert that the contents of a struct/enum are also TotalEq, because the deriving infrastructure makes it very hard to do anything but create a trait method. (You didn't hear about this horrible work-around from me :(.)
2014-03-23use TotalEq for HashMapDaniel Micay-1/+1
Closes #5283
2014-03-22syntax: Fix fallout of removing get()Alex Crichton-30/+25
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-1/+0
It's now in the prelude.
2014-03-20auto merge of #12686 : FlaPer87/rust/shared, r=nikomatsakisbors-1/+1
`Share` implies that all *reachable* content is *threadsafe*. Threadsafe is defined as "exposing no operation that permits a data race if multiple threads have access to a &T pointer simultaneously". (NB: the type system should guarantee that if you have access to memory via a &T pointer, the only other way to gain access to that memory is through another &T pointer)... Fixes #11781 cc #12577 What this PR will do ================ - [x] Add Share kind and - [x] Replace usages of Freeze with Share in bounds. - [x] Add Unsafe<T> #12577 - [x] Forbid taking the address of a immutable static item with `Unsafe<T>` interior What's left to do in a separate PR (after the snapshot)? =========================================== - Remove `Freeze` completely
2014-03-20Relax interner's Share boundFlavio Percoco-4/+1
The interner uses `RefCell` internally which opted out from Share.
2014-03-20Replace Freeze bounds with Share boundsFlavio Percoco-1/+4
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-1/+1
Closes #12771
2014-03-19Discard MTWT & interner tables from TLD after they stop being useful.Eduard Burtescu-0/+10
2014-03-13Remove Rc's borrow method to avoid conflicts with RefCell's borrow in ↵Eduard Burtescu-2/+2
Rc<RefCell<T>>.
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-4/+5
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-4/+4
2014-02-28std: Change assert_eq!() to use {} instead of {:?}Alex Crichton-0/+8
Formatting via reflection has been a little questionable for some time now, and it's a little unfortunate that one of the standard macros will silently use reflection when you weren't expecting it. This adds small bits of code bloat to libraries, as well as not always being necessary. In light of this information, this commit switches assert_eq!() to using {} in the error message instead of {:?}. In updating existing code, there were a few error cases that I encountered: * It's impossible to define Show for [T, ..N]. I think DST will alleviate this because we can define Show for [T]. * A few types here and there just needed a #[deriving(Show)] * Type parameters needed a Show bound, I often moved this to `assert!(a == b)` * `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths. I don't think this is much of a regression though because {:?} on paths looks awful (it's a byte array). Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime significant for smaller binaries.
2014-02-24std: minor whitespace cleanupErick Tryzelaar-4/+2
2014-02-24Transition to new `Hash`, removing IterBytes and std::to_bytes.Huon Wilson-5/+5
2014-02-23Move std::{trie, hashmap} to libcollectionsAlex Crichton-1/+1
These two containers are indeed collections, so their place is in libcollections, not in libstd. There will always be a hash map as part of the standard distribution of Rust, but by moving it out of the standard library it makes libstd that much more portable to more platforms and environments. This conveniently also removes the stuttering of 'std::hashmap::HashMap', although 'collections::HashMap' is only one character shorter.
2014-02-21std: rewrite Hash to make it more genericErick Tryzelaar-0/+1
This patch merges IterBytes and Hash traits, which clears up the confusion of using `#[deriving(IterBytes)]` to support hashing. Instead, it now is much easier to use the new `#[deriving(Hash)]` for making a type hashable with a stream hash. Furthermore, it supports custom non-stream-based hashers, such as if a value's hash was cached in a database. This does not yet replace the old IterBytes-hash with this new version.
2014-02-14Refactored ast_map and friends, mainly to have Paths without storing them.Eduard Burtescu-9/+9
2014-02-02librustc: Remove `@str` from the languagePatrick Walton-1/+1
2014-02-02libsyntax: Remove `@str` from the internerPatrick Walton-37/+80
2014-02-02libsyntax: Introduce an `InternedString` type to reduce `@str` in thePatrick Walton-0/+11
compiler and use it for attributes
2014-01-07'borrowed pointer' -> 'reference'Brian Anderson-1/+1
2014-01-03libsyntax: De-`@mut` `Interner::vect`Patrick Walton-19/+31
2014-01-03libsyntax: De-`@mut` the interner mapPatrick Walton-10/+15
2013-11-27Shink NodeId, CrateNum, Name and Mrk down to 32 bits on x64.Eduard Burtescu-18/+20
2013-10-04Remove specific errors for very old obsolete syntaxBenjamin Herr-3/+0
Replaces existing tests for removed obsolete-syntax errors with tests for the resulting regular errors, adds a test for each of the removed parser errors to make sure that obsolete forms don't start working again, removes some obsolete/superfluous tests that were now failing. Deletes some amount of dead code in the parser, also includes some small changes to parser error messages to accomodate new tests.
2013-09-06added gensym_copy mechanism to ensure sharing of pointers in the internerJohn Clements-8/+55
this makes comparisons constant-time, and enables spelling-comparison of identifiers, crucial in many parts of resolve.
2013-08-03remove obsolete `foreach` keywordDaniel Micay-2/+2
this has been replaced by `for`
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-2/+2
2013-07-18librustc: Forbid `&` pointers (other than `&'static`) inside `@` boxes.Patrick Walton-1/+1
This makes custom borrowing implementations for custom smart pointers sound.
2013-07-17librustc: Remove all uses of "copy".Patrick Walton-4/+8
2013-06-28librustc: Rename Const to FreezePatrick Walton-1/+1
2013-06-25great renaming propagation: syntaxCorey Richardson-7/+2
2013-06-23vec: remove BaseIter implementationDaniel Micay-2/+2
I removed the `static-method-test.rs` test because it was heavily based on `BaseIter` and there are plenty of other more complex uses of static methods anyway.
2013-06-16Add copies to type params with Copy boundNiko Matsakis-3/+3
2013-06-13Use @str instead of @~str in libsyntax and librustc. Fixes #5048.Huon Wilson-30/+30
This almost removes the StringRef wrapper, since all strings are Equiv-alent now. Removes a lot of `/* bad */ copy *`'s, and converts several things to be &'static str (the lint table and the intrinsics table). There are many instances of .to_managed(), unfortunately.
2013-06-05removed obsolete reference to purityJohn Clements-3/+0
2013-06-01Remove all uses of `pub impl`. rs=stylePatrick Walton-17/+17
2013-05-22libextra: Rename the actual metadata names of libcore to libstd and libstd ↵Patrick Walton-0/+5
to libextra
2013-05-20getting rid of interner_key! macroJohn Clements-14/+2
2013-05-09Use a specialized string interner to reduce the need for owned stringsBjörn Steinbrink-0/+56
&str can be turned into @~str on demand, using to_owned(), so for strings, we can create a specialized interner that accepts &str for intern() and find() but stores and returns @~str.
2013-05-08librustc: Stop parsing modes and remove them entirely from the languagePatrick Walton-1/+1
2013-04-30new borrow checker (mass squash)Niko Matsakis-2/+2
2013-04-27only use #[no_core] in libcoreDaniel Micay-1/+0
2013-04-19librustc: Optimize metadata::decoder::item_name.Patrick Walton-0/+9