Commit Graph

94108 Commits

Author SHA1 Message Date
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
memoryruins
83660b6273 Update libstd doctests to use dyn 2019-05-29 00:57:42 -04:00
memoryruins
fd347a8735 Update the rest of the test suites to use dyn 2019-05-29 00:57:42 -04:00
memoryruins
f19f4545b1 Update run-pass test suite to use dyn 2019-05-29 00:57:42 -04:00
memoryruins
eb4580a570 Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
Nicholas Nethercote
2ca6facaaf Optimize TyCtxt::hygienic_eq.
It's measurably faster to avoid the context comparison when possible.

The commit also adds `hygienic_eq` in one appropriate place.
2019-05-29 09:32:56 +10:00
Nicholas Nethercote
caea42f6c8 Introduce and use SyntaxContext::outer_expn_info().
It reduces two `hygiene_data` accesses to one on some hot paths.
2019-05-29 09:32:56 +10:00
Nicholas Nethercote
828f6fdbe5 Introduce and use Mark::outer_is_descendant_of().
It reduces two `hygiene_data` accesses to one on some hot paths.
2019-05-29 09:32:56 +10:00
bors
4b9d80325a Auto merge of #61296 - Centril:rollup-5ad68b0, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #60742 (Allow const parameters in array sizes to be unified)
 - #60756 (Add better tests for hidden lifetimes in impl trait)
 - #60928 (Changes the type `mir::Mir` into `mir::Body`)
 - #61024 (tests: Centralize proc macros commonly used for testing)
 - #61157 (BufReader: In Seek impl, remove extra discard_buffer call)
 - #61195 (Special-case `.llvm` in mangler)
 - #61202 (Print PermissionExt::mode() in octal in Documentation Examples)
 - #61259 (Mailmap fixes)
 - #61273 (mention that MaybeUninit is a bit like Option)

Failed merges:

r? @ghost
2019-05-28 23:07:19 +00:00
David Tolnay
9f8d934f27
Bump Sum and Product for Option<T> to 1.37 2019-05-28 16:00:39 -07:00
Eduard-Mihai Burtescu
7fa97c0850 rustc_codegen_llvm: rename away the last occurrence of insn. 2019-05-29 01:43:58 +03:00
Eduard-Mihai Burtescu
29b7c0687e rustc_codegen_llvm: remove LLVM instruction count stats. 2019-05-29 01:43:57 +03:00
Mazdak Farrokhzad
9121a73ab1
Rollup merge of #61273 - RalfJung:maybe-uninit, r=Centril
mention that MaybeUninit is a bit like Option
2019-05-29 00:20:06 +02:00
Mazdak Farrokhzad
2d01c91c30
Rollup merge of #61259 - JosephTLyons:mailmap-fixes, r=nikomatsakis
Mailmap fixes

I've made a few fixes and additions to the .mailmap file.

