Commit graph

94086 commits

Author SHA1 Message Date
varkor
5e3ff4c2f1 Add test for condition in trait const param 2019-05-31 20:49:19 +01:00
bors
0bfbaa6e8d Auto merge of #61253 - nnethercote:avoid-hygiene_data-lookups, r=petrochenkov
Avoid `hygiene_data` lookups

These commits mostly introduce compound operations that allow two close adjacent `hygiene_data` lookups to be combined.

r? @petrochenkov
2019-05-30 16:54:13 +00:00
bors
aee7012fab Auto merge of #61343 - Centril:rollup-dzsuo01, r=Centril
Rollup of 11 pull requests

Successful merges:

 - #60802 (upgrade rustdoc's `pulldown-cmark` to 0.5.2)
 - #60839 (Fix ICE with struct ctors and const generics.)
 - #60850 (Stabilize RefCell::try_borrow_unguarded)
 - #61231 (Fix linkage diagnostic so it doesn't ICE for external crates)
 - #61244 (Box::into_vec: use Box::into_raw instead of mem::forget)
 - #61279 (implicit `Option`-returning doctests)
 - #61280 (Revert "Disable solaris target since toolchain no longer builds")
 - #61284 (Update all s3 URLs used on CI with subdomains)
 - #61321 (libsyntax: introduce 'fn is_keyword_ahead(dist, keywords)'.)
 - #61322 (ci: display more debug information in the init_repo script)
 - #61333 (Fix ICE with APIT in a function with a const parameter)

Failed merges:

 - #61304 (Speed up Azure CI installing Windows dependencies)

r? @ghost
2019-05-30 11:56:32 +00:00
Mazdak Farrokhzad
528972a28a
Rollup merge of #61333 - varkor:apit-const-param-ice, r=estebank
Fix ICE with APIT in a function with a const parameter

Fixes https://github.com/rust-lang/rust/issues/60953.
2019-05-30 10:53:07 +02:00
Mazdak Farrokhzad
6282fae46f
Rollup merge of #61322 - pietroalbini:debug-windows-submodule-cloning, r=alexcrichton
ci: display more debug information in the init_repo script

I'm *really* confused about the error message [while cloning submodules on Windows on Azure](https://dev.azure.com/rust-lang/e71b0ddf-dd27-435a-873c-e30f86eea377/_apis/build/builds/295/logs/506):

```
/usr/bin/tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options
Try '/usr/bin/tar --help' or '/usr/bin/tar --usage' for more information.
```

It doesn't make sense for it to execute a command without any of those flags since they're clearly added:

81970852e1/src/ci/init_repo.sh (L45)

So this adds `set -x` to the script to hopefully catch what command it's executing.

r? @alexcrichton
cc https://github.com/rust-lang/rust/issues/61301
2019-05-30 10:53:05 +02:00
Mazdak Farrokhzad
bc3f373cbb
Rollup merge of #61321 - Centril:is_keyword_ahead, r=petrochenkov
libsyntax: introduce 'fn is_keyword_ahead(dist, keywords)'.

Introduces:
```rust
    /// Returns whether any of the given keywords are `dist` tokens ahead of the current one.
    fn is_keyword_ahead(&self, dist: usize, kws: &[Symbol]) -> bool {
        self.look_ahead(dist, |t| kws.iter().any(|&kw| t.is_keyword(kw)))
    }
```

r? @oli-obk
2019-05-30 10:53:03 +02:00
Mazdak Farrokhzad
8cb5885adc
Rollup merge of #61284 - alexcrichton:less-s3, r=pietroalbini
Update all s3 URLs used on CI with subdomains

Ensure that they're all forwards-compatible with AWS updates happening
next year by ensuring the bucket name shows up in the domain name.

Closes #61168
2019-05-30 10:52:59 +02:00
Mazdak Farrokhzad
8b555299b0
Rollup merge of #61280 - bgermann:master, r=alexcrichton
Revert "Disable solaris target since toolchain no longer builds"

