about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2014-03-07std: stop `vec!()` warning about unused mutability.Huon Wilson-3/+5
If no arguments are given to `vec!` then no pushes are emitted and so the compiler (rightly) complains that the mutability of `temp` is never used. This behaviour is rather annoying for users.
2014-03-06auto merge of #12746 : alexcrichton/rust/issue-12743, r=brsonbors-12/+13
The arguments were accidentally swapped in the wrong order. Closes #12743
2014-03-06syntax: Conditionally deriving(Hash) with WritersAlex Crichton-97/+128
If #[feature(default_type_parameters)] is enabled for a crate, then deriving(Hash) will expand with Hash<W: Writer> instead of Hash<SipState> so more hash algorithms can be used.
2014-03-06collections: Correct with_capacity_and_hasherAlex Crichton-12/+13
The arguments were accidentally swapped in the wrong order. Closes #12743
2014-03-06rustc: Move to FNV hashing for node/def idsAlex Crichton-195/+364
This leverages the new hashing framework and hashmap implementation to provide a much speedier hashing algorithm for node ids and def ids. The hash algorithm used is currentl FNV hashing, but it's quite easy to swap out. I originally implemented hashing as the identity function, but this actually ended up in slowing down rustc compiling libstd from 8s to 13s. I would suspect that this is a result of a large number of collisions. With FNV hashing, we get these timings (compiling with --no-trans, in seconds): | | before | after | |-----------|---------:|--------:| | libstd | 8.324 | 6.703 | | stdtest | 47.674 | 46.857 | | libsyntax | 9.918 | 8.400 |
2014-03-06auto merge of #12738 : alexcrichton/rust/needstest, r=brson,justbors-0/+340
Closes #6738 Closes #7061 Closes #7899 Closes #9719 Closes #10028 Closes #10228 Closes #10401 Closes #11192 Closes #11508 Closes #11529 Closes #11873 Closes #11925
2014-03-06auto merge of #12737 : alexcrichton/rust/issue-12736, r=brsonbors-2/+1
Turns out sundown has already escaped this content for us, so there's no need for us to escape it again. Closes #12736
2014-03-06auto merge of #12732 : klutzy/rust/this-is-windows, r=alexcrichtonbors-2/+4
On Windows, `LLVMRustGetLastError()` may return non-utf8 mojibake string if system uses non-English locale. It caused ICE when llvm fails. This patch doesn't fix the real problem, but just make rustc not die.
2014-03-06test: Add some tests for closed issuesAlex Crichton-0/+340
Closes #6738 Closes #7061 Closes #7899 Closes #9719 Closes #10028 Closes #10228 Closes #10401 Closes #11192 Closes #11508 Closes #11529 Closes #11873 Closes #11925
2014-03-06rustdoc: Don't escape contents of headersAlex Crichton-2/+1
Turns out sundown has already escaped this content for us, so there's no need for us to escape it again. Closes #12736
2014-03-06Added missing possessive apostrophe.Mike Boutin-1/+1
2014-03-07rustc: Get LLVM error message safelyklutzy-2/+4
On Windows, `LLVMRustGetLastError()` may return non-utf8 mojibake string if system uses non-English locale. It caused ICE when llvm fails. This patch doesn't fix the real problem, but just make rustc not die.
2014-03-06auto merge of #12727 : lifthrasiir/rust/buffalo-buffalo, r=huonwbors-29/+29
Cosmetic changes at best, but there are so many such typos that I couldn't ignore them. :) Some occurrences of typos are linked to the generated documentations but no changes should break the builds.
2014-03-06fix typos with with repeated words, just like this sentence.Kang Seonghoon-29/+29
2014-03-06auto merge of #12719 : alexcrichton/rust/fix-llvm-33, r=brsonbors-4/+32
The llvm.copysign and llvm.round intrinsics weren't added until LLVM 3.4, so if we're on LLVM 3.3 we lower these to calls in libm instead of LLVM intrinsics. This should fix our travis failures.
2014-03-06auto merge of #12714 : michaelwoerister/rust/limited-debuginfo, r=alexcrichtonbors-72/+155
This PR brings back limited debuginfo which allows for nice backtraces and breakpoints, but omits any info about variables and types. The `-g` and `--debuginfo` command line options have been extended to take an optional argument: `-g0` means no debug info. `-g1` means line-tables only. `-g2` means full debug info. Specifying `-g` without argument is equivalent to `-g2`. Fixes #12280
2014-03-06auto merge of #12705 : alexcrichton/rust/issue-12692, r=brsonbors-45/+136
Details are in the commit messages, but this closes a few issues seen with `libnative` recently.
2014-03-05auto merge of #12687 : alexcrichton/rust/issue-12681, r=huonwbors-24/+105
This commit adds a appear-on-over link to all section headers to generated documentation. Each header also receives an id now, even those generated through markdown. The purpose of this is to provide easy to link to sections. This modifies the default header markdown generation because the default id added looks like "toc_NN" which is difficult to reconcile among all sections (by default each section gets a "toc_0" id), and it's also not very descriptive of where you're going. This chooses to adopt the github-style anchors by taking the contents of the title and hyphen-separating them (after lower casing). Closes #12681
2014-03-06debuginfo: Add test case for limited debuginfoMichael Woerister-0/+52
2014-03-06debuginfo: Expose limited debuginfo in command line optionsMichael Woerister-54/+69
2014-03-06debuginfo: Re-introduce the notion of line-table-only debuginfo.Michael Woerister-23/+39
2014-03-05rustdoc: Add anchors to section headersAlex Crichton-24/+105
This commit adds a appear-on-over link to all section headers to generated documentation. Each header also receives an id now, even those generated through markdown. The purpose of this is to provide easy to link to sections. This modifies the default header markdown generation because the default id added looks like "toc_NN" which is difficult to reconcile among all sections (by default each section gets a "toc_0" id), and it's also not very descriptive of where you're going. This chooses to adopt the github-style anchors by taking the contents of the title and hyphen-separating them (after lower casing). Closes #12681
2014-03-05std: Move libnative task count bookkeeping to stdAlex Crichton-12/+49
When using tasks in Rust, the expectation is that the runtime does not exit before all tasks have exited. This is enforced in libgreen through the `SchedPool` type, and it is enforced in libnative through a `bookkeeping` module and a global count/mutex pair. Unfortunately, this means that a process which originates with libgreen will not wait for spawned native tasks. In order to fix this problem, the bookkeeping module was moved from libnative to libstd so the runtime itself can wait for native tasks to exit. Green tasks do not manage themselves through this bookkeeping module, but native tasks will continue to manage themselves through this module. Closes #12684
2014-03-05Fix ICE on statics with fancy nullable enums.Jed Davis-13/+28
Closes #8506. The `trans::adt` code for statics uses fields with `C_undef` values to insert alignment padding (because LLVM's own alignment padding isn't always sufficient for aggregate constants), and assumes that all fields in the actual Rust value are represented by non-undef LLVM values, to distinguish them from that padding. But for nullable pointer enums, if non-null variant has fields other than the pointer used as the discriminant, they would be set to undef in the null case, to reflect that they're never accessed. To avoid the obvious conflict between these two items, the latter undefs were wrapped in unary LLVM structs to distinguish them from the former undefs. Except this doesn't actually work -- LLVM, not unreasonably, treats the "wrapped undef" as a regular undef. So this commit just sets all fields to null in the null pointer case of a nullable pointer enum static, because the other fields don't really need to be undef in the first place.
2014-03-05rustc: Fix support for LLVM 3.3Alex Crichton-4/+32
The llvm.copysign and llvm.round intrinsics weren't added until LLVM 3.4, so if we're on LLVM 3.3 we lower these to calls in libm instead of LLVM intrinsics. This should fix our travis failures.
2014-03-05auto merge of #12718 : thestinger/rust/min_max, r=alexcrichtonbors-3/+35
2014-03-05stats: fix handling of NaN in `min` and `max`Daniel Micay-3/+11
The `cmp::min` and `cmp::max` functions are not correct with partially ordered values. #12712
2014-03-05add tests for `min` and `max` from `Float`Daniel Micay-0/+24
2014-03-05auto merge of #12715 : dmski/rust/no-extern-fn-pat, r=alexcrichtonbors-0/+35
Fixes #10877 There was another PR which attempted to fix this in the parser (#11804) and which was closed due to inactivity. This PR modifies typeck instead (as suggested in #11804), which indeed seems to be simpler than modifying the parser and allows for a better error message.
2014-03-06Disallowed patterns in extern fn declarations.Dmitry Promsky-0/+35
Closes #10877
2014-03-05auto merge of #12711 : edwardw/rust/mtwt, r=pcwaltonbors-562/+558
- Moves mtwt hygiene code into its own file - Fixes FIXME's which leads to ~2x speed gain in expansion pass - It is now @-free
2014-03-05native: Fix usage of a deallocated mutexAlex Crichton-16/+36
When the timer_helper thread exited, it would attempt to re-acquire the global task count mutex, but the mutex had previously been deallocated, leading to undefined behavior of the mutex, and in some cases deadlock. Another mutex is used to coordinate shutting down the timer helper thread. Closes #12699
2014-03-05native: Move from usleep() to nanosleep()Alex Crichton-6/+22
Using nanosleep() allows us to gracefully recover from EINTR because on error it fills in the second parameter with the remaining time to sleep. Closes #12689
2014-03-05native: Stop using readdir()Alex Crichton-11/+29
This function is not threadsafe, and is deprecated in favor of the threadsafe readdir_r variant. Closes #12692
2014-03-05auto merge of #12700 : thestinger/rust/float, r=cmrbors-90/+43
2014-03-05consistently use LLVM floating point intrinsicsDaniel Micay-87/+18
2014-03-05add correct floating point `min` and `max` methods.Daniel Micay-3/+25
The `std::cmp` functions are not correct for floating point types. `min(NaN, 2.0)` and `min(2.0, NaN)` return different values, because these functions assume a total order. Floating point types need special `min`, `max` and `clamp` functions.
2014-03-05Refactor and fix FIXME's in mtwt hygiene codeEdward Wang-562/+558
- Moves mtwt hygiene code into its own file - Fixes FIXME's which leads to ~2x speed gain in expansion pass - It is now @-free
2014-03-05Str::slice_chars() is O(end), not O(end - begin)Simon Sapin-2/+2
2014-03-04auto merge of #12491 : eddyb/rust/deref, r=nikomatsakisbors-138/+520
Add the `Deref` and `DerefMut` traits and implement overloading explicit dereferences.
2014-03-04auto merge of #12300 : DaGenix/rust/uppercase-variable-lint, r=alexcrichtonbors-605/+698
I added a new lint for variables whose names contain uppercase characters, since, by convention, variable names should be all lowercase. What motivated me to work on this was when I ran into something like the following: ```rust use std::io::File; use std::io::IoError; fn main() { let mut f = File::open(&Path::new("/something.txt")); let mut buff = [0u8, ..16]; match f.read(buff) { Ok(cnt) => println!("read this many bytes: {}", cnt), Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {}", EndOfFile.to_str()), } } ``` I then got compile errors when I tried to add a wildcard match pattern at the end which I found very confusing since I believed that the 2nd match arm was only matching the EndOfFile condition. The problem is that I hadn't imported io::EndOfFile into the local scope. So, I thought that I was using EndOfFile as a sub-pattern, however, what I was actually doing was creating a new local variable named EndOfFile. This lint makes this error easier to spot by providing a warning that the variable name EndOfFile contains a uppercase characters which provides a nice hint as to why the code isn't doing what is intended. The lint warns on local bindings as well: ```rust let Hi = 0; ``` And also struct fields: ```rust struct Something { X: uint } ```
2014-03-05Emit the uppercase variable lint for struct fields that have names with ↵Palmer Cox-1/+26
uppercase characters
2014-03-05Allow uppercase_variables in libstd/libc.rsPalmer Cox-0/+1
2014-03-04auto merge of #12671 : nick29581/rust/expand, r=sfacklerbors-6/+15
Fixes a regression from #4913 which causes items to be exanded with spans lacking expn_info from the context's current backtrace.
2014-03-04auto merge of #12688 : alexcrichton/rust/fix-some-link-args, r=brsonbors-6/+31
Linker argument order with respect to libraries is important enough that we shouldn't be attempting to filter out libraries getting passed through to the linker. When linking with a native library that has multiple dependant native libraries, it's useful to have control over the link argument order.
2014-03-04Rename struct fields with uppercase characters in their names to use lowercasePalmer Cox-68/+68
2014-03-04Add lint for variable names that contain uppercase charactersPalmer Cox-1/+68
2014-03-04Rename all variables that have uppercase characters in their names to use ↵Palmer Cox-541/+541
only lowercase characters
2014-03-04Expand nested items within a backtrace.Nick Cameron-6/+15
Fixes a regression from #4913 which causes items to be exanded with spans lacking expn_info from the context's current backtrace.
2014-03-04auto merge of #12697 : thestinger/rust/vec, r=huonwbors-0/+3
This exists for the sake of compatibility during the ~[T] -> Vec<T> transition. It will be removed in the future.