Commit Graph

67625 Commits

Author SHA1 Message Date
Guillaume Gomez
76e32210d1 Add license exceptions 2017-08-30 20:07:58 +02:00
Alex Crichton
fd4f362b30 Rollup merge of #44125 - SergioBenitez:master, r=nrc
Initial diagnostic API for proc-macros.

This commit introduces the ability to create and emit `Diagnostic` structures from proc-macros, allowing for proc-macro authors to emit warning, error, note, and help messages just like the compiler does.

The API is somewhat based on the diagnostic API already present in `rustc` with several changes that improve usability. The entry point into the diagnostic API is a new `Diagnostic` type which is primarily created through new `error`, `warning`, `help`, and `note` methods on `Span`. The `Diagnostic` type records the diagnostic level, message, and optional `Span` for the top-level diagnostic and contains a `Vec` of all of the child diagnostics. Child diagnostics can be added through builder methods on `Diagnostic`.

A typical use of the API may look like:

```rust
let token = parse_token();
let val = parse_val();

val.span
    .error(format!("expected A but found {}", val))
    .span_note(token.span, "because of this token")
    .help("consider using a different token")
    .emit();
```

cc @jseyfried @nrc @dtolnay @alexcrichton
2017-08-30 11:11:12 -05:00
Alex Crichton
bc6981ba55 Rollup merge of #44116 - alexcrichton:update-libc, r=Mark-Simulacrum
Update the libc submodule

Brings in a few fixes for wasm/asmjs
2017-08-30 11:11:11 -05:00
Alex Crichton
63cc2dda63 Rollup merge of #44089 - alexcrichton:trait-proc-macro, r=nrc
rustc: Fix proc_macro expansions on trait methods

This commit fixes procedural macro attributes being attached to trait methods,
ensuring that they get resolved and expanded as other procedural macro
attributes. The bug here was that `current_module` on the resolver was
accidentally set to be a trait when it's otherwise only ever expecting a
`mod`/block module. The actual fix here came from @jseyfried, I'm just helping
to land it in the compiler!

Closes #42493
2017-08-30 11:11:10 -05:00
Alex Crichton
581dc93293 Rollup merge of #44044 - mattico:string-splice-return, r=dtolnay
Remove Splice struct return value from String::splice

The implementation is now almost identical to the one in the RFC.

Fixes #44038
cc #32310
2017-08-30 11:11:09 -05:00
bors
51a54b6dc0 Auto merge of #43895 - JeremySorensen:master, r=alexcrichton
make ignore-git true by default when channel is dev

Fixes #43771
(Handle git info in rustbuild differently)
2017-08-30 15:43:09 +00:00
bors
ca9cf3594a Auto merge of #43968 - petrochenkov:span2, r=michaelwoerister
Make fields of `Span` private

I actually tried to intern spans and benchmark the result<sup>*</sup>, and this was a prerequisite.
This kind of encapsulation will be a prerequisite for any other attempt to compress span's representation, so I decided to submit this change alone.

The issue https://github.com/rust-lang/rust/issues/43088 seems relevant, but it looks like `SpanId` won't be able to reuse this interface, unless the tables are global (like interner that I tried) and are not a part of HIR.
r? @michaelwoerister anyway

<sup>*</sup> Interning means 2-3 times more space is required for a single span, but duplicates are free. In practice it turned out that duplicates are not *that* common, so more memory was wasted by interning rather than saved.
2017-08-30 11:08:26 +00:00
Guillaume Gomez
9b26f3ad25 Remove some false positive issues 2017-08-30 11:46:58 +02:00
bors
c66e7fa8de Auto merge of #43903 - oli-obk:alignto, r=aturon
Add align_offset intrinsic

see https://github.com/rust-lang/rfcs/pull/2043 for details and the plan towards stabilization (reexport in `core::mem` via various convenience functions)

