]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #12899 : brson/rust/cleanbacktrace, r=alexcrichton
bors [Sun, 16 Mar 2014 08:36:21 +0000 (01:36 -0700)]
auto merge of #12899 : brson/rust/cleanbacktrace, r=alexcrichton

After `make clean` I'm seeing the build break with

```
cp: cannot stat ‘x86_64-unknown-linux-gnu/rt/libbacktrace/.libs/libbacktrace.a’: No such file or directory
```

Deleteing the libbacktrace dir entirely on clean fixes.

10 years agoauto merge of #12791 : alexcrichton/rust/liblog, r=brson
bors [Sun, 16 Mar 2014 06:01:24 +0000 (23:01 -0700)]
auto merge of #12791 : alexcrichton/rust/liblog, r=brson

The rationale and modifications can be found in the first commit message.

This does make logging a bit more painful to use initially because it involves a feature gate and some `phase` attributes, but I think it may be reasonable to not require the `phase` attribute for loading `macro_rules!` macros because defining them will still be gated.

10 years agoTest fixes and rebase conflicts
Alex Crichton [Thu, 13 Mar 2014 06:34:31 +0000 (23:34 -0700)]
Test fixes and rebase conflicts

This commit switches over the backtrace infrastructure from piggy-backing off
the RUST_LOG environment variable to using the RUST_BACKTRACE environment
variable (logging is now disabled in libstd).

10 years agorustc: Topographically sort rust dependencies
Alex Crichton [Fri, 14 Mar 2014 01:47:43 +0000 (18:47 -0700)]
rustc: Topographically sort rust dependencies

This commit starts to topographically sort rust dependencies on the linker
command line. The reason for this is that linkers use right-hand libraries to
resolve left-hand libraries symbols, which is especially crucial for us because
we're using --as-needed on linux.

10 years agorustc: Tweak where -lmorestack is on link commands
Alex Crichton [Wed, 12 Mar 2014 16:49:38 +0000 (09:49 -0700)]
rustc: Tweak where -lmorestack is on link commands

In removing many fields from the crate map, executables no longer always have an
explicit dependency on all upstream libraries. This means that the linker is no
longer picking them up as it used to.

To the best of my knowledge, the current situation is happening:

* On linux, we're passing the --as-needed flag to the linker, meaning that
  libraries are stripped out if there are no references to symbols in them.
* Executables may not reference libstd at all, such as "fn main() {}"
* When linking, the linker will discard libstd because there are no references
  to symbols in it. I presume that this means that all previous libs have had
  all their symbols resolved, so none of the libs are pulling in libstd as a
  dependency.
* The only real dependence on libstd comes from the rust_stack_exhausted symbol
  (which comes from libmorestack), but -lmorestack is at the end so by the time
  this comes up libstd is completely gone, leading to undefined references to
  rust_stack_exhausted

I'm not entirely convinced that this is what's happening, but it appears to be
along these lines. The one thing that I'm sure of is that removing the crate map
(and hence implicit dependency on all upstream libraries) has changed how
objects depend on upstream libraries.

10 years agorustc: Remove compiler support for __log_level()
Alex Crichton [Sun, 9 Mar 2014 06:36:10 +0000 (22:36 -0800)]
rustc: Remove compiler support for __log_level()

This commit removes all internal support for the previously used __log_level()
expression. The logging subsystem was previously modified to not rely on this
magical expression. This also removes the only other function to use the
module_data map in trans, decl_gc_metadata. It appears that this is an ancient
function from a GC only used long ago.

This does not remove the crate map entirely, as libgreen still uses it to hook
in to the event loop provided by libgreen.

10 years agolog: Introduce liblog, the old std::logging
Alex Crichton [Sun, 9 Mar 2014 06:11:44 +0000 (22:11 -0800)]
log: Introduce liblog, the old std::logging

This commit moves all logging out of the standard library into an external
crate. This crate is the new crate which is responsible for all logging macros
and logging implementation. A few reasons for this change are:

* The crate map has always been a bit of a code smell among rust programs. It
  has difficulty being loaded on almost all platforms, and it's used almost
  exclusively for logging and only logging. Removing the crate map is one of the
  end goals of this movement.

* The compiler has a fair bit of special support for logging. It has the
  __log_level() expression as well as generating a global word per module
  specifying the log level. This is unfairly favoring the built-in logging
  system, and is much better done purely in libraries instead of the compiler
  itself.

* Initialization of logging is much easier to do if there is no reliance on a
  magical crate map being available to set module log levels.

* If the logging library can be written outside of the standard library, there's
  no reason that it shouldn't be. It's likely that we're not going to build the
  highest quality logging library of all time, so third-party libraries should
  be able to provide just as high-quality logging systems as the default one
  provided in the rust distribution.

With a migration such as this, the change does not come for free. There are some
subtle changes in the behavior of liblog vs the previous logging macros:

* The core change of this migration is that there is no longer a physical
  log-level per module. This concept is still emulated (it is quite useful), but
  there is now only a global log level, not a local one. This global log level
  is a reflection of the maximum of all log levels specified. The previously
  generated logging code looked like:

    if specified_level <= __module_log_level() {
        println!(...)
    }

  The newly generated code looks like:

    if specified_level <= ::log::LOG_LEVEL {
        if ::log::module_enabled(module_path!()) {
            println!(...)
        }
    }

  Notably, the first layer of checking is still intended to be "super fast" in
  that it's just a load of a global word and a compare. The second layer of
  checking is executed to determine if the current module does indeed have
  logging turned on.

  This means that if any module has a debug log level turned on, all modules
  with debug log levels get a little bit slower (they all do more expensive
  dynamic checks to determine if they're turned on or not).

  Semantically, this migration brings no change in this respect, but
  runtime-wise, this will have a perf impact on some code.

* A `RUST_LOG=::help` directive will no longer print out a list of all modules
  that can be logged. This is because the crate map will no longer specify the
  log levels of all modules, so the list of modules is not known. Additionally,
  warnings can no longer be provided if a malformed logging directive was
  supplied.

The new "hello world" for logging looks like:

    #[phase(syntax, link)]
    extern crate log;

    fn main() {
        debug!("Hello, world!");
    }

10 years agoauto merge of #12927 : sfackler/rust/test-warn, r=huonw
bors [Sun, 16 Mar 2014 04:16:29 +0000 (21:16 -0700)]
auto merge of #12927 : sfackler/rust/test-warn, r=huonw

The use of `std::os::args` creates a deprecated_owned_vector warning
with a bogus span.

10 years agoSquash test ~[] warning
Steven Fackler [Sun, 16 Mar 2014 03:02:11 +0000 (20:02 -0700)]
Squash test ~[] warning

The use of `std::os::args` creates a deprecated_owned_vector warning
with a bogus span.

10 years agoauto merge of #12923 : sfackler/rust/vecify, r=brson
bors [Sun, 16 Mar 2014 02:26:31 +0000 (19:26 -0700)]
auto merge of #12923 : sfackler/rust/vecify, r=brson

10 years agoauto merge of #12922 : luqmana/rust/fix-arm, r=alexcrichton
bors [Sun, 16 Mar 2014 00:51:35 +0000 (17:51 -0700)]
auto merge of #12922 : luqmana/rust/fix-arm, r=alexcrichton

10 years agomk: Clean libbacktrace w/ gusto
Brian Anderson [Sat, 15 Mar 2014 01:06:37 +0000 (18:06 -0700)]
mk: Clean libbacktrace w/ gusto

After `make clean' I'm seeing the build break with

```
cp: cannot stat ‘x86_64-unknown-linux-gnu/rt/libbacktrace/.libs/libbacktrace.a’: No such file or directory
```

Deleteing the libbacktrace dir entirely on clean fixes.

10 years agoauto merge of #12921 : alexcrichton/rust/no-extra, r=sfackler
bors [Sat, 15 Mar 2014 23:11:32 +0000 (16:11 -0700)]
auto merge of #12921 : alexcrichton/rust/no-extra, r=sfackler

Forgot to remove this as part of the previous removal of libextra

10 years agolibstd: Fix a typo. s/target_os/target_arch/
Luqman Aden [Sat, 15 Mar 2014 22:45:26 +0000 (18:45 -0400)]
libstd: Fix a typo. s/target_os/target_arch/

10 years agoRemove ~[] from libsemver
Steven Fackler [Sat, 15 Mar 2014 22:41:51 +0000 (15:41 -0700)]
Remove ~[] from libsemver

10 years agodoc: Remove reference to the 'extra' library
Alex Crichton [Sat, 15 Mar 2014 22:37:16 +0000 (15:37 -0700)]
doc: Remove reference to the 'extra' library

Forgot to remove this as part of the previous removal of libextra

10 years agoRemove most ~[] usage in liburl
Steven Fackler [Sat, 15 Mar 2014 22:13:00 +0000 (15:13 -0700)]
Remove most ~[] usage in liburl

10 years agoauto merge of #12918 : sfackler/rust/doc-html-attr, r=alexcrichton
bors [Sat, 15 Mar 2014 21:31:38 +0000 (14:31 -0700)]
auto merge of #12918 : sfackler/rust/doc-html-attr, r=alexcrichton

10 years agoAdd rustdoc html crate info
Steven Fackler [Sat, 15 Mar 2014 21:26:12 +0000 (14:26 -0700)]
Add rustdoc html crate info

10 years agoauto merge of #12908 : alexcrichton/rust/issue-12897, r=thestinger
bors [Sat, 15 Mar 2014 09:21:26 +0000 (02:21 -0700)]
auto merge of #12908 : alexcrichton/rust/issue-12897, r=thestinger

This is mostly just an implementation detail, and anyone worried about the stack
bounds doesn't need to be bothered with the red zone because it's not usable
anyway.

Closes #12897

10 years agoauto merge of #12906 : sfackler/rust/timespec-total, r=thestinger
bors [Sat, 15 Mar 2014 07:46:28 +0000 (00:46 -0700)]
auto merge of #12906 : sfackler/rust/timespec-total, r=thestinger

10 years agoauto merge of #12896 : alexcrichton/rust/goodbye-extra, r=brson
bors [Sat, 15 Mar 2014 06:11:31 +0000 (23:11 -0700)]
auto merge of #12896 : alexcrichton/rust/goodbye-extra, r=brson

This commit shreds all remnants of libextra from the compiler and standard
distribution. Two modules, c_vec/tempfile, were moved into libstd after some
cleanup, and the other modules were moved to separate crates as seen fit.

Closes #8784
Closes #12413
Closes #12576

10 years agogreen: Don't return the red zone in stack_bounds()
Alex Crichton [Sat, 15 Mar 2014 05:46:13 +0000 (22:46 -0700)]
green: Don't return the red zone in stack_bounds()

This is mostly just an implementation detail, and anyone worried about the stack
bounds doesn't need to be bothered with the red zone because it's not usable
anyway.

Closes #12897

10 years agoImplement TotalEq and TotalOrd for Timespec
Steven Fackler [Sat, 15 Mar 2014 04:50:23 +0000 (21:50 -0700)]
Implement TotalEq and TotalOrd for Timespec

There's a test making sure that Ord works, so the order dependence
shouldn't be an issue

10 years agoauto merge of #12895 : michaelwoerister/rust/limited-debuginfo, r=alexcrichton
bors [Sat, 15 Mar 2014 04:36:26 +0000 (21:36 -0700)]
auto merge of #12895 : michaelwoerister/rust/limited-debuginfo, r=alexcrichton

Very minor modification of just one test case. Fixes #12787.

10 years agoauto merge of #12887 : huonw/rust/danger-guide, r=alexcrichton
bors [Sat, 15 Mar 2014 03:01:32 +0000 (20:01 -0700)]
auto merge of #12887 : huonw/rust/danger-guide, r=alexcrichton

docs: begin a "low-level & unsafe code" guide.

This aims to cover the basics of writing safe unsafe code. At the moment
it is just designed to be a better place for the `asm!()` docs than the
detailed release notes wiki page, and I took the time to write up some
other things.

More examples are needed, especially of things that can subtly go wrong;
and vast areas of `unsafe`-ty aren't covered, e.g. `static mut`s and
thread-safety in general.

10 years agodocs: begin a "low-level & unsafe code" guide.
Huon Wilson [Fri, 14 Mar 2014 15:13:48 +0000 (02:13 +1100)]
docs: begin a "low-level & unsafe code" guide.

This aims to cover the basics of writing safe unsafe code. At the moment
it is just designed to be a better place for the `asm!()` docs than the
detailed release notes wiki page, and I took the time to write up some
other things.

More examples are needed, especially of things that can subtly go wrong;
and vast areas of `unsafe`-ty aren't covered, e.g. `static mut`s and
thread-safety in general.

10 years agoauto merge of #12893 : alexcrichton/rust/cfg-not, r=luqmana
bors [Sat, 15 Mar 2014 01:26:30 +0000 (18:26 -0700)]
auto merge of #12893 : alexcrichton/rust/cfg-not, r=luqmana

The two commits have the details of the two fixes

10 years agoauto merge of #12888 : aochagavia/rust/Fix-comment, r=alexcrichton
bors [Fri, 14 Mar 2014 23:51:26 +0000 (16:51 -0700)]
auto merge of #12888 : aochagavia/rust/Fix-comment, r=alexcrichton

The old comment of as_mut_slice() did not describe the function correctly. The new one does.

Also refactored option::iter() and option::mut_iter() to use as_ref() and as_mut() instead of match.

10 years agoauto merge of #12878 : crabtw/rust/mips, r=alexcrichton
bors [Fri, 14 Mar 2014 22:16:31 +0000 (15:16 -0700)]
auto merge of #12878 : crabtw/rust/mips, r=alexcrichton

I ignored AtomicU64 methods on MIPS target
because libgcc doesn't implement MIPS32 64-bit atomic operations.
Otherwise it would cause link failure.

By the way, the patched LLVM doesn't have MIPS split stack anymore.
Should I file an issue about that?

10 years agoextra: Put the nail in the coffin, delete libextra
Alex Crichton [Fri, 14 Mar 2014 18:16:10 +0000 (11:16 -0700)]
extra: Put the nail in the coffin, delete libextra

This commit shreds all remnants of libextra from the compiler and standard
distribution. Two modules, c_vec/tempfile, were moved into libstd after some
cleanup, and the other modules were moved to separate crates as seen fit.

Closes #8784
Closes #12413
Closes #12576

10 years agoauto merge of #12869 : thestinger/rust/cmp, r=brson
bors [Fri, 14 Mar 2014 20:41:36 +0000 (13:41 -0700)]
auto merge of #12869 : thestinger/rust/cmp, r=brson

The `Float` trait provides correct `min` and `max` methods on floating
point types, providing a consistent result regardless of the order the
parameters are passed.

These generic functions do not take the necessary performance hit to
correctly support a partial order, so the true requirement should be
given as a type bound.

Closes #12712

10 years agocmp: switch `min` and `max` to `TotalOrd`
Daniel Micay [Sat, 8 Mar 2014 06:10:32 +0000 (01:10 -0500)]
cmp: switch `min` and `max` to `TotalOrd`

The `Float` trait provides correct `min` and `max` methods on floating
point types, providing a consistent result regardless of the order the
parameters are passed.

These generic functions do not take the necessary performance hit to
correctly support a partial order, so the true requirement should be
given as a type bound.

Closes #12712

10 years agodebuginfo: Make limited-debuginfo test case more robust against GDB output variations.
Michael Woerister [Fri, 14 Mar 2014 17:23:45 +0000 (18:23 +0100)]
debuginfo: Make limited-debuginfo test case more robust against GDB output variations.

Fixes issue #12787.

10 years agostd: Fix backtraces on arm linux
Alex Crichton [Fri, 14 Mar 2014 17:34:29 +0000 (10:34 -0700)]
std: Fix backtraces on arm linux

On android, libgcc is missing the _Unwind_GetIP symbol because it's defined as a
macro. This is the same case for arm linux, so this commit adds the necessary
cfgs in place to use the "expanded macro" in rust for arm linux.

10 years agorustc: Fix cfg(not(a, b)) to be not(a && b)
Alex Crichton [Fri, 14 Mar 2014 17:29:13 +0000 (10:29 -0700)]
rustc: Fix cfg(not(a, b)) to be not(a && b)

Previously, the cfg attribute `cfg(not(a, b))` was translated to `(!a && !b)`,
but this isn't very useful because that can already be expressed as
`cfg(not(a), not(b))`. This commit changes the translation to `!(a && b)` which
is more symmetrical of the rest of the `cfg` attribute.

Put another way, I would expect `cfg(clause)` to be the opposite of
`cfg(not(clause))`, but this is not currently the case with multiple element
clauses.

10 years agoRefactored iter and mut_iter
aochagavia [Fri, 14 Mar 2014 16:29:47 +0000 (17:29 +0100)]
Refactored iter and mut_iter

Replaced match by self.as_ref() and self.as_mut()

10 years agoauto merge of #12880 : tedhorst/rust/master, r=alexcrichton
bors [Fri, 14 Mar 2014 16:16:35 +0000 (09:16 -0700)]
auto merge of #12880 : tedhorst/rust/master, r=alexcrichton

Fix a test that was missed in the chan/port renaming (PR #12815).  This was missed because it is skipped on linux and windows, and the mac bots were moving at the time the PR landed.

10 years agoFixed comment of as_mut_slice (libstd/option.rs)
aochagavia [Fri, 14 Mar 2014 15:32:04 +0000 (16:32 +0100)]
Fixed comment of as_mut_slice (libstd/option.rs)

The old comment did not describe the function correctly

10 years agoauto merge of #12764 : Kimundi/rust/partial_typehint, r=nikomatsakis
bors [Fri, 14 Mar 2014 15:01:28 +0000 (08:01 -0700)]
auto merge of #12764 : Kimundi/rust/partial_typehint, r=nikomatsakis

# Summary

This patch introduces the `_` token into the type grammar, with the meaning "infer this type".
With this change, the following two lines become equivalent:
```
let x = foo();
let x: _ = foo();
```
But due to its composability, it enables partial type hints like this:
```
let x: Bar<_> = baz();
```

Using it on the item level is explicitly forbidden, as the Rust language does not enable global type inference by design.

This implements the feature requested in https://github.com/mozilla/rust/issues/9508.

# Things requiring clarification

- The change to enable it is very small, but I have only limited understanding of the related code, so the approach here might be wrong.
  - In particular, while this patch works, it does so in a way not originally intended according to the code comments.
- This probably needs more tests, or rather feedback for which tests are still missing.
- I'm unsure how this interacts with lifetime parameters, and whether it is correct in regard to them.
- Partial type hints on the right side of `as` like `&foo as *_` work in both a normal function contexts and in constexprs like `static foo: *int = &'static 123 as *_`. The question is whether this should be allowed in general.

# Todo for this PR

- The manual and tutorial still needs updating.

# Bugs I'm unsure how to fix

- Requesting inference for the top level of the right hand side of a `as` fails to infer correctly, even if all possible hints are given:

  ```
.../type_hole_1.rs:35:18: 35:22 error: the type of this value must be known in this context
.../type_hole_1.rs:35     let a: int = 1u32 as _;
                                           ^~~~
```

10 years agoAdded support for type placeholders (explicit requested type
Marvin Löbel [Mon, 10 Mar 2014 23:17:46 +0000 (00:17 +0100)]
Added support for type placeholders (explicit requested type
inference in a type with `_` ). This enables partial type inference.

10 years agoauto merge of #12875 : alexcrichton/rust/demangle-more-things, r=brson
bors [Fri, 14 Mar 2014 13:41:26 +0000 (06:41 -0700)]
auto merge of #12875 : alexcrichton/rust/demangle-more-things, r=brson

Add some more infrastructure support for demangling `$`-sequences, as well as fixing demangling of closure symbol names if there's more than one closure in a function.

10 years agoauto merge of #12874 : huonw/rust/printier-rustc, r=alexcrichton
bors [Fri, 14 Mar 2014 12:26:29 +0000 (05:26 -0700)]
auto merge of #12874 : huonw/rust/printier-rustc, r=alexcrichton

rustc: make stack traces print for .span_bug/.bug.

Previously a call to either of those to diagnostic printers would defer
to the `fatal` equivalents, which explicitly silence the stderr
printing, including a stack trace from `RUST_LOG=std::rt::backtrace`.

This splits the bug printers out to their own diagnostic type so that
things work properly.

Also, this removes the `Ok(...)` that was being printed around the
subtask's stderr output.

10 years agoauto merge of #12871 : aochagavia/rust/Optimize-while_some, r=alexcrichton
bors [Fri, 14 Mar 2014 11:06:31 +0000 (04:06 -0700)]
auto merge of #12871 : aochagavia/rust/Optimize-while_some, r=alexcrichton

The old 'while' needed to match 2 times for each iteration. With the new 'loop' there is just one match needed.

I have also replaced 'blk' by 'f' to be more consistent with parameter names in other functions that are implemented for Option<T>

10 years agoauto merge of #12867 : alexcrichton/rust/issue-12860, r=thestinger
bors [Fri, 14 Mar 2014 09:01:34 +0000 (02:01 -0700)]
auto merge of #12867 : alexcrichton/rust/issue-12860, r=thestinger

This switches a "tail call" to a manual loop to get around LLVM not optimizing
to a tail call.

Close #12860

10 years agoauto merge of #12864 : huonw/rust/hash-docs, r=alexcrichton
bors [Fri, 14 Mar 2014 07:41:34 +0000 (00:41 -0700)]
auto merge of #12864 : huonw/rust/hash-docs, r=alexcrichton

collections: move hashmap's example to the struct.

Most people go straight to the struct, not looking at the module, so the
example was well hidden.

10 years agoauto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger
bors [Fri, 14 Mar 2014 05:26:35 +0000 (22:26 -0700)]
auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger

lint: add lint for use of a `~[T]`.

This is useless at the moment (since pretty much every crate uses
`~[]`), but should help avoid regressions once completely removed from a
crate.

10 years agofix a test that was missed in the chan/port renaming (PR #12815)
Ted Horst [Fri, 14 Mar 2014 04:26:14 +0000 (23:26 -0500)]
fix a test that was missed in the chan/port renaming (PR #12815)

10 years agoauto merge of #12855 : alexcrichton/rust/shutdown, r=brson
bors [Fri, 14 Mar 2014 04:06:34 +0000 (21:06 -0700)]
auto merge of #12855 : alexcrichton/rust/shutdown, r=brson

This is something that is plausibly useful, and is provided by libuv. This is
not currently surfaced as part of the `TcpStream` type, but it may possibly
appear in the future. For now only the raw functionality is provided through the
Rtio objects.

10 years agofix MIPS target
Jyun-Yan You [Thu, 13 Mar 2014 06:35:24 +0000 (14:35 +0800)]
fix MIPS target

I ignored AtomicU64 methods on MIPS target
because libgcc doesn't implement MIPS32 64-bit atomic operations.
Otherwise it would cause link failure.

10 years agoauto merge of #12798 : pczarn/rust/inline-asm, r=alexcrichton
bors [Fri, 14 Mar 2014 01:41:35 +0000 (18:41 -0700)]
auto merge of #12798 : pczarn/rust/inline-asm, r=alexcrichton

## read+write modifier '+'
This small sugar was left out in the original implementation (#5359).

When an output operand with the '+' modifier is encountered, we store the index of that operand alongside the expression to create and append an input operand later. The following lines are equivalent:
```
asm!("" : "+m"(expr));
asm!("" : "=m"(expr) : "0"(expr));
```
## misplaced options and clobbers give a warning
It's really annoying when a small typo might change behavior without any warning.
```
asm!("mov $1, $0" : "=r"(x) : "r"(8u) : "cc" , "volatile");
//~^ WARNING expected a clobber, but found an option
```
## liveness
Fixed incorrect order of propagation.
Sometimes it caused spurious warnings in code: `warning: value assigned to `i` is never read, #[warn(dead_assignment)] on by default`

~~Note: Rebased on top of another PR. (uses other changes)~~

* [x] Implement read+write
* [x] Warn about misplaced options
* [x] Fix liveness (`dead_assignment` lint)
* [x] Add all tests

10 years agostd: render the vec_ng docs.
Huon Wilson [Thu, 13 Mar 2014 12:59:01 +0000 (23:59 +1100)]
std: render the vec_ng docs.

These are wildly incomplete, but having something there is better than
nothing, e.g. so that people know it exists, and many of the functions
behaviour can be guessed from the name or by checking the source: it's
knowing they exist at all that's the hard part.

10 years agolint: add lint for use of a `~[T]`.
Huon Wilson [Thu, 13 Mar 2014 07:53:14 +0000 (18:53 +1100)]
lint: add lint for use of a `~[T]`.

This is useless at the moment (since pretty much every crate uses
`~[]`), but should help avoid regressions once completely removed from a
crate.

10 years agorustc: Prevent collisions in names of closures
Alex Crichton [Thu, 13 Mar 2014 23:24:46 +0000 (16:24 -0700)]
rustc: Prevent collisions in names of closures

This commit goes back to using `gensym` to generate unique tokens to put into
the names of closures, allowing closures to be able to get demangled in
backtraces.

Closes #12400

10 years agostd: Demangle more escapes in backtraces
Alex Crichton [Thu, 13 Mar 2014 23:23:10 +0000 (16:23 -0700)]
std: Demangle more escapes in backtraces

The rust compiler not only outputs symbols in the form that C++ does, but it
also mangle symbols like '&' and '~' to special compiler-defined escape
sequences. For convenience, these symbols are demangled when printing
backtraces.

10 years agorustc: make stack traces print for .span_bug/.bug.
Huon Wilson [Thu, 13 Mar 2014 23:00:07 +0000 (10:00 +1100)]
rustc: make stack traces print for .span_bug/.bug.

Previously a call to either of those to diagnostic printers would defer
to the `fatal` equivalents, which explicitly silence the stderr
printing, including a stack trace from `RUST_LOG=std::rt::backtrace`.

This splits the bug printers out to their own diagnostic type so that
things work properly.

Also, this removes the `Ok(...)` that was being printed around the
subtask's stderr output.

10 years agoio: Bind to shutdown() for TCP streams
Alex Crichton [Thu, 13 Mar 2014 00:04:34 +0000 (17:04 -0700)]
io: Bind to shutdown() for TCP streams

This is something that is plausibly useful, and is provided by libuv. This is
not currently surfaced as part of the `TcpStream` type, but it may possibly
appear in the future. For now only the raw functionality is provided through the
Rtio objects.

10 years agoFix and improve inline assembly.
Piotr Czarnecki [Sun, 9 Mar 2014 22:41:18 +0000 (23:41 +0100)]
Fix and improve inline assembly.

Read+write modifier
Some documentation in asm.rs
rpass and cfail tests

10 years agoauto merge of #12815 : alexcrichton/rust/chan-rename, r=brson
bors [Thu, 13 Mar 2014 21:06:37 +0000 (14:06 -0700)]
auto merge of #12815 : alexcrichton/rust/chan-rename, r=brson

* Chan<T> => Sender<T>
* Port<T> => Receiver<T>
* Chan::new() => channel()
* constructor returns (Sender, Receiver) instead of (Receiver, Sender)
* local variables named `port` renamed to `rx`
* local variables named `chan` renamed to `tx`

Closes #11765

10 years agoRefactored while_some (libstd/option.rs)
aochagavia [Thu, 13 Mar 2014 20:28:36 +0000 (21:28 +0100)]
Refactored while_some (libstd/option.rs)

The old 'while' needed to match 2 times for each iteration. With the new
'loop' there is just one match needed.

I have also replaced 'blk' by 'f' to be more consistent with parameter
names in other functions that are implemented for Option

10 years agostd: Rename Chan/Port types and constructor
Alex Crichton [Sun, 9 Mar 2014 21:58:32 +0000 (14:58 -0700)]
std: Rename Chan/Port types and constructor

* Chan<T> => Sender<T>
* Port<T> => Receiver<T>
* Chan::new() => channel()
* constructor returns (Sender, Receiver) instead of (Receiver, Sender)
* local variables named `port` renamed to `rx`
* local variables named `chan` renamed to `tx`

Closes #11765

10 years agoauto merge of #12573 : lbonn/rust/unrecurs, r=alexcrichton
bors [Thu, 13 Mar 2014 19:16:34 +0000 (12:16 -0700)]
auto merge of #12573 : lbonn/rust/unrecurs, r=alexcrichton

As mentioned in #6109, ```mkdir_recursive``` doesn't really need to use recursive calls, so here is an iterative version.
The other points of the proposed overhaul (renaming and existing permissions) still need to be resolved.

I also bundled an iterative ```rmdir_recursive```, for the same reason.

Please do not hesitate to provide feedback on style as this is my first code change in rust.

10 years agoauto merge of #12561 : pzol/rust/char-case, r=alexcrichton
bors [Thu, 13 Mar 2014 17:56:35 +0000 (10:56 -0700)]
auto merge of #12561 : pzol/rust/char-case, r=alexcrichton

Added common and simple case folding, i.e. mapping one to one character mapping. For more information see http://www.unicode.org/faq/casemap_charprop.html

Removed auto-generated dead code which wasn't used.

10 years agocollections: Don't recurse in hashmap robin_hood
Alex Crichton [Thu, 13 Mar 2014 16:46:38 +0000 (09:46 -0700)]
collections: Don't recurse in hashmap robin_hood

This switches a "tail call" to a manual loop to get around LLVM not optimizing
to a tail call.

Close #12860

10 years agoauto merge of #12238 : ktt3ja/rust/lifetime-error-msg, r=nikomatsakis
bors [Thu, 13 Mar 2014 16:41:35 +0000 (09:41 -0700)]
auto merge of #12238 : ktt3ja/rust/lifetime-error-msg, r=nikomatsakis

For the following code snippet:

```rust
struct Foo { bar: int }
fn foo1(x: &Foo) -> &int {
    &x.bar
}
```

This PR generates the following error message:

```rust
test.rs:2:1: 4:2 note: consider using an explicit lifetime parameter as shown: fn foo1<'a>(x: &'a Foo) -> &'a int
test.rs:2 fn foo1(x: &Foo) -> &int {
test.rs:3     &x.bar
test.rs:4 }
test.rs:3:5: 3:11 error: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
test.rs:3     &x.bar
              ^~~~~~
```

Currently it does not support methods.

10 years agoauto merge of #12852 : itdaniher/rust/master, r=alexcrichton
bors [Thu, 13 Mar 2014 15:26:40 +0000 (08:26 -0700)]
auto merge of #12852 : itdaniher/rust/master, r=alexcrichton

This enables the lowering of llvm 64b intrinsics to hardware ops, resolving issues around `__kernel_cmpxchg64` on older kernels on ARM devices, and also enables use of the hardware floating point unit, resolving https://github.com/mozilla/rust/issues/10482.

10 years agoauto merge of #12849 : nick29581/rust/doubles, r=alexcrichton
bors [Thu, 13 Mar 2014 14:11:41 +0000 (07:11 -0700)]
auto merge of #12849 : nick29581/rust/doubles, r=alexcrichton

10 years agoauto merge of #12610 : eddyb/rust/deref-now-auto, r=nikomatsakis
bors [Thu, 13 Mar 2014 12:51:40 +0000 (05:51 -0700)]
auto merge of #12610 : eddyb/rust/deref-now-auto, r=nikomatsakis

Enables the dereference overloads introduced by #12491 to be applied wherever automatic dereferences would be used (field accesses, method calls and indexing).

10 years agoTweak comments
Niko Matsakis [Wed, 12 Mar 2014 17:38:17 +0000 (13:38 -0400)]
Tweak comments

10 years agocompile-fail: Beef up borrowck test to include some scenarios where we borrow mutably...
Niko Matsakis [Wed, 12 Mar 2014 17:31:00 +0000 (13:31 -0400)]
compile-fail: Beef up borrowck test to include some scenarios where we borrow mutably twice in a row

10 years agoRegion + borrow checker support and tests for overloaded autoderef.
Eduard Burtescu [Tue, 11 Mar 2014 20:27:55 +0000 (22:27 +0200)]
Region + borrow checker support and tests for overloaded autoderef.

10 years agoApply @nikomatsakis' nits and comments patch.
Eduard Burtescu [Sat, 8 Mar 2014 16:33:39 +0000 (18:33 +0200)]
Apply @nikomatsakis' nits and comments patch.

10 years agoIntroduce a common recursion limit for auto-dereference and monomorphization.
Eduard Burtescu [Thu, 6 Mar 2014 18:37:24 +0000 (20:37 +0200)]
Introduce a common recursion limit for auto-dereference and monomorphization.

10 years agoImplement automatic overloaded dereference.
Eduard Burtescu [Thu, 6 Mar 2014 17:24:11 +0000 (19:24 +0200)]
Implement automatic overloaded dereference.
Closes #7141.

10 years agoRemove Rc's borrow method to avoid conflicts with RefCell's borrow in Rc<RefCell...
Eduard Burtescu [Thu, 27 Feb 2014 22:02:27 +0000 (00:02 +0200)]
Remove Rc's borrow method to avoid conflicts with RefCell's borrow in Rc<RefCell<T>>.

10 years agoauto merge of #12845 : eddyb/rust/vec-no-drop-flag, r=thestinger
bors [Thu, 13 Mar 2014 11:36:36 +0000 (04:36 -0700)]
auto merge of #12845 : eddyb/rust/vec-no-drop-flag, r=thestinger

10 years agocollections: move hashmap's example to the struct.
Huon Wilson [Thu, 13 Mar 2014 11:31:56 +0000 (22:31 +1100)]
collections: move hashmap's example to the struct.

Most people go straight to the struct, not looking at the module, so the
example was well hidden.

10 years agoRemove code duplication
Piotr Zolnierek [Sat, 1 Mar 2014 06:40:38 +0000 (07:40 +0100)]
Remove code duplication

Remove whitespace

Update documentation for to_uppercase, to_lowercase

10 years agoImplement lower, upper case conversion for char
Piotr Zolnierek [Wed, 26 Feb 2014 12:49:56 +0000 (13:49 +0100)]
Implement lower, upper case conversion for char

10 years agostd::unicode: remove unused category tables
Piotr Zolnierek [Wed, 26 Feb 2014 08:36:11 +0000 (09:36 +0100)]
std::unicode: remove unused category tables

10 years agoauto merge of #12602 : alexcrichton/rust/backtrace, r=brson
bors [Thu, 13 Mar 2014 08:11:39 +0000 (01:11 -0700)]
auto merge of #12602 : alexcrichton/rust/backtrace, r=brson

Whenever a failure happens, if a program is run with
`RUST_LOG=std::rt::backtrace` a backtrace will be printed to the task's stderr
handle. Stack traces are uncondtionally printed on double-failure and
rtabort!().

This ended up having a nontrivial implementation, and here's some highlights of
it:

* We're bundling libbacktrace for everything but OSX and Windows
* We use libgcc_s and its libunwind apis to get a backtrace of instruction
  pointers
* On OSX we use dladdr() to go from an instruction pointer to a symbol
* On unix that isn't OSX, we use libbacktrace to get symbols
* Windows, as usual, has an entirely separate implementation

Lots more fun details and comments can be found in the source itself.

Closes #10128

10 years agoAdd basic backtrace functionality
Alex Crichton [Wed, 5 Feb 2014 23:19:40 +0000 (15:19 -0800)]
Add basic backtrace functionality

Whenever a failure happens, if a program is run with
`RUST_LOG=std::rt::backtrace` a backtrace will be printed to the task's stderr
handle. Stack traces are uncondtionally printed on double-failure and
rtabort!().

This ended up having a nontrivial implementation, and here's some highlights of
it:

* We're bundling libbacktrace for everything but OSX and Windows
* We use libgcc_s and its libunwind apis to get a backtrace of instruction
  pointers
* On OSX we use dladdr() to go from an instruction pointer to a symbol
* On unix that isn't OSX, we use libbacktrace to get symbols
* Windows, as usual, has an entirely separate implementation

Lots more fun details and comments can be found in the source itself.

Closes #10128

10 years agoauto merge of #12414 : DaGenix/rust/failing-iterator-wrappers, r=alexcrichton
bors [Thu, 13 Mar 2014 06:51:40 +0000 (23:51 -0700)]
auto merge of #12414 : DaGenix/rust/failing-iterator-wrappers, r=alexcrichton

Most IO related functions return an IoResult so that the caller can handle failure in whatever way is appropriate. However, the `lines`, `bytes`, and `chars` iterators all supress errors. This means that code that needs to handle errors can't use any of these iterators. All three of these iterators were updated to produce IoResults.

Fixes #12368

10 years agoauto merge of #12823 : alexcrichton/rust/issue-12666, r=pcwalton
bors [Thu, 13 Mar 2014 05:36:40 +0000 (22:36 -0700)]
auto merge of #12823 : alexcrichton/rust/issue-12666, r=pcwalton

If a TTY fails to get initialized, it still needs to have uv_close invoked on
it. This fixes the problem by constructing the TtyWatcher struct before the call
to uv_tty_init. The struct has a destructor on it which will close the handle
properly.

Closes #12666

10 years agoauto merge of #12822 : erickt/rust/cleanup, r=acrichto
bors [Thu, 13 Mar 2014 04:21:44 +0000 (21:21 -0700)]
auto merge of #12822 : erickt/rust/cleanup, r=acrichto

This PR makes `std::io::FileStat` hashable, and `Path` serializable as a byte array.

10 years agoUpdate io iterators to produce IoResults
Palmer Cox [Thu, 20 Feb 2014 02:53:46 +0000 (21:53 -0500)]
Update io iterators to produce IoResults

Most IO related functions return an IoResult so that the caller can handle failure
in whatever way is appropriate. However, the `lines`, `bytes`, and `chars` iterators all
supress errors. This means that code that needs to handle errors can't use any of these
iterators. All three of these iterators were updated to produce IoResults.

Fixes #12368

10 years agoauto merge of #12756 : pongad/rust/remove_owned_str_pat, r=alexcrichton
bors [Thu, 13 Mar 2014 02:21:44 +0000 (19:21 -0700)]
auto merge of #12756 : pongad/rust/remove_owned_str_pat, r=alexcrichton

match-drop-strs-issue-4541.rs deleted as it's the same with issue-4541.rs

10 years agosyntax: change the #[deriving(Hash)] typaram variable name
Erick Tryzelaar [Wed, 12 Mar 2014 03:07:42 +0000 (20:07 -0700)]
syntax: change the #[deriving(Hash)] typaram variable name

10 years agoserialize: make Paths serializable
Erick Tryzelaar [Tue, 11 Mar 2014 03:47:47 +0000 (20:47 -0700)]
serialize: make Paths serializable

10 years agostd: allow io::File* structs to be hashable
Erick Tryzelaar [Tue, 11 Mar 2014 03:47:25 +0000 (20:47 -0700)]
std: allow io::File* structs to be hashable

10 years agoauto merge of #12081 : cgaebel/rust/robinhood-hashing, r=alexcrichton
bors [Thu, 13 Mar 2014 01:06:47 +0000 (18:06 -0700)]
auto merge of #12081 : cgaebel/rust/robinhood-hashing, r=alexcrichton

Partially addresses #11783.

Previously, rust's hashtable was totally unoptimized. It used an Option
per key-value pair, and used very naive open allocation.

The old hashtable had very high variance in lookup time. For an example,
see the 'find_nonexisting' benchmark below. This is fixed by keys in
'lucky' spots with a low probe sequence length getting their good spots
stolen by keys with long probe sequence lengths. This reduces hashtable
probe length variance, while maintaining the same mean.

Also, other optimization liberties were taken. Everything is as cache
aware as possible, and this hashtable should perform extremely well for
both large and small keys and values.

Benchmarks:

```
comprehensive_old_hashmap         378 ns/iter (+/- 8)
comprehensive_new_hashmap         206 ns/iter (+/- 4)
1.8x faster

old_hashmap_as_queue              238 ns/iter (+/- 8)
new_hashmap_as_queue              119 ns/iter (+/- 2)
2x faster

old_hashmap_insert                172 ns/iter (+/- 8)
new_hashmap_insert                146 ns/iter (+/- 11)
1.17x faster

old_hashmap_find_existing         50 ns/iter (+/- 12)
new_hashmap_find_existing         35 ns/iter (+/- 6)
1.43x faster

old_hashmap_find_notexisting      49 ns/iter (+/- 49)
new_hashmap_find_notexisting      34 ns/iter (+/- 4)
1.44x faster

Memory usage of old hashtable (64-bit assumed):

aligned(8+sizeof(Option)+sizeof(K)+sizeof(V))/0.75 + 48ish bytes

Memory usage of new hashtable:

(aligned(sizeof(K))
+ aligned(sizeof(V))
+ 8)/0.9 + 112ish bytes

Timing of building librustc:

compile_and_link: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc
time: 0.457 s   parsing
time: 0.028 s   gated feature checking
time: 0.000 s   crate injection
time: 0.108 s   configuration 1
time: 1.049 s   expansion
time: 0.219 s   configuration 2
time: 0.222 s   maybe building test harness
time: 0.223 s   prelude injection
time: 0.268 s   assinging node ids and indexing ast
time: 0.075 s   external crate/lib resolution
time: 0.026 s   language item collection
time: 1.016 s   resolution
time: 0.038 s   lifetime resolution
time: 0.000 s   looking for entry point
time: 0.030 s   looking for macro registrar
time: 0.061 s   freevar finding
time: 0.138 s   region resolution
time: 0.110 s   type collecting
time: 0.072 s   variance inference
time: 0.126 s   coherence checking
time: 9.110 s   type checking
time: 0.186 s   const marking
time: 0.049 s   const checking
time: 0.418 s   privacy checking
time: 0.057 s   effect checking
time: 0.033 s   loop checking
time: 1.293 s   compute moves
time: 0.182 s   match checking
time: 0.242 s   liveness checking
time: 0.866 s   borrow checking
time: 0.150 s   kind checking
time: 0.013 s   reachability checking
time: 0.175 s   death checking
time: 0.461 s   lint checking
time: 13.112 s  translation
  time: 4.352 s llvm function passes
  time: 96.702 s    llvm module passes
  time: 50.574 s    codegen passes
time: 154.611 s LLVM passes
  time: 2.821 s running linker
time: 15.750 s  linking

compile_and_link: x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc
time: 0.422 s   parsing
time: 0.031 s   gated feature checking
time: 0.000 s   crate injection
time: 0.126 s   configuration 1
time: 1.014 s   expansion
time: 0.251 s   configuration 2
time: 0.249 s   maybe building test harness
time: 0.273 s   prelude injection
time: 0.279 s   assinging node ids and indexing ast
time: 0.076 s   external crate/lib resolution
time: 0.033 s   language item collection
time: 1.028 s   resolution
time: 0.036 s   lifetime resolution
time: 0.000 s   looking for entry point
time: 0.029 s   looking for macro registrar
time: 0.063 s   freevar finding
time: 0.133 s   region resolution
time: 0.111 s   type collecting
time: 0.077 s   variance inference
time: 0.565 s   coherence checking
time: 8.953 s   type checking
time: 0.176 s   const marking
time: 0.050 s   const checking
time: 0.401 s   privacy checking
time: 0.063 s   effect checking
time: 0.032 s   loop checking
time: 1.291 s   compute moves
time: 0.172 s   match checking
time: 0.249 s   liveness checking
time: 0.831 s   borrow checking
time: 0.121 s   kind checking
time: 0.013 s   reachability checking
time: 0.179 s   death checking
time: 0.503 s   lint checking
time: 14.385 s  translation
  time: 4.495 s llvm function passes
  time: 92.234 s    llvm module passes
  time: 51.172 s    codegen passes
time: 150.809 s LLVM passes
  time: 2.542 s running linker
time: 15.109 s  linking
```

BUT accesses are much more cache friendly. In fact, if the probe
sequence length is below 8, only two cache lines worth of hashes will be
pulled into cache. This is unlike the old version which would have to
stride over the stoerd keys and values, and would be more cache
unfriendly the bigger the stored values got.

And did you notice the higher load factor? We can now reasonably get a
load factor of 0.9 with very good performance.

Please review this very closely. This is my first major contribution to Rust. Sorry for the ugly diff!

10 years agorustuv: Fix a use-after-free in TTY failure
Alex Crichton [Tue, 11 Mar 2014 04:27:34 +0000 (21:27 -0700)]
rustuv: Fix a use-after-free in TTY failure

If a TTY fails to get initialized, it still needs to have uv_close invoked on
it. This fixes the problem by constructing the TtyWatcher struct before the call
to uv_tty_init. The struct has a destructor on it which will close the handle
properly.

Closes #12666

10 years agorustc: Remove matching on ~str from the language
Michael Darakananda [Fri, 7 Mar 2014 21:15:50 +0000 (16:15 -0500)]
rustc: Remove matching on ~str from the language

The `~str` type is not long for this world as it will be superseded by the
soon-to-come DST changes for the language. The new type will be
`~Str`, and matching over the allocation will no longer be supported.
Matching on `&str` will continue to work, in both a pre and post DST world.

10 years agoPerformance-oriented hashtable.
Clark Gaebel [Sat, 1 Mar 2014 03:23:53 +0000 (22:23 -0500)]
Performance-oriented hashtable.

Previously, rust's hashtable was totally unoptimized. It used an Option
per key-value pair, and used very naive open allocation.

The old hashtable had very high variance in lookup time. For an example,
see the 'find_nonexisting' benchmark below. This is fixed by keys in
'lucky' spots with a low probe sequence length getting their good spots
stolen by keys with long probe sequence lengths. This reduces hashtable
probe length variance, while maintaining the same mean.

Also, other optimization liberties were taken. Everything is as cache
aware as possible, and this hashtable should perform extremely well for
both large and small keys and values.

Benchmarks:

comprehensive_old_hashmap         378 ns/iter (+/- 8)
comprehensive_new_hashmap         206 ns/iter (+/- 4)
1.8x faster

old_hashmap_as_queue              238 ns/iter (+/- 8)
new_hashmap_as_queue              119 ns/iter (+/- 2)
2x faster

old_hashmap_insert                172 ns/iter (+/- 8)
new_hashmap_insert                146 ns/iter (+/- 11)
1.17x faster

old_hashmap_find_existing         50 ns/iter (+/- 12)
new_hashmap_find_existing         35 ns/iter (+/- 6)
1.43x faster

old_hashmap_find_notexisting      49 ns/iter (+/- 49)
new_hashmap_find_notexisting      34 ns/iter (+/- 4)
1.44x faster

Memory usage of old hashtable (64-bit assumed):

aligned(8+sizeof(K)+sizeof(V))/0.75 + 6 words

Memory usage of new hashtable:

(aligned(sizeof(K))
+ aligned(sizeof(V))
+ 8)/0.9 + 6.5 words

BUT accesses are much more cache friendly. In fact, if the probe
sequence length is below 8, only two cache lines worth of hashes will be
pulled into cache. This is unlike the old version which would have to
stride over the stoerd keys and values, and would be more cache
unfriendly the bigger the stored values got.

And did you notice the higher load factor? We can now reasonably get a
load factor of 0.9 with very good performance.

10 years agoauto merge of #12848 : alexcrichton/rust/rollup, r=alexcrichton
bors [Wed, 12 Mar 2014 22:07:06 +0000 (15:07 -0700)]
auto merge of #12848 : alexcrichton/rust/rollup, r=alexcrichton

10 years agoTest fixes from rolling up PRs
Alex Crichton [Wed, 12 Mar 2014 17:31:52 +0000 (10:31 -0700)]
Test fixes from rolling up PRs

Closes #12803 (std: Relax an assertion in oneshot selection) r=brson
Closes #12818 (green: Fix a scheduler assertion on yielding) r=brson
Closes #12819 (doc: discuss try! in std::io) r=alexcrichton
Closes #12820 (Use generic impls for `Hash`) r=alexcrichton
Closes #12826 (Remove remaining nolink usages) r=alexcrichton
Closes #12835 (Emacs: always jump the cursor if needed on indent) r=brson
Closes #12838 (Json method cleanup) r=alexcrichton
Closes #12843 (rustdoc: whitelist the headers that get a § on hover) r=alexcrichton
Closes #12844 (docs: add two unlisted libraries to the index page) r=pnkfelix
Closes #12846 (Added a test that checks that unary structs can be mutably borrowed) r=sfackler
Closes #12847 (mk: Fix warnings about duplicated rules) r=nmatsakis

10 years agomk: Fix warnings about duplicated rules
Alex Crichton [Wed, 12 Mar 2014 17:35:17 +0000 (10:35 -0700)]
mk: Fix warnings about duplicated rules

The footer.tex rule didn't depend on $(1) of the macro it was being defined in,
so it was getting duplicated, causing many warnings.

10 years agoAdded a test that checks that unary structs can be mutably borrowed.
Dmitry Promsky [Wed, 12 Mar 2014 15:54:43 +0000 (19:54 +0400)]
Added a test that checks that unary structs can be mutably borrowed.

Closes #11267

10 years agodocs: add two unlisted libraries to the index page.
Huon Wilson [Wed, 12 Mar 2014 12:19:09 +0000 (23:19 +1100)]
docs: add two unlisted libraries to the index page.

10 years agorustdoc: whitelist the headers that get a § on hover.
Huon Wilson [Wed, 12 Mar 2014 12:09:03 +0000 (23:09 +1100)]
rustdoc: whitelist the headers that get a § on hover.

Previously the :hover rules were making the links to the traits/types in
something like

    impl<K: Hash + Eq, V> ... { ... }

be displayed with a trailing `§` when hovered over. This commit
restricts that behaviour to specific headers, i.e. those that are known
to be section headers (like those rendered in markdown doc-comments, and
the "Modules", "Functions" etc. headings).