about summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2014-02-21auto merge of #12419 : huonw/rust/compiler-unsafe, r=alexcrichtonbors-18/+29
Previously an `unsafe` block created by the compiler (like those in the formatting macros) would be "ignored" if surrounded by `unsafe`, that is, the internal unsafety would be being legitimised by the external block: unsafe { println!("...") } =(expansion)=> unsafe { ... unsafe { ... } } And the code in the inner block would be using the outer block, making it considered used (and the inner one considered unused). This patch forces the compiler to create a new unsafe context for compiler generated blocks, so that their internal unsafety doesn't escape to external blocks. Fixes #12418.
2014-02-21auto merge of #12415 : HeroesGrave/rust/move-enum-set, r=alexcrichtonbors-1/+1
Part of #8784 Also removed the one glob import.
2014-02-21Changed NonCamelCaseTypes lint to warn by defaultmr.Shu-22/+60
Added allow(non_camel_case_types) to librustc where necesary Tried to fix problems with non_camel_case_types outside rustc fixed failing tests Docs updated Moved #[allow(non_camel_case_types)] a level higher. markdown.rs reverted Fixed timer that was failing tests Fixed another timer
2014-02-20auto merge of #12164 : alexcrichton/rust/rlibs-and-dylibs, r=cmrbors-94/+167
The first commit improves error messages during linking, and the second commit improves error messages during crate-loading time. Closes #12297 Closes #12377
2014-02-20Re-work loading crates with nicer errorsAlex Crichton-94/+167
This commit rewrites crate loading internally in attempt to look at less metadata and provide nicer errors. The loading is now split up into a few stages: 1. Collect a mapping of (hash => ~[Path]) for a set of candidate libraries for a given search. The hash is the hash in the filename and the Path is the location of the library in question. All candidates are filtered based on their prefix/suffix (dylib/rlib appropriate) and then the hash/version are split up and are compared (if necessary). This means that if you're looking for an exact hash of library you don't have to open up the metadata of all libraries named the same, but also in your path. 2. Once this mapping is constructed, each (hash, ~[Path]) pair is filtered down to just a Path. This is necessary because the same rlib could show up twice in the path in multiple locations. Right now the filenames are based on just the crate id, so this could be indicative of multiple version of a crate during one crate_id lifetime in the path. If multiple duplicate crates are found, an error is generated. 3. Now that we have a mapping of (hash => Path), we error on multiple versions saying that multiple versions were found. Only if there's one (hash => Path) pair do we actually return that Path and its metadata. With this restructuring, it restructures code so errors which were assertions previously are now first-class errors. Additionally, this should read much less metadata with lots of crates of the same name or same version in a path. Closes #11908
2014-02-20auto merge of #12401 : alexcrichton/rust/if-ok-2-try, r=brsonbors-31/+31
This "bubble up an error" macro was originally named if_ok! in order to get it landed, but after the fact it was discovered that this name is not exactly desirable. The name `if_ok!` isn't immediately clear that is has much to do with error handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In general, the agreed opinion about `if_ok!` is that is came in as subpar. The name `try!` is more invocative of error handling, it's shorter by 2 letters, and it looks fitting in almost all circumstances. One concern about the word `try!` is that it's too invocative of exceptions, but the belief is that this will be overcome with documentation and examples. Close #12037
2014-02-20Mass rename if_ok! to try!Alex Crichton-31/+31
This "bubble up an error" macro was originally named if_ok! in order to get it landed, but after the fact it was discovered that this name is not exactly desirable. The name `if_ok!` isn't immediately clear that is has much to do with error handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In general, the agreed opinion about `if_ok!` is that is came in as subpar. The name `try!` is more invocative of error handling, it's shorter by 2 letters, and it looks fitting in almost all circumstances. One concern about the word `try!` is that it's too invocative of exceptions, but the belief is that this will be overcome with documentation and examples. Close #12037
2014-02-20auto merge of #12405 : kud1ing/rust/backticks, r=huonwbors-1/+1
2014-02-20auto merge of #12403 : eddyb/rust/generic-dtors-with-bounds, r=nikomatsakisbors-153/+110
Fix generic Drop impls with trait bounds. Fixes #4252.
2014-02-20auto merge of #12399 : michaelwoerister/rust/simd-fix, r=alexcrichtonbors-1/+7
Fixes #12333. I also re-enabled the *function-arg-initialization* test case, so if it passes again, fixes #12021.
2014-02-20auto merge of #12398 : alexcrichton/rust/rlibs-and-dylibs-2, r=cmrbors-84/+138
The new methodology can be found in the re-worded comment, but the gist of it is that -C prefer-dynamic doesn't turn off static linkage. The error messages should also be a little more sane now. Closes #12133
2014-02-20rustc: avoid compiler generated `unsafe` blocks leaking.Huon Wilson-18/+29
Previously an `unsafe` block created by the compiler (like those in the formatting macros) would be "ignored" if surrounded by `unsafe`, that is, the internal unsafety would be being legitimised by the external block: unsafe { println!("...") } =(expansion)=> unsafe { ... unsafe { ... } } And the code in the inner block would be using the outer block, making it considered used (and the inner one considered unused). This patch forces the compiler to create a new unsafe context for compiler generated blocks, so that their internal unsafety doesn't escape to external blocks. Fixes #12418.
2014-02-20move extra::test to libtestLiigo Zhuang-24/+24
2014-02-20move enum_set to libcollections. #8784HeroesGrave-1/+1
2014-02-19auto merge of #12244 : pcwalton/rust/deuniquevectorpatterns, r=pcwaltonbors-12/+23
Preparatory work for removing unique vectors from the language, which is itself preparatory work for dynamically sized types. r? @brson
2014-02-19auto merge of #12394 : huonw/rust/transmute--, r=pnkfelixbors-12/+4
These can all be done by implicit or explicit &T -> *T casts, which are more restricted and so are safer.
2014-02-19librustc: Remove unique vector patterns from the language.Patrick Walton-12/+23
Preparatory work for removing unique vectors from the language, which is itself preparatory work for dynamically sized types.
2014-02-19auto merge of #12387 : cmr/rust/ast-json, r=alexcrichtonbors-7/+30
See the commits
2014-02-20Resolve the vtables for method calls to generic Drop impls with trait bounds.Eduard Burtescu-16/+31
2014-02-19adjust to currently used stylekud1ing-1/+1
2014-02-19Replaced method_map_entry with method_origin and cleaned up vtable checking ↵Eduard Burtescu-133/+79
a bit.
2014-02-19Don't recurse twice into ExprParen in vtable checking.Eduard Burtescu-4/+0
2014-02-19rustc: support dumping the AST as JSONCorey Richardson-7/+30
This is mostly useful for working on rustc, when one is unfamiliar with the AST a particular construct will produce. It's a -Z flag as it's very much for debugging. Closes #10485
2014-02-19auto merge of #12379 : alexcrichton/rust/fix-ar-thing, r=brsonbors-0/+1
When creating a staticlib, it unzips all static archives it finds and then inserts the files manually into the output file. This process is done through `ar`, and `ar` doesn't like if you specify you want to add files and you don't give it any files. This case arose whenever you linked to an archive that didn't have any contents or all of the contents were filtered out. This just involved ignoring the case where the number of inputs we have is 0, because we don't have any files to add anyway.
2014-02-19Tweak how preference factors into linkageAlex Crichton-84/+138
The new methodology can be found in the re-worded comment, but the gist of it is that -C prefer-dynamic doesn't turn off static linkage. The error messages should also be a little more sane now. Closes #12133
2014-02-19debuginfo: Add support for simd typesMichael Woerister-1/+7
2014-02-20rustc: remove some unnecessary `transmute`s.Huon Wilson-12/+4
These can all be done by implicit or explicit &T -> *T casts, which are more restricted and so are safer.
2014-02-19Change the format_args! macro expansion for temporariesEdward Wang-7/+7
Currently, the format_args! macro and its downstream macros in turn expand to series of let statements, one for each of its arguments, and then the invocation of the macro function. If one or more of the arguments are RefCell's, the enclosing statement for the temporary of the let is the let itself, which leads to scope problem. This patch changes let's to a match expression. Closes #12239.
2014-02-18auto merge of #12245 : nick29581/rust/priv2, r=alexcrichtonbors-108/+268
closes #4110
2014-02-19Make priavcy checking aware that a `use` directive can point to two ↵Nick Cameron-108/+268
defintions (namespaces) with different privacy. Closes #4110
2014-02-18Fix staticlib outputs linking to blank archivesAlex Crichton-0/+1
When creating a staticlib, it unzips all static archives it finds and then inserts the files manually into the output file. This process is done through `ar`, and `ar` doesn't like if you specify you want to add files and you don't give it any files. This case arose whenever you linked to an archive that didn't have any contents or all of the contents were filtered out. This just involved ignoring the case where the number of inputs we have is 0, because we don't have any files to add anyway.
2014-02-18auto merge of #12351 : kud1ing/rust/backticks, r=alexcrichtonbors-2/+2
2014-02-17auto merge of #12232 : kballard/rust/taskbuilder-is-a-builder, r=alexcrichtonbors-2/+1
Delete all the documentation from std::task that references linked failure. Tweak TaskBuilder to be more builder-like. `.name()` is now `.named()` and `.add_wrapper()` is now `.with_wrapper()`. Remove `.watched()` and `.unwatched()` as they didn't actually do anything. Closes #6399.
2014-02-17auto merge of #12146 : gentlefolk/rust/issue-2404, r=alexcrichtonbors-12/+29
Addresses FIXME described in issue #2404
2014-02-17Updated metadata::creader::resolve_crate_deps to use the correct span. ↵gentlefolk-12/+29
Clarified error message when an external crate's dependency is missing. Closes #2404.
2014-02-17backticks for syntax elementskud1ing-2/+2
2014-02-17auto merge of #12337 : nick29581/rust/generic_extern, r=alexcrichtonbors-94/+110
and fix up some formatting.
2014-02-17Forbid use of generics with foreign functions. Closes #10353.Nick Cameron-94/+110
2014-02-17Rename Bitwise::population_count to Bitwise::count_ones and add ↵Brendan Zabarauskas-1/+1
Bitwise::count_zeros These are inspired by the [functions in the Julia standard library](http://docs.julialang.org/en/release-0.2/stdlib/base/#Base.count_ones).
2014-02-16Update clients of the TaskBuilder APIKevin Ballard-2/+1
2014-02-17Remove CloneableTuple and ImmutableTuple traitsBrendan Zabarauskas-2/+2
These are adequately covered by the Tuple2 trait.
2014-02-15auto merge of #12272 : alexcrichton/rust/snapshot, r=kballardbors-13/+13
This notably contains the `extern mod` => `extern crate` change. Closes #9880
2014-02-15Declare by-value on-stack parameters to be noaliasBjörn Steinbrink-1/+9
Function parameters that are to be passed by value but don't fit into a single register are currently passed by creating a copy on the stack and passing a pointer to that copy to the callee. Since the copy is made just for the function call, there are no aliases. For example, this sometimes allows LLVM to eliminate unnecessary calls to drop glue. Given ````rust struct Foo { a: int, b: Option<~str>, } extern { fn eat(eat: Option<~str>); } pub fn foo(v: Foo) { match v { Foo { a: _, b } => unsafe { eat(b) } } } ```` LLVM currently can't eliminate the drop call for the string, because it only sees a _pointer_ to Foo, for which it has to expect an alias. So we get: ````llvm ; Function Attrs: uwtable define void @_ZN3foo20h9f32c90ae7201edbxaa4v0.0E(%struct.Foo* nocapture) unnamed_addr #0 { "_ZN34std..option..Option$LT$$UP$str$GT$9glue_drop17hc39b3015f3b9c69dE.exit": %1 = getelementptr inbounds %struct.Foo* %0, i64 0, i32 1, i32 0 %2 = load { i64, i64, [0 x i8] }** %1, align 8 store { i64, i64, [0 x i8] }* null, { i64, i64, [0 x i8] }** %1, align 8 %3 = ptrtoint { i64, i64, [0 x i8] }* %2 to i64 %.fca.0.insert = insertvalue { i64 } undef, i64 %3, 0 tail call void @eat({ i64 } %.fca.0.insert) %4 = load { i64, i64, [0 x i8] }** %1, align 8 %5 = icmp eq { i64, i64, [0 x i8] }* %4, null br i1 %5, label %_ZN3Foo9glue_drop17hf611996539d3036fE.exit, label %"_ZN8_$UP$str9glue_drop17h15dbdbe2b8897a98E.exit.i.i" "_ZN8_$UP$str9glue_drop17h15dbdbe2b8897a98E.exit.i.i": ; preds = %"_ZN34std..option..Option$LT$$UP$str$GT$9glue_drop17hc39b3015f3b9c69dE.exit" %6 = bitcast { i64, i64, [0 x i8] }* %4 to i8* tail call void @free(i8* %6) #1 br label %_ZN3Foo9glue_drop17hf611996539d3036fE.exit _ZN3Foo9glue_drop17hf611996539d3036fE.exit: ; preds = %"_ZN34std..option..Option$LT$$UP$str$GT$9glue_drop17hc39b3015f3b9c69dE.exit", %"_ZN8_$UP$str9glue_drop17h15dbdbe2b8897a98E.exit.i.i" ret void } ```` But with the `noalias` attribute, it can safely optimize that to: ````llvm define void @_ZN3foo20hd28431f929f0d6c4xaa4v0.0E(%struct.Foo* noalias nocapture) unnamed_addr #0 { _ZN3Foo9glue_drop17he9afbc09d4e9c851E.exit: %1 = getelementptr inbounds %struct.Foo* %0, i64 0, i32 1, i32 0 %2 = load { i64, i64, [0 x i8] }** %1, align 8 store { i64, i64, [0 x i8] }* null, { i64, i64, [0 x i8] }** %1, align 8 %3 = ptrtoint { i64, i64, [0 x i8] }* %2 to i64 %.fca.0.insert = insertvalue { i64 } undef, i64 %3, 0 tail call void @eat({ i64 } %.fca.0.insert) ret void } ````
2014-02-15std: clean up ptr a bitCorey Richardson-3/+2
2014-02-14extern mod => extern crateAlex Crichton-13/+13
This was previously implemented, and it just needed a snapshot to go through
2014-02-14auto merge of #12276 : alexcrichton/rust/issue-8449, r=kballardbors-7/+7
This was just waiting for compiler-rt support, which was added in #12027 Closes #8449
2014-02-14Enable 64-bit checked multiplication on 32-bitAlex Crichton-7/+7
This was just waiting for compiler-rt support, which was added in #12027 Closes #8449
2014-02-14auto merge of #12267 : alexcrichton/rust/rollup, r=alexcrichtonbors-84/+64
The last commit has the closed PRs
2014-02-14auto merge of #12205 : alexcrichton/rust/nodefaultlibs, r=brsonbors-0/+11
This will hopefully bring us closer to #11937. We're still using gcc's idea of "startup files", but this should prevent us from leaking in dependencies that we don't quite want (libgcc for example once compiler-rt is what we use).
2014-02-14Invoke gcc with -nodefaultlibsAlex Crichton-0/+11
This will hopefully bring us closer to #11937. We're still using gcc's idea of "startup files", but this should prevent us from leaking in dependencies that we don't quite want (libgcc for example once compiler-rt is what we use).