as per @scottmcm 's [comment](https://github.com/rust-lang/rfcs/pull/2043#issuecomment-316818169), this is just the intrinsic (which is obviously unstable).
2017-08-30 08:06:42 +00:00
Guillaume Gomez
bba7fd9dd5 Temporary fix for a test (will require another update when this is fully merged) 2017-08-30 09:40:43 +02:00
Guillaume Gomez
f2774b7ac3 Print warning whatever the rendering mode 2017-08-30 09:40:43 +02:00
Guillaume Gomez
33d99e526e Set python binary name to python 2.7 2017-08-30 09:40:43 +02:00
Guillaume Gomez
e1367ef1b1 Update unstable-crate test 2017-08-30 09:40:43 +02:00
Guillaume Gomez
274543b9ca Add warnings when rustdoc html rendering differs 2017-08-30 09:40:43 +02:00
bors
b58e31ac03 Auto merge of #43880 - arielb1:noninvasive-probe, r=nikomatsakis
Remove the trait selection impl in method::probe

This removes the hacky trait selection reimplementation in `method::probe`, which occasionally comes and causes problems.

There are 2 issues I've found with this approach:
1. The older implementation sometimes had a "guess" type from an impl, which allowed subtyping to work. This is why I needed to make a change in `libtest`: there's an `impl<A> Clone for fn(A)` and we're calling `<for<'a> fn(&'a T) as Clone>::clone`. The older implementation would do a subtyping between the impl type and the trait type, so it would do the check for `<fn(A) as Clone>::clone`, and confirmation would continue with the subtyping. The newer implementation directly passes `<for<'a> fn(&'a T) as Clone>::clone` to selection, which fails. I'm not sure how big of a problem that would be in reality, especially after #43690 would remove the `Clone` problem, but I still want a crater run to avoid breaking the world.
2. The older implementation "looked into" impls to display error messages. I'm not sure that's an advantage - it looked exactly 1 level deep.

r? @eddyb
2017-08-30 05:30:28 +00:00
Jeremy Sorensen
4f591a47d5 fix option for RUST_CONFIGURE_ARGS to be rust.ignore-git=false 2017-08-29 22:01:51 -07:00
Alex Crichton
942c8dcf19 rustc: Make the export_map of TyCtxt private
This map, like `trait_map`, is calculated in resolve, but we want to be sure to
track it for incremental compliation. Hide it behind a query to get more
refactorings later.
2017-08-29 22:00:40 -07:00
Jeremy Sorensen
873a05e85c allow value of key/value pair argument to set option be boolean 2017-08-29 21:57:48 -07:00
Matt Ickstadt
6f7594d506 Fix link in unstable book entry for Generators 2017-08-29 22:27:50 -05:00
bors
c2f9cc4a3b Auto merge of #44143 - alexcrichton:faster-bootstrap, r=Mark-Simulacrum
rustbuild: Avoid some extraneous rustc compiles on cross builds

This tweaks a few locations here and there to avoid compiling rustc too many times on our cross-builders on CI.

Closes https://github.com/rust-lang/rust/issues/44132
2017-08-30 02:56:48 +00:00
bors
09ea6b7a82 Auto merge of #43938 - arielb1:closure-key, r=nikomatsakis
Track closure signatures & kinds in freshened types

r? @nikomatsakis
2017-08-30 00:25:23 +00:00
Andy Gauge
80d513aaec broken links resolved 2017-08-29 16:39:11 -07:00
Vadim Petrochenkov
a0c32641fd Make fields of Span public again
This helps to avoid landing changes to rustc and rustfmt in one step
2017-08-30 01:41:05 +03:00
Vadim Petrochenkov
71dfe6487d Normalize order of lo and hi in Span::new 2017-08-30 01:39:51 +03:00
Vadim Petrochenkov
3da868dcb6 Make fields of Span private 2017-08-30 01:38:54 +03:00
Alex Crichton
32d35e6e9f rustc: Make the trait_map of TyCtxt private
This map is calculated in resolve, but we want to be sure to track it for
incremental compliation. Hide it behind a query to get more refactorings later.
2017-08-29 14:53:03 -07:00
bors
c11f689d24 Auto merge of #44169 - arielb1:rollup, r=arielb1
Rollup of 12 pull requests

