Commit graph

6677 commits

Author SHA1 Message Date
Guillaume Gomez
effea681c0
Rollup merge of #87158 - In-line:suggest-full-enum-variant-for-local-module, r=estebank
Suggest full enum variant for local modules
2021-07-16 19:54:02 +02:00
Guillaume Gomez
8273567a71
Rollup merge of #87107 - oli-obk:tait_double, r=nikomatsakis
Loop over all opaque types instead of looking at just the first one with the same DefId

This exposed a bug in VecMap and is needed for https://github.com/rust-lang/rust/pull/86410 anyway

r? ``@spastorino``

cc ``@nikomatsakis``
2021-07-16 19:53:59 +02:00
bors
2119976c49 Auto merge of #87140 - camsteffen:pat-slice-refs, r=oli-obk
Remove refs from Pat slices

Changes `PatKind::Or(&'hir [&'hir Pat<'hir>])` to `PatKind::Or(&'hir [Pat<'hir>])` and others. This is more consistent with `ExprKind`, saves a little memory, and is a little easier to use.
2021-07-16 13:35:48 +00:00
Guillaume Gomez
41433795e7
Rollup merge of #87161 - sexxi-goose:fix-issue-87097, r=nikomatsakis
RFC2229: Use the correct place type

Closes https://github.com/rust-lang/rust/issues/87097

The ICE occurred because instead of looking at the type of the place after all the projections are applied, we instead looked at the `base_ty` of the Place to decide whether a discriminant should be read of not. This lead to two issues:

1. the kind of the type is not necessarily `Adt` since we only look at the `base_ty`, it could be instead `Ref` for example
2. if the kind of the type is `Adt` you could still be looking at the wrong variant to make a decision on whether the discriminant should be read or not

r? `@nikomatsakis`
2021-07-16 10:08:08 +02:00
Guillaume Gomez
c1b9bbf1e7
Rollup merge of #87145 - jsgf:fix-lint-opt-hash, r=michaelwoerister
Make --cap-lints and related options leave crate hash alone

Closes: #87144
2021-07-16 10:08:07 +02:00
Guillaume Gomez
c1ffca0869
Rollup merge of #87069 - sexxi-goose:copy_ref_always, r=nikomatsakis
ExprUseVisitor: Treat ByValue use of Copy types as ImmBorrow

r? ```@nikomatsakis```
2021-07-16 10:08:05 +02:00
bors
27e4205881 Auto merge of #86993 - jackh726:project-gat-binders, r=nikomatsakis
Replace associated item bound vars with placeholders when projecting

Fixes #76407
Fixes #76826

Similar, but more limited, to #85499. This allows us to handle things like `for<'a> <T as Trait>::Assoc<'a>` but not `for<'a> <T as Trait<'a>>::Assoc`, unblocking GATs.

r? `@nikomatsakis`
2021-07-16 01:11:37 +00:00
Cameron Steffen
1537cd4fb1 Remove refs from pat slices 2021-07-15 16:09:57 -05:00
bors
b1f8e27b74 Auto merge of #83319 - tmiasko:packed-aligned, r=jackh726
Layout error instead of an ICE for packed and aligned types

Fixes #83107.
2021-07-15 19:51:17 +00:00
Tomasz Miąsko
d49f977ed9 Layout error instead of an ICE for packed and aligned types 2021-07-15 18:17:27 +02:00
jackh726
cf001dc889 Remove failed and review comments 2021-07-15 10:58:49 -04:00
Roxane
9fe470b620 Get the right place type 2021-07-15 10:33:51 -04:00
Alik Aslanyan
b69090102e
Suggest full enum variant for local modules 2021-07-15 16:34:49 +04:00
Yuki Okushi
6d0d80e181
Rollup merge of #87134 - BoxyUwU:cgd-self-ty-error, r=lcnr
Make SelfInTyParamDefault wording not be specific to type defaults

r? ```@lcnr```
2021-07-15 21:19:20 +09:00
Yuki Okushi
a5acb7b4ba
Rollup merge of #86947 - m-ou-se:assert-matches-to-submodule, r=yaahc
Move assert_matches to an inner module

Fixes #82913
2021-07-15 21:19:16 +09:00
Yuki Okushi
98130137d9
Rollup merge of #86478 - ehuss:future-incompat-test, r=oli-obk
Add -Zfuture-incompat-test to assist with testing future-incompat reports.

