Commit graph

8918 commits

Author SHA1 Message Date
Tomasz Miąsko
e4aeeca667 Reset qualifs when a storage of a local ends
to ensure that the local qualifs are affected by the state from previous
loop iterations only if the local is kept alive.

The change should be forward compatible with a stricter handling of
indirect assignments, since storage dead invalidates all existing
pointers to the local.
2021-10-23 09:26:22 +02:00
Matthias Krüger
8fb194c86f
Rollup merge of #89920 - hudson-ayers:location-detail-control, r=davidtwco
Implement -Z location-detail flag

This PR implements the `-Z location-detail` flag as described in https://github.com/rust-lang/rfcs/pull/2091 .

`-Z location-detail=val` controls what location details are tracked when using `caller_location`. This allows users to control what location details are printed as part of panic messages, by allowing them to exclude any combination of filenames, line numbers, and column numbers. This option is intended to provide users with a way to mitigate the size impact of `#[track_caller]`.

Some measurements of the savings of this approach on an embedded binary can be found here: https://github.com/rust-lang/rust/issues/70579#issuecomment-942556822 .

Closes #70580 (unless people want to leave that open as a place for discussion of further improvements).

This is my first real PR to rust, so any help correcting mistakes / understanding side effects / improving my tests is appreciated :)

I have one question: RFC 2091 specified this as a debugging option (I think that is what -Z implies?). Does that mean this can never be stabilized without a separate MCP? If so, do I need to submit an MCP now, or is the initial RFC specifying this option sufficient for this to be merged as is, and then an MCP would be needed for eventual stabilization?
2021-10-23 05:28:23 +02:00
Matthias Krüger
736e8ebd1c
Rollup merge of #89730 - crlf0710:type_changing_feature, r=jackh726
add feature flag for `type_changing_struct_update`

This implements the PR0 part of the mentoring notes within #86618.

overrides the previous inactive #86646 pr.

r? ```@nikomatsakis```
2021-10-23 05:28:22 +02:00
Matthias Krüger
0f81c7faf5
Rollup merge of #89468 - FabianWolff:issue-89358, r=jackh726
Report fatal lexer errors in `--cfg` command line arguments

Fixes #89358. The erroneous behavior was apparently introduced by `@Mark-Simulacrum` in a678e31911; the idea is to silence individual parser errors and instead emit one catch-all error message after parsing. However, for the example in #89358, a fatal lexer error is created here:
edebf77e00/compiler/rustc_parse/src/lexer/mod.rs (L340-L349)

This fatal error aborts the compilation, and so the call to `new_parser_from_source_str()` never returns and the catch-all error message is never emitted. I have therefore changed the `SilentEmitter` to silence only non-fatal errors; with my changes, for the rustc invocation described in #89358:
```sh
rustc --cfg "abc\""
```
I get the following output:
```
error[E0765]: unterminated double quote string
  |
  = note: this error occurred on the command line: `--cfg=abc"`