- I've added my information to it, as I noticed it was popping up twice at the [Thanks](https://thanks.rust-lang.org/rust/all-time/) website (I've made contributions to the Rust Book).
- I noticed that @carols10cents‘ information was popping up in multiple places at the [Thanks](https://thanks.rust-lang.org/rust/all-time/) website and when running `git shortlog -s -e > out.txt`, and fixed her information
- I alphabetized the list using Atom's [Sort Lines package](https://github.com/atom/sort-lines)

The output from before and after running `git shortlog -s -e > out.txt` for Carol:
<img width="708" alt="Carol Before" src="https://user-images.githubusercontent.com/19867440/58472843-2d8ca880-8115-11e9-9624-d31ed23ae9b5.png">
<img width="523" alt="Carol After" src="https://user-images.githubusercontent.com/19867440/58472844-2d8ca880-8115-11e9-95c6-80b17cc04790.png">

The output from before and after running `git shortlog -s -e > out.txt` for myself:

<img width="489" alt="Joseph After" src="https://user-images.githubusercontent.com/19867440/58472941-6e84bd00-8115-11e9-8266-1d7fcd53d0bc.png">
<img width="421" alt="Joseph Before" src="https://user-images.githubusercontent.com/19867440/58472943-6e84bd00-8115-11e9-9fd2-d7ace7e3d636.png">
2019-05-29 00:20:04 +02:00
Mazdak Farrokhzad
21684c07c7
Rollup merge of #61202 - oberien:permissionext-print-octal, r=varkor
Print PermissionExt::mode() in octal in Documentation Examples

Printing the file permission mode on unix systems in decimal feels unintuitive. Printing it in octal gives the expected form of e.g. `664`.
2019-05-29 00:20:01 +02:00
Mazdak Farrokhzad
dae331d921
Rollup merge of #61195 - davidtwco:seg-fault-mangler, r=eddyb
Special-case `.llvm` in mangler

Fixes #60925 and fixes #53912.

r? @michaelwoerister
cc @eddyb
2019-05-29 00:20:00 +02:00
Mazdak Farrokhzad
745af720bb
Rollup merge of #61157 - czipperz:BufReader-Seek-remove-extra-discard_buffer, r=nikomatsakis
BufReader: In Seek impl, remove extra discard_buffer call

As far as I can tell, this code does nothing.  I'm not sure why it even is there.
2019-05-29 00:19:58 +02:00
Mazdak Farrokhzad
bfe9080ea0
Rollup merge of #61024 - petrochenkov:proctest, r=nikomatsakis
tests: Centralize proc macros commonly used for testing

Many proc macros in `ui\proc-macro\auxiliary` were doing same things.
(I added a fair share of those myself.)

Now commonly used macros (empty, identity, etc) are collected in one place - `ui\proc-macro\auxiliary\test-macros.rs`.
2019-05-29 00:19:57 +02:00
Mazdak Farrokhzad
ee08261c8c
Rollup merge of #60928 - TheSirC:fix/60229, r=eddyb
Changes the type `mir::Mir` into `mir::Body`

Fixes part 1 of #60229 (previously attempted in #60242).

I stumbled upon the issue and it seems that the previous attempt at solving it was not merged. This is a second try more up-to-date.

The commit should have changed comments as well.
At the time of writting, it passes the tidy and check tool.
2019-05-29 00:19:55 +02:00
Mazdak Farrokhzad
e19a229c88
Rollup merge of #60756 - matthewjasper:extra-impl-trait-tests, r=nikomatsakis
Add better tests for hidden lifetimes in impl trait

cc #60670
2019-05-29 00:19:53 +02:00
Mazdak Farrokhzad
d85e256a87
Rollup merge of #60742 - varkor:fn-const-array-parameter, r=eddyb
Allow const parameters in array sizes to be unified

Fixes https://github.com/rust-lang/rust/issues/60632.
Fixes https://github.com/rust-lang/rust/issues/60744.
Fixes https://github.com/rust-lang/rust/pull/60923.
(The last commit should probably be viewed in isolation, as it just renames things from `type` to `kind`.)

r? @eddyb
2019-05-29 00:19:52 +02:00
Eduard-Mihai Burtescu
03d32905e7 rustc_codegen_ssa: remove obsolete codegen stats. 2019-05-29 01:01:32 +03:00
varkor
9c9b7b4eac Add a regression test for unevaluated const in rustdoc 2019-05-28 22:53:48 +01:00
varkor
7f9dc73a31 Add a const-generics folder to rustdoc tests 2019-05-28 22:53:36 +01:00
varkor
35ce2abf21 Use proper const printing in rustdoc 2019-05-28 22:53:16 +01:00
Eduard-Mihai Burtescu
120ce12016 Rename TraitOrImpl to Assoc and trait_or_impl to assoc. 2019-05-29 00:35:14 +03:00
Eduard-Mihai Burtescu
95013e612d syntax: bail out of find_width_of_character_at_span if the span doesn't start and end in the same file. 2019-05-29 00:27:42 +03:00
Eduard-Mihai Burtescu
3e5beb2c6f rustc: rename Mir to mir::Body in comments and to MIR in error strings. 2019-05-29 00:26:56 +03:00
Santiago Pastorino
0631d19c9a Avoid unneeded bug!() call 2019-05-28 22:46:56 +02:00