Mark Simulacrum [Sun, 14 May 2017 02:55:08 +0000 (20:55 -0600)]
Rollup merge of #41612 - mandeep:add-ops-generics, r=GuillaumeGomez,frewsxcv
Added generic example of std::ops::Add in doc comments
We discussed on IRC how the std::ops examples were potentially missing examples using generics. This PR adds an example to std::ops::Add that shows the use of a generic type T. I'm not sure this is ready for merge as I think the two examples now make the documentation a bit verbose, but I think it's a good starting point. I'd love to hear others thoughts on this. This is in relation to the last item in issue #29365.
bors [Sat, 13 May 2017 17:56:09 +0000 (17:56 +0000)]
Auto merge of #41914 - eddyb:region-refactor, r=nikomatsakis
rustc: simpler ParameterEnvironment and free regions.
The commits describe the slow transformation but the highlights are:
* `ReEarlyBound` is considered free, with a scope based on the item that defined the lifetime parameter, and the root body of the `RegionMaps` in use, removing the need for `free_substs`
* `liberate_late_bound_regions` and `implicit_region_bound` moved to typeck
* `CodeExtent` not interned at all now - ideally it would be 2 `u32` but it's small anyway
Future work building up on this could include:
* `ParameterEnvironment` becoming just the result of `predicates_of`
* interning makes my "parent chain" scheme unnecessary
* `implicit_region_bound` could be retrieved from `RegionMaps`
* renaming `CodeExtent` to `Scope`
* generalizing "call site" to "use site" or something better to include constants
* renaming `RegionMaps` to `ScopeTree` and its API to talk about "parents" explicitly
est31 [Fri, 12 May 2017 06:10:52 +0000 (08:10 +0200)]
Support #[allow] etc logic on a per macro level
This commit extends the current unused macro linter
to support directives like #[allow(unused_macros)]
or #[deny(unused_macros)] directly next to the macro
definition, or in one of the modules the macro is
inside. Before, we only supported such directives
at a per crate level, due to the crate's NodeId
being passed to session.add_lint.
We also had to implement handling of the macro's
NodeId in the lint visitor.
kennytm [Fri, 12 May 2017 14:48:46 +0000 (22:48 +0800)]
Fix #35829 (syntax extension's `quote_expr!()` does not handle b"…")
* Handles `b"…"`, `br#"…"#` and `...` for `quote_expr!()`.
* Refactored the match statement to allow it to complain loudly on any
unhandled token.
* Similarly, proc_macro's `quote!()` did not handle `br#"…"#` or `r#"…"#`,
so this commit fixes it too.
bors [Sat, 13 May 2017 09:12:09 +0000 (09:12 +0000)]
Auto merge of #41861 - arthurprs:update-jemalloc, r=alexcrichton
Update jemalloc to 4.5.0
* pointing jemalloc submodule to the 4.5.0 HEAD + generated configure script
* removed the now unnecessary extra config for windows. jemalloc is now much better at configuring itself overall.
bors [Sat, 13 May 2017 05:22:08 +0000 (05:22 +0000)]
Auto merge of #41847 - alexcrichton:less-unstable-annotations, r=eddyb
rustc: Add a new `-Z force-unstable-if-unmarked` flag
This commit adds a new `-Z` flag to the compiler for use when bootstrapping the
compiler itself. We want to be able to use crates.io crates, but we also want
the usage of such crates to be as ergonomic as possible! To that end compiler
crates are a little tricky in that the crates.io crates are not annotated as
unstable, nor do they expect to pull in unstable dependencies.
To cover all these situations it's intended that the compiler will forever now
bootstrap with `-Z force-unstable-if-unmarked`. This flags serves a dual purpose
of forcing crates.io crates to themselves be unstable while also allowing them
to use other "unstable" crates.io crates. This should mean that adding a
dependency to compiler no longer requires upstream modification with
unstable/staged_api attributes for inclusion!
Mark Simulacrum [Sat, 13 May 2017 00:57:36 +0000 (18:57 -0600)]
Rollup merge of #41940 - est31:master, r=eddyb
config.toml.example: point out that optimize = false won't speed up a full bootstrap
Originally I've learned about this by @eddyb pointing this out to me over IRC, and after having told someone today the same over IRC I've thought that this is a common mistake and should be prevented by a note in config.toml.example
est31 [Fri, 12 May 2017 06:21:00 +0000 (08:21 +0200)]
Remove some unused macros from the rust codebase
Removes unused macros from:
* libcore
* libcollections
The last use of these two macros was removed in commit b64c9d56700e2c41207166fe8709711ff02488ff
when the char_range_at_reverse function was been removed.
* librustc_errors
Their last use was removed by commits 2f2c3e178325dc1837badcd7573c2c0905fab979
and 11dc974a38fd533aa692cea213305056cd3a6902.
* libsyntax_ext
* librustc_trans
Also, put the otry macro in back/msvc/mod.rs under the
same cfg argument as the places that use it.
bors [Fri, 12 May 2017 07:33:10 +0000 (07:33 +0000)]
Auto merge of #41757 - alexcrichton:stabilize-crt-static, r=japaric
rustc: Stabilize `-C target-feature=+crt-static`
This commit stabilizes the `crt-static` feature accepted by the compiler. Note
that this does not stabilize the `#[cfg]` attribute for `crt-static` as
that's going to be covered by #29717. This only stabilizes a few small pieces:
* The `crt-static` feature as accepted by the `-C target-feature` flag, and its
connection with the platform-specific definition of `crt-static`.
* The semantics of `--print cfg` printing out activated `crt-static` feature, if
available.
This should be enough to get the benefits of `crt-static` on stable Rust with
MSVC and with musl, but sidsteps the issue of stabilizing #29717 first.
bors [Thu, 11 May 2017 22:37:38 +0000 (22:37 +0000)]
Auto merge of #41684 - jethrogb:feature/ntstatus, r=alexcrichton
Windows io::Error: also format NTSTATUS error codes
`NTSTATUS` errors may be encoded as `HRESULT`, see [[MS-ERREF]](https://msdn.microsoft.com/en-us/library/cc231198.aspx). These error codes can still be formatted using `FormatMessageW` but require some different parameters to be passed in.
I wasn't sure if this needed a test and if so, how to test it. Presumably we wouldn't want to make our tests dependent on localization-dependent strings returned from `FormatMessageW`.
Users that get an `err: NTSTATUS` will need to do `io::Error::from_raw_os_error(err|0x1000_0000)` (the equivalent of [`HRESULT_FROM_NT`](https://msdn.microsoft.com/en-us/library/ms693780(VS.85).aspx))
bors [Thu, 11 May 2017 16:56:17 +0000 (16:56 +0000)]
Auto merge of #41913 - nikomatsakis:issue-41849-variance-cycle, r=eddyb
do not fetch variance for items when equating
Fixes #41849. Problem was that evaluating the constant expression
required evaluating a trait, which would equate types, which would
request variance information, which it would then discard. However,
computing the variance information would require determining the type of
a field, which would evaluate the constant expression.
(This problem will potentially arise *later* as we move to more sophisticated
constants, however, where we need to check subtyping. We can tackle that
when we come to it.)
Niko Matsakis [Thu, 11 May 2017 14:54:19 +0000 (10:54 -0400)]
do not fetch variance for items when equating
Fixes #41849. Problem was that evaluating the constant expression
required evaluating a trait, which would equate types, which would
request variance information, which it would then discard. However,
computing the variance information would require determining the type of
a field, which would evaluate the constant expression.
(This problem will potentially arise *later* as we move to more sophisticated
constants, however, where we need to check subtyping. We can tackle that
when we come to it.)
bors [Thu, 11 May 2017 14:05:37 +0000 (14:05 +0000)]
Auto merge of #41864 - malbarbo:android-docker, r=alexcrichton
Add disabled android host builders
Introduce the concept of disabled builder. A disabled builder is one that is not run by travis. It is intended to be run by the user who wants a rustc for a tier 2 or 3 platform. Off corse, there is no guarantee that it will work.
bors [Thu, 11 May 2017 11:27:43 +0000 (11:27 +0000)]
Auto merge of #41863 - malbarbo:update-android-builder, r=alexcrichton
ci: Update android ndk and sdk
Make install-sdk.sh and install-ndk.sh more generic so future updates can be made directly on Dockerfile. Update ndk to r13b, which will be necessary to make host builds for android (in the future). Update sdk to r25.2.5 (maybe some emulator performance improvement).
Corey Farwell [Thu, 11 May 2017 04:21:27 +0000 (00:21 -0400)]
Rollup merge of #41877 - eddyb:gdb-force-rust, r=michaelwoerister
compiletest: force GDB to print values in the Rust format.
Based on @nodakai's https://github.com/rust-lang/rust/issues/40557#issuecomment-294368330 and @infinity0's https://github.com/rust-lang/rust/issues/40557#issuecomment-300133591.
Fixes #40557.
Corey Farwell [Thu, 11 May 2017 04:21:26 +0000 (00:21 -0400)]
Rollup merge of #41873 - michaelwoerister:fix-filemap-hash-lookup, r=nikomatsakis
ICH: Handle case of removed FileMaps.
This PR fixes a bug introduced in #41709 where removing a source file between compilation sessions would cause an ICE:
https://travis-ci.org/rust-icci/crossbeam/jobs/230582234#L633
Corey Farwell [Thu, 11 May 2017 04:21:24 +0000 (00:21 -0400)]
Rollup merge of #41192 - zackw:eprintln, r=alexcrichton
Add `eprint!` and `eprintln!` macros to the prelude.
These are exactly the same as `print!` and `println!` except that they write to stderr instead of stdout. Issues #39228 and #40528; previous PR #39229; accepted RFC rust-lang/rfcs#1869; proposed revision to The Book rust-lang/book#615.
I have _not_ revised this any since the original submission; I will do that later this week. I wanted to get this PR in place since it's been quite a while since the RFC was merged.
Known outstanding review comments:
* [x] @steveklabnik requested a new chapter for the unstable version of The Book -- please see if the proposed revisions to the second edition cover it.
* [x] @nodakai asked if it were possible to merge the internal methods `_print` and `_eprint` - not completely, since they both refer to different internal globals which we don't want to expose, but I will see if some duplication can be factored out.
Steve Klabnik [Wed, 10 May 2017 15:18:33 +0000 (17:18 +0200)]
Rollup merge of #41854 - gamazeps:thread-spawn-doc, r=steveklabnik
[Doc] Improve `thread::spawn` documentation
Part of #29378
- Add two examples to `thread::spawn` doumentation that show common uses of threads.
- Add a link to `thread::Builder` in the `thread::spawn` documentation for configuring threads.
- Add a link to `thread::spawn` in `thread::Builder` in order to avoid documentation duplication.