```
2021-10-23 05:28:22 +02:00
Michael Howell
98ed5548d7 nice_region_error: Include lifetime placeholders in error output
As you can see in src/test/ui/traits/self-without-lifetime-constraint.stderr
you can get very confusing type names if you don't have this.

Fixes #87763
2021-10-22 15:26:20 -07:00
Santiago Pastorino
9534186857
Hide negative coherence checks under negative_impls feature flag 2021-10-22 17:54:20 -03:00
Santiago Pastorino
132409f0c6
Assemple trait alias candidates for negative polarity
This doesn't work properly yet, we would probably need to implement an
`assembly_neg_candidates` and consider things like `T: !AB` as `T: !A`
|| `T: !B`
2021-10-22 15:49:54 -03:00
Santiago Pastorino
da79fa964c
Add rustc_strict_coherence attribute and use it to check overlap 2021-10-22 15:49:46 -03:00
Josh Stone
e9f545b9a9 Update the minimum external LLVM to 12 2021-10-22 10:50:07 -07:00
bors
01198792a6 Auto merge of #89893 - camsteffen:redundant-dump-enabled, r=matthewjasper
Remove redundant dump_enabled check
2021-10-22 17:32:20 +00:00
Josh Stone
65150af1b4 Update the minimum external LLVM to 11 2021-10-22 09:22:18 -07:00
Charles Lew
7d7ebf8805 add feature flag for type_changing_struct_update 2021-10-22 11:46:55 -04:00
Santiago Pastorino
74454c4888
Add comment about the only way to prove NotImplemented here 2021-10-22 11:04:30 -03:00
Santiago Pastorino
2e9fb8b68b
Fix filter_impls comment 2021-10-22 10:58:38 -03:00
Santiago Pastorino
b03a0df737
Fix debug method name 2021-10-22 10:57:10 -03:00
Santiago Pastorino
5b5a2e600e
Move const filter to filter_impls 2021-10-22 10:56:32 -03:00
Santiago Pastorino
c4c76a4fbd
Document flip polarity 2021-10-22 09:34:36 -03:00
Santiago Pastorino
7829d9dde3
Document overlap check filter 2021-10-22 09:22:19 -03:00
Yuki Okushi
a656bc5b08
Rollup merge of #90069 - tmiasko:promoted-const-qualif, r=oli-obk
Fix const qualification when executed after promotion

The const qualification was so far performed before the promotion and
the implementation assumed that it will never encounter a promoted.

With `const_precise_live_drops` feature, checking for live drops is
delayed until after drop elaboration, which in turn runs after
promotion. so the assumption is no longer true. When evaluating
`NeedsNonConstDrop` it is now possible to encounter promoteds.

Use type base qualification for the promoted. It is a sound
approximation in general, and in the specific case of promoteds and
`NeedsNonConstDrop` it is precise.

Fixes #89938.
2021-10-22 19:42:49 +09:00
Yuki Okushi
9ed9025ea9
Rollup merge of #90028 - tmiasko:structural-match-closure, r=spastorino
Reject closures in patterns

Fixes #90013.
2021-10-22 19:42:48 +09:00
Yuki Okushi
cbebdd8e67
Rollup merge of #89991 - petrochenkov:visitok2, r=jackh726
rustc_ast: Turn `MutVisitor::token_visiting_enabled` into a constant

It's a visitor property rather than something that needs to be determined at runtime
2021-10-22 19:42:48 +09:00
Yuki Okushi
327d8073e2
Rollup merge of #89922 - JohnTitor:update-e0637, r=jackh726
Update E0637 description to mention `&` w/o an explicit lifetime name

Deal with https://github.com/rust-lang/rust/issues/89824#issuecomment-941598647. Another solution would be splitting the error code into two as (I think) it's a bit unclear to users why they have the same error code.
2021-10-22 19:42:46 +09:00
Yuki Okushi
91fb223f59
Rollup merge of #89895 - camsteffen:for-loop-head-span, r=davidtwco
Don't mark for loop iter expression as desugared

We typically don't mark spans of lowered things as desugared. This helps Clippy rightly discern when code is (not) from expansion. This was discovered by ``@flip1995`` at https://github.com/rust-lang/rust-clippy/pull/7789#issuecomment-939289501.
2021-10-22 19:42:45 +09:00
Yuki Okushi
8738d5d611
Rollup merge of #89257 - aDotInTheVoid:macro-error-2, r=estebank
Give better error for `macro_rules name`

follow up to #89221

r? ``@estebank``

``@rustbot`` modify labels: +A-diagnostics +A-parser
2021-10-22 19:42:43 +09:00
lcnr
22e1798975 ignore potential_query_instability in rustdoc 2021-10-21 21:14:34 +02:00
Camille GILLOT
0a5666b838 Do not depend on the stored value when trying to cache on disk. 2021-10-21 20:00:45 +02:00
Hudson Ayers
b802629311 add tests for -Zlocation-detail 2021-10-21 10:44:22 -07:00
Hudson Ayers
e1d94b8fd1 Configure saved panic locations based on location-detail flag 2021-10-21 10:41:19 -07:00
bors
547a6ffee0 Auto merge of #90130 - Mark-Simulacrum:revert-namebinding, r=oli-obk
Revert "resolve: Use NameBinding for local variables and generic parameters"

This reverts commit 6162529a01, that is, PR #89100.

Reverting per performance regression noted post-merge on that PR (https://github.com/rust-lang/rust/pull/89100#issuecomment-948065457).
2021-10-21 15:45:00 +00:00
Mark Rousskov
7552af2f6f Revert "Auto merge of #89100 - petrochenkov:localbind, r=cjgillot"
This reverts commit 6162529a01.
2021-10-21 09:09:24 -04:00
Yuki Okushi
3b2dd702fc
Do not mention a reexported item if it's private 2021-10-21 20:25:45 +09:00
Tomasz Miąsko
74c6636d27 Verify that only NeedsNonConstDrop expects promoteds 2021-10-21 11:14:41 +02:00
bors
e015ef5b26 Auto merge of #90119 - JohnTitor:rollup-e5t6khz, r=JohnTitor
Rollup of 14 pull requests

Successful merges:

 - #86984 (Reject octal zeros in IPv4 addresses)
 - #87440 (Remove unnecessary condition in Barrier::wait())
 - #88644 (`AbstractConst` private fields)
 - #89292 (Stabilize CString::from_vec_with_nul[_unchecked])
 - #90010 (Avoid overflow in `VecDeque::with_capacity_in()`.)
 - #90029 (Add test for debug logging during incremental compilation)
 - #90031 (config: add the option to enable LLVM tests)
 - #90048 (Add test for line-number setting)
 - #90071 (Remove hir::map::blocks and use FnKind instead)
 - #90074 (2229 migrations small cleanup)
 - #90077 (Make `From` impls of NonZero integer const.)
 - #90097 (Add test for duplicated sidebar entries for reexported macro)
 - #90098 (Add test to ensure that the missing_doc_code_examples is not triggered on foreign trait implementations)
 - #90099 (Fix MIRI UB in `Vec::swap_remove`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-21 08:04:19 +00:00
Yuki Okushi
371fd4f1c0
Rollup merge of #90074 - klensy:upvar-all, r=wesleywiser
2229 migrations small cleanup

This removes needless `format!`'ing of empty string and replaces `vec!` with const strings with const array.
2021-10-21 14:11:09 +09:00
Yuki Okushi
afdd0c3ade
Rollup merge of #90071 - cjgillot:no-blocks, r=oli-obk
Remove hir::map::blocks and use FnKind instead

The principal tool is `FnLikeNode`, which is not often used and can be easily implemented using `rustc_hir::intravisit::FnKind`.
2021-10-21 14:11:08 +09:00
Yuki Okushi
6f0acbcbd0
Rollup merge of #88644 - eopb:abstractconst_leaf_subst, r=lcnr
`AbstractConst` private fields

Calls `subst` in `AbstractConst::root` when `Node` is `Leaf`.

r? ``@lcnr``
2021-10-21 14:11:03 +09:00
bors
40ebd07382 Auto merge of #90072 - ehuss:empty-rmeta-no-warn, r=Mark-Simulacrum
Don't emit a warning for empty rmeta files.

This avoids displaying a warning when attempting to load an empty rmeta file. Warnings were enabled via #89634 which can cause a lot of noise (for example, running `./x.py check`).  rustc generates empty rmeta files for things like binaries, which can happen when checking libraries as unittests.

Closes #89795
2021-10-21 05:04:39 +00:00
Santiago Pastorino
5a727538f8
Fix allow_negative_impls logic 2021-10-20 18:05:06 -03:00
bors
efd0483949 Auto merge of #89978 - cjgillot:qarray, r=Mark-Simulacrum
Merge the two depkind vtables

Knowledge of `DepKind`s is managed using two arrays containing flags (is_anon, eval_always, fingerprint_style), and function pointers (forcing and loading code).

This PR aims at merging the two arrays so as to reduce unneeded indirect calls and (hopefully) increase code locality.
r? `@ghost`
2021-10-20 17:57:35 +00:00
Santiago Pastorino
68d444ffa1
Add TraitObligation::polarity() for better encapsulation 2021-10-20 14:45:10 -03:00
Camille GILLOT
b11ec29e28 Address review. 2021-10-20 18:51:15 +02:00
Camille GILLOT
8785b70774 Inline DepNodeParams methods. 2021-10-20 18:46:25 +02:00
Camille GILLOT
df71d0874a Compute query vtable manually. 2021-10-20 18:41:28 +02:00
Camille GILLOT
69a3594635 Store node_intern_event_id in CurrentDepGraph. 2021-10-20 18:37:11 +02:00
Camille GILLOT
bd5c107672 Build jump table at runtime. 2021-10-20 18:32:29 +02:00
Camille GILLOT
602d3cbce3 Invoke callbacks from rustc_middle. 2021-10-20 18:29:33 +02:00
Camille GILLOT
b09de95fab Merge two query callbacks arrays. 2021-10-20 18:29:27 +02:00
Camille GILLOT
dc7143367c Drop has_params. 2021-10-20 18:29:22 +02:00
Camille GILLOT
aa404c24dd Make hash_result an Option. 2021-10-20 18:29:18 +02:00
Camille GILLOT
e53404cca6 Move def_path_hash_to_def_id to rustc_middle. 2021-10-20 18:28:54 +02:00
Camille GILLOT
88c6d3de95 Avoid trivial lambdas. 2021-10-20 18:24:16 +02:00
Santiago Pastorino
7568632513
Filter candidates when goal and impl polarity doesn't match 2021-10-20 12:10:46 -03:00
Santiago Pastorino
6ae1d68e16
Use predicate_must_hold_modulo_regions 2021-10-20 12:10:46 -03:00
Santiago Pastorino
89a419cf7d
Filter out Negative impls on intercrate mode's ambiguous reasoning 2021-10-20 12:10:46 -03:00
Santiago Pastorino
85c8fd9c94
Make EvaluationCache consider polarity as cache's key 2021-10-20 12:10:46 -03:00
Santiago Pastorino
da8873e343
Only assemble_candidates_from_impls for polarity Negative 2021-10-20 12:10:46 -03:00
Santiago Pastorino
ab17068662
Consider negative polarity on trait selection 2021-10-20 12:10:45 -03:00
Santiago Pastorino
8b0bfb0dcb
Consider negative polarity on overlap check 2021-10-20 12:10:45 -03:00
Santiago Pastorino
6975afd141
Add polarity to TraitPredicate 2021-10-20 12:10:41 -03:00
bors
3d71e749a2 Auto merge of #90050 - michaelwoerister:fix-vtable-debug-name-crash-90019, r=wesleywiser
Erase late-bound regions before computing vtable debuginfo name.

Fixes #90019.

The `msvc_enum_fallback()` for computing enum type names needs to access the memory layout of niche enums in order to determine the type name. `compute_debuginfo_vtable_name()` did not properly erase regions before computing type names which made memory layout computation ICE when encountering un-erased regions.

r? `@wesleywiser`
2021-10-20 14:37:48 +00:00
Ethan Brierley
be30e60296 remove duplicate subst 2021-10-20 10:21:06 +01:00
bors
6162529a01 Auto merge of #89100 - petrochenkov:localbind, r=cjgillot
resolve: Use `NameBinding` for local variables and generic parameters

`NameBinding` is a structure used for representing any name introduction (an item, or import, or even a built-in).
Except that local variables and generic parameters weren't represented as `NameBinding`s, for this reason they requires separate paths in name resolution code in several places.

This PR introduces `NameBinding`s for local variables as well and simplifies all the code working with them leaving only the `NameBinding` paths.
2021-10-20 07:21:01 +00:00
klensy
f3fb821f3b use array explicitly instead of vec for const content (even if optimizer smart enought to remove allocation) 2021-10-20 03:24:07 +03:00
klensy
aad48f71b3 replace format!("") with String::new()
use array explicitly instead of vec for const content (even if optimizer smart enought to remove allocation)
2021-10-20 03:23:24 +03:00
Eric Huss
6f915056a1 Don't emit a warning for empty rmeta files. 2021-10-19 16:56:47 -07:00
Camille GILLOT
6e98688e68 Replace FnLikeNode by FnKind. 2021-10-19 23:31:51 +02:00
Ethan Brierley
99b8c016ce Address lcnr review 2021-10-19 22:18:13 +01:00
Camille GILLOT
05eb6f36f1 Cleanup dead code in hir::map::blocks. 2021-10-19 23:10:09 +02:00
Yuki Okushi
d8b3764bd2
Rollup merge of #90025 - JohnTitor:revert-86011, r=estebank
Revert #86011 to fix an incorrect bound check

This reverts commit 36a1076d24, reversing
changes made to e1e9319d93.

Fixes #89935
r? ``@estebank``
2021-10-20 04:35:17 +09:00
Yuki Okushi
f7024998c7
Rollup merge of #88860 - nbdd0121:panic, r=m-ou-se
Deduplicate panic_fmt

std's begin_panic_fmt and core's panic_fmt are duplicates. Merge them to declutter code and remove a lang item.
2021-10-20 04:35:14 +09:00
Yuki Okushi
3d95330230
Rollup merge of #87404 - rylev:artifact-size-profiling, r=wesleywiser
Add support for artifact size profiling

This adds support for profiling artifact file sizes (incremental compilation artifacts and query cache to begin with).

Eventually we want to track this in perf.rlo so we can ensure that file sizes do not change dramatically on each pull request.

This relies on support in measureme: https://github.com/rust-lang/measureme/pull/169. Once that lands we can update this PR to not point to a git dependency.

This was worked on together with `@michaelwoerister.`

r? `@wesleywiser`
2021-10-20 04:35:11 +09:00
Tomasz Miąsko
c97cf7fed7 Reject closures in patterns 2021-10-19 20:45:43 +02:00
bors
1af55d19c7 Auto merge of #89933 - est31:let_else, r=michaelwoerister
Adopt let_else across the compiler

This performs a substitution of code following the pattern:

```
let <id> = if let <pat> = ... { identity } else { ... : ! };
```

To simplify it to:

```
let <pat> = ... { identity } else { ... : ! };
```

By adopting the `let_else` feature (cc #87335).

The PR also updates the syn crate because the currently used version of the crate doesn't support `let_else` syntax yet.

Note: Generally I'm the person who *removes* usages of unstable features from the compiler, not adds more usages of them, but in this instance I think it hopefully helps the feature get stabilized sooner and in a better state. I have written a [comment](https://github.com/rust-lang/rust/issues/87335#issuecomment-944846205) on the tracking issue about my experience and what I feel could be improved before stabilization of `let_else`.
2021-10-19 14:41:39 +00:00
Gary Guo
9370156957 Deduplicate panic_fmt
std's begin_panic_fmt and core's panic_fmt are duplicates.
Merge them to declutter code and remove a lang item.
2021-10-19 15:02:21 +01:00
Michael Woerister
bf39d86e0f Erase late-bound regions before computing vtable debuginfo name. 2021-10-19 13:57:35 +02:00
bors
d45ed7502a Auto merge of #90040 - nbdd0121:issue-90038, r=oli-obk
Fix wrong niche calculation when 2+ niches are placed at the start

When the niche is at the start, existing code incorrectly uses 1 instead of count for subtraction.

Fix #90038

`@rustbot` label: T-compiler
2021-10-19 08:13:35 +00:00
Gary Guo
7dbd5bb0bd Fix issue 90038 2021-10-19 06:43:33 +01:00
bors
2f22e63cc4 Auto merge of #90037 - matthiaskrgr:rollup-cdfhxtn, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #89766 (RustWrapper: adapt for an LLVM API change)
 - #89867 (Fix macro_rules! duplication when reexported in the same module)
 - #89941 (removing TLS support in x86_64-unknown-none-hermitkernel)
 - #89956 (Suggest a case insensitive match name regardless of levenshtein distance)
 - #89988 (Do not promote values with const drop that need to be dropped)
 - #89997 (Add test for issue #84957 - `str.as_bytes()` in a `const` expression)
 - #90002 (⬆️ rust-analyzer)
 - #90034 (Tiny tweak to Iterator::unzip() doc comment example.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-19 05:04:38 +00:00
Matthias Krüger
a0724d72b0
Rollup merge of #89988 - tmiasko:unpromote-const-drop, r=oli-obk
Do not promote values with const drop that need to be dropped

Changes from #88558 allowed using `~const Drop` in constants by
introducing a new `NeedsNonConstDrop` qualif.

The new qualif was also used for promotion purposes, and allowed
promotion to happen for values that needs to be dropped but which
do have a const drop impl.

Since for promoted the drop implementation is never executed,
this lead to observable change in behaviour. For example:

```rust