This adds a `-Zfuture-incompat-test` cli flag to assist with testing future-incompatible reports. This flag causes all lints to be treated as a future-incompatible lint, and will emit a report for them. This is being added so that Cargo's testsuite can reliably test the reporting infrastructure.  Right now, Cargo relies on using array_into_iter as a test subject. Since the breaking "future incompatible" lints are never intended to last forever, this means Cargo's testsuite would always need to keep changing to choose different lints (for example, #86330 proposed dropping that moniker for array_into_iter). With this flag, Cargo's tests can trigger any lint and check for the report.
2021-07-15 21:19:11 +09:00
Niko Matsakis
75291ee924
Update compiler/rustc_typeck/src/expr_use_visitor.rs 2021-07-15 04:13:20 -04:00
Aman Arora
c4ac8369e2 PR feedback 2021-07-15 03:57:50 -04:00
bors
b9197978a9 Auto merge of #86876 - jyn514:56935-target-crate-num, r=petrochenkov
Reuse CrateNum for proc-macro crates even when cross-compiling

Proc-macros are always compiled for the host, so this should be the same
in every way as recompiling the crate.

I am not sure why the previous code special-cased the target, since the
compiler properly gives an error when trying to load a crate for a
different host:

```
error[E0461]: couldn't find crate `dependency` with expected target triple x86_64-unknown-linux-gnu
  --> /home/joshua/rustc4/src/test/ui/cfg-dependent.rs:8:2
   |
LL |     dependency::is_64();
   |     ^^^^^^^^^^
   |
   = note: the following crate versions were found:
           crate `dependency`, target triple i686-unknown-linux-gnu: /home/joshua/rustc4/build/x86_64-unknown-linux-gnu/test/ui/cfg-dependent/auxiliary/libdependency.so
```

I think another possible fix is to remove the check altogether. But I'm
not sure, and this fix works, so I'm not making the larger change here.

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

r? `@petrochenkov` cc `@alexcrichton`
2021-07-15 02:39:38 +00:00
Joshua Nelson
68b959827b Reuse CrateNum for proc-macro crates even when cross-compiling
Proc-macros are always compiled for the host, so this should be the same
in every way as recompiling the crate.

I am not sure why the previous code special-cased the target, since the
compiler properly gives an error when trying to load a crate for a
different host:

```
error[E0461]: couldn't find crate `dependency` with expected target triple x86_64-unknown-linux-gnu
  --> /home/joshua/rustc4/src/test/ui/cfg-dependent.rs:8:2
   |
LL |     dependency::is_64();
   |     ^^^^^^^^^^
   |
   = note: the following crate versions were found:
           crate `dependency`, target triple i686-unknown-linux-gnu: /home/joshua/rustc4/build/x86_64-unknown-linux-gnu/test/ui/cfg-dependent/auxiliary/libdependency.so
```

I think another possible fix is to remove the check altogether. But I'm
not sure, and this fix works, so I'm not making the larger change here.
2021-07-14 20:36:35 -04:00
Jeremy Fitzhardinge
51142a0f5f Make --cap-lints and related options leave crate hash alone
Closes: #87144
2021-07-14 17:04:55 -07:00
bors
e87188c252 Auto merge of #87133 - GuillaumeGomez:rollup-pfz9jbk, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #87027 (expand: Support helper attributes for built-in derive macros)
 - #87056 (Fix codeblocks overflow)
 - #87117 (Shrink the CrateStore dynamic interface.)
 - #87120 (rustdoc: Remove unnecessary `extern crate` aliases)
 - #87125 (Fix Ayu theme `<code>` color)
 - #87130 (Update browser-ui-test package version)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-14 18:36:44 +00:00
Ellen
da189d9514 Change type param -> generic param 2021-07-14 19:22:39 +01:00
Guillaume Gomez
40155f5ea7
Rollup merge of #87117 - cjgillot:cstore, r=petrochenkov
Shrink the CrateStore dynamic interface.

The information is either accessible through queries or by crates which already depend on rustc_metadata.
2021-07-14 19:53:37 +02:00
Guillaume Gomez
4d141f5e4c
Rollup merge of #87027 - petrochenkov:builderhelp, r=oli-obk
expand: Support helper attributes for built-in derive macros

This is needed for https://github.com/rust-lang/rust/pull/86735 (derive macro `Default` should have a helper attribute `default`).

With this PR we can specify helper attributes for built-in derives using syntax `#[rustc_builtin_macro(MacroName, attributes(attr1, attr2, ...))]` which mirrors equivalent syntax for proc macros `#[proc_macro_derive(MacroName, attributes(attr1, attr2, ...))]`.
Otherwise expansion infra was already ready for this.
The attribute parsing code is shared between proc macro derives and built-in macros (`fn parse_macro_name_and_helper_attrs`).
2021-07-14 19:53:35 +02:00
Eric Huss
636fcacb44 Add -Zfuture-incompat-test to assist with testing future-incompat reports. 2021-07-14 08:37:58 -07:00
bors
4f0c568785 Auto merge of #87082 - michaelwoerister:const-in-debuginfo-type-names-fix, r=oli-obk,wesleywiser
Handle non-integer const generic parameters in debuginfo type names.

This PR fixes an ICE introduced by https://github.com/rust-lang/rust/pull/85269 which started emitting const generic arguments for debuginfo names but did not cover the case where such an argument could not be evaluated to a flat string of bits.

The fix implemented in this PR is very basic: If `try_eval_bits()` fails for the constant in question, we fall back to generating a stable hash of the constant and emit that instead. This way we get a (virtually) unique name and side step the problem of generating a string representation of a potentially complex value.

The downside is that the generated name will be rather opaque. E.g. the regression test adds a function `const_generic_fn_non_int<()>` which is then rendered as `const_generic_fn_non_int<{CONST#fe3cfa0214ac55c7}>`. I think it's an open question how to deal with this more gracefully.

I'd be interested in ideas on how to do this better.

r? `@wesleywiser`

cc `@dpaoliello` (do you see any problems with this approach?)
cc `@Mark-Simulacrum` & `@nagisa` (who I've seen comment on debuginfo issues recently -- anyone else?)

Fixes https://github.com/rust-lang/rust/issues/86893
2021-07-14 15:18:27 +00:00
Camille GILLOT
3fba5a4844 Shrink the CrateStore dynamic interface. 2021-07-14 16:37:56 +02:00
Michael Woerister
28343be42f Handle non-integer const generic parameters in debuginfo type names. 2021-07-14 15:55:03 +02:00
bors
ee5ed4a88d Auto merge of #87118 - JohnTitor:rollup-8ltidsq, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #87085 (Search result colors)
 - #87090 (Make BTreeSet::split_off name elements like other set methods do)
 - #87098 (Unignore some pretty printing tests)
 - #87099 (Upgrade `cc` crate to 1.0.69)
 - #87101 (Suggest a path separator if a stray colon is found in a match arm)
 - #87102 (Add GUI test for "go to first" feature)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-14 12:49:45 +00:00
Aman Arora
6c3774eec4 ExprUseVisitor::Delegate consume only when moving 2021-07-14 02:21:08 -04:00
bors
2155386f31 Auto merge of #87106 - Mark-Simulacrum:edition-no-clone, r=petrochenkov
Avoid cloning ExpnData to access Span edition

ExpnData is a fairly hefty structure to clone; cloning it may not be cheap. In
some cases this may get optimized out, but it's not clear that will always be
the case. Try to avoid that cost.

r? `@ghost` -- opening for a perf run to start with
2021-07-14 01:41:12 +00:00
Yuki Okushi
d8943a7d52
Rollup merge of #87101 - FabianWolff:issue-87086, r=estebank
Suggest a path separator if a stray colon is found in a match arm

Attempts to fix #87086.

r? `@estebank`
2021-07-14 09:35:26 +09:00
Yuki Okushi
4ec7b489d6
Rollup merge of #87099 - JohnTitor:upgrade-cc-crate, r=alexcrichton
Upgrade `cc` crate to 1.0.69

This pulls another fix for #83043, i.e., alexcrichton/cc-rs#605.
r? ``@alexcrichton``
2021-07-14 09:35:25 +09:00
Fabian Wolff
2362450425 Suggest a path separator if a stray colon is found in a match arm
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-07-14 01:15:59 +02:00
bors
c7d6bcc788 Auto merge of #87044 - cjgillot:expnhash, r=petrochenkov
Cache expansion hash globally

... instead of computing it multiple times.

Split from #86676
r? `@petrochenkov`
2021-07-13 22:32:58 +00:00
Camille GILLOT
616ce3c5c0 Cache expansion hash. 2021-07-13 23:10:56 +02:00
Camille GILLOT
cff0ea5f88 Move HashStable implementations. 2021-07-13 23:10:55 +02:00
jackh726
09978bdcd1 Conditionally call normalize_erasing_regions only if polymorhization is enabled 2021-07-13 15:09:01 -04:00
Vadim Petrochenkov
6c9ea1e8a9 expand: Support helper attributes for built-in derive macros 2021-07-13 21:59:22 +03:00
Oli Scherer
587e8fd112 Loop over all opaque types instead of looking at just the first one with the same DefId 2021-07-13 15:19:35 +00:00
bors
3e1c75c6e2 Auto merge of #86827 - camsteffen:hash-lint-resolved, r=oli-obk
Fix internal `default_hash_types` lint to use resolved path

I run into false positives now and then (mostly in Clippy) when I want to name some util after HashMap.
2021-07-13 15:06:10 +00:00
Oli Scherer
95f296db63 Debug log all the things 2021-07-13 15:06:09 +00:00
Oli Scherer
692f638036 Fix VecMap Extend impl 2021-07-13 15:05:29 +00:00
Mark Rousskov
7d373c9c11 Avoid cloning ExpnData to access Span edition
ExpnData is a fairly hefty structure to clone; cloning it may not be cheap. In
some cases this may get optimized out, but it's not clear that will always be
the case. Try to avoid that cost.
2021-07-13 10:57:10 -04:00
jackh726
a9f1e1c440 WIP partial apply fix 2021-07-13 10:50:40 -04:00
bors
ca99e3eb3a Auto merge of #86922 - joshtriplett:target-abi, r=oli-obk
target abi

Implement cfg(target_abi) (RFC 2992)

Add an `abi` field to `TargetOptions`, defaulting to "". Support using
`cfg(target_abi = "...")` for conditional compilation on that field.

Gated by `feature(cfg_target_abi)`.

Add a test for `target_abi`, and a test for the feature gate.

Add `target_abi` to tidy as a platform-specific cfg.

Update targets to use `target_abi`

All eabi targets have `target_abi = "eabi".`
All eabihf targets have `target_abi = "eabihf"`.
`armv6_unknown_freebsd` and `armv7_unknown_freebsd` have `target_abi = "eabihf"`.
All abi64 targets have `target_abi = "abi64"`.
All ilp32 targets have `target_abi = "ilp32"`.
All softfloat targets have `target_abi = "softfloat"`.
All *-uwp-windows-* targets have `target_abi = "uwp"`.
All spe targets have `target_abi = "spe"`.
All macabi targets have `target_abi = "macabi"`.
aarch64-apple-ios-sim has `target_abi = "sim"`.
`x86_64-fortanix-unknown-sgx` has `target_abi = "fortanix"`.
`x86_64-unknown-linux-gnux32` has `target_abi = "x32"`.

Add FIXME entries for targets for which existing values need to change
once `cfg_target_abi` becomes stable. (All of them are tier 3 targets.)

Add a test for `target_abi` in `--print cfg`.
2021-07-13 12:25:10 +00:00
Yuki Okushi
e457c2739b
Upgrade cc crate to 1.0.69 2021-07-13 17:58:50 +09:00
bors
394804bb23 Auto merge of #86857 - fee1-dead:add-attr, r=oli-obk
Add #[default_method_body_is_const]

`@rustbot` label F-const_trait_impl
2021-07-13 06:59:34 +00:00
bors
1f0db5e0a3 Auto merge of #86665 - FabianWolff:layout-field-thir-unsafeck, r=oli-obk
Implement Mutation- and BorrowOfLayoutConstrainedField in thir-unsafeck

Since nobody has so far claimed Mutation- and BorrowOfLayoutConstrainedField in rust-lang/project-thir-unsafeck#7, I have taken the liberty of implementing them in thir-unsafeck.

r? `@LeSeulArtichaut`
2021-07-13 04:38:39 +00:00