]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #61665 - aschampion:slice-eq-ptr, r=sfackler
Mazdak Farrokhzad [Thu, 11 Jul 2019 02:33:11 +0000 (04:33 +0200)]
Rollup merge of #61665 - aschampion:slice-eq-ptr, r=sfackler

core: check for pointer equality when comparing Eq slices

Because `Eq` types must be reflexively equal, an equal-length slice to the same memory location must be equal.

This is related to #33892 (and #32699) answering this comment from that PR:

> Great! One more easy question: why does this optimization not apply in the non-BytewiseEquality implementation directly above?

Because slices of non-reflexively equal types (like `f64`) are not equal even if it's the same slice. But if the types are `Eq`, we can use this same-address optimization, which this PR implements. Obviously this changes behavior if types violate the reflexivity condition of `Eq`, because their impls of `PartialEq` will no longer be called per-item, but đź¤·â€Ťâ™‚ .

It's not clear how often this optimization comes up in the real world outside of the same-`&str` case covered by #33892, so **I'm requesting a perf run** (on MacOS today, so can't run `rustc_perf` myself). I'm going ahead and making the PR on the basis of being surprised things didn't already work this way.

This is my first time hacking rust itself, so as a perf sanity check I ran `./x.py bench --stage 0 src/lib{std,alloc}`, but the differences were noisy.

To make the existing specialization for `BytewiseEquality` explicit, it's now a supertrait of `Eq + Copy`. `Eq` should be sufficient, but `Copy` was included for clarity.

5 years agoAuto merge of #62561 - Centril:rollup-5pxj3bo, r=Centril
bors [Wed, 10 Jul 2019 23:02:44 +0000 (23:02 +0000)]
Auto merge of #62561 - Centril:rollup-5pxj3bo, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #62275 (rustc_mir: treat DropAndReplace as Drop + Assign in qualify_consts.)
 - #62465 (Sometimes generate storage statements for temporaries with type `!`)
 - #62481 (Use `fold` in `Iterator::last` default implementation)
 - #62493 (#62357: doc(ptr): add example for {read,write}_unaligned)
 - #62532 (Some more cleanups to syntax::print)

Failed merges:

r? @ghost

5 years agoAuto merge of #62564 - Mark-Simulacrum:azure-line-endings, r=pietroalbini
bors [Wed, 10 Jul 2019 19:36:42 +0000 (19:36 +0000)]
Auto merge of #62564 - Mark-Simulacrum:azure-line-endings, r=pietroalbini

Ensure that checkout is with \n line endings

During installation of mingw, at least, the git directories change, so
we need to reset the core.autocrlf config to false.

Once we finish checking out submodules, check that the line endings are
\n and not \r\n.

Artifacts were built via the last try on #62545; I've manually confirmed that `install.sh` appears to no longer have `\r\n` line endings.

Fixes #62276.

5 years agoRollup merge of #62532 - Mark-Simulacrum:syntax-print-cleanup, r=petrochenkov
Mazdak Farrokhzad [Wed, 10 Jul 2019 14:08:26 +0000 (16:08 +0200)]
Rollup merge of #62532 - Mark-Simulacrum:syntax-print-cleanup, r=petrochenkov

Some more cleanups to syntax::print

All of these changes should be functionally equivalent to previous code.

Each commit mostly stands alone and this PR is easiest to review by-commit.

5 years agoRollup merge of #62493 - Freyskeyd:valid_example_read-write_unaligned, r=rkruppe
Mazdak Farrokhzad [Wed, 10 Jul 2019 14:08:24 +0000 (16:08 +0200)]
Rollup merge of #62493 - Freyskeyd:valid_example_read-write_unaligned, r=rkruppe

#62357: doc(ptr): add example for {read,write}_unaligned

related to #62357

> With #62323 the only example (that had UB and was thus invalid) in std::ptr::read_unaligned and std::ptr::write_unaligned is removed.

> We should add a valid example of using the aforementioned functions.

Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
5 years agoRollup merge of #62481 - czipperz:iterator-last-nth-use-for_each, r=scottmcm
Mazdak Farrokhzad [Wed, 10 Jul 2019 14:08:23 +0000 (16:08 +0200)]
Rollup merge of #62481 - czipperz:iterator-last-nth-use-for_each, r=scottmcm

Use `fold` in `Iterator::last` default implementation

We already use it in all the other methods.  Consistency + potential perf is a pretty nice win!

5 years agoRollup merge of #62465 - matthewjasper:never-type-storage, r=pnkfelix
Mazdak Farrokhzad [Wed, 10 Jul 2019 14:08:21 +0000 (16:08 +0200)]
Rollup merge of #62465 - matthewjasper:never-type-storage, r=pnkfelix

Sometimes generate storage statements for temporaries with type `!`

Closes #62165
cc #42371

5 years agoRollup merge of #62275 - eddyb:const-drop-replace, r=pnkfelix
Mazdak Farrokhzad [Wed, 10 Jul 2019 14:08:19 +0000 (16:08 +0200)]
Rollup merge of #62275 - eddyb:const-drop-replace, r=pnkfelix

rustc_mir: treat DropAndReplace as Drop + Assign in qualify_consts.

This slipped through the cracks and never got implemented (thankfully that just meant it was overly conservative and didn't allow assignments that don't *actually* drop the previous value).
Fixes #62273.

r? @oli-obk

5 years agoEnsure that checkout is with \n line endings
Mark Rousskov [Tue, 9 Jul 2019 22:21:23 +0000 (18:21 -0400)]
Ensure that checkout is with \n line endings

During installation of mingw, at least, the git directories change, so
we need to reset the core.autocrlf config to false.

Once we finish checking out submodules, check that the line endings are
\n and not \r\n.

5 years agoAuto merge of #62339 - pnkfelix:issue-61188-use-visitor-for-structural-match-check...
bors [Wed, 10 Jul 2019 12:26:44 +0000 (12:26 +0000)]
Auto merge of #62339 - pnkfelix:issue-61188-use-visitor-for-structural-match-check, r=nikomatsakis

use visitor for #[structural_match] check

This changes the code so that we recur down the structure of a type of a const (rather than just inspecting at a shallow one or two levels) when we are looking to see if it has an ADT that did not derive `PartialEq` and `Eq`.

Fix #61188

Fix #62307

Cc #62336

5 years agoFile is now short enough for tidy
Mark Rousskov [Tue, 9 Jul 2019 15:10:03 +0000 (11:10 -0400)]
File is now short enough for tidy

5 years agoRemove writer function from PrintState
Mark Rousskov [Tue, 9 Jul 2019 13:51:56 +0000 (09:51 -0400)]
Remove writer function from PrintState

5 years agoUse constant instead of magic number
Mark Rousskov [Tue, 9 Jul 2019 13:49:37 +0000 (09:49 -0400)]
Use constant instead of magic number

5 years agoRemove needless indent arguments
Mark Rousskov [Tue, 9 Jul 2019 13:30:08 +0000 (09:30 -0400)]
Remove needless indent arguments

We're always indenting by INDENT_UNIT anyway

5 years agoProperly case indent_unit constant
Mark Rousskov [Tue, 9 Jul 2019 13:32:25 +0000 (09:32 -0400)]
Properly case indent_unit constant

5 years agoMove pp::Printer helpers to direct impl
Mark Rousskov [Tue, 9 Jul 2019 13:26:50 +0000 (09:26 -0400)]
Move pp::Printer helpers to direct impl

5 years agoRename is_bol -> is_beginning_of_line
Mark Rousskov [Tue, 9 Jul 2019 11:42:05 +0000 (07:42 -0400)]
Rename is_bol -> is_beginning_of_line

Also moves it to pp::Printer from PrintState.

5 years agoRemove needless indirection in bclose
Mark Rousskov [Tue, 9 Jul 2019 11:38:31 +0000 (07:38 -0400)]
Remove needless indirection in bclose

5 years agoDrop length from Token::String
Mark Rousskov [Fri, 5 Jul 2019 13:58:34 +0000 (09:58 -0400)]
Drop length from Token::String

It was always set to the string's length

5 years agoRename pretty_print_* to scan_* to follow naming in the paper
Mark Rousskov [Mon, 8 Jul 2019 18:25:01 +0000 (14:25 -0400)]
Rename pretty_print_* to scan_* to follow naming in the paper

This is also easier to understand because the scan and print "tasks" are
separate, but previously were both called "print" or "pretty print."

5 years agoRemove is_begin/is_end functions from PrintState
Mark Rousskov [Sun, 7 Jul 2019 14:51:18 +0000 (10:51 -0400)]
Remove is_begin/is_end functions from PrintState

These are somewhat ambiguous (beginning/end of what?) so it's better to
inline their one use into the code.

5 years agoSimplify print_end
Mark Rousskov [Sun, 7 Jul 2019 14:38:09 +0000 (10:38 -0400)]
Simplify print_end

Presumably the code was from an older age of Rust and can now be written
much simpler.

5 years agoSimplify check_stack implementation
Mark Rousskov [Sun, 7 Jul 2019 14:15:47 +0000 (10:15 -0400)]
Simplify check_stack implementation

5 years agoMove BufEntry assignment into scan_push
Mark Rousskov [Sat, 6 Jul 2019 11:28:25 +0000 (07:28 -0400)]
Move BufEntry assignment into scan_push

5 years agoRemove useless call to indent
Mark Rousskov [Sat, 6 Jul 2019 02:31:45 +0000 (22:31 -0400)]
Remove useless call to indent

5 years agoFully privatize (vs. crate visibility) functions
Mark Rousskov [Sat, 6 Jul 2019 02:27:36 +0000 (22:27 -0400)]
Fully privatize (vs. crate visibility) functions

5 years agoMove pp::Printer out field to owned String
Mark Rousskov [Fri, 5 Jul 2019 23:10:18 +0000 (19:10 -0400)]
Move pp::Printer out field to owned String

This enforces that eof() must be called to get the String out, and
generally is better from an API perspective. No users of pretty printing
pre-allocate the buffer.

5 years agoInline State::new_from_input in pprust
Mark Rousskov [Fri, 5 Jul 2019 22:32:04 +0000 (18:32 -0400)]
Inline State::new_from_input in pprust

This function took too many arguments and are simple on the inside;
inlining them makes complexity go down.

hir::print's copy is unfortunately used from librustc_driver so inlining
it is not as straightforward.

5 years agoprint_crate returns String instead of taking an out pointer
Mark Rousskov [Fri, 5 Jul 2019 21:48:21 +0000 (17:48 -0400)]
print_crate returns String instead of taking an out pointer

5 years agoReplace src: &mut dyn Read with String
Mark Rousskov [Fri, 5 Jul 2019 21:12:11 +0000 (17:12 -0400)]
Replace src: &mut dyn Read with String

5 years agoCombine comment-handling logic into struct
Mark Rousskov [Fri, 5 Jul 2019 22:29:15 +0000 (18:29 -0400)]
Combine comment-handling logic into struct

This also permits sharing the underlying code between pprust and
hir::print.

5 years agoInline State::new
Mark Rousskov [Fri, 5 Jul 2019 20:35:23 +0000 (16:35 -0400)]
Inline State::new

There was only one callsite for each and this removes the
unwrap_or_default's on the comments argument

5 years agoStop Option-wrapping comments
Mark Rousskov [Fri, 5 Jul 2019 20:32:15 +0000 (16:32 -0400)]
Stop Option-wrapping comments

We always check against the length before indexing anyway.

5 years agoRemove unused boxes vector
Mark Rousskov [Fri, 5 Jul 2019 20:14:47 +0000 (16:14 -0400)]
Remove unused boxes vector

5 years agoPrivatize and remove unused functions
Mark Rousskov [Fri, 5 Jul 2019 20:00:38 +0000 (16:00 -0400)]
Privatize and remove unused functions

5 years agoDon't re-collect tokenstream twice to pretty print
Mark Rousskov [Fri, 5 Jul 2019 16:25:34 +0000 (12:25 -0400)]
Don't re-collect tokenstream twice to pretty print

5 years agoMove lifetime_to_string to Display impl
Mark Rousskov [Fri, 5 Jul 2019 19:42:28 +0000 (15:42 -0400)]
Move lifetime_to_string to Display impl

5 years agoRemove unused arm_to_string
Mark Rousskov [Fri, 5 Jul 2019 19:43:13 +0000 (15:43 -0400)]
Remove unused arm_to_string

5 years agoRemove duplicate attr_to_string
Mark Rousskov [Fri, 5 Jul 2019 16:16:41 +0000 (12:16 -0400)]
Remove duplicate attr_to_string

attribute_to_string exists.

5 years agoMove literal_to_string to fmt::Display
Mark Rousskov [Wed, 26 Jun 2019 11:23:27 +0000 (07:23 -0400)]
Move literal_to_string to fmt::Display

5 years agoAuto merge of #62441 - RalfJung:place-ptr-normalization, r=oli-obk
bors [Wed, 10 Jul 2019 08:59:15 +0000 (08:59 +0000)]
Auto merge of #62441 - RalfJung:place-ptr-normalization, r=oli-obk

Miri: Provide pointer forcing methods for MemPlace and Op

These are useful when one wants to to a lot of work with some place or operand and not to int-to-ptr casts all the time. In particular, this is needed to fix some test failures in Miri: we need to normalize before starting a visitor that walks a run-time value, so that we can later be sure (during the visitor walk) that we have a proper `Pointer`.

Also see the Miri side at https://github.com/rust-lang/miri/pull/830.

Cc @eddyb @oli-obk

5 years agoAuto merge of #62555 - Centril:rollup-ti46adx, r=Centril
bors [Wed, 10 Jul 2019 05:21:43 +0000 (05:21 +0000)]
Auto merge of #62555 - Centril:rollup-ti46adx, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #61853 (Emit warning when trying to use PGO in conjunction with unwinding on â€¦)
 - #62278 (Add Iterator::partition_in_place() and is_partitioned())
 - #62283 (Target::arch can take more than listed options)
 - #62393 (Fix pretty-printing of `$crate` (take 4))
 - #62474 (Prepare for LLVM 9 update)

Failed merges:

r? @ghost

5 years agoUse fold in Iterator::last
Chris Gregory [Sun, 7 Jul 2019 23:54:48 +0000 (16:54 -0700)]
Use fold in Iterator::last

Replace last impl with fold

5 years agoRollup merge of #62474 - nikic:update-llvm, r=alexcrichton
Mazdak Farrokhzad [Wed, 10 Jul 2019 03:14:10 +0000 (05:14 +0200)]
Rollup merge of #62474 - nikic:update-llvm, r=alexcrichton

Prepare for LLVM 9 update

Main changes:

 * In preparation for opaque pointer types, the `byval` attribute now takes a type. As such, the argument type needs to be threaded through to the function/callsite attribute application logic.
 * On ARM the `+fp-only-sp` and `+d16` features have become `-fp64` and `-d32`. I've switched the target definitions to use the new names, but also added bidirectional emulation so either can be used on any LLVM version for backwards compatibility.
 * The datalayout can now specify function pointer alignment. In particular on ARM `Fi8` is specified, which means that function pointer alignment is independent of function alignment. I've added this to our datalayouts to match LLVM (which is something we check) and strip the fnptr alignment for older LLVM versions.
 * The fmul/fadd reductions now always respect the accumulator (including for unordered reductions), so we should pass the identity instead of undef.

Open issues:

 * https://reviews.llvm.org/D62106 causes linker errors with ld.bdf due to https://sourceware.org/bugzilla/show_bug.cgi?id=24784. To avoid this I've enabled `RelaxELFRelocations`, which results in a GOTPCRELX relocation for `__tls_get_addr` and avoids the issue. However, this is likely not acceptable because relax relocations are not supported by older linker versions. We may need an LLVM option to keep using PLT for `__tls_get_addr` despite `RtLibUseGOT`.

The corresponding llvm-project PR is https://github.com/rust-lang/llvm-project/pull/19.

r? @ghost

5 years agoRollup merge of #62393 - petrochenkov:notto-disu, r=Mark-Simulacrum
Mazdak Farrokhzad [Wed, 10 Jul 2019 03:14:09 +0000 (05:14 +0200)]
Rollup merge of #62393 - petrochenkov:notto-disu, r=Mark-Simulacrum

Fix pretty-printing of `$crate` (take 4)

Pretty-print `$crate` as `crate` or `crate_name` in unstructured tokens like `a $crate c` in `foo!(a $crate c)`, but only if those tokens are printed as a part of AST pretty-printing, rather than as a standalone token stream.

Fixes https://github.com/rust-lang/rust/issues/62325
Previous iterations - https://github.com/rust-lang/rust/pull/56647, https://github.com/rust-lang/rust/pull/57155, https://github.com/rust-lang/rust/pull/57915.

5 years agoRollup merge of #62283 - fintelia:patch-5, r=Mark-Simulacrum
Mazdak Farrokhzad [Wed, 10 Jul 2019 03:14:07 +0000 (05:14 +0200)]
Rollup merge of #62283 - fintelia:patch-5, r=Mark-Simulacrum

Target::arch can take more than listed options

A list of options in a comment like this is almost guaranteed to become out of date: right now it is missing "riscv32" and "riscv64" and perhaps other architectures as well.

5 years agoRollup merge of #62278 - cuviper:iter-partition, r=alexcrichton
Mazdak Farrokhzad [Wed, 10 Jul 2019 03:14:06 +0000 (05:14 +0200)]
Rollup merge of #62278 - cuviper:iter-partition, r=alexcrichton

Add Iterator::partition_in_place() and is_partitioned()

`partition_in_place()` swaps `&mut T` items in-place to satisfy the
predicate, so all `true` items precede all `false` items. This requires
a `DoubleEndedIterator` so we can search from front and back for items
that need swapping.

`is_partitioned()` checks whether the predicate is already satisfied.

5 years agoRollup merge of #61853 - EricRahm:use_warning, r=varkor
Mazdak Farrokhzad [Wed, 10 Jul 2019 03:14:04 +0000 (05:14 +0200)]
Rollup merge of #61853 - EricRahm:use_warning, r=varkor

Emit warning when trying to use PGO in conjunction with unwinding on â€¦

…Windows.

This reduces the error introduced for #61002 to just a warning.

5 years agoAuto merge of #62548 - ehuss:update-cargo, r=alexcrichton
bors [Wed, 10 Jul 2019 01:53:04 +0000 (01:53 +0000)]
Auto merge of #62548 - ehuss:update-cargo, r=alexcrichton

Update cargo

Update cargo

12 commits in 4c1fa54d10f58d69ac9ff55be68e1b1c25ecb816..677a180f4c8ca1dcef594f68dd0e63e4f08621f5
2019-06-24 11:24:18 +0000 to 2019-07-08 13:43:02 +0000
- Update dependencies (rust-lang/cargo#7106)
- Fix overwriting .d file for binary with dSYM on apple targets. (rust-lang/cargo#7057)
- Update changelog. (rust-lang/cargo#7102)
- Revert "Fix 'getting started' internal links" (rust-lang/cargo#7099)
- Bump to 0.39.0 (rust-lang/cargo#7100)
- Update dependency.rs (rust-lang/cargo#7098)
- Typo (rust-lang/cargo#7097)
- Fix 'getting started' internal links (rust-lang/cargo#7093)
- Fix misleading comment in testsuite (rust-lang/cargo#7090)
- improve uncommitted changes cargo-package message (rust-lang/cargo#7083)
- Clean environment when git-fetch-with-cli is used. (rust-lang/cargo#7082)
- Fix exponentiality in depend_on_deps_of_deps. (rust-lang/cargo#7062)

5 years agoUpdate cargo
Eric Huss [Tue, 9 Jul 2019 23:47:45 +0000 (16:47 -0700)]
Update cargo

5 years agoTracking issue 62544 for iter_is_partitioned
Josh Stone [Tue, 9 Jul 2019 22:18:33 +0000 (15:18 -0700)]
Tracking issue 62544 for iter_is_partitioned

5 years agoTracking issue 62543 for iter_partition_in_place
Josh Stone [Tue, 9 Jul 2019 22:17:47 +0000 (15:17 -0700)]
Tracking issue 62543 for iter_partition_in_place

5 years agoAuto merge of #62542 - Centril:rollup-5mpb8tu, r=Centril
bors [Tue, 9 Jul 2019 22:02:58 +0000 (22:02 +0000)]
Auto merge of #62542 - Centril:rollup-5mpb8tu, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #62417 (Fix ICEs when `Self` is used in type aliases)
 - #62450 (Raise the default recursion limit to 128)
 - #62470 (Prevent shrinking of "crate select" element on Firefox)
 - #62515 (cli: make help output for -l and -L consistent)
 - #62520 (Regression test for issue 42574.)
 - #62526 (normalize use of backticks in compiler messages for libsyntax/feature_gate.rs)
 - #62527 (clarify that debug_assert does not completely omits the code)
 - #62535 (ci: Configure $CI_JOB_NAME correctly)
 - #62541 (Add spastorino for rustc-guide toolstate)

Failed merges:

r? @ghost

5 years agoEmit warning when trying to use PGO in conjunction with unwinding on Windows.
Eric Rahm [Fri, 14 Jun 2019 17:58:39 +0000 (10:58 -0700)]
Emit warning when trying to use PGO in conjunction with unwinding on Windows.

5 years agoAdjust codegen tests for DISPFlagMainSubprogram
Nikita Popov [Sun, 7 Jul 2019 18:22:56 +0000 (20:22 +0200)]
Adjust codegen tests for DISPFlagMainSubprogram

5 years agoFix float add/mul reduction codegen
Nikita Popov [Sun, 7 Jul 2019 17:08:40 +0000 (19:08 +0200)]
Fix float add/mul reduction codegen

The accumulator is now respected for unordered reductions.

5 years agoStrip function pointer alignment for older LLVM versions
Nikita Popov [Sun, 7 Jul 2019 16:41:28 +0000 (18:41 +0200)]
Strip function pointer alignment for older LLVM versions

5 years agoAdd function pointer alignment to ARM/Thumb data layout
Nikita Popov [Sun, 7 Jul 2019 16:18:02 +0000 (18:18 +0200)]
Add function pointer alignment to ARM/Thumb data layout

5 years agoUse new feature names in target feature lists
Nikita Popov [Sun, 7 Jul 2019 16:10:12 +0000 (18:10 +0200)]
Use new feature names in target feature lists

5 years agoTranslate target features for LLVM 9
Nikita Popov [Sun, 7 Jul 2019 15:44:00 +0000 (17:44 +0200)]
Translate target features for LLVM 9

5 years agoPass type to byval attributes
Nikita Popov [Sat, 6 Jul 2019 19:52:25 +0000 (21:52 +0200)]
Pass type to byval attributes

5 years agoPass GUIDPreservedSymbols to thinLTOResolvePrevailingInIndex()
Nikita Popov [Sat, 6 Jul 2019 17:02:48 +0000 (19:02 +0200)]
Pass GUIDPreservedSymbols to thinLTOResolvePrevailingInIndex()

5 years agoAdd a test case with `$crate` from other crate
Vadim Petrochenkov [Tue, 9 Jul 2019 19:21:55 +0000 (22:21 +0300)]
Add a test case with `$crate` from other crate

5 years agoUnit test Iterator::partition_in_place and is_partitioned
Josh Stone [Tue, 9 Jul 2019 19:39:19 +0000 (12:39 -0700)]
Unit test Iterator::partition_in_place and is_partitioned

5 years agoReturn the true count from partition_in_place
Josh Stone [Tue, 9 Jul 2019 01:25:19 +0000 (18:25 -0700)]
Return the true count from partition_in_place

5 years agoRename partition_mut to partition_in_place
Josh Stone [Mon, 1 Jul 2019 22:34:53 +0000 (15:34 -0700)]
Rename partition_mut to partition_in_place

5 years agoCapitalize example comment
Josh Stone [Mon, 1 Jul 2019 22:17:39 +0000 (15:17 -0700)]
Capitalize example comment

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
5 years agoAdd Iterator::partition_mut() and is_partitioned()
Josh Stone [Mon, 1 Jul 2019 18:49:44 +0000 (11:49 -0700)]
Add Iterator::partition_mut() and is_partitioned()

`partition_mut()` swaps `&mut T` items in-place to satisfy the
predicate, so all `true` items precede all `false` items. This requires
a `DoubleEndedIterator` so we can search from front and back for items
that need swapping.

`is_partitioned()` checks whether the predicate is already satisfied.

5 years agoResolve `$crate` in all hygienic contexts for pretty-pringing
Vadim Petrochenkov [Fri, 5 Jul 2019 00:09:24 +0000 (03:09 +0300)]
Resolve `$crate` in all hygienic contexts for pretty-pringing

Stop visiting AST to discover those contexts, just iterate through hygiene data instead

5 years agoPretty-print `$crate` as `crate`/`::my_crate` in tokens
Vadim Petrochenkov [Wed, 3 Jul 2019 23:37:34 +0000 (02:37 +0300)]
Pretty-print `$crate` as `crate`/`::my_crate` in tokens

...but only if those tokens are printed from inside of AST pretty-printing.

5 years agoAdd a test for `$crate` inside macro invocation
Vadim Petrochenkov [Wed, 3 Jul 2019 22:28:24 +0000 (01:28 +0300)]
Add a test for `$crate` inside macro invocation

5 years agoRollup merge of #62541 - mark-i-m:patch-1, r=Centril
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:59 +0000 (21:01 +0200)]
Rollup merge of #62541 - mark-i-m:patch-1, r=Centril

Add spastorino for rustc-guide toolstate

cc @spastorino

r? @Centril

5 years agoRollup merge of #62535 - alexcrichton:ci-job-name, r=pietroalbini
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:58 +0000 (21:01 +0200)]
Rollup merge of #62535 - alexcrichton:ci-job-name, r=pietroalbini

ci: Configure $CI_JOB_NAME correctly

Looks like some env vars were tweaked on Azure's side of things, so
update how we configure `CI_JOB_NAME`.

5 years agoRollup merge of #62527 - matklad:debug-assert, r=Centril
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:56 +0000 (21:01 +0200)]
Rollup merge of #62527 - matklad:debug-assert, r=Centril

clarify that debug_assert does not completely omits the code

TIL that debug_assert is implemented using `if cfg!(debug_assertions)`
rather than `#[cfg(debug_assertions)]`. This means one can not use API
gated with `#[cfg(debug_assertions)]` in `debug_assert` family of
macros.

5 years agoRollup merge of #62526 - fakenine:normalize_use_of_backticks_compiler_messages_p4...
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:55 +0000 (21:01 +0200)]
Rollup merge of #62526 - fakenine:normalize_use_of_backticks_compiler_messages_p4, r=Centril

normalize use of backticks in compiler messages for libsyntax/feature_gate.rs

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

5 years agoRollup merge of #62520 - pnkfelix:add-test-for-42574, r=alexcrichton
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:53 +0000 (21:01 +0200)]
Rollup merge of #62520 - pnkfelix:add-test-for-42574, r=alexcrichton

Regression test for issue 42574.

Cc #42574.

I'm not going to say this *closes* that issue yet, for two reasons:

 1. I am still confused about some aspects of the behavior we are observing that bug

 2. The "fix" to the diagnostic relies on full NLL (`#![feature(nll)]`); migration mode still has a subpar diagnostic.

5 years agoRollup merge of #62515 - tshepang:consistent, r=Centril
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:52 +0000 (21:01 +0200)]
Rollup merge of #62515 - tshepang:consistent, r=Centril

cli: make help output for -l and -L consistent

5 years agoRollup merge of #62470 - dima74:patch-1, r=GuillaumeGomez
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:51 +0000 (21:01 +0200)]
Rollup merge of #62470 - dima74:patch-1, r=GuillaumeGomez

Prevent shrinking of "crate select" element on Firefox

This fixes #60368

5 years agoRollup merge of #62450 - nagisa:reclimit, r=pnkfelix
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:49 +0000 (21:01 +0200)]
Rollup merge of #62450 - nagisa:reclimit, r=pnkfelix

Raise the default recursion limit to 128

The previous limit of 64 is being (just) barely hit by genuine code out there, which is causing issues like https://github.com/rust-lang/rust/issues/62059 to rear their end.

Ideally, we wouldn’t have such arbitrary limits at all, but while we do, it makes a lot of sense to just raise this limit whenever genuine use-cases end up hitting it.

r? @pnkfelix

Fixes https://github.com/rust-lang/rust/issues/62059

5 years agoRollup merge of #62417 - alexreg:fix-self-in-type-alias, r=pnkfelix
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:48 +0000 (21:01 +0200)]
Rollup merge of #62417 - alexreg:fix-self-in-type-alias, r=pnkfelix

Fix ICEs when `Self` is used in type aliases

I think it is right just to disallow this at resolution stage rather than let typeck produce a cyclic error. This is in line with previous behaviour. There was probably no need at all for the change that introduced this bug in #57428, so I've simply reversed it.

Fixes #62263, #62364, #62305.

r? @eddyb

5 years agoAdd spastorino for rustc-guide toolstate
Who? Me?! [Tue, 9 Jul 2019 18:58:32 +0000 (13:58 -0500)]
Add spastorino for rustc-guide toolstate

5 years agoAuto merge of #62221 - jonas-schievink:normalize-impl-trait, r=nikomatsakis
bors [Tue, 9 Jul 2019 18:35:12 +0000 (18:35 +0000)]
Auto merge of #62221 - jonas-schievink:normalize-impl-trait, r=nikomatsakis

Normalize projections appearing in `impl Trait`

Fixes #60414

This does not try to do the same for `existential type`s (which have the same bug), since that always seems to lead to cycle errors.

5 years agoApply suggestions from code review
Aleksey Kladov [Tue, 9 Jul 2019 16:10:22 +0000 (19:10 +0300)]
Apply suggestions from code review

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
5 years agoci: Configure $CI_JOB_NAME correctly
Alex Crichton [Tue, 9 Jul 2019 16:09:13 +0000 (09:09 -0700)]
ci: Configure $CI_JOB_NAME correctly

Looks like some env vars were tweaked on Azure's side of things, so
update how we configure `CI_JOB_NAME`.

5 years agodoc(ptr): add example for {read,write}_unaligned
Freyskeyd [Mon, 8 Jul 2019 14:03:29 +0000 (16:03 +0200)]
doc(ptr): add example for {read,write}_unaligned

Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
5 years agoAdded comment explaining purpose of `search_for_adt_without_structural_match`.
Felix S. Klock II [Tue, 9 Jul 2019 14:54:19 +0000 (16:54 +0200)]
Added comment explaining purpose of `search_for_adt_without_structural_match`.

5 years agoAuto merge of #62233 - matthewjasper:exit-arm-scopes, r=pnkfelix
bors [Tue, 9 Jul 2019 13:10:31 +0000 (13:10 +0000)]
Auto merge of #62233 - matthewjasper:exit-arm-scopes, r=pnkfelix

Exit arm scopes

Due to a bug in the HIR CFG construction, borrows for arm scopes were incorrectly leaking into other arms.
This PR also includes some drive-by improvements to `-Zunpretty=hir,identified` that would have been helpful while investigating this.

Closes #62107

5 years agoclarify that debug_assert does not completely omits the code
Aleksey Kladov [Tue, 9 Jul 2019 12:26:18 +0000 (15:26 +0300)]
clarify that debug_assert does not completely omits the code

TIL that debug_assert is implemented using `if cfg!(debug_assertions)`
rather than `#[cfg(debug_assertions)]`. This means one can not use API
gated with `#[cfg(debug_assertions)]` in `debug_assert` family of
macros.

5 years agonormalize use of backticks in compiler messages for libsyntax/feature_gate
Samy Kacimi [Tue, 9 Jul 2019 09:32:08 +0000 (11:32 +0200)]
normalize use of backticks in compiler messages for libsyntax/feature_gate

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

5 years agorewrite the test to workaround #51525
Niko Matsakis [Tue, 9 Jul 2019 10:57:52 +0000 (06:57 -0400)]
rewrite the test to workaround #51525

5 years agoRegression test for issue 42574.
Felix S. Klock II [Tue, 9 Jul 2019 09:56:01 +0000 (11:56 +0200)]
Regression test for issue 42574.

5 years agoAuto merge of #62463 - Disasm:riscv-lto, r=alexcrichton
bors [Tue, 9 Jul 2019 09:50:51 +0000 (09:50 +0000)]
Auto merge of #62463 - Disasm:riscv-lto, r=alexcrichton

Update LLVM: apply patch necessary for ThinLTO on RISC-V

This patch allows [using inlined assembly operations](https://github.com/rust-embedded/cortex-m/issues/139) on stable Rust with the help of ThinLTO.

5 years agoAuto merge of #62460 - RalfJung:llvm-null, r=eddyb
bors [Tue, 9 Jul 2019 06:20:44 +0000 (06:20 +0000)]
Auto merge of #62460 - RalfJung:llvm-null, r=eddyb

 Handle null from LLVMRustGetSectionName

As part of https://github.com/rust-lang/rust/pull/58783 and https://github.com/rust-lang/rust/pull/62103, this incorrect use of a NULL pointer was found in the interface to LLVM. That PR is stuck with some linker issues, but there is no reason the soundness fix should have to wait for that.

5 years agoAuto merge of #62511 - Centril:rollup-ojzb35x, r=Centril
bors [Tue, 9 Jul 2019 02:53:20 +0000 (02:53 +0000)]
Auto merge of #62511 - Centril:rollup-ojzb35x, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #60458 (Add key and value methods to DebugMap)
 - #62090 (typeck: merge opaque type inference logic)
 - #62403 (Replace SliceConcatExt trait with inherent methods and SliceConcat helper trait)
 - #62494 (Remove unused dependencies)

Failed merges:

r? @ghost

5 years agoRollup merge of #62494 - sinkuu:unused_deps, r=alexcrichton
Mazdak Farrokhzad [Tue, 9 Jul 2019 02:52:40 +0000 (04:52 +0200)]
Rollup merge of #62494 - sinkuu:unused_deps, r=alexcrichton

Remove unused dependencies

5 years agoRollup merge of #62403 - SimonSapin:concat, r=alexcrichton
Mazdak Farrokhzad [Tue, 9 Jul 2019 02:52:38 +0000 (04:52 +0200)]
Rollup merge of #62403 - SimonSapin:concat, r=alexcrichton

Replace SliceConcatExt trait with inherent methods and SliceConcat helper trait

Before this change `SliceConcatExt` was an unstable extension trait with stable methods. It was in the libstd prelude, so that its methods could be used on the stable channel.

This replaces it with inherent methods, which can be used without any addition to the prelude. Since the methods are stable and very generic (with for example a return type that depends on the types of parameters), an helper trait is still needed. But now that trait does not need to be in scope for the methods to be used.

Removing this depedency on the libstd prelude allows the methods to be used in `#![no_std]` crate that use liballoc, which does not have its own implicitly-imported prelude.

5 years agoRollup merge of #62090 - davidtwco:ice-async-await-out-of-range-substitution, r=nikom...
Mazdak Farrokhzad [Tue, 9 Jul 2019 02:52:37 +0000 (04:52 +0200)]
Rollup merge of #62090 - davidtwco:ice-async-await-out-of-range-substitution, r=nikomatsakis

typeck: merge opaque type inference logic

Fixes #55872. See [relevant Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/187312-wg-async-foundations/topic/type.20parameter.20out.20of.20range.20.2355872).

r? @nikomatsakis

5 years agoRollup merge of #60458 - KodrAus:debug_map_entry, r=alexcrichton
Mazdak Farrokhzad [Tue, 9 Jul 2019 02:52:35 +0000 (04:52 +0200)]
Rollup merge of #60458 - KodrAus:debug_map_entry, r=alexcrichton

Add key and value methods to DebugMap

Implementation PR for an active (not approved) RFC: https://github.com/rust-lang/rfcs/pull/2696.

Add two new methods to `std::fmt::DebugMap` for writing the key and value part of a map entry separately:

```rust
impl<'a, 'b: 'a> DebugMap<'a, 'b> {
    pub fn key(&mut self, key: &dyn Debug) -> &mut Self;
    pub fn value(&mut self, value: &dyn Debug) -> &mut Self;
}
```

I want to do this so that I can write a `serde::Serializer` that forwards to our format builders, so that any `T: Serialize` can also be treated like a `T: Debug`.

5 years agoadd feature to docs
Ashley Mannix [Mon, 8 Jul 2019 22:30:20 +0000 (08:30 +1000)]
add feature to docs

5 years agoAuto merge of #61224 - aloucks:drain_filter, r=Gankro
bors [Mon, 8 Jul 2019 22:03:26 +0000 (22:03 +0000)]
Auto merge of #61224 - aloucks:drain_filter, r=Gankro

Prevent Vec::drain_filter from double dropping on panic

Fixes: #60977
The changes in this PR prevent leaking and double-panicking in addition to double-drop.

Tracking issue: #43244