]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #78396 - josephlr:ermsb, r=petrochenkov
Yuki Okushi [Mon, 26 Oct 2020 23:45:24 +0000 (08:45 +0900)]
Rollup merge of #78396 - josephlr:ermsb, r=petrochenkov

Add compiler support for LLVM's x86_64 ERMSB feature

This change is needed for compiler-builtins to check for this feature
when implementing memcpy/memset. See:
  https://github.com/rust-lang/compiler-builtins/pull/365

Without this change, the following code compiles, but does nothing:
```rust
#[cfg(target_feature = "ermsb")]
pub unsafe fn ermsb_memcpy() { ... }
```

The change just does compile-time detection. I think that runtime
detection will have to come in a follow-up CL to std-detect.

Like all the CPU feature flags, this just references #44839

Signed-off-by: Joe Richey <joerichey@google.com>
3 years agoRollup merge of #78394 - rubik:master, r=m-ou-se
Yuki Okushi [Mon, 26 Oct 2020 23:45:20 +0000 (08:45 +0900)]
Rollup merge of #78394 - rubik:master, r=m-ou-se

fix(docs): typo in BufWriter documentation

This PR fixes a small typo in the BufWriter documentation. The current documentation looks like this:

![2020-10-26-111501_438x83_scrot](https://user-images.githubusercontent.com/238549/97160357-83d3a000-177c-11eb-8a35-3cdd3a7d89de.png)

The `<u8>` at the end is mangled by Markdown. This PR makes the `BufWriter` documentation like the `BufReader` one:

https://github.com/rust-lang/rust/blob/master/library/std/src/io/buffered/bufreader.rs#L16

I'm tagging Steve as per the Rustc dev guide.

r? @steveklabnik

3 years agoRollup merge of #78388 - camelid:regression-tests, r=lcnr
Yuki Okushi [Mon, 26 Oct 2020 23:45:17 +0000 (08:45 +0900)]
Rollup merge of #78388 - camelid:regression-tests, r=lcnr

Add some regression tests

Closes #75763.
Closes #76179.

3 years agoRollup merge of #78377 - LeSeulArtichaut:patch-docs, r=jonas-schievink
Yuki Okushi [Mon, 26 Oct 2020 23:45:14 +0000 (08:45 +0900)]
Rollup merge of #78377 - LeSeulArtichaut:patch-docs, r=jonas-schievink

Fix typo in debug statement

3 years agoRollup merge of #78375 - taiki-e:question-in-macros, r=kennytm
Yuki Okushi [Mon, 26 Oct 2020 23:45:10 +0000 (08:45 +0900)]
Rollup merge of #78375 - taiki-e:question-in-macros, r=kennytm

Use ? in core/std macros

3 years agoRollup merge of #78349 - JohnTitor:issue-75962, r=davidtwco
Yuki Okushi [Mon, 26 Oct 2020 23:45:07 +0000 (08:45 +0900)]
Rollup merge of #78349 - JohnTitor:issue-75962, r=davidtwco

Use its own `TypeckResults` to avoid ICE

Fixes #75962

3 years agoRollup merge of #78348 - jyn514:pub-crate, r=GuillaumeGomez
Yuki Okushi [Mon, 26 Oct 2020 23:45:04 +0000 (08:45 +0900)]
Rollup merge of #78348 - jyn514:pub-crate, r=GuillaumeGomez

Make some functions private that don't have to be public

r? @GuillaumeGomez

3 years agoRollup merge of #78347 - Rustin-Liu:rustin-patch-doc, r=kennytm
Yuki Okushi [Mon, 26 Oct 2020 23:45:01 +0000 (08:45 +0900)]
Rollup merge of #78347 - Rustin-Liu:rustin-patch-doc, r=kennytm

Add lexicographical comparison doc

close https://github.com/rust-lang/rust/issues/72255

3 years agoRollup merge of #78342 - oliviacrain:checkmate-pass, r=Mark-Simulacrum
Yuki Okushi [Mon, 26 Oct 2020 23:44:57 +0000 (08:44 +0900)]
Rollup merge of #78342 - oliviacrain:checkmate-pass, r=Mark-Simulacrum

Use check-pass in single-use-lifetime ui tests

Rationale: the `single_use_lifetimes` lint is used during late name resolution, which is within the scope of `check-pass` and does not require codegen or linking.

Helps remove some FIXMES associated with #62277. Additionally tidies touched test files.

3 years agoRollup merge of #78332 - PoignardAzur:doc_E0308, r=camelid
Yuki Okushi [Mon, 26 Oct 2020 23:44:54 +0000 (08:44 +0900)]
Rollup merge of #78332 - PoignardAzur:doc_E0308, r=camelid

Update description for error E0308

Fixes #76462

r? @camelid

3 years agoRollup merge of #78298 - Aaron1011:fix/nll-ranked-test, r=Mark-Simulacrum
Yuki Okushi [Mon, 26 Oct 2020 23:44:51 +0000 (08:44 +0900)]
Rollup merge of #78298 - Aaron1011:fix/nll-ranked-test, r=Mark-Simulacrum

Add test for bad NLL higher-ranked subtype

Fixes #57642

3 years agoRollup merge of #78219 - JohnTitor:print-def-path, r=estebank
Yuki Okushi [Mon, 26 Oct 2020 23:44:47 +0000 (08:44 +0900)]
Rollup merge of #78219 - JohnTitor:print-def-path, r=estebank

Prefer to use `print_def_path`

Follow-up of https://github.com/rust-lang/rust/pull/71310#discussion_r415438577

3 years agoRollup merge of #77703 - Keruspe:system-libunwind, r=Mark-Simulacrum
Yuki Okushi [Mon, 26 Oct 2020 23:44:44 +0000 (08:44 +0900)]
Rollup merge of #77703 - Keruspe:system-libunwind, r=Mark-Simulacrum

add system-llvm-libunwind config option

allows using the system-wide llvm-libunwind as the unwinder

Workaround for #76020

3 years agoRollup merge of #76635 - scottmcm:slice-as-chunks, r=LukasKalbertodt
Yuki Okushi [Mon, 26 Oct 2020 23:44:41 +0000 (08:44 +0900)]
Rollup merge of #76635 - scottmcm:slice-as-chunks, r=LukasKalbertodt

Add [T]::as_chunks(_mut)

Allows getting the slices directly, rather than just through an iterator as in `array_chunks(_mut)`.  The constructors for those iterators are then written in terms of these methods, so the iterator constructors no longer have any `unsafe` of their own.

Unstable, of course. #74985

3 years agoAuto merge of #77187 - TimDiekmann:box-alloc, r=Amanieu
bors [Mon, 26 Oct 2020 21:16:33 +0000 (21:16 +0000)]
Auto merge of #77187 - TimDiekmann:box-alloc, r=Amanieu

Support custom allocators in `Box`

r? `@Amanieu`

This pull request requires a crater run.

### Prior work:
- #71873
- #58457
- [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg)-crate

Currently blocked on:
- ~#77118~
- ~https://github.com/rust-lang/chalk/issues/615 (#77515)~

3 years agoAdd FIXME note to const generics test
Camelid [Mon, 26 Oct 2020 20:56:31 +0000 (13:56 -0700)]
Add FIXME note to const generics test

Co-authored-by: lcnr <bastian_kauschke@hotmail.de>
3 years agoAdd some regression tests
Camelid [Mon, 26 Oct 2020 05:01:37 +0000 (22:01 -0700)]
Add some regression tests

3 years agoAuto merge of #68965 - eddyb:mir-inline-scope, r=nagisa,oli-obk
bors [Mon, 26 Oct 2020 18:50:22 +0000 (18:50 +0000)]
Auto merge of #68965 - eddyb:mir-inline-scope, r=nagisa,oli-obk

 rustc_mir: track inlined callees in SourceScopeData.

We now record which MIR scopes are the roots of *other* (inlined) functions's scope trees, which allows us to generate the correct debuginfo in codegen, similar to what LLVM inlining generates.
This PR makes the `ui` test `backtrace-debuginfo` pass, if the MIR inliner is turned on by default.

Also, `#[track_caller]` is now correct in the face of MIR inlining (cc `@anp).`

Fixes #76997.

r? `@rust-lang/wg-mir-opt`

3 years agoAuto merge of #77975 - bjorn3:cg_clif_subtree3, r=Mark-Simulacrum
bors [Mon, 26 Oct 2020 16:31:38 +0000 (16:31 +0000)]
Auto merge of #77975 - bjorn3:cg_clif_subtree3, r=Mark-Simulacrum

Add cg_clif as optional codegen backend

Rustc_codegen_cranelift is an alternative codegen backend for rustc based on Cranelift. It has the potential to improve compilation times in debug mode. In my experience the compile time improvements over debug mode LLVM for a clean build are about 20-30% in most cases.

This PR adds cg_clif as optional codegen backend. By default it is only enabled for `./x.py check`. It can be enabled for `./x.py build` too by adding `cranelift` to the `rust.codegen-backends` array in `config.toml`.

MCP: https://github.com/rust-lang/compiler-team/issues/270

r? `@Mark-Simulacrum`

3 years agoAdd lexicographical comparison doc
Rustin-Liu [Sun, 25 Oct 2020 09:46:45 +0000 (17:46 +0800)]
Add lexicographical comparison doc

Add links

Fix typo

Use `sequence`

Fix typo

Fix broken link

Fix broken link

Fix broken link

Fix broken links

Fix broken links

3 years agoAuto merge of #78395 - RalfJung:miri, r=RalfJung
bors [Mon, 26 Oct 2020 14:13:37 +0000 (14:13 +0000)]
Auto merge of #78395 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/78339
Cc `@rust-lang/miri` r? `@ghost`

3 years agoIgnore long lines in test
oli [Mon, 26 Oct 2020 14:09:27 +0000 (14:09 +0000)]
Ignore long lines in test

3 years agoAdd an inlining debuginfo test
oli [Mon, 26 Oct 2020 13:18:12 +0000 (13:18 +0000)]
Add an inlining debuginfo test

3 years agoDeduplicate span and dbg_scope adjustment
oli [Mon, 26 Oct 2020 13:04:52 +0000 (13:04 +0000)]
Deduplicate span and dbg_scope adjustment

3 years agoPrefer `bug!` over `unwrap()`
oli [Mon, 26 Oct 2020 12:49:49 +0000 (12:49 +0000)]
Prefer `bug!` over `unwrap()`

3 years agoAuto merge of #78196 - pietroalbini:shipped-files, r=Mark-Simulacrum
bors [Mon, 26 Oct 2020 11:56:59 +0000 (11:56 +0000)]
Auto merge of #78196 - pietroalbini:shipped-files, r=Mark-Simulacrum

Allow creating a list of files shipped in a release

This PR adds the `BUILD_MANIFEST_SHIPPED_FILES_PATH` environment variable to `build-manifest`, which writes a list of all the files referenced in the manifest to the path defined in the variable. The use for this is for `promote-release` to prune files unused files before publishing a release.

This PR **does not implement any pruning**, it just adds support for it to be implemented in the future on `promote-release`'s side.

r? `@Mark-Simulacrum`

3 years agoupdate Miri
Ralf Jung [Mon, 26 Oct 2020 11:44:41 +0000 (12:44 +0100)]
update Miri

3 years agoAdd compiler support for LLVM's x86 ERMSB feature
Joe Richey [Mon, 26 Oct 2020 10:46:54 +0000 (03:46 -0700)]
Add compiler support for LLVM's x86 ERMSB feature

This change is needed for compiler-builtins to check for this feature
when implementing memcpy/memset. See:
  https://github.com/rust-lang/compiler-builtins/pull/365

The change just does compile-time detection. I think that runtime
detection will have to come in a follow-up CL to std-detect.

Like all the CPU feature flags, this just references #44839

Signed-off-by: Joe Richey <joerichey@google.com>
3 years agofix(docs): typo in BufWriter documentation
Michele Lacchia [Mon, 26 Oct 2020 10:13:47 +0000 (11:13 +0100)]
fix(docs): typo in BufWriter documentation

3 years agobuild-manifest: allow creating a list of files shipped in a release
Pietro Albini [Wed, 21 Oct 2020 17:29:07 +0000 (19:29 +0200)]
build-manifest: allow creating a list of files shipped in a release

3 years agoAuto merge of #78324 - RalfJung:uninhabited-statics, r=oli-obk
bors [Mon, 26 Oct 2020 09:11:34 +0000 (09:11 +0000)]
Auto merge of #78324 - RalfJung:uninhabited-statics, r=oli-obk

ensure that statics are inhabited

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

r? `@oli-obk`

3 years agoAdd 'compiler/rustc_codegen_cranelift/' from commit '793d26047f994e23415f8f6bb5686ff2...
bjorn3 [Mon, 26 Oct 2020 08:53:27 +0000 (09:53 +0100)]
Add 'compiler/rustc_codegen_cranelift/' from commit '793d26047f994e23415f8f6bb5686ff25d3dda92'

git-subtree-dir: compiler/rustc_codegen_cranelift
git-subtree-mainline: cf798c1ec65a5ec3491846777f9003fabb881b4a
git-subtree-split: 793d26047f994e23415f8f6bb5686ff25d3dda92

3 years agoAdd support for using cg_clif to bootstrap rustc
bjorn3 [Thu, 15 Oct 2020 12:23:43 +0000 (14:23 +0200)]
Add support for using cg_clif to bootstrap rustc

3 years agoRustup to rustc 1.49.0-nightly (4760b8fb8 2020-10-25)
bjorn3 [Mon, 26 Oct 2020 08:51:48 +0000 (09:51 +0100)]
Rustup to rustc 1.49.0-nightly (4760b8fb8 2020-10-25)

3 years agoAuto merge of #75728 - nagisa:improve_align_offset_2, r=Mark-Simulacrum
bors [Mon, 26 Oct 2020 06:49:34 +0000 (06:49 +0000)]
Auto merge of #75728 - nagisa:improve_align_offset_2, r=Mark-Simulacrum

Optimise align_offset for stride=1 further

`stride == 1` case can be computed more efficiently through `-p (mod
a)`. That, then translates to a nice and short sequence of LLVM
instructions:

    %address = ptrtoint i8* %p to i64
    %negptr = sub i64 0, %address
    %offset = and i64 %negptr, %a_minus_one

And produces pretty much ideal code-gen when this function is used in
isolation.

Typical use of this function will, however, involve use of
the result to offset a pointer, i.e.

    %aligned = getelementptr inbounds i8, i8* %p, i64 %offset

This still looks very good, but LLVM does not really translate that to
what would be considered ideal machine code (on any target). For example
that's the codegen we obtain for an unknown alignment:

    ; x86_64
    dec     rsi
    mov     rax, rdi
    neg     rax
    and     rax, rsi
    add     rax, rdi

In particular negating a pointer is not something that’s going to be
optimised for in the design of CISC architectures like x86_64. They
are much better at offsetting pointers. And so we’d love to utilize this
ability and produce code that's more like this:

    ; x86_64
    lea     rax, [rsi + rdi - 1]
    neg     rsi
    and     rax, rsi

To achieve this we need to give LLVM an opportunity to apply its
various peep-hole optimisations that it does during DAG selection. In
particular, the `and` instruction appears to be a major inhibitor here.
We cannot, sadly, get rid of this load-bearing operation, but we can
reorder operations such that LLVM has more to work with around this
instruction.

One such ordering is proposed in #75579 and results in LLVM IR that
looks broadly like this:

    ; using add enables `lea` and similar CISCisms
    %offset_ptr = add i64 %address, %a_minus_one
    %mask = sub i64 0, %a
    %masked = and i64 %offset_ptr, %mask
    ; can be folded with `gepi` that may follow
    %offset = sub i64 %masked, %address

…and generates the intended x86_64 machine code.
One might also wonder how the increased amount of code would impact a
RISC target. Turns out not much:

    ; aarch64 previous                 ; aarch64 new
    sub     x8, x1, #1                 add     x8, x1, x0
    neg     x9, x0                     sub     x8, x8, #1
    and     x8, x9, x8                 neg     x9, x1
    add     x0, x0, x8                 and     x0, x8, x9

    (and similarly for ppc, sparc, mips, riscv, etc)

The only target that seems to do worse is… wasm32.

Onto actual measurements – the best way to evaluate snipets like these
is to use llvm-mca. Much like Aarch64 assembly would allow to suspect,
there isn’t any performance difference to be found. Both snippets
execute in same number of cycles for the CPUs I tried. On x86_64,
we get throughput improvement of >50%!

Fixes #75579

3 years agoAuto merge of #78387 - Dylan-DPC:rollup-ch0st6z, r=Dylan-DPC
bors [Mon, 26 Oct 2020 04:34:46 +0000 (04:34 +0000)]
Auto merge of #78387 - Dylan-DPC:rollup-ch0st6z, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #74477 (`#[deny(unsafe_op_in_unsafe_fn)]` in sys/wasm)
 - #77836 (transmute_copy: explain that alignment is handled correctly)
 - #78126 (Properly define va_arg and va_list for aarch64-apple-darwin)
 - #78137 (Initialize tracing subscriber in compiletest tool)
 - #78161 (Add issue template link to IRLO)
 - #78214 (Tweak match arm semicolon removal suggestion to account for futures)
 - #78247 (Fix #78192)
 - #78252 (Add codegen test for #45964)
 - #78268 (Do not try to report on closures to avoid ICE)
 - #78295 (Add some regression tests)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #78295 - Alexendoo:ice-regression-tests, r=nagisa
Dylan DPC [Mon, 26 Oct 2020 02:09:13 +0000 (03:09 +0100)]
Rollup merge of #78295 - Alexendoo:ice-regression-tests, r=nagisa

Add some regression tests

Closes #56229
Closes #59494
Closes #70746
Closes #73229

3 years agoRollup merge of #78268 - JohnTitor:issue-78262, r=estebank
Dylan DPC [Mon, 26 Oct 2020 02:09:11 +0000 (03:09 +0100)]
Rollup merge of #78268 - JohnTitor:issue-78262, r=estebank

Do not try to report on closures to avoid ICE

Fixes #78262

3 years agoRollup merge of #78252 - bugadani:issue-45964, r=Mark-Simulacrum
Dylan DPC [Mon, 26 Oct 2020 02:09:09 +0000 (03:09 +0100)]
Rollup merge of #78252 - bugadani:issue-45964, r=Mark-Simulacrum

Add codegen test for #45964

Closes #45964

3 years agoRollup merge of #78247 - simonvandel:fix-78192, r=oli-obk
Dylan DPC [Mon, 26 Oct 2020 02:09:08 +0000 (03:09 +0100)]
Rollup merge of #78247 - simonvandel:fix-78192, r=oli-obk

Fix #78192

Check which places are marked dead.

Fixes #78192

3 years agoRollup merge of #78214 - estebank:match-semicolon, r=oli-obk
Dylan DPC [Mon, 26 Oct 2020 02:09:06 +0000 (03:09 +0100)]
Rollup merge of #78214 - estebank:match-semicolon, r=oli-obk

Tweak match arm semicolon removal suggestion to account for futures

* Tweak and extend "use `.await`" suggestions
* Suggest removal of semicolon on prior match arm
* Account for `impl Future` when suggesting semicolon removal
* Silence some errors when encountering `await foo()?` as can't be certain what the intent was

*Thanks to https://twitter.com/a_hoverbear/status/1318960787105353728 for pointing this out!*

3 years agoRollup merge of #78161 - jonas-schievink:irlo-issue-link, r=Mark-Simulacrum
Dylan DPC [Mon, 26 Oct 2020 02:09:04 +0000 (03:09 +0100)]
Rollup merge of #78161 - jonas-schievink:irlo-issue-link, r=Mark-Simulacrum

Add issue template link to IRLO

3 years agoRollup merge of #78137 - tmiasko:compiletest-tracing, r=Mark-Simulacrum
Dylan DPC [Mon, 26 Oct 2020 02:09:02 +0000 (03:09 +0100)]
Rollup merge of #78137 - tmiasko:compiletest-tracing, r=Mark-Simulacrum

Initialize tracing subscriber in compiletest tool

The logging in compiletest was migrated from log crate to a tracing, but
the initialization code was never changed, so logging is non-functional.

Initialize tracing subscriber using default settings.

3 years agoRollup merge of #78126 - shepmaster:aarch64-apple-darwin-valist, r=nagisa
Dylan DPC [Mon, 26 Oct 2020 02:09:00 +0000 (03:09 +0100)]
Rollup merge of #78126 - shepmaster:aarch64-apple-darwin-valist, r=nagisa

Properly define va_arg and va_list for aarch64-apple-darwin

From [Apple][]:

> Because of these changes, the type `va_list` is an alias for `char*`,
> and not for the struct type in the generic procedure call standard.

With this change `/x.py test --stage 1 src/test/ui/abi/variadic-ffi`
passes.

Fixes #78092

[Apple]: https://developer.apple.com/documentation/xcode/writing_arm64_code_for_apple_platforms

3 years agoRollup merge of #77836 - RalfJung:transmute_copy, r=Mark-Simulacrum
Dylan DPC [Mon, 26 Oct 2020 02:08:58 +0000 (03:08 +0100)]
Rollup merge of #77836 - RalfJung:transmute_copy, r=Mark-Simulacrum

transmute_copy: explain that alignment is handled correctly

The doc comment currently is somewhat misleading because if it actually transmuted `&T` to `&U`, a higher-aligned `U` would be problematic.

3 years agoRollup merge of #74477 - chansuke:sys-wasm-unsafe-op-in-unsafe-fn, r=Mark-Simulacrum
Dylan DPC [Mon, 26 Oct 2020 02:08:56 +0000 (03:08 +0100)]
Rollup merge of #74477 - chansuke:sys-wasm-unsafe-op-in-unsafe-fn, r=Mark-Simulacrum

`#[deny(unsafe_op_in_unsafe_fn)]` in sys/wasm

This is part of #73904.

This encloses unsafe operations in unsafe fn in `libstd/sys/wasm`.

@rustbot modify labels: F-unsafe-block-in-unsafe-fn

3 years agoAuto merge of #77283 - estebank:if-let-sugg, r=Mark-Simulacrum
bors [Mon, 26 Oct 2020 01:53:51 +0000 (01:53 +0000)]
Auto merge of #77283 - estebank:if-let-sugg, r=Mark-Simulacrum

Tweak `if let` suggestion to be more liberal with suggestion and to not ICE

Fix #77218. Fix #77238.

3 years agoProperly define va_arg and va_list for aarch64-apple-darwin
Jake Goulding [Tue, 20 Oct 2020 01:48:58 +0000 (21:48 -0400)]
Properly define va_arg and va_list for aarch64-apple-darwin

From [Apple][]:

> Because of these changes, the type `va_list` is an alias for `char*`,
> and not for the struct type in the generic procedure call standard.

With this change `/x.py test --stage 1 src/test/ui/abi/variadic-ffi`
passes.

Fixes #78092

[Apple]: https://developer.apple.com/documentation/xcode/writing_arm64_code_for_apple_platforms

3 years agoAuto merge of #78015 - ssomers:btree_merge_mergers, r=Mark-Simulacrum
bors [Sun, 25 Oct 2020 22:29:02 +0000 (22:29 +0000)]
Auto merge of #78015 - ssomers:btree_merge_mergers, r=Mark-Simulacrum

btree: merge the implementations of MergeIter

Also remove the gratuitous Copy bounds. Same benchmark performance.

r? `@Mark-Simulacrum`

3 years agoTweak `if let` suggestion to be more liberal with suggestion and to not ICE
Esteban Küber [Mon, 28 Sep 2020 01:58:56 +0000 (18:58 -0700)]
Tweak `if let` suggestion to be more liberal with suggestion and to not ICE

Fix #77218. Fix #77238.

3 years agoUse ? in core/std macros
Taiki Endo [Sun, 25 Oct 2020 22:15:37 +0000 (07:15 +0900)]
Use ? in core/std macros

3 years agoAuto merge of #78179 - RalfJung:miri-comments, r=oli-obk
bors [Sun, 25 Oct 2020 20:15:44 +0000 (20:15 +0000)]
Auto merge of #78179 - RalfJung:miri-comments, r=oli-obk

Miri engine: entirely skip interning of ZST, and improve some comments

r? `@oli-obk`

3 years agoFix typo in debug statement
LeSeulArtichaut [Sun, 25 Oct 2020 19:54:44 +0000 (20:54 +0100)]
Fix typo in debug statement

3 years agoAuto merge of #77901 - jonas-schievink:unignore-test-36710, r=Mark-Simulacrum
bors [Sun, 25 Oct 2020 16:37:01 +0000 (16:37 +0000)]
Auto merge of #77901 - jonas-schievink:unignore-test-36710, r=Mark-Simulacrum

Unignore test for #36710 on MUSL

This now works fine thanks to autodetected `-C link-self-contained`.

Closes #36710

3 years agoMerge remote-tracking branch 'upstream/master' into box-alloc
Tim Diekmann [Sun, 25 Oct 2020 15:32:28 +0000 (16:32 +0100)]
Merge remote-tracking branch 'upstream/master' into box-alloc

3 years agoAuto merge of #78253 - Aaron1011:bump-llvm-deadarg, r=cuviper
bors [Sun, 25 Oct 2020 14:17:26 +0000 (14:17 +0000)]
Auto merge of #78253 - Aaron1011:bump-llvm-deadarg, r=cuviper

Bump LLVM for DeadArgElim fix

Fixes #76387

Pulls in https://github.com/rust-lang/llvm-project/pull/82

3 years agoalso test non-extern uninhabited statics
Ralf Jung [Sun, 25 Oct 2020 14:01:32 +0000 (15:01 +0100)]
also test non-extern uninhabited statics

3 years agoReplace write with write_all
bjorn3 [Sun, 25 Oct 2020 12:33:39 +0000 (13:33 +0100)]
Replace write with write_all

3 years agoAuto merge of #78350 - JohnTitor:rollup-vbbm5wf, r=JohnTitor
bors [Sun, 25 Oct 2020 11:35:26 +0000 (11:35 +0000)]
Auto merge of #78350 - JohnTitor:rollup-vbbm5wf, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #77984 (Compute proper module parent during resolution)
 - #78085 (MIR validation should check `SwitchInt` values are valid for the type)
 - #78208 (replace `#[allow_internal_unstable]` with `#[rustc_allow_const_fn_unstable]` for `const fn`s)
 - #78209 (Update `compiler_builtins` to 0.1.36)
 - #78276 (Bump backtrace-rs to enable Mach-O support on iOS.)
 - #78320 (Link to cargo's `build-std` feature instead of `xargo` in custom target docs)
 - #78322 (BTreeMap: stop mistaking node::MIN_LEN for a node level constraint)
 - #78326 (Split out statement attributes changes from #78306)

Failed merges:

r? `@ghost`

3 years agoUpdate description for error E0308
Olivier FAURE [Sat, 24 Oct 2020 20:02:52 +0000 (22:02 +0200)]
Update description for error E0308

As per #76462

3 years agoRollup merge of #78326 - Aaron1011:fix/min-stmt-lints, r=petrochenkov
Yuki Okushi [Sun, 25 Oct 2020 09:43:49 +0000 (18:43 +0900)]
Rollup merge of #78326 - Aaron1011:fix/min-stmt-lints, r=petrochenkov

Split out statement attributes changes from #78306

This is the same as PR https://github.com/rust-lang/rust/pull/78306, but `unused_doc_comments` is modified to explicitly ignore statement items (which preserves the current behavior).

This shouldn't have any user-visible effects, so it can be landed without lang team discussion.

---------
When the 'early' and 'late' visitors visit an attribute target, they
activate any lint attributes (e.g. `#[allow]`) that apply to it.
This can affect warnings emitted on sibiling attributes. For example,
the following code does not produce an `unused_attributes` for
`#[inline]`, since the sibiling `#[allow(unused_attributes)]` suppressed
the warning.

```rust
trait Foo {
    #[allow(unused_attributes)] #[inline] fn first();
    #[inline] #[allow(unused_attributes)] fn second();
}
```

However, we do not do this for statements - instead, the lint attributes
only become active when we visit the struct nested inside `StmtKind`
(e.g. `Item`).

Currently, this is difficult to observe due to another issue - the
`HasAttrs` impl for `StmtKind` ignores attributes for `StmtKind::Item`.
As a result, the `unused_doc_comments` lint will never see attributes on
item statements.

This commit makes two interrelated fixes to the handling of inert
(non-proc-macro) attributes on statements:

* The `HasAttr` impl for `StmtKind` now returns attributes for
  `StmtKind::Item`, treating it just like every other `StmtKind`
  variant. The only place relying on the old behavior was macro
  which has been updated to explicitly ignore attributes on item
  statements. This allows the `unused_doc_comments` lint to fire for
  item statements.
* The `early` and `late` lint visitors now activate lint attributes when
  invoking the callback for `Stmt`. This ensures that a lint
  attribute (e.g. `#[allow(unused_doc_comments)]`) can be applied to
  sibiling attributes on an item statement.

For now, the `unused_doc_comments` lint is explicitly disabled on item
statements, which preserves the current behavior. The exact locatiosn
where this lint should fire are being discussed in PR #78306

3 years agoRollup merge of #78322 - ssomers:btree_no_min_len_at_node_level, r=Mark-Simulacrum
Yuki Okushi [Sun, 25 Oct 2020 09:43:47 +0000 (18:43 +0900)]
Rollup merge of #78322 - ssomers:btree_no_min_len_at_node_level, r=Mark-Simulacrum

BTreeMap: stop mistaking node::MIN_LEN for a node level constraint

Correcting #77612 that fell into the trap of assuming that node::MIN_LEN is an imposed minimum everywhere, and trying to make it much more clear it is an offered minimum at the node level.

r? @Mark-Simulacrum

3 years agoRollup merge of #78320 - phil-opp:patch-5, r=GuillaumeGomez,alexcrichton
Yuki Okushi [Sun, 25 Oct 2020 09:43:45 +0000 (18:43 +0900)]
Rollup merge of #78320 - phil-opp:patch-5, r=GuillaumeGomez,alexcrichton

Link to cargo's `build-std` feature instead of `xargo` in custom target docs

The `xargo` tool is in maintenance mode since 2018 and the `build-std` feature of cargo already works reasonably well for most use cases.

3 years agoRollup merge of #78276 - cutsoy:bump-backtrace, r=nagisa
Yuki Okushi [Sun, 25 Oct 2020 09:43:44 +0000 (18:43 +0900)]
Rollup merge of #78276 - cutsoy:bump-backtrace, r=nagisa

Bump backtrace-rs to enable Mach-O support on iOS.

Related to rust-lang/backtrace-rs#378. Fixes backtraces on iOS that were missing in Rust v1.47.0 after switching to gimli because it only enabled Mach-O support on macOS.

3 years agoRollup merge of #78209 - JohnTitor:compiler-builtins, r=Amanieu
Yuki Okushi [Sun, 25 Oct 2020 09:43:42 +0000 (18:43 +0900)]
Rollup merge of #78209 - JohnTitor:compiler-builtins, r=Amanieu

Update `compiler_builtins` to 0.1.36

So, the libc build with cargo's `build-std` feature emits a lot of warnings like:
```
 warning: a method with this name may be added to the standard library in the future
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.35/src/int/udiv.rs:98:23
    |
98  |             q = n << (<$ty>::BITS - sr);
    |                       ^^^^^^^^^^^
...
268 |         udivmod_inner!(n, d, rem, u128)
    |         ------------------------------- in this macro invocation
    |
    = warning: once this method is added to the standard library, the ambiguity may cause an error or change in behavior!
    = note: for more information, see issue #48919 <rust-lang/rust/issues/48919>
    = help: call with fully qualified syntax `Int::BITS(...)` to keep using the current method
    = help: add `#![feature(int_bits_const)]` to the crate attributes to enable `num::<impl u128>::BITS`
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
```

(You can find the full log in https://github.com/rust-lang/libc/runs/1283695796?check_suite_focus=true for example.)

0.1.36 contains https://github.com/rust-lang/compiler-builtins/pull/332 so this version should remove this warning.

cc https://github.com/rust-lang/libc/issues/1942

3 years agoRollup merge of #78208 - liketechnik:issue-69399, r=oli-obk
Yuki Okushi [Sun, 25 Oct 2020 09:43:40 +0000 (18:43 +0900)]
Rollup merge of #78208 - liketechnik:issue-69399, r=oli-obk

replace `#[allow_internal_unstable]` with `#[rustc_allow_const_fn_unstable]` for `const fn`s

`#[allow_internal_unstable]` is currently used to side-step feature gate and stability checks.
While it was originally only meant to be used only on macros, its use was expanded to `const fn`s.

This pr adds stricter checks for the usage of `#[allow_internal_unstable]` (only on macros) and introduces the `#[rustc_allow_const_fn_unstable]` attribute for usage on `const fn`s.

This pr does not change any of the functionality associated with the use of `#[allow_internal_unstable]` on macros or the usage of `#[rustc_allow_const_fn_unstable]` (instead of `#[allow_internal_unstable]`) on `const fn`s (see https://github.com/rust-lang/rust/issues/69399#issuecomment-712911540).

Note: The check for `#[rustc_allow_const_fn_unstable]` currently only validates that the attribute is used on a function, because I don't know how I would check if the function is a `const fn` at the place of the check. I therefore openend this as a 'draft pull request'.

Closes rust-lang/rust#69399

r? @oli-obk

3 years agoRollup merge of #78085 - wesleywiser:mir_validation_switch_int, r=oli-obk
Yuki Okushi [Sun, 25 Oct 2020 09:43:38 +0000 (18:43 +0900)]
Rollup merge of #78085 - wesleywiser:mir_validation_switch_int, r=oli-obk

MIR validation should check `SwitchInt` values are valid for the type

Fixes #75440

3 years agoRollup merge of #77984 - Aaron1011:fix/macro-mod-weird-parent, r=petrochenkov
Yuki Okushi [Sun, 25 Oct 2020 09:43:37 +0000 (18:43 +0900)]
Rollup merge of #77984 - Aaron1011:fix/macro-mod-weird-parent, r=petrochenkov

Compute proper module parent during resolution

Fixes #75982

The direct parent of a module may not be a module
(e.g. `const _: () =  { #[path = "foo.rs"] mod foo; };`).

To find the parent of a module for purposes of resolution, we need to
walk up the tree until we hit a module or a crate root.

3 years agoFix small typos
Yuki Okushi [Sun, 25 Oct 2020 09:33:22 +0000 (18:33 +0900)]
Fix small typos

3 years agoUse its own `TypeckResults` to avoid ICE
Yuki Okushi [Sun, 25 Oct 2020 09:33:13 +0000 (18:33 +0900)]
Use its own `TypeckResults` to avoid ICE

3 years agoAuto merge of #77476 - tgnottingham:buffered_siphasher128, r=nnethercote
bors [Sun, 25 Oct 2020 09:23:45 +0000 (09:23 +0000)]
Auto merge of #77476 - tgnottingham:buffered_siphasher128, r=nnethercote

perf: buffer SipHasher128

This is an attempt to improve Siphasher128 performance by buffering input. Although it reduces instruction count, I'm not confident the effect on wall times, or lack-thereof, is worth the change.

---

Additional notes not reflected in source comments:

* Implementation choices were guided by a combination of results from rustc-perf and micro-benchmarks, mostly the former.
* ~~I tried a couple of different struct layouts that might be more cache friendly with no obvious effect.~~ Update: a particular struct layout was chosen, but it's not critical to performance. See comments in source and discussion below.
* I suspect that buffering would be important to a SIMD-accelerated algorithm, but from what I've read and my own tests, SipHash does not seem very amenable to SIMD acceleration, at least by SSE.

3 years agoMake some functions private that don't have to be public
Joshua Nelson [Sun, 25 Oct 2020 09:18:44 +0000 (05:18 -0400)]
Make some functions private that don't have to be public

3 years agoAuto merge of #77546 - lcnr:impl-trait-closure, r=eddyb
bors [Sun, 25 Oct 2020 07:03:58 +0000 (07:03 +0000)]
Auto merge of #77546 - lcnr:impl-trait-closure, r=eddyb

fix def collector for impl trait

fixes #77329

We now consistently make `impl Trait` a hir owner, requiring some special casing for synthetic generic params.

r? `@eddyb`

3 years agoAuto merge of #77398 - wesleywiser:measureme_0_8, r=Mark-Simulacrum
bors [Sun, 25 Oct 2020 04:48:37 +0000 (04:48 +0000)]
Auto merge of #77398 - wesleywiser:measureme_0_8, r=Mark-Simulacrum

Upgrade to measureme 9.0.0

I believe I did this correctly but there's still a reference to `measureme@0.7.1` coming from `rustc-ap-rustc_data_structures` and I'm not sure how to resolve that.

r? `@Mark-Simulacrum`

We'll also need to deploy the new version of the tools on perf.rlo.

3 years agoTest with NLL explicitly
Yuki Okushi [Sun, 25 Oct 2020 02:43:26 +0000 (11:43 +0900)]
Test with NLL explicitly

3 years agoUpgrade to measureme 9.0.0
Wesley Wiser [Thu, 1 Oct 2020 12:34:48 +0000 (08:34 -0400)]
Upgrade to measureme 9.0.0

3 years agoAuto merge of #77526 - RalfJung:dont-promote-unions, r=lcnr
bors [Sun, 25 Oct 2020 02:27:09 +0000 (02:27 +0000)]
Auto merge of #77526 - RalfJung:dont-promote-unions, r=lcnr

stop promoting union field accesses in 'const'

Turns out that promotion of union field accesses is the only difference between "promotion in `const`/`static` bodies" and "explicit promotion". So if we can remove this, we have finally achieved what I thought to already be the case -- that the bodies of `const`/`static` initializers behave the same as explicit promotion contexts.

The reason we do not want to promote union field accesses is that they can introduce UB, i.e., they can go wrong. We want to [minimize the ways promoteds can fail to evaluate](https://github.com/rust-lang/const-eval/issues/53). Also this change makes things more consistent overall, removing a special case that was added without much consideration (as far as I can tell).

Cc `@rust-lang/wg-const-eval`

3 years agoDo not try to report on closures to avoid ICE
Yuki Okushi [Fri, 23 Oct 2020 09:00:18 +0000 (18:00 +0900)]
Do not try to report on closures to avoid ICE

3 years agoAuto merge of #78310 - ebroto:clippyup, r=Manishearth
bors [Sun, 25 Oct 2020 00:24:49 +0000 (00:24 +0000)]
Auto merge of #78310 - ebroto:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy update.

This includes a Cargo.lock update: [ca11eeb ](https://github.com/rust-lang/rust/commit/ca11eeb563399b78896dbf40e827594d53a84b7f) (should be rollup=never)

r? `@Manishearth`

3 years agoUse check-pass in single-use-lifetime ui test suite
Olivia Crain [Sun, 25 Oct 2020 00:22:53 +0000 (19:22 -0500)]
Use check-pass in single-use-lifetime ui test suite

3 years agoAuto merge of #78334 - jonas-schievink:rollup-z0gzbmm, r=jonas-schievink
bors [Sat, 24 Oct 2020 21:42:39 +0000 (21:42 +0000)]
Auto merge of #78334 - jonas-schievink:rollup-z0gzbmm, r=jonas-schievink

Rollup of 12 pull requests

Successful merges:

 - #75115 (`#[deny(unsafe_op_in_unsafe_fn)]` in sys/cloudabi)
 - #76614 (change the order of type arguments on ControlFlow)
 - #77610 (revise Hermit's mutex interface to support the behaviour of StaticMutex)
 - #77830 (Simplify query proc-macros)
 - #77930 (Do not ICE with TraitPredicates containing [type error])
 - #78069 (Fix const core::panic!(non_literal_str).)
 - #78072 (Cleanup constant matching in exhaustiveness checking)
 - #78119 (Throw core::panic!("message") as &str instead of String.)
 - #78191 (Introduce a temporary for discriminant value in MatchBranchSimplification)
 - #78272 (const_evaluatable_checked: deal with unused nodes + div)
 - #78318 (TyCtxt: generate single impl block with `slice_interners` macro)
 - #78327 (resolve: Relax macro resolution consistency check to account for any errors)

Failed merges:

r? `@ghost`

3 years agoAdd unbounded_depth to serde_json (clippy-driver)
Eduardo Broto [Sat, 24 Oct 2020 20:59:44 +0000 (22:59 +0200)]
Add unbounded_depth to serde_json (clippy-driver)

3 years agoRollup merge of #78327 - petrochenkov:inconsist, r=Aaron1011
Jonas Schievink [Sat, 24 Oct 2020 20:40:00 +0000 (22:40 +0200)]
Rollup merge of #78327 - petrochenkov:inconsist, r=Aaron1011

resolve: Relax macro resolution consistency check to account for any errors

The check was previously omitted only when ambiguity errors or `Res::Err` were encountered, but the "macro-expanded `extern crate` items cannot shadow..." error (at least) can cause same inconsistencies as well.

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

3 years agoRollup merge of #78318 - bugadani:tyctx-impl, r=petrochenkov
Jonas Schievink [Sat, 24 Oct 2020 20:39:59 +0000 (22:39 +0200)]
Rollup merge of #78318 - bugadani:tyctx-impl, r=petrochenkov

TyCtxt: generate single impl block with `slice_interners` macro

Reduces the work needed to check overlapping impls a bit.

3 years agoRollup merge of #78272 - lcnr:abstract-const-unused-node, r=oli-obk
Jonas Schievink [Sat, 24 Oct 2020 20:39:57 +0000 (22:39 +0200)]
Rollup merge of #78272 - lcnr:abstract-const-unused-node, r=oli-obk

const_evaluatable_checked: deal with unused nodes + div

r? @oli-obk

3 years agoRollup merge of #78191 - tmiasko:temp-match-branch-simplification, r=oli-obk
Jonas Schievink [Sat, 24 Oct 2020 20:39:55 +0000 (22:39 +0200)]
Rollup merge of #78191 - tmiasko:temp-match-branch-simplification, r=oli-obk

Introduce a temporary for discriminant value in MatchBranchSimplification

The optimization introduces additional uses of the discriminant operand, but
does not ensure that it is still valid to evaluate it or that it still
evaluates to the same value.

Evaluate it once at original position, and store the result in a new temporary.

Follow up on #78151. The optimization remains disabled by default.

Closes #78239.

3 years agoRollup merge of #78119 - fusion-engineering-forks:panic-use-as-str, r=Amanieu
Jonas Schievink [Sat, 24 Oct 2020 20:39:53 +0000 (22:39 +0200)]
Rollup merge of #78119 - fusion-engineering-forks:panic-use-as-str, r=Amanieu

Throw core::panic!("message") as &str instead of String.

This makes `core::panic!("message")` consistent with `std::panic!("message")`, which throws a `&str` and not a `String`.

This also makes any other panics from `core::panicking::panic` result in a `&str` rather than a `String`, which includes compiler-generated panics such as the panics generated for `mem::zeroed()`.

---

Demonstration:

```rust
use std::panic;
use std::any::Any;

fn main() {
    panic::set_hook(Box::new(|panic_info| check(panic_info.payload())));

    check(&*panic::catch_unwind(|| core::panic!("core")).unwrap_err());
    check(&*panic::catch_unwind(|| std::panic!("std")).unwrap_err());
}

fn check(msg: &(dyn Any + Send)) {
    if let Some(s) = msg.downcast_ref::<String>() {
        println!("Got a String: {:?}", s);
    } else if let Some(s) = msg.downcast_ref::<&str>() {
        println!("Got a &str: {:?}", s);
    }
}
```

Before:
```
Got a String: "core"
Got a String: "core"
Got a &str: "std"
Got a &str: "std"
```

After:
```
Got a &str: "core"
Got a &str: "core"
Got a &str: "std"
Got a &str: "std"
```

3 years agoRollup merge of #78072 - Nadrieril:cleanup-constant-matching, r=varkor
Jonas Schievink [Sat, 24 Oct 2020 20:39:51 +0000 (22:39 +0200)]
Rollup merge of #78072 - Nadrieril:cleanup-constant-matching, r=varkor

Cleanup constant matching in exhaustiveness checking

This supercedes https://github.com/rust-lang/rust/pull/77390. I made the `Opaque` constructor work.
I have opened two issues https://github.com/rust-lang/rust/issues/78071 and https://github.com/rust-lang/rust/issues/78057 from the discussion we had on the previous PR. They are not regressions nor directly related to the current PR so I thought we'd deal with them separately.

I left a FIXME somewhere because I didn't know how to compare string constants for equality. There might even be some unicode things that need to happen there. In the meantime I preserved previous behavior.

EDIT: I accidentally fixed #78071

3 years agoRollup merge of #78069 - fusion-engineering-forks:core-const-panic-str, r=RalfJung
Jonas Schievink [Sat, 24 Oct 2020 20:39:49 +0000 (22:39 +0200)]
Rollup merge of #78069 - fusion-engineering-forks:core-const-panic-str, r=RalfJung

Fix const core::panic!(non_literal_str).

Invocations of `core::panic!(x)` where `x` is not a string literal expand to `panic!("{}", x)`, which is not understood by the const panic logic right now. This adds `panic_str` as a lang item, and modifies the const eval implementation to hook into this item as well.

This fixes the issue mentioned here: https://github.com/rust-lang/rust/issues/51999#issuecomment-687604248

r? `@RalfJung`

`@rustbot` modify labels: +A-const-eval

3 years agoRollup merge of #77930 - estebank:ice-77919, r=eddyb
Jonas Schievink [Sat, 24 Oct 2020 20:39:47 +0000 (22:39 +0200)]
Rollup merge of #77930 - estebank:ice-77919, r=eddyb

Do not ICE with TraitPredicates containing [type error]

Fix #77919.

3 years agoRollup merge of #77830 - cjgillot:remacro, r=oli-obk
Jonas Schievink [Sat, 24 Oct 2020 20:39:46 +0000 (22:39 +0200)]
Rollup merge of #77830 - cjgillot:remacro, r=oli-obk

Simplify query proc-macros

The query code generation is split between proc-macros and regular macros in `rustc_middle::ty::query`.

This PR removes unused capabilities of the proc-macros, and tend to use regular macros for the logic.

3 years agoRollup merge of #77610 - hermitcore:dtors, r=m-ou-se
Jonas Schievink [Sat, 24 Oct 2020 20:39:44 +0000 (22:39 +0200)]
Rollup merge of #77610 - hermitcore:dtors, r=m-ou-se

revise Hermit's mutex interface to support the behaviour of StaticMutex

rust-lang/rust#77147 simplifies things by splitting this Mutex type into two types matching the two use cases: StaticMutex and MovableMutex. To support the new behavior of StaticMutex, we move part of the mutex implementation into libstd.

The interface to the OS changed. Consequently, I removed a few functions, which aren't longer needed.

3 years agoRollup merge of #76614 - NoraCodes:nora/control_flow_enum, r=scottmcm
Jonas Schievink [Sat, 24 Oct 2020 20:39:41 +0000 (22:39 +0200)]
Rollup merge of #76614 - NoraCodes:nora/control_flow_enum, r=scottmcm

change the order of type arguments on ControlFlow

This allows ControlFlow<BreakType> which is much more ergonomic for common iterator combinator use cases.

Addresses one component of #75744

3 years agoRollup merge of #75115 - chansuke:sys-cloudabi-unsafe, r=KodrAus
Jonas Schievink [Sat, 24 Oct 2020 20:39:35 +0000 (22:39 +0200)]
Rollup merge of #75115 - chansuke:sys-cloudabi-unsafe, r=KodrAus

`#[deny(unsafe_op_in_unsafe_fn)]` in sys/cloudabi

Partial fix of #73904.

This encloses unsafe operations in unsafe fn in sys/cloudabi.

3 years agoMIR validation should check `SwitchInt` values are valid for the type
Wesley Wiser [Sun, 18 Oct 2020 20:32:25 +0000 (16:32 -0400)]
MIR validation should check `SwitchInt` values are valid for the type

3 years agoAuto merge of #77255 - Aaron1011:feature/collect-attr-tokens, r=petrochenkov
bors [Sat, 24 Oct 2020 19:23:32 +0000 (19:23 +0000)]
Auto merge of #77255 - Aaron1011:feature/collect-attr-tokens, r=petrochenkov

Unconditionally capture tokens for attributes.

This allows us to avoid synthesizing tokens in `prepend_attr`, since we
have the original tokens available.

We still need to synthesize tokens when expanding `cfg_attr`,
but this is an unavoidable consequence of the syntax of `cfg_attr` -
the user does not supply the `#` and `[]` tokens that a `cfg_attr`
expands to.

This is based on PR https://github.com/rust-lang/rust/pull/77250 - this PR exposes a bug in the current `collect_tokens` implementation, which is fixed by the rewrite.

3 years agofix typo
Ralf Jung [Sat, 24 Oct 2020 18:39:04 +0000 (20:39 +0200)]
fix typo

Co-authored-by: BlackHoleFox <blackholefoxdev@gmail.com>
3 years agoCompute proper module parent during resolution
Aaron Hill [Thu, 15 Oct 2020 18:19:54 +0000 (14:19 -0400)]
Compute proper module parent during resolution

Fixes #75982

The direct parent of a module may not be a module
(e.g. `const _: () =  { #[path = "foo.rs"] mod foo; };`).

To find the parent of a module for purposes of resolution, we need to
walk up the tree until we hit a module or a crate root.

3 years agoresolve: Relax macro resolution consistency check to account for any errors
Vadim Petrochenkov [Sat, 24 Oct 2020 18:17:34 +0000 (21:17 +0300)]
resolve: Relax macro resolution consistency check to account for any errors

3 years agoSwitch from tuple matching to match guards
Jake Goulding [Sat, 24 Oct 2020 13:44:57 +0000 (09:44 -0400)]
Switch from tuple matching to match guards