- Successful merges: #43705, #43778, #43918, #44076, #44117, #44121, #44126, #44134, #44135, #44141, #44144, #44158
- Failed merges:
2017-08-29 21:42:34 +00:00
Ariel Ben-Yehuda
be0ac0124c Rollup merge of #44158 - dtolnay:zero48, r=sfackler
Use a byte literal ASCII 0 instead of its decimal value

@SimonSapin noticed this in https://github.com/dtolnay/itoa/pull/8.
2017-08-29 21:41:04 +00:00
Ariel Ben-Yehuda
a88757e0cd Rollup merge of #44144 - alexcrichton:faster-hash-and-sign, r=Mark-Simulacrum
rustbuild: Fix dependencies of build-manifest

No need to depend on librustc! All we need is libstd

Closes #44140
2017-08-29 21:41:03 +00:00
Ariel Ben-Yehuda
294ce22f76 Rollup merge of #44141 - nrc:rls-preview-beta, r=alexcrichton
Rename the rls component to rls-preview on beta/stable

Background is that we will have automatic renaming with the next rustup release. We'll then rename rls to rls-preview. In the meantime, this ensures beta/stable users will always have rls-preview.

r? @alexcrichton
2017-08-29 21:41:02 +00:00
Ariel Ben-Yehuda
588f83324d Rollup merge of #44135 - GuillaumeGomez:fix-css-links, r=QuietMisdreavus
Fix invalid linker position

Fixes #44120.

Result isn't "optimal" though because there are spaces at the end of some lines.
2017-08-29 21:41:01 +00:00
Ariel Ben-Yehuda
d59aa7d846 Rollup merge of #44134 - vorner:x-py-unknown-cmd, r=nikomatsakis
Fail ./x.py on invalid command

Make the ./x.py script fail when run with an invalid command, like:

```
./x.py nonsense
```

This helps in case of chaining multiple runs, eg.:

```
./x.py biuld && ./x.py test
```
2017-08-29 21:41:00 +00:00
Ariel Ben-Yehuda
29f360b179 Rollup merge of #44126 - laumann:config-doc-comments, r=nikomatsakis
compiletest: Change Config comments to doc comments

I plan to make the same change in compiletest-rs, to have some documentation in [the docs](https://docs.rs/compiletest_rs/0.2.9/compiletest_rs/common/struct.Config.html).
2017-08-29 21:40:59 +00:00
Ariel Ben-Yehuda
ec83edabb3 Rollup merge of #44121 - ishitatsuyuki:bootstrap-deps-purge, r=Mark-Simulacrum
bootstrap: remove unneeded extern crate

The crate itself is internally referenced by serde_derive.
2017-08-29 21:40:58 +00:00
Ariel Ben-Yehuda
30907e1a27 Rollup merge of #44117 - frewsxcv:frewsxcv-to-socket-addrs-examples, r=QuietMisdreavus
Rewrite `std::net::ToSocketAddrs` doc examples.

in particular:

* show how to create an iterator that yields multiple socket addresses
* show more failing scenarios

done this as preliminary work while investigating https://github.com/rust-lang/rust/issues/22569

note: i haven't run doc tests on my machine for this, so would be good to confirm CI passes before approving
2017-08-29 21:40:57 +00:00
Ariel Ben-Yehuda
ba304b96c4 Rollup merge of #44076 - RalfJung:src, r=alexcrichton
include Cargo.{toml,lock} in rust-src tarball

The lock file is interesting because e.g. xargo could use it to build libstd against the same dependencies that were used for the main build. More generally speaking, just documenting in this form which exact dependencies should be used IMHO makes lots of sense.

I added the Cargo.toml mostly because having the lock without the toml feels odd. Of course, the toml contains references to paths that don't actually exist in the rust-src tarball. Not sure if that is considered a problem.
2017-08-29 21:40:56 +00:00
Ariel Ben-Yehuda
b1fff23f60 Rollup merge of #43918 - mystor:rustdoc-pound, r=QuietMisdreavus
Don't highlight # which does not start an attribute in rustdoc

Currently when we highlight some macros for rustdoc (e.g. `quote!` from https://github.com/dtolnay/quote), we get really bad syntax highlighting, because we assume that every token between a `#` character and the next `]` in the source must be an attribute.

This patch improves that highlighting behavior to instead only highlight after finding the `[` token after the `#` token.

(NOTE: I've only run this patch against https://github.com/nrc/rustdoc-highlight so if it doesn't build on travis that's why - I don't have a recent rustc build on this laptop)

I'm guessing r? @steveklabnik
2017-08-29 21:40:55 +00:00
Ariel Ben-Yehuda
64a21f875f Rollup merge of #43778 - topecongiro:handler-reset-err-count, r=arielb1
Add reset_err_count() to errors::Handler

The motivation here is to allow rustfmt to recover from parse errors after failing to parse macros (cc https://github.com/rust-lang-nursery/rustfmt/issues/1742).
r? @nrc
2017-08-29 21:40:54 +00:00
Ariel Ben-Yehuda
11e75fd115 Rollup merge of #43705 - panicbit:option_ref_mut_cloned, r=aturon
libcore: Implement cloned() for Option<&mut T>

None
2017-08-29 21:40:53 +00:00
Andrew Gauger
84c5441e70 fix test failures in documentation change 2017-08-29 12:53:12 -07:00
bors
630e02f25b Auto merge of #43648 - RalfJung:jemalloc-debug, r=alexcrichton
Fix alloc_jemalloc debug feature

At least, I think that's how it should be.  'debug' is how the feature is called in liballoc_jemalloc/Cargo.toml and libstd/Cargo.toml. I verified this by making the build script panic rather than adding `--enable-debug`, and without this PR, the panic does not occur even when I set `debug-jemalloc = true` in config.toml. With the PR, the panic occurs as expected.

However, I actually have no idea what I am doing here.
2017-08-29 17:32:13 +00:00
Andy Gauge
b9b654924e API docs: macros. Part of #29329 Standard Library Documentation Checklist. 2017-08-29 10:30:19 -07:00
Alex Crichton
1d70b66fe4 rustbuild: Don't require cross-compiled error index
All architectures use the same errors, no need to cross-compile a version only
to not look at it.
2017-08-29 10:30:15 -07:00
David Tolnay
4312ed765a
Use a byte literal ASCII 0 instead of its decimal value 2017-08-29 10:01:12 -07:00
Ariel Ben-Yehuda
15f6540ec0 resolve type vars with obligations in more places
This fixes a few cases of inference misses, some of them regressions
caused by the impl selected for a method not being immediately evaluated.
2017-08-29 19:45:32 +03:00
Ariel Ben-Yehuda
de0e695f62 Check the substituted return type in return type suggestions.
Fixes #43420.
2017-08-29 19:45:32 +03:00
Ariel Ben-Yehuda
6c11b47745 remove the data from ClosureCandidate
the data serves no purpose - it can be recovered from the obligation -
and I think may leak stale inference variables into global caches.
2017-08-29 19:45:32 +03:00
Jeremy Sorensen
d24ee2380f change option for RUST_CONFIGURE_ARGS to ignore-git=false 2017-08-29 09:39:12 -07:00
Alex Crichton
27c4ff6967 rustc: Remove specailization_cache in favor of a query
This commit removes the `specialization_cache` field of `TyCtxt` by moving it to
a dedicated query, which it turned out was already quite easily structured to do
so!
2017-08-29 09:36:24 -07:00
Jeremy Sorensen
68aab69af3 add ignore-git=true option to RUST_CONFIGURE_ARGS 2017-08-29 08:27:30 -07:00