struct Panic();

impl const Drop for Panic {
    fn drop(&mut self) {
        panic!();
    }
}

fn main() {
    let _ = &Panic();
}
```

Restore the use of `NeedsDrop` qualif during promotion to avoid the issue.
2021-10-19 05:40:54 +02:00
Matthias Krüger
8c8835d277
Rollup merge of #89956 - JohnTitor:suggest-case-insensitive-match-names, r=estebank
Suggest a case insensitive match name regardless of levenshtein distance

Fixes #86170

Currently, `find_best_match_for_name` only returns a case insensitive match name depending on a Levenshtein distance. It's a bit unfortunate that that hides some suggestions for typos like `Bar` -> `BAR`. That idea is from https://github.com/rust-lang/rust/pull/46347#discussion_r153701834, but I think it still makes some sense to show a candidate when we find a case insensitive match name as it's more like a typo.
Skipped the `candidate != lookup` check because the current (i.e, `levenshtein_match`) returns the exact same `Symbol` anyway but it doesn't seem to confuse anything on UI tests.

r? ``@estebank``
2021-10-19 05:40:53 +02:00
Matthias Krüger
9dccb7bd89
Rollup merge of #89941 - hermitcore:kernel, r=joshtriplett
removing TLS support in x86_64-unknown-none-hermitkernel

HermitCore's kernel itself doesn't support TLS. Consequently, the entries in x86_64-unknown-none-hermitkernel should be removed. This commit should help to finalize #89062.
2021-10-19 05:40:52 +02:00
Matthias Krüger
54aa5477ac
Rollup merge of #89766 - krasimirgg:llvm-14-targetregistrty, r=nagisa
RustWrapper: adapt for an LLVM API change

No functional changes intended.

The LLVM commit
89b57061f7
moved TargetRegistry.(h|cpp) from Support to MC.
This adapts RustWrapper accordingly.
2021-10-19 05:40:50 +02:00
bors
cd8b56f528 Auto merge of #89905 - matthiaskrgr:rev_89709_entirely, r=michaelwoerister
Revert "Auto merge of #89709 - clemenswasser:apply_clippy_suggestions…

…_2, r=petrochenkov"

The PR had some unforseen perf regressions that are not as easy to find.
Revert the PR for now.

This reverts commit 6ae8912a3e, reversing
changes made to 86d6d2b738.
2021-10-19 02:03:21 +00:00
Tomasz Miąsko
7581bae996 Fix const qualification when executed after promotion
The const qualification was so far performed before the promotion and
the implementation assumed that it will never encounter a promoted.

With `const_precise_live_drops` feature, checking for live drops is
delayed until after drop elaboration, which in turn runs after
promotion. so the assumption is no longer true. When evaluating
`NeedsNonConstDrop` it is now possible to encounter promoteds.

Use type base qualification for the promoted. It is a sound
approximation in general, and in the specific case of promoteds and
`NeedsNonConstDrop` it is precise.
2021-10-19 00:00:00 +00:00
bors
ec724ac075 Auto merge of #89229 - oli-obk:i_love_inferctxt, r=jackh726
Remove redundant member-constraint check

impl trait will, for each lifetime in the hidden type, register a "member constraint" that says the lifetime must be equal or outlive one of the lifetimes of the impl trait. These member constraints will be solved by borrowck

But, as you can see in the big red block of removed code, there was an ad-hoc check for member constraints happening at the site where they get registered. This check had some minor effects on diagnostics, but will fall down on its feet with my big type alias impl trait refactor. So we removed it and I pulled the removal out into a (hopefully) reviewable PR that works on master directly.
2021-10-18 23:02:53 +00:00
Tomasz Miąsko
915a581bcb Do not promote values with const drop that need to be dropped
Changes from #88558 allowed using `~const Drop` in constants by
introducing a new `NeedsNonConstDrop` qualif.

The new qualif was also used for promotion purposes, and allowed
promotion to happen for values that needs to be dropped but which
do have a const drop impl.

Since for promoted the drop implementation is never executed,
this lead to observable change in behaviour. For example:

```rust

