Commit Graph

95817 Commits

Author SHA1 Message Date
Mazdak Farrokhzad 3250b8ee59
Rollup merge of #62042 - petrochenkov:macstab, r=matthewjasper
Support stability and deprecation checking for all macros

RELNOTES: Deprecation attributes on macros now have effect.

Fixes https://github.com/rust-lang/rust/issues/34079
Fixes https://github.com/rust-lang/rust/issues/49912
Unblocks https://github.com/rust-lang/rust/pull/62086
Unblocks https://github.com/rust-lang/rust/pull/61000
2019-07-07 17:00:17 +02:00
Mazdak Farrokhzad 9cd75fb35f
Rollup merge of #61883 - zackmdavis:non_ascii_idents_lint, r=Manishearth
`non_ascii_idents` lint (part of RFC 2457)

RFC 2457 [declares](121bbeff50/text/2457-non-ascii-idents.md): "A `non_ascii_idents` lint is added to the compiler. This lint is allow by default."

(Part of #55467.)

r? @Manishearth
2019-07-07 17:00:15 +02:00
bors dd2e8040a3 Auto merge of #59800 - Zoxc:less-dylibs, r=alexcrichton
rustc: Remove `dylib` crate type from most rustc crates

Revival of https://github.com/rust-lang/rust/pull/56987

cc @alexcrichton
r? @michaelwoerister
2019-07-07 11:32:58 +00:00
Vadim Petrochenkov 941653b528 Address review comments + Fix rebase 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov b6d522a101 syntax: Pre-intern names of all built-in macros
They always end up interned anyway
2019-07-07 13:04:07 +03:00
Vadim Petrochenkov 1ee0ce82cb syntax: Migrate built-in macros to the regular stability checking 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov 0817fc6c6c Support deprecation checking for macros 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov d9ee97e896 resolve: Use standard stability diagnostics for macros 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov 3542995ff9 syntax: Keep full `Stability` in `SyntaxExtension` 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov 73dec4a804 resolve: Check stability for local macros as well 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov 290475e837 Collect library features from non-exported macros 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov 3b6370b4ab resolve/expand: Move macro stability checking to an earlier point 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov 03ac05338c syntax: Remove `NodeId` from `SyntaxExtension` 2019-07-07 13:04:06 +03:00
bors dbeed58ade Auto merge of #62434 - Manishearth:clippyup, r=Manishearth
Update clippy

r? @ghost
2019-07-07 08:07:54 +00:00
bors 927a3e873d Auto merge of #62458 - Centril:rollup-j6o2sqj, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #61990 (First question mark in doctest)
 - #62379 (Add missing links in Option documentation)
 - #62438 (rustbuild: Cleanup global lint settings)
 - #62455 (name the trait in ambiguous-associated-items fully qualified suggestion)

Failed merges:

r? @ghost
2019-07-07 04:42:58 +00:00
Manish Goregaokar e2885eb656 Update clippy 2019-07-06 21:41:57 -07:00
Mazdak Farrokhzad fb0117000a
Rollup merge of #62455 - zackmdavis:name_trait_for_ambiguous_assoc_item, r=petrochenkov
name the trait in ambiguous-associated-items fully qualified suggestion

We have the trait at this point, so we can name it in the error message, rather than using "Trait" as a (potentially confusing) placeholder.

Thanks to Yuki "@JohnTitor" Okushi for pointing out where to look (in the same file) for a closely related issue for ambiguous associated types (as opposed to items; that was #59225, except that one won't be
quite as easy to resolve, because we actually don't have the trait `DefId` at that point).

r? @petrochenkov
2019-07-07 05:11:56 +02:00
Mazdak Farrokhzad 037f568f17
Rollup merge of #62438 - petrochenkov:buildwarn, r=Mark-Simulacrum
rustbuild: Cleanup global lint settings

Lint settings do not depend on `if let Some(target) = target` in any way, so they are moved out of that clause.

Internal lints now respect `RUSTC_DENY_WARNINGS`.

Crate name treatment is cleaned up a bit.

cc https://github.com/rust-lang/rust/pull/61545 @flip1995
r? @Mark-Simulacrum
2019-07-07 05:11:55 +02:00
Mazdak Farrokhzad c512829363
Rollup merge of #62379 - GuillaumeGomez:option-doc-links, r=QuietMisdreavus
Add missing links in Option documentation

r? @rust-lang/docs
2019-07-07 05:11:53 +02:00
Mazdak Farrokhzad 719eeb260b
Rollup merge of #61990 - llogiq:questionmark-test, r=QuietMisdreavus
First question mark in doctest

We have had `?` for `Result`s in doctests for some time, but so far haven't used them in doctests. With this PR, I want to start the de-`unwrap`ping of doctests – and the discussion on where to do so.

There is one downside, which is that the code can no longer be copied into a plain `main()` method, on the other hand, there should be a workable error if one does this.
2019-07-07 05:11:51 +02:00
John Kåre Alsaker 7198687bb2 Link compiler plugins to rustc_driver 2019-07-07 03:23:02 +02:00
John Kåre Alsaker 2caf5d9a5b Update Cargo.lock 2019-07-07 03:23:00 +02:00
John Kåre Alsaker 60c49bcb55 Remove some dummy dependencies 2019-07-07 03:23:00 +02:00
Alex Crichton 345ba505ec rustc: Remove `dylib` crate type from most rustc crates
Now that procedural macros no longer link transitively to libsyntax,
this shouldn't be needed any more! This commit is an experiment in
removing all dynamic libraries from rustc except for librustc_driver
itself. Let's see how far we can get with that!
2019-07-07 03:23:00 +02:00
bors 4393768faa Auto merge of #62281 - Disasm:riscv-pic, r=nagisa
Add support for pc-relative addressing on 64-bit RISC-V

These changes allow Rust to generate position-independent code on `riscv64` targets with code model `medium`.

Closes: https://github.com/rust-lang/rust/issues/59802
See also: https://github.com/rust-embedded/riscv-rt/issues/25, https://github.com/rust-embedded/wg/issues/218
2019-07-07 01:14:42 +00:00
Zack M. Davis 6de8e39e26 in which the `non_ascii_idents` lint appears (RFC 2457)
RFC 2457 declares: "A `non_ascii_idents` lint is added to the
compiler. This lint is allow by default."
2019-07-06 17:23:17 -07:00
Zack M. Davis 6bb60ef6f2 name the trait in ambiguous-associated-items fully qualified suggestion
We have the trait at this point, so we can name it in the error
message, rather than using "Trait" as a (potentially confusing)
placeholder.

Thanks to Yuki "@JohnTitor" Okushi for pointing out where to look (in
the same file) for a closely related issue for ambiguous associated
types (as opposed to items; that was #59225, except that one won't be
quite as easy to resolve, because we actually don't have the trait
`DefId` at that point).
2019-07-06 16:47:43 -07:00
Vadim Petrochenkov 36a5aa8325 Address review comments 2019-07-07 01:18:29 +03:00
bors b0bd5f236d Auto merge of #62452 - Centril:rollup-5jww3h7, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #60081 (Refactor unicode.py script)
 - #61862 (Make the Weak::{into,as}_raw methods)
 - #62243 (Improve documentation for built-in macros)
 - #62422 (Remove some uses of mem::uninitialized)
 - #62436 (normalize use of backticks/lowercase in compiler messages for librustc_mir)

Failed merges:

r? @ghost
2019-07-06 21:47:45 +00:00
Mazdak Farrokhzad 7ef02dcf67
Rollup merge of #62436 - fakenine:normalize_use_of_backticks_compiler_messages_1, r=Centril
normalize use of backticks/lowercase in compiler messages for librustc_mir

normalize use of backticks/lowercase in compiler messages for librustc_mir

https://github.com/rust-lang/rust/issues/60532

r? @alexreg
2019-07-06 22:14:39 +02:00
Mazdak Farrokhzad 30e4a874cb
Rollup merge of #62422 - lzutao:remove-some-mem-uinit, r=alexcrichton
Remove some uses of mem::uninitialized

cc #62397
r? @RalfJung
2019-07-06 22:14:38 +02:00
Mazdak Farrokhzad 154726cf7d
Rollup merge of #62243 - petrochenkov:macrodoc, r=eddyb
Improve documentation for built-in macros

This is the `libcore` part of https://github.com/rust-lang/rust/pull/62086.
Right now the only effect is improved documentation.

The changes in the last few commits are required to make the `libcore` change compile successfully.
2019-07-06 22:14:36 +02:00
Mazdak Farrokhzad 296e825afa
Rollup merge of #61862 - vorner:weak-into-raw-methods, r=sfackler
Make the Weak::{into,as}_raw methods

Because Weak doesn't Deref, so there's no reason for them to be only
associated methods.

As kindly pointed out here https://github.com/rust-lang/rust/pull/60766#issuecomment-501706422 by @chpio.
2019-07-06 22:14:35 +02:00
Mazdak Farrokhzad 327c54ed02
Rollup merge of #60081 - pawroman:cleanup_unicode_script, r=varkor
Refactor unicode.py script

Hi, I noticed that the `unicode.py` script used some deprecated escapes in regular expressions. E.g. `\d`, `\w`, `\.` will be illegal in the future without "raw strings". This is now fixed. I have also cleaned up the script quite a bit.

## Escape deprecation

OK (note the `r`):
`re.compile(r"\d")`

Deprecated (from Python 3.6 onwards, see [here][link1] and [here][link2]):
`re.compile("\d")`.

[link1]: https://docs.python.org/3.6/whatsnew/3.6.html#deprecated-python-behavior
[link2]: https://bugs.python.org/issue27364

This was evident running the script using Python 3.7 like so:

```
$ python3 -Wall unicode.py
unicode.py:227: DeprecationWarning: invalid escape sequence \w
  re1 = re.compile("^ *([0-9A-F]+) *; *(\w+)")
unicode.py:228: DeprecationWarning: invalid escape sequence \.
  re2 = re.compile("^ *([0-9A-F]+)\.\.([0-9A-F]+) *; *(\w+)")
unicode.py:453: DeprecationWarning: invalid escape sequence \d
  pattern = "for Version (\d+)\.(\d+)\.(\d+) of the Unicode"
```

The documentation states that
> A backslash-character pair that is not a valid escape sequence now generates a DeprecationWarning. Although this will eventually become a SyntaxError, that will not be for several Python releases.

## Testing

To test my changes, I had to add support for choosing the Unicode version to use. The script will default to latest release (which is 12.0.0 at the moment, repo has 11.0.0 checked in).

The script generates the exact same output for version 11.0.0 with Python 2.7 and 3.7 and no longer generates any deprecation warnings:

```
$ python3 -Wall unicode.py -v 11.0.0
Using Unicode version: 11.0.0
Regenerated tables.rs.
$ git diff tables.rs
$ python2 -Wall unicode.py -v 11.0.0
Using Unicode version: 11.0.0
Regenerated tables.rs.
$ git diff tables.rs
$ python2 --version
Python 2.7.16
$ python3 --version
Python 3.7.3
```

## Extra functionality

Furthermore, the script will check and download the latest Unicode version by default (without the `-v` argument). The `--help` is below:

```
$ ./unicode.py --help
usage: unicode.py [-h] [-v VERSION]

Regenerate Unicode tables (tables.rs).

optional arguments:
  -h, --help            show this help message and exit
  -v VERSION, --version VERSION
                        Unicode version to use (if not specified, defaults to
                        latest available final release).
```

## Cleanups

I have cleaned up the code quite a bit, with Python best practices and code style in mind. I'm happy to provide more details and rationale for all my changes if the reviewers so desire.

One externally visible change is that the Unicode data will now be downloaded into `src/libcore/unicode/downloaded` directory suffixed by Unicode version:

```
$ pwd
.../rust/src/libcore/unicode
$ exa -T downloaded/
downloaded
├── 11.0.0
│  ├── DerivedCoreProperties.txt
│  ├── DerivedNormalizationProps.txt
│  ├── PropList.txt
│  ├── ReadMe.txt
│  ├── Scripts.txt
│  ├── SpecialCasing.txt
│  └── UnicodeData.txt
└── 12.0.0
   ├── DerivedCoreProperties.txt
   ├── DerivedNormalizationProps.txt
   ├── PropList.txt
   ├── ReadMe.txt
   ├── Scripts.txt
   ├── SpecialCasing.txt
   └── UnicodeData.txt
```
2019-07-06 22:14:33 +02:00
Samy Kacimi 7a2a17af09
normalize use of backticks/lowercase in compiler messages for librustc_mir
https://github.com/rust-lang/rust/issues/60532

r? @alexreg
2019-07-06 20:40:40 +02:00
bors dfd52ba6ac Auto merge of #59772 - andrehjr:add-rustc-guide-to-toolstate, r=mark-i-m
Add rustc guide to toolstate

Closes #59597
2019-07-06 18:19:01 +00:00
Vadim Petrochenkov 327450797d resolve: Reserve cfg/cfg_attr/derive only in attribute sub-namespace 2019-07-06 18:36:35 +03:00
André Luis Leal Cardoso Junior b5cd962be8 Don't return an error from linkcheck when it's not supported' 2019-07-06 11:05:22 -03:00
André Luis Leal Cardoso Junior 43cb7d08e4 Ignore unused variable for non-linux builds 2019-07-06 11:05:22 -03:00
Mark Mansi f0e45bfe81 fix macos build 2019-07-06 11:05:22 -03:00
Mark Mansi 1de42ff95a cfg: linkcheck only on x86-64 linux 2019-07-06 11:05:22 -03:00
André Luis Leal Cardoso Junior 7fbc6a9ba3 add missing libssl-dev dependency to docker images on travis 2019-07-06 11:05:22 -03:00
André Luis Leal Cardoso Junior 9ca5dee0ad Add 'Apache-2.0 OR MIT' license variation to tidy/tools check 2019-07-06 11:05:22 -03:00
André Luis Leal Cardoso Junior a55fa18a52 Move installing of deps to the docker container, instead of installing on the host machine on travis 2019-07-06 11:05:22 -03:00
André Luis Leal Cardoso Junior f80697215f Add linkcheck command to rustbook tool 2019-07-06 11:05:22 -03:00
André Luis Leal Cardoso Junior d8a6ccfb4a Track rustc-guide on toolstate 2019-07-06 11:05:22 -03:00
André Luis Leal Cardoso Junior 83877773da add ./x.py test src/doc/rustc-guide 2019-07-06 11:05:22 -03:00
Vadim Petrochenkov 920a17a60c privacy: Only opaque macros leak private things 2019-07-06 16:59:08 +03:00
Vadim Petrochenkov 987be89db3 Fix tidy issues 2019-07-06 16:59:08 +03:00
Vadim Petrochenkov ab112cab03 Improve documentation for built-in macros 2019-07-06 16:59:08 +03:00