This reverts commit e764f475ca.
Fixes #61174.
2019-05-30 10:52:58 +02:00
Mazdak Farrokhzad
07d0b578c1
Rollup merge of #61279 - llogiq:implicit-option-main-doctests, r=GuillaumeGomez
implicit `Option`-returning doctests

This distinguishes `Option` and `Result`-returning doctests with implicit `main` method, where the former tests must end with `Some(())`.

Open question: Does this need a feature gate?

r? @GuillaumeGomez
2019-05-30 10:52:56 +02:00
Mazdak Farrokhzad
1b66a13540
Rollup merge of #61244 - RalfJung:box, r=rkruppe
Box::into_vec: use Box::into_raw instead of mem::forget

`Box::into_raw` does, in one step, turn the `Box` into a raw ptr and avoid deallocation.  Seems cleaner than separating the two.

Also, `mem::forget` gets the `Box` with a `noalias` argument, but it is not actually correct that this is an exclusive pointer. So a stricter version of Stacked Borrows would complain here. (I can't actually make Stacked Borrows that strict yet though due to other issues.)
2019-05-30 10:52:55 +02:00
Mazdak Farrokhzad
6351267c1f
Rollup merge of #61231 - pnkfelix:issue-59548-linkage-diagnostic, r=petrochenkov
Fix linkage diagnostic so it doesn't ICE for external crates

Fix linkage diagnostic so it doesn't ICE for external crates

(As a drive-by improvement, improved the diagnostic to indicate *why* `*const T` or `*mut T` is required.)

Fix #59548
Fix #61232
2019-05-30 10:52:53 +02:00
Mazdak Farrokhzad
74b359373c
Rollup merge of #60850 - SimonSapin:unguarded, r=alexcrichton
Stabilize RefCell::try_borrow_unguarded

Servo has been using this since https://github.com/servo/servo/pull/23196 to add a runtime check to some unsafe code, as discussed in PR https://github.com/rust-lang/rust/pull/59211. Stabilizing would help do more of the same in libraries that also have users on Stable.
2019-05-30 10:52:51 +02:00
Mazdak Farrokhzad
933c773b61
Rollup merge of #60839 - davidtwco:const-generics-struct-ctor, r=varkor
Fix ICE with struct ctors and const generics.

Fixes #60818.

r? @varkor
2019-05-30 10:52:49 +02:00
Mazdak Farrokhzad
040af62a5a
Rollup merge of #60802 - euclio:pulldown-cmark-panic, r=GuillaumeGomez
upgrade rustdoc's `pulldown-cmark` to 0.5.2

Fixes #60482.
2019-05-30 10:52:48 +02:00
bors
c28084ac16 Auto merge of #61005 - michaelwoerister:error-pgo-windows-unwind, r=zackmdavis
Emit error when trying to use PGO in conjunction with unwinding on Windows.

This PR makes `rustc` emit an error when trying use PGO in conjunction with `-Cpanic=unwind` on Windows, isn't supported by LLVM yet. The error messages points to https://github.com/rust-lang/rust/issues/61002, which documents this known limitation.
2019-05-30 03:37:37 +00:00
bors
19e0ddbb9f Auto merge of #61212 - alexcrichton:skip-rustc, r=pietroalbini
ci: Attempt to skip a full rustc compile on dist*

Currently when we're preparing cross-compiled compilers it can take
quite some time because we have to build the compiler itself three
different times. The first is the normal bootstrap, the second is a
second build for the build platform, and the third is the actual target
architecture compiler. The second compiler was historically built
exclusively for procedural macros, and long ago we didn't actually need
it.

This commit tries out avoiding that second compiled compiler, meaning we
only compile rustc for the build platform only once. Some local testing
shows that this is promising, but bors is of course the ultimate test!
2019-05-30 00:38:51 +00:00
varkor
998ef688a3 Add a regression test for const parameters with impl Trait 2019-05-30 00:21:04 +01:00
varkor
eafa3a888f Sort in-band generic parameter definitions from APIT 2019-05-30 00:20:52 +01:00
Nicholas Nethercote
95ea7fd735 Add HygieneData::{outer,expn_info,is_descendant_of} methods.
This commit factors out some repeated code.
2019-05-30 08:59:22 +10:00
Nicholas Nethercote
2232321ac7 Optimize TyCtxt::adjust_ident.
It's a hot function that returns a 2-tuple, but the hottest call site
(`hygienic_eq`) discards the second element.

This commit renames `adjust_ident` as `adjust_ident_and_get_scope`, and
then introduces a new `adjust_ident` that only computes the first
element. This change also avoids the need to pass in an unused
`DUMMY_HIR_ID` argument in a couple of places, which is nice.
2019-05-30 08:38:15 +10:00
bors
413790186c Auto merge of #61203 - memoryruins:bare_trait_objects, r=Centril
Warn on bare_trait_objects by default

The `bare_trait_objects` lint is set to `warn` by default.
Most ui tests have been updated to use `dyn` to avoid creating noise in stderr files.

r? @Centril

cc #54910
2019-05-29 21:55:59 +00:00
bors
37d001e4de Auto merge of #61317 - oli-obk:rollup-tm5qivq, r=oli-obk
Rollup of 7 pull requests

Successful merges:

 - #60549 (do not print panic message on doctest failures)
 - #60885 (strip synstructure consts from compiler docs)
 - #61217 (Account for short-hand init structs when suggesting conversion)
 - #61261 (is_union returns ty to avoid computing it twice)
 - #61293 (Print const generics properly in rustdoc)
 - #61310 (split libcore::mem into multiple files)
 - #61313 (Simplify Set1::insert)

Failed merges:

r? @ghost
2019-05-29 19:10:33 +00:00
Mazdak Farrokhzad
5d72ac3639 libsyntax: introduce 'fn is_keyword_ahead(dist, keywords)'. 2019-05-29 17:58:44 +02:00
Pietro Albini
5f4f3684b9
ci: display more debug information in the init_repo script 2019-05-29 17:57:28 +02:00
Andy Russell
ed8a4d5bc1
upgrade rustdoc's pulldown-cmark to 0.5.2
Fixes #60482.
2019-05-29 10:59:59 -04:00
Alex Crichton
3eda151086 Update all s3 URLs used on CI with subdomains
Ensure that they're all forwards-compatible with AWS updates happening
next year by ensuring the bucket name shows up in the domain name.

Closes #61168
2019-05-29 07:03:50 -07:00
Oliver Scherer
b742d7ee6a
Rollup merge of #61313 - Centril:simplify-set1-insert, r=varkor
Simplify Set1::insert

r? @varkor
2019-05-29 14:41:13 +02:00
Oliver Scherer
18967566c7
Rollup merge of #61310 - RalfJung:mem, r=Centril
split libcore::mem into multiple files

r? @Centril
2019-05-29 14:41:09 +02:00
Oliver Scherer
9cc289e7b4
Rollup merge of #61293 - varkor:rustdoc-print-const-generic, r=GuillaumeGomez
Print const generics properly in rustdoc

Now that https://github.com/rust-lang/rust/pull/59276 is merged, we can print consts properly in rustdoc.

Fixes https://github.com/rust-lang/rust/issues/60737.
Fixes https://github.com/rust-lang/rust/issues/61257.

r? @GuillaumeGomez
2019-05-29 14:41:08 +02:00
Oliver Scherer
20f462d9fc
Rollup merge of #61261 - spastorino:is-union-return-ty, r=oli-obk
is_union returns ty to avoid computing it twice

r? @oli-obk
2019-05-29 14:41:06 +02:00
Oliver Scherer
e83776f3ab
Rollup merge of #61217 - estebank:issue-52820, r=Centril
Account for short-hand init structs when suggesting conversion

Fix #52820.
2019-05-29 14:41:05 +02:00
Oliver Scherer
e84c9f3799
Rollup merge of #60885 - euclio:strip-synstructure-consts, r=GuillaumeGomez
strip synstructure consts from compiler docs

Fixes #60150.

Unfortunately this PR depends on the use of the deprecated `--passes` flag in bootstrap to keep the `--strip-hidden` pass while still documenting private items. I've opened #60884 to track stabilization of a new flag that encapsulates this behavior.

r? @QuietMisdreavus
2019-05-29 14:41:03 +02:00
Oliver Scherer
8186994446
Rollup merge of #60549 - euclio:doctest-panic-messages, r=GuillaumeGomez
do not print panic message on doctest failures

This PR cleans up rustdoc test output by silently unwinding on failure instead of using `panic!`. It also improves the clarity and consistency of the output on test failure, and adds test cases for failure modes that were previously untested.
2019-05-29 14:41:01 +02:00
Michael Woerister
a19a9e9194 Make run-make PGO tests work on MSVC. 2019-05-29 14:32:38 +02:00
Ralf Jung
d0b3774490 bless you 2019-05-29 12:28:45 +02:00
Mazdak Farrokhzad
3f3087bb7f Simplify Set1::insert. 2019-05-29 12:14:54 +02:00
Ralf Jung
1529067a04 split libcore::mem into multiple files 2019-05-29 10:00:13 +02:00
bors
81970852e1 Auto merge of #61305 - Centril:rollup-t39m00m, r=Centril
Rollup of 11 pull requests

Successful merges:

 - #58975 (Implement `iter::Sum` and `iter::Product` for `Option`)
 - #60542 (Add Step::sub_usize)
 - #60555 (Implement nth_back for RChunks(Exact)(Mut))
 - #60766 (Weak::into_raw)
 - #61048 (Feature/nth back chunks)
 - #61191 (librustc_errors: Move annotation collection to own impl)
 - #61235 (Stabilize bufreader_buffer feature)
 - #61249 (Rename Place::local to Place::local_or_deref_local)
 - #61291 (Avoid unneeded bug!() call)
 - #61294 (Rename `TraitOrImpl` to `Assoc` and `trait_or_impl` to `assoc`.)
 - #61297 (Remove LLVM instruction stats and other (obsolete) codegen stats.)

Failed merges:

r? @ghost
2019-05-29 07:50:16 +00:00
David Wood
41aaf7bc46
Fix ICE with struct ctors and const generics.
This commit fixes a ICE where struct constructors were resulting in an
ICE with const generics. Previously, a `match` in `type_of` did not have
an arm for the `DefKind::Ctor` resolutions and therefore would assume
that the type did not have generics.
2019-05-29 08:30:07 +01:00
Mazdak Farrokhzad
907f4fd4ae
Rollup merge of #61297 - eddyb:forsaken-stats, r=nagisa
Remove LLVM instruction stats and other (obsolete) codegen stats.

Both `-Z count_llvm_insns` and `-Z codegen-stats` are removed, as (AFAIK) they have been of little use in the last few years, especially after the transition to MIR->LLVM codegen.

Other than for the LLVM instruction counts, `-Z codegen-stats` has long been obsoleted anyway.

r? @nagisa cc @rust-lang/compiler
2019-05-29 08:16:06 +02:00
Mazdak Farrokhzad
3013c0b698
Rollup merge of #61294 - eddyb:no-trait-nor-impl, r=varkor
Rename `TraitOrImpl` to `Assoc` and `trait_or_impl` to `assoc`.
2019-05-29 08:16:04 +02:00
Mazdak Farrokhzad
73530ff80b
Rollup merge of #61291 - spastorino:avoid-unneeded-bug-call, r=estebank
Avoid unneeded bug!() call

r? @oli-obk
2019-05-29 08:16:02 +02:00
Mazdak Farrokhzad
dcfc15b23c
Rollup merge of #61249 - spastorino:local-or-deref-local, r=oli-obk,Centril
Rename Place::local to Place::local_or_deref_local

r? @oli-obk
2019-05-29 08:15:59 +02:00
Mazdak Farrokhzad
405edc71fd
Rollup merge of #61235 - lzutao:stabilize-bufreader_buffer, r=Centril
Stabilize bufreader_buffer feature

FCP done in https://github.com/rust-lang/rust/issues/45323#issuecomment-495937047

Closes #45323

r? @SimonSapin
2019-05-29 08:15:58 +02:00
Mazdak Farrokhzad
01c3ca12bc
Rollup merge of #61191 - phansch:annotate_snippet_refactorings1, r=estebank
librustc_errors: Move annotation collection to own impl

Extracted from work on #59346. This moves the annotation collection to
the `FileWithAnnotatedLines` impl to allow easier re-use in a separate
EmitterWriter. Even without that new EmitterWriter present, I think it makes
sense to have this as an associated function.
2019-05-29 08:15:56 +02:00
Mazdak Farrokhzad
f0ea975a1c
Rollup merge of #61048 - wizAmit:feature/nth_back_chunks, r=scottmcm
Feature/nth back chunks

A succinct implementation for nth_back on chunks. Thank you @timvermeulen for the guidance.

r? @timvermeulen
2019-05-29 08:15:55 +02:00
Mazdak Farrokhzad
cb012a0430
Rollup merge of #60766 - vorner:weak-into-raw, r=sfackler
Weak::into_raw

Hello

This is my first shot at #60728. I'd like to consult it a bit before moving further.

The biggest question I have is if this API makes sense. My motivation for it is to be able to store the `Weak` in `AtomicPtr`. For that I don't actually need for the pointer to point to the `T`, any pointer (maybe casted to `usize`) would be good enough, but this mirrors what `Arc` does and could be useful for other things too (like comparing if Arc and Weak point to the same thing without playing with the counts), while some opaque pointer wouldn't.

Some secondary questions, if this is deemed desirable are:
* The weak pointer may be dangling if it is created by `Weak::new()`. It would make sense to treat this as NULL, but that is incompatible with `T: ?Sized` ‒ both `new()` and `ptr::null()` are available only for sized types. The current implementation is therefore also available only for sized `T`s. It would be possible to allow `?Sized` if the API would be `fn into_raw(self) -> Option<NonNull<T>>` and `fn from_raw(NonNull<T>)`, but that's different API than `Arc` has. What would be preferred?
* There's a FIXME in my code about what I suspect could be UB. Is it really UB & how to get the pointer correctly? Is manual offsetting of the pointer the only way?
* Am I missing some other necessary thing around the feature gates and such?
* Is the documentation understandable? I know writing docs is not my strongest skill :-|.

Thinks I'd like to do as part of the PR, but are not yet done:
* Turn the referenced issue into tracking issue for the feature flag.
* Once the `sync::Weak` is considered reasonable, I'd do the equivalent for `rc::Weak`.
* This might call for few more tests than what is currently part of the documentation.
2019-05-29 08:15:53 +02:00
Mazdak Farrokhzad
23b9b8320b
Rollup merge of #60555 - timvermeulen:rchunks_nth_back, r=scottmcm
Implement nth_back for RChunks(Exact)(Mut)

Part of #54054.

These implementations may not be optimal because of the use of `self.len()`, but it's quite cheap and simplifies the code a lot.

There's quite some duplication going on here, I wouldn't mind cleaning this up later. A good next step would probably be to add private `split_off_up_to`/`split_off_from` helper methods for slices since their behavior is commonly useful throughout the `Chunks` types.

r? @scottmcm
2019-05-29 08:15:51 +02:00
Mazdak Farrokhzad
61545b6975
Rollup merge of #60542 - timvermeulen:step_sub_usize, r=scottmcm
Add Step::sub_usize

Required for #54054.

I'm aware that the `Step` trait needs a rework, but this still seems like a reasonable addition?

This currently doesn't compile because Chalk contains a type that implement this trait, and this is a breaking change. How can that be fixed?
2019-05-29 08:15:49 +02:00
Mazdak Farrokhzad
d67d1f24dc
Rollup merge of #58975 - jtdowney:iter_arith_traits_option, r=dtolnay
Implement `iter::Sum` and `iter::Product` for `Option`

This is similar to the existing implementation for `Result`. It will take each item into the accumulator unless a `None` is returned.

I based a lot of this on #38580. From that discussion it didn't seem like this addition would be too controversial or difficult. One thing I still don't understand is picking the values for the `stable` attribute. This is my first non-documentation PR for rust so I am open to any feedback on improvements.
2019-05-29 08:15:48 +02:00