struct Panic();

impl const Drop for Panic {
    fn drop(&mut self) {
        panic!();
    }
}

fn main() {
    let _ = &Panic();
}
```

Restore the use of `NeedsDrop` qualif during promotion to avoid the issue.
2021-10-18 21:56:57 +02:00
bors
bd41e09da3 Auto merge of #89124 - cjgillot:owner-info, r=michaelwoerister
Index and hash HIR as part of lowering

Part of https://github.com/rust-lang/rust/pull/88186
~Based on https://github.com/rust-lang/rust/pull/88880 (see merge commit).~

Once HIR is lowered, it is later indexed by the `index_hir` query and hashed for `crate_hash`. This PR moves those post-processing steps to lowering itself. As a side objective, the HIR crate data structure is refactored as an `IndexVec<LocalDefId, Option<OwnerInfo<'hir>>>` where `OwnerInfo` stores all the relevant information for an HIR owner.

r? `@michaelwoerister`
cc `@petrochenkov`
2021-10-18 19:53:05 +00:00
Tomasz Miąsko
171cbc01ef Rename needs_drop to needs_non_const_drop 2021-10-18 20:51:22 +02:00
Aaron Hill
02e4d0b3b5
Make all proc-macro back-compat lints deny-by-default
The affected crates have had plenty of time to update.
By keeping these as lints rather than making them hard errors,
we ensure that downstream crates will still be able to compile,
even if they transitive depend on broken versions of the affected
crates.

This should hopefully discourage anyone from writing any
new code which relies on the backwards-compatibility behavior.
2021-10-18 13:17:05 -05:00
Yuki Okushi
e2453dc2ff
Revert "Rollup merge of #86011 - tlyu:correct-sized-bound-spans, r=estebank"
This reverts commit 36a1076d24, reversing
changes made to e1e9319d93.
2021-10-19 02:33:38 +09:00
Oli Scherer
4413f8c709 Member constraints already covered all of E0482 already, so that error never occurred anymore 2021-10-18 15:50:56 +00:00
Oli Scherer
2220fafa8c Guarding a loop with a check that it never runs is useless 2021-10-18 15:50:56 +00:00
Oli Scherer
2431540b62 Remove unused enum variant 2021-10-18 15:50:56 +00:00
Oli Scherer
b02f2982e7 Remove regionck member constraint handling and leave it to mir borrowck 2021-10-18 15:50:56 +00:00
Krasimir Georgiev
e3c3f4a09c RustWrapper: adapt for an LLVM API change
No functional changes intended.

The LLVM commit
89b57061f7
moved TargetRegistry.(h|cpp) from Support to MC.
This adapts RustWrapper accordingly.
2021-10-18 09:48:47 +02:00
Vadim Petrochenkov
c1e8fc8c97 resolve: Use NameBinding for local variables and generic parameters 2021-10-18 10:42:39 +03:00
Matthias Krüger
2fd765c1d9
Rollup merge of #89990 - petrochenkov:idempty, r=wesleywiser
rustc_span: `Ident::invalid` -> `Ident::empty`

The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s as well.
2021-10-18 08:13:30 +02:00
Matthias Krüger
cd72393566
Rollup merge of #89987 - pierwill:fix-85526-docs-hidden-assoc, r=GuillaumeGomez
Check implementing type for `#[doc(hidden)]`

Closes #85526.
2021-10-18 08:13:28 +02:00
Matthias Krüger
5898c5d88e
Rollup merge of #89974 - est31:let_else_if_error, r=nagisa
Nicer error message if the user attempts to do let...else if

Gives a nice "conditional `else if` is not supported for `let...else`" error when encountering a `let...else if` pattern, as suggested in the [let...else tracking issue](https://github.com/rust-lang/rust/issues/87335#issuecomment-944846205).
2021-10-18 08:13:27 +02:00
Matthias Krüger
b356a04c9a
Rollup merge of #89965 - JohnTitor:fix-let-else-ice-with-ref-mut, r=petrochenkov
Fix ICE with `let...else` and `ref mut`

Fixes #89960, opened for review.
I'm not satisfied with the current diagnostics, any ideas?
2021-10-18 08:13:26 +02:00