Commit Graph

57669 Commits

Author SHA1 Message Date
Nicholas Nethercote
6a9b5e4c51 Clarify HashMap's capacity handling.
This commit does the following.

- Changes the terminology for capacities used within HashMap's code.
  "Internal capacity" is now consistently "raw capacity", and "usable
  capacity" is now consistently just "capacity". This makes the code
  easier to understand.

- Reworks capacity and raw capacity computations. Raw capacity
  computations are now handled in a single place:
  `DefaultResizePolicy::raw_capacity()`. This function correctly returns
  zero when given zero, which means that the following cases now result
  in a capacity of zero when they previously did not.

  * `Hash{Map,Set}::with_capacity(0)`
  * `Hash{Map,Set}::with_capacity_and_hasher(0)`
  * `Hash{Map,Set}::shrink_to_fit()`, when used with a hash map/set whose
    elements have all been removed

- Strengthens the language used in the comments describing the above
  functions, to make it clearer when they will result in a map/set with
  a capacity of zero. The new language is based on the language used for
  the corresponding functions in `Vec`.

- Adds tests for the above zero-capacity cases.

- Removes `test_resize_policy` because it is no longer useful.
2016-09-29 20:38:35 +10:00
bors
91f34c0c70 Auto merge of #36818 - jonathandturner:rollup, r=jonathandturner
Rollup of 12 pull requests

- Successful merges: #35286, #35892, #36460, #36704, #36741, #36760, #36787, #36789, #36794, #36803, #36811, #36813
- Failed merges:
2016-09-28 21:55:15 -07:00
James Miller
ec2e05194f Resolve the callee type in check_call before autoderef
If the callee type is an associated type, then it needs to be normalized
before trying to deref it. This matches the behaviour of
`check_method_call` for autoderef behaviour in calls.

Fixes #36786
2016-09-29 17:07:03 +13:00
Pweaver (Paul Weaver)
5e3aaab2f6 #36680 add warning when compliation cache fails to hard link 2016-09-29 00:03:13 -04:00
Jeffrey Seyfried
4bec961a21 Add regression test. 2016-09-29 03:52:09 +00:00
Jonathan Turner
f12f9504b3 Rollup merge of #36813 - palango:link-to-fmt, r=steveklabnik
Add link to format! docs
2016-09-28 20:21:53 -07:00
Jonathan Turner
02c050644b Rollup merge of #36811 - brson:bootstrap, r=alexcrichton
Update bootstrap compiler
2016-09-28 20:21:52 -07:00
Jonathan Turner
47a335b677 Rollup merge of #36803 - brson:node, r=alexcrichton
Move nodejs detection into bootstrap

This avoids issues with mingw path conversions.

r? @alexcrichton
2016-09-28 20:21:52 -07:00
Jonathan Turner
9143c3c9c0 Rollup merge of #36794 - japaric:target-panic, r=alexcrichton
add a panic-strategy field to the target specification

Now a target can define its panic strategy in its specification. If a
user doesn't specify a panic strategy via the command line, i.e. '-C
panic', then the compiler will use the panic strategy defined by the
target specification.

Custom targets can pick their panic strategy via the "panic-strategy"
field of their target specification JSON file. If omitted in the
specification, the strategy defaults to "unwind".

closes #36647

---

I checked that compiling an executable for a custom target with "panic-strategy" set to "abort" doesn't need the "eh_personality" lang item and also that standard crates compiled for that custom target didn't contained undefined symbols to _Unwind_Resume. But this needs an actual unit test, any suggestion on how to test this?

Most of the noise in the diff is due to moving `PanicStrategy` from the `rustc` to the `rustc_back` crate.

r? @alexcrichton
cc @phil-opp
2016-09-28 20:21:52 -07:00
Jonathan Turner
f1ea5cc273 Rollup merge of #36789 - jseyfried:non_inline_mod_in_block, r=nikomatsakis
Allow more non-inline modules in blocks

Currently, non-inline modules without a `#[path]` attribute are not allowed in blocks.
This PR allows non-inline modules that have an ancestor module with a `#[path]` attribute, provided there is not a nearer ancestor block.

For example,
```rust
fn main() {
    #[path = "..."] mod foo {
        mod bar; //< allowed by this PR
        fn f() {
            mod bar; //< still an error
        }
    }
}
```

Fixes #36772.
r? @nikomatsakis
2016-09-28 20:21:52 -07:00
Jonathan Turner
13c8e763d4 Rollup merge of #36787 - jseyfried:fix_test_harness_reexport_errors, r=nrc
Avoid re-export errors in the generated test harness

Fixes #36768.
r? @nrc
2016-09-28 20:21:51 -07:00
Jonathan Turner
45fd0626a4 Rollup merge of #36760 - nrc:input2, r=alexcrichton
Allow supplying an error destination via the compiler driver

Allows replacing stderr with a buffer from the client.

Also, some refactoring around run_compiler.
2016-09-28 20:21:51 -07:00
Jonathan Turner
8f2c000506 Rollup merge of #36741 - matklad:no-flacky-test, r=alexcrichton
Remove CString drop test.

The test relies on the undefined behavior, and so may fail in some
circumstances. This can be worked around by stubbing a memory allocator
in the test, but it is a bit of work, and LLVM could still theoretically
eliminate the write of the zero byte in release mode (which is
intended).

So let's just remove the test and mark the function as inline. It
shouldn't be optimized away when inlined into the debug build of user's
code.

Supersedes #36607

r? @alexcrichton
2016-09-28 20:21:51 -07:00
Jonathan Turner
725d0f5d6a Rollup merge of #36704 - Mark-Simulacrum:cleanup-cabi, r=Aatch
Move ty_align and ty_size out of most C ABI code

s390x's C ABI ty_align and ty_size are not moved because the
implementation of ty_align varies in an atypical pattern: it calls
ty_size for the llvm::Vector type kind. ty_size then cannot be moved
since it indirectly calls ty_align through align.

Fixes #5116 (probably, not sure).
2016-09-28 20:21:51 -07:00
Jonathan Turner
94622260a8 Rollup merge of #36460 - mikhail-m1:35123-map3, r=nikomatsakis
map crate numbers between compilations

?r nikomatsakis
issue #35123
2016-09-28 20:21:50 -07:00
Jonathan Turner
55c9bc2556 Rollup merge of #35892 - srinivasreddy:typeck/coherence, r=nikomatsakis
run rustfmt on typecheck/coherence folder
2016-09-28 20:21:50 -07:00
Jonathan Turner
83c54dc971 Rollup merge of #35286 - dns2utf8:doc_never_expression, r=nikomatsakis
Add docs for "!" Never type (rfc 1216)

Pull Request: https://github.com/rust-lang/rfcs/pull/1216
Tracking Issue: #35121
2016-09-28 20:21:50 -07:00
Jeffrey Seyfried
316f7bb1a8 Fix ICE on a macro in a constant integer position that expands into other macros. 2016-09-29 02:25:21 +00:00
bors
eee2d04d87 Auto merge of #36395 - durka:rangeinclusive-no-esi, r=alexcrichton
remove ExactSizeIterator from RangeInclusive<{u,i}{32,size}>

Fixes #36386.

This is a [breaking-change] for nightly users of `#![feature(inclusive_range_syntax)]` and/or `#![feature(inclusive_range)]`.
2016-09-28 18:31:07 -07:00
Alex Crichton
d68f7eb865 rustbuild: Use current_dir instead of -C
Apparently some versions of git don't support the `-C` flag, so let's use the
guaranteed-to-work `current_dir` function.
2016-09-28 16:45:17 -07:00
Jonas Schievink
d2c8893137 Remove MIR dump comments from mir-opt tests
They're ignored by the test runner, so let's not suggest that they
matter
2016-09-29 01:22:11 +02:00
Brian Anderson
3b49c60ab7 Remove stage0 hacks 2016-09-28 23:17:56 +00:00
Jonas Schievink
34155a87f6 Change the local prefix to _
There's no need for a long prefix, since there's nothing to distinguish
anymore.
2016-09-29 01:11:54 +02:00
Jeffrey Seyfried
174f093651 Add regression test. 2016-09-28 22:16:23 +00:00
Jeffrey Seyfried
ce5ad1da12 Allow non-inline modules in more places. 2016-09-28 22:16:20 +00:00
bors
86affcdf6c Auto merge of #36805 - jonathandturner:rollup, r=jonathandturner
Rollup of 11 pull requests

- Successful merges: #36376, #36672, #36740, #36757, #36765, #36769, #36782, #36783, #36784, #36795, #36796
- Failed merges:
2016-09-28 15:03:26 -07:00
Paul Lange
c48b7abd4c Add link to format! docs 2016-09-29 00:02:02 +02:00
Jonas Schievink
bc2b28387c Fix rebase fallout 2016-09-28 22:31:20 +02:00
Jonas Schievink
e59756ee92 Fix tidy 2016-09-28 22:31:20 +02:00
Jonas Schievink
48e5199de3 libsyntax: clearer names for some AST parts
This applies the HIR changes from the previous commits to the AST, and
is thus a syntax-[breaking-change]

Renames `PatKind::Vec` to `PatKind::Slice`, since these are called slice
patterns, not vec patterns. Renames `TyKind::Vec`, which represents the
type `[T]`, to `TyKind::Slice`. Renames `TyKind::FixedLengthVec` to
`TyKind::Array`.
2016-09-28 22:31:18 +02:00
Jonas Schievink
cf0b7bdd0c Call arrays "arrays" instead of "vecs" internally 2016-09-28 22:30:30 +02:00
Jonas Schievink
69c3d0add4 Remove unused TypeError variants
These weren't flagged by the lint because they were still technically
created somewhere... if you created them before, somehow.
2016-09-28 22:30:30 +02:00
Brian Anderson
6ffb39bd08 Update bootstrap compiler 2016-09-28 20:20:25 +00:00
bors
f17b1e03df Auto merge of #36795 - TimNN:fix-36793, r=eddyb
TypeIdHasher: hash usize as u64

Fixes #36793.
2016-09-28 11:52:25 -07:00
Mathieu Poumeyrol
5980d5bfdd use MSG_NOSIGNAL from liblibc 2016-09-28 19:44:20 +02:00
Mathieu Poumeyrol
ed5e542819 MSG_NOSIGNAL on linux 2016-09-28 19:43:11 +02:00
Mathieu Poumeyrol
6f6e261e20 set SO_NOSIGPIPE on apple platforms 2016-09-28 19:43:11 +02:00
Jonathan Turner
ac82eaaafe Rollup merge of #36796 - TimNN:mips64-data-layout, r=japaric
update mips64* data-layout

I tried to compile some (`#![no_core]`) code for the `mips64` targets on the latest nightly and got ICE's about mismatched data layouts. I updated the data layouts to match the listed llvm defaults.

cc @japaric

Funnily enough, this seems to be the exact reverse of what @japaric did in 2222d437a7 as part of #36024.
2016-09-28 10:33:58 -07:00
Jonathan Turner
46746012e7 Rollup merge of #36795 - TimNN:fix-36793, r=eddyb
TypeIdHasher: hash usize as u64

Fixes #36793.
2016-09-28 10:33:58 -07:00
Jonathan Turner
723ddd1ca7 Rollup merge of #36784 - jonathandturner:env_var, r=alexcrichton
Remove requirement to use 10.7 (fixes macOS)

Fixes https://github.com/rust-lang/rust/issues/36650 by removing the requirement to use 10.7.  @alexcrichton pointed out that the buildbots won't be affected, since they set the requirement with an environment variable.

This should now allow rustbuild to build Rust on macOS (nee OS X)

r? @alexcrichton
2016-09-28 10:33:57 -07:00
Jonathan Turner
452bb07050 Rollup merge of #36783 - die4taoam:master, r=alexcrichton
testcase about issue-18088

this testcase is associated with issue #18088 . you can find that here. https://github.com/rust-lang/rust/issues/18088.
2016-09-28 10:33:57 -07:00
Jonathan Turner
f819b4d72d Rollup merge of #36782 - alexcrichton:rustc-macro-expand-order, r=nrc
rustc: Tweak expansion order of custom derive

This commit alters the expansion order of custom macros-1.1 style `#[derive]`
modes. Instead of left-to-right the expansion now happens in three categories,
each of which is internally left-to-right:

* Old-style custom derive (`#[derive_Foo]`) is expanded
* New-style custom derive (macros 1.1) is expanded
* Built in derive modes are expanded

This gives built in derive modes maximal knowledge about the struct that's being
expanded and also avoids pesky issues like exposing `#[structural_match]` or
`#[rustc_copy_clone_marker]`.

cc #35900
2016-09-28 10:33:57 -07:00
Jonathan Turner
f7f1903b89 Rollup merge of #36769 - nathanmusoke:master, r=apasel422
doc: Fix minor typo in book/variable-bindings.md

r? @steveklabnik
2016-09-28 10:33:57 -07:00
Jonathan Turner
9a17da2470 Rollup merge of #36765 - frewsxcv:ptr-write-bytes, r=steveklabnik
Add basic doc example for `core::ptr::write_bytes`.

None
2016-09-28 10:33:56 -07:00
Jonathan Turner
224e882878 Rollup merge of #36757 - KiChjang:E0025-format, r=jonathandturner
Update E0025 to new error format

Part of #35233.
Fixes #35198.

r? @jonathandturner
2016-09-28 10:33:56 -07:00
Jonathan Turner
4676bb0172 Rollup merge of #36740 - frehberg:apidoc, r=steveklabnik
Document init of HashSet/HashMap from vector
2016-09-28 10:33:56 -07:00
Jonathan Turner
fe0729d2e4 Rollup merge of #36672 - LinkiTools:master, r=steveklabnik
Improve documention troubleshooting missing linker. Fix #32208.

@steveklabnik is this in the direction on how you want to see #32208 fixed?
2016-09-28 10:33:56 -07:00
Jonathan Turner
475a41bd50 Rollup merge of #36376 - GuillaumeGomez:e0050, r=jonathandturner
Update E0050 to new error format

Part of #35233.
Fixes #35211.

r? @jonathandturner
2016-09-28 10:33:56 -07:00
Brian Anderson
27588dd7a1 Move nodejs detection into bootstrap
This avoids issues with mingw path conversions.
2016-09-28 09:05:19 -07:00
Jorge Aparicio
8a46e78e64 fix librustc test: panic is Option<PanicStrategy> now 2016-09-28 10:57:31 -05:00