about summary refs log tree commit diff
path: root/src/librustc/metadata
AgeCommit message (Collapse)AuthorLines
2013-08-06Move EnumSet into libextraSangeun Kim-3/+2
2013-08-04Merge remote-tracking branch 'remotes/origin/master' into str-remove-nullErick Tryzelaar-63/+63
2013-08-04std: replace str::as_c_str with std::c_strErick Tryzelaar-1/+2
2013-08-03remove obsolete `foreach` keywordDaniel Micay-63/+63
this has been replaced by `for`
2013-08-03replace all remaining `for` with `foreach` or `do`Daniel Micay-113/+132
2013-08-02librustc: Disallow "unsafe" for external functionsPatrick Walton-2/+2
2013-08-02librustc: Introduce a new visitor type based on traits and port syntax to it.Patrick Walton-10/+10
This is preparation for removing `@fn`. This does *not* use default methods yet, because I don't know whether they work. If they do, a forthcoming PR will use them. This also changes the precedence of `as`.
2013-08-02replace `range` with an external iteratorDaniel Micay-1/+1
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-59/+59
2013-07-30auto merge of #8121 : thestinger/rust/offset, r=alexcrichtonbors-1/+1
Closes #8118, #7136 ~~~rust extern mod extra; use std::vec; use std::ptr; fn bench_from_elem(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = vec::from_elem(1024, 0u8); } } fn bench_set_memory(b: &mut extra::test::BenchHarness) { do b.iter { let mut v: ~[u8] = vec::with_capacity(1024); unsafe { let vp = vec::raw::to_mut_ptr(v); ptr::set_memory(vp, 0, 1024); vec::raw::set_len(&mut v, 1024); } } } fn bench_vec_repeat(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = ~[0u8, ..1024]; } } ~~~ Before: test bench_from_elem ... bench: 415 ns/iter (+/- 17) test bench_set_memory ... bench: 85 ns/iter (+/- 4) test bench_vec_repeat ... bench: 83 ns/iter (+/- 3) After: test bench_from_elem ... bench: 84 ns/iter (+/- 2) test bench_set_memory ... bench: 84 ns/iter (+/- 5) test bench_vec_repeat ... bench: 84 ns/iter (+/- 3)
2013-07-30implement pointer arithmetic with GEPDaniel Micay-1/+1
Closes #8118, #7136 ~~~rust extern mod extra; use std::vec; use std::ptr; fn bench_from_elem(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = vec::from_elem(1024, 0u8); } } fn bench_set_memory(b: &mut extra::test::BenchHarness) { do b.iter { let mut v: ~[u8] = vec::with_capacity(1024); unsafe { let vp = vec::raw::to_mut_ptr(v); ptr::set_memory(vp, 0, 1024); vec::raw::set_len(&mut v, 1024); } } } fn bench_vec_repeat(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = ~[0u8, ..1024]; } } ~~~ Before: test bench_from_elem ... bench: 415 ns/iter (+/- 17) test bench_set_memory ... bench: 85 ns/iter (+/- 4) test bench_vec_repeat ... bench: 83 ns/iter (+/- 3) After: test bench_from_elem ... bench: 84 ns/iter (+/- 2) test bench_set_memory ... bench: 84 ns/iter (+/- 5) test bench_vec_repeat ... bench: 84 ns/iter (+/- 3)
2013-07-29New naming convention for ast::{node_id, local_crate, crate_node_id, ↵Michael Woerister-51/+51
blk_check_mode, ty_field, ty_method}
2013-07-27cleanup .chain and .chain_err + fixing other filesmaikklein-3/+3
2013-07-26Eliminate unused variable warnings.Michael Sullivan-2/+2
2013-07-25Allow linking against crates with #[no_std]Alex Crichton-0/+3
Previously having optional lang_items caused an assertion failure at compile-time, and then once that was fixed there was a segfault at runtime of using a NULL crate-map (crates with no_std)
2013-07-25auto merge of #8027 : ↵bors-3/+34
nikomatsakis/rust/issue-4846-multiple-lifetime-parameters-1, r=pcwalton Small step towards #4846. r? @msullivan
2013-07-25auto merge of #8015 : msullivan/rust/default-methods, r=nikomatsakisbors-0/+41
Lots of changes to vtable resolution, handling of super/self method calls in default methods. Fix a lot of trait inheritance bugs. r? @nikomatsakis
2013-07-24Allow uint discriminants and store them as suchKevin Murphy-6/+5
Infers type of constants used as discriminants and ensures they are integral, instead of forcing them to be a signed integer. Also, stores discriminant values as uint instead of int interally and deals with related fallout. Fixes issue #7994
2013-07-24Generalize the `ty::substs` struct so that it can representNiko Matsakis-3/+34
multiple lifetime parameters, and not just one. Also add an option for erasing lifetimes, which makes trans code somewhat simpler and cleaner.
2013-07-24auto merge of #7996 : erickt/rust/cleanup-strs, r=ericktbors-6/+5
This is a cleanup pull request that does: * removes `os::as_c_charp` * moves `str::as_buf` and `str::as_c_str` into `StrSlice` * converts some functions from `StrSlice::as_buf` to `StrSlice::as_c_str` * renames `StrSlice::as_buf` to `StrSlice::as_imm_buf` (and adds `StrSlice::as_mut_buf` to match `vec.rs`. * renames `UniqueStr::as_bytes_with_null_consume` to `UniqueStr::to_bytes` * and other misc cleanups and minor optimizations
2013-07-24Change 'print(fmt!(...))' to printf!/printfln! in src/lib*Birunthan Mohanathas-10/+10
2013-07-23Properly track and export information about vtables for impls in metadata.Michael Sullivan-0/+41
Partially rework how vtables are handled in default method calls. Closes #7460.
2013-07-23std: remove str::to_owned and str::raw::slice_bytes_ownedErick Tryzelaar-4/+3
2013-07-23std: move StrUtil::as_c_str into StrSliceErick Tryzelaar-2/+2
2013-07-22auto merge of #7942 : Dretch/rust/os-listdir-path-no-squiggle, r=brsonbors-1/+1
2013-07-22Ast spanned<T> refactoring, renaming: crate, local, blk, crate_num, crate_cfg.Michael Woerister-32/+32
`crate => Crate` `local => Local` `blk => Block` `crate_num => CrateNum` `crate_cfg => CrateConfig` Also, Crate and Local are not wrapped in spanned<T> anymore.
2013-07-21Remove what appears to be redundant indirection fromGareth Smith-1/+1
os::list_dir_path.
2013-07-20auto merge of #7902 : huonw/rust/attr++, r=cmr,pcwaltonbors-71/+71
This does a number of things, but especially dramatically reduce the number of allocations performed for operations involving attributes/ meta items: - Converts ast::meta_item & ast::attribute and other associated enums to CamelCase. - Converts several standalone functions in syntax::attr into methods, defined on two traits AttrMetaMethods & AttributeMethods. The former is common to both MetaItem and Attribute since the latter is a thin wrapper around the former. - Deletes functions that are unnecessary due to iterators. - Converts other standalone functions to use iterators and the generic AttrMetaMethods rather than allocating a lot of new vectors (e.g. the old code would have to allocate a new vector to use functions that operated on &[meta_item] on &[attribute].) - Moves the core algorithm of the #[cfg] matching to syntax::attr, similar to find_inline_attr and find_linkage_metas. This doesn't have much of an effect on the speed of #[cfg] stripping, despite hugely reducing the number of allocations performed; presumably most of the time is spent in the ast folder rather than doing attribute checks. Also fixes the Eq instance of MetaItem_ to correctly ignore spans, so that `rustc --cfg 'foo(bar)'` now works.
2013-07-20auto merge of #7894 : pcwalton/rust/and-pointers-in-at-boxes, r=brsonbors-5/+7
r? @brson
2013-07-20auto merge of #7710 : michaelwoerister/rust/WP4, r=jdmbors-8/+13
This pull request includes various improvements: + Composite types (structs, tuples, boxes, etc) are now handled more cleanly by debuginfo generation. Most notably, field offsets are now extracted directly from LLVM types, as opposed to trying to reconstruct them. This leads to more stable handling of edge cases (e.g. packed structs or structs implementing drop). + `debuginfo.rs` in general has seen a major cleanup. This includes better formatting, more readable variable and function names, removal of dead code, and better factoring of functionality. + Handling of `VariantInfo` in `ty.rs` has been improved. That is, the `type VariantInfo = @VariantInfo_` typedef has been replaced with explicit uses of @VariantInfo, and the duplicated logic for creating VariantInfo instances in `ty::enum_variants()` and `typeck::check::mod::check_enum_variants()` has been unified into a single constructor function. Both function now look nicer too :) + Debug info generation for enum types is now mostly supported. This includes: + Good support for C-style enums. Both DWARF and `gdb` know how to handle them. + Proper description of tuple- and struct-style enum variants as unions of structs. + Proper handling of univariant enums without discriminator field. + Unfortunately `gdb` always prints all possible interpretations of a union, so debug output of enums is verbose and unintuitive. Neither `LLVM` nor `gdb` support DWARF's `DW_TAG_variant` which allows to properly describe tagged unions. Adding support for this to `LLVM` seems doable. `gdb` however is another story. In the future we might be able to use `gdb`'s Python scripting support to alleviate this problem. In agreement with @jdm this is not a high priority for now. + The debuginfo test suite has been extended with 14 test files including tests for packed structs (with Drop), boxed structs, boxed vecs, vec slices, c-style enums (standalone and embedded), empty enums, tuple- and struct-style enums, and various pointer types to the above. ~~What is not yet included is DI support for some enum edge-cases represented as described in `trans::adt::NullablePointer`.~~ Cheers, Michael PS: closes #7819, fixes #7712
2013-07-20syntax: modernise attribute handling in syntax::attr.Huon Wilson-71/+71
This does a number of things, but especially dramatically reduce the number of allocations performed for operations involving attributes/ meta items: - Converts ast::meta_item & ast::attribute and other associated enums to CamelCase. - Converts several standalone functions in syntax::attr into methods, defined on two traits AttrMetaMethods & AttributeMethods. The former is common to both MetaItem and Attribute since the latter is a thin wrapper around the former. - Deletes functions that are unnecessary due to iterators. - Converts other standalone functions to use iterators and the generic AttrMetaMethods rather than allocating a lot of new vectors (e.g. the old code would have to allocate a new vector to use functions that operated on &[meta_item] on &[attribute].) - Moves the core algorithm of the #[cfg] matching to syntax::attr, similar to find_inline_attr and find_linkage_metas. This doesn't have much of an effect on the speed of #[cfg] stripping, despite hugely reducing the number of allocations performed; presumably most of the time is spent in the ast folder rather than doing attribute checks. Also fixes the Eq instance of MetaItem_ to correctly ignore spaces, so that `rustc --cfg 'foo(bar)'` now works.
2013-07-19Cleanup of ty::VariantInfo and related functions.Michael Woerister-4/+4
2013-07-19debuginfo: Added support for struct-style enums.Michael Woerister-5/+10
2013-07-18librustc: Forbid `&` pointers (other than `&'static`) inside `@` boxes.Patrick Walton-5/+7
This makes custom borrowing implementations for custom smart pointers sound.
2013-07-18Export information about used default methods instead of regenerating it. ↵Michael Sullivan-6/+31
Closes #7862.
2013-07-18Refactor a handful of stuff in the metadata encoder.Michael Sullivan-125/+87
2013-07-18Add provided method information to ty::Method. Get rid of ProvidedMethodSource.Michael Sullivan-16/+19
2013-07-18Get rid of resolve::MethodInfo. Closes #4946.Michael Sullivan-20/+15
2013-07-18Start of data structure cleanup for trait system. Get rid of CoherenceInfo, ↵Michael Sullivan-1/+1
make trait_impls less bogus.
2013-07-17librustc: Remove the `Copy` bound from the language.Patrick Walton-4/+0
2013-07-17librustc: Remove all uses of the `Copy` bound.Patrick Walton-1/+1
2013-07-17librustc: Remove all uses of "copy".Patrick Walton-42/+57
2013-07-17librustc: Add a lint mode for unnecessary `copy` and remove a bunch of them.Patrick Walton-12/+17
2013-07-12auto merge of #7725 : msullivan/rust/default-methods, r=pcwaltonbors-12/+7
r?
2013-07-12Remove the global 'vec::to_owned' functionAlex Crichton-2/+2
2013-07-11Get cross crate static default methods working. Closes #7569.Michael Sullivan-12/+7
2013-07-10Add an identifier to TypeParameterDefs and use it to pretty print type ↵Niko Matsakis-1/+4
parameters
2013-07-09auto merge of #7117 : jensnockert/rust/freestanding, r=cmrbors-2/+2
The free-standing functions in f32, f64, i8, i16, i32, i64, u8, u16, u32, u64, float, int, and uint are replaced with generic functions in num instead. This means that instead of having to know everywhere what the type is, like ~~~ f64::sin(x) ~~~ You can simply write code that uses the type-generic versions in num instead, this works for all types that implement the corresponding trait in num. ~~~ num::sin(x) ~~~ Note 1: If you were previously using any of those functions, just replace them with the corresponding function with the same name in num. Note 2: If you were using a function that corresponds to an operator, use the operator instead. Note 3: This is just https://github.com/mozilla/rust/pull/7090 reopened against master.
2013-07-08Miscellaneous fixes and cleanupNiko Matsakis-1/+3
2013-07-08 Replaces the free-standing functions in f32, &c.Jens Nockert-2/+2
The free-standing functions in f32, f64, i8, i16, i32, i64, u8, u16, u32, u64, float, int, and uint are replaced with generic functions in num instead. If you were previously using any of those functions, just replace them with the corresponding function with the same name in num. Note: If you were using a function that corresponds to an operator, use the operator instead.