Commit graph

157035 commits

Author SHA1 Message Date
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
Eric Huss
2fcf911741 Update cargo 2021-10-18 21:22:09 -07:00
Jacob Hoffman-Andrews
e39934374a Reduce margin on h5 and h6 2021-10-18 21:04:38 -07:00
Matthias Krüger
5bcaf04cbb
Rollup merge of #90034 - moxian:unzip-doc, r=cuviper
Tiny tweak to Iterator::unzip() doc comment example.

It's easier to figure out what it's doing and which output elements map to which input ones if the matrix we are dealing with is rectangular 2x3 rather than square 2x2.
2021-10-19 05:40:56 +02:00
Matthias Krüger
a3a6b49734
Rollup merge of #90002 - lnicola:rust-analyzer-2021-10-18, r=lnicola
⬆️ rust-analyzer

r? ``@ghost``
2021-10-19 05:40:55 +02:00
Matthias Krüger
c3cfa58157
Rollup merge of #89997 - cameron1024:const-str-as-bytes-ice, r=JohnTitor
Add test for issue #84957 - `str.as_bytes()` in a `const` expression

Hi, this PR adds a test for issue #84957 . I'm quite new to rustc so let me know if there's anything else that needs doing 😄

Closes #84957
2021-10-19 05:40:54 +02: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
0d990a3dbd
Rollup merge of #89867 - Urgau:fix-double-definition, r=GuillaumeGomez
Fix macro_rules! duplication when reexported in the same module

This can append if within the same module a `#[macro_export] macro_rules!`
is declared but also a reexport of itself producing two export of the same
macro in the same module. In that case we only want to document it once.

Before:
```
Module {
    is_crate: true,
    items: [
        Id("0:4"),   // pub use crate::repro as repro2;
        Id("0:3"),   // macro_rules! repro
        Id("0:3"),   // duplicate, same as above
    ],
}
```

After:
```
Module {
    is_crate: true,
    items: [
        Id("0:4"),   // pub use crate::repro as repro2;
        Id("0:3"),   // macro_rules! repro
    ],
}
```

Fixes https://github.com/rust-lang/rust/issues/89852
2021-10-19 05:40:51 +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
Jacob Hoffman-Andrews
9aec3a0e5a Remove border-bottom from most docblocks.
Headings in the top-doc docblock still get a border-bottom due to a rule
that covers all h2, h3, and h4. Method docblocks are generally h5, and
so don't get a border-bottom anymore.

This fixes a problem where a sub-sub-heading within a method would have
a line that went all the way across the page, creating a division that
made that sub-sub-heading look much more important than it really is.
2021-10-18 20:24:41 -07:00
Yacin Tmimi
1ae5c35f8d Replace match expression with match! macro
This is a follow up to 5f4811ed7b

The matches! macro expresses the condition more succinctly and avoids
the extra level of indentation introduced with the match arm body.
2021-10-18 21:32:52 -05: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
Nathaniel Hamovitz
5283d24b38 formatting 🙃 2021-10-18 18:42:01 -07:00
Nathaniel Hamovitz
4c8e816972 Use real type in doc examples 2021-10-18 18:32:00 -07:00
Nathaniel Hamovitz
02b1f266d6 Remove explicit lifetime 2021-10-18 18:20:35 -07:00
Nathaniel Hamovitz
bc32be0fec Remove comment 2021-10-18 18:03:00 -07:00
Nathaniel Hamovitz
c654cc56da One more test + final tidying 2021-10-18 17:41:27 -07:00
Augie Fackler
f2a234e63c config: add the option to enable LLVM tests
I'm working on some LLVM patches in concert with a Rust patch, and it's
helping me quite a bit to have this as an option. It doesn't seem that
hard, so I figured I'd formalize it in x.py and send it upstream.
2021-10-18 20:19:13 -04:00
Nathaniel Hamovitz
6303d2d075 Revert "!: this is the commit that demonstrates the ICE"
This reverts commit d85f903c91.
2021-10-18 17:18:07 -07:00
Nathaniel Hamovitz
d85f903c91 !: this is the commit that demonstrates the ICE 2021-10-18 17:07:51 -07:00
moxian
1519ca99d8 Tiny tweak to Iterator::unzip() doc comment example.
It's easier to figure out what it's doing and which output
elements map to which input ones if the matrix we are dealing
with is rectangular 2x3 rather than square 2x2.
2021-10-19 00:03:51 +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
Nathaniel Hamovitz
48cf9c284a Don't need rustc_attr anymore 2021-10-18 16:53:17 -07:00
Nathaniel Hamovitz
18c863dd0e Improve help message 2021-10-18 16:53:05 -07:00
Tyson Nottingham
aefbd40140 Add test for debug logging during incremental compilation
Debug logging during incremental compilation had been broken for some
time, until #89343 fixed it (among other things). Add a test so this is
less likely to break without being noticed. This test is nearly a copy
of the `src/test/ui/rustc-rust-log.rs` test, but tests debug logging in
the incremental compliation code paths.
2021-10-18 16:28:10 -07:00
Tyson Nottingham
93f80bff94 Remove comment saying that we don't build debug rustc in CI, since we do 2021-10-18 16:28:09 -07: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
Nathaniel Hamovitz
d8bacf078a All five has_repr_attr agree + are correct 2021-10-18 15:33:11 -07: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
101a81b807
Add a regression test for #89935 2021-10-19 02:43:54 +09: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
Noah Lev
90986897c5 rustdoc: Box ty field of GenericParamDefKind::Const
This cuts the size of `GenericParamDef` in half, from 104 bytes to 56
bytes. I think the extra indirection should be worth the size savings.
2021-10-18 10:16:01 -07:00
Noah Lev
9b52a633e4 rustdoc: Box default fields of GenericParamDefKind
This reduces the size of `GenericParamDef` a bit, but some of the size
savings are hidden because of the `ty` field of the `Const` variant.
I will box that in the next commit.
2021-10-18 10:14:59 -07: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
Guillaume Gomez
77c29294be Add test to ensure that the docblock elements left margin is as expected 2021-10-18 16:50:31 +02:00
jackh726
347d503333 Add a couple tests for normalize under binder issues 2021-10-18 10:46:59 -04:00
Guillaume Gomez
20c286e268 Add GUI overflow tests for constant and typedef 2021-10-18 16:15:09 +02:00
Nathaniel Hamovitz
3a41f226c5 Exploring emitting other sorts of spans 2021-10-18 07:02:00 -07:00
Guillaume Gomez
809330bda6 Prevent documentation page title to grow too big 2021-10-18 15:30:03 +02:00
Guillaume Gomez
8b7a2dd462 * Remove left margin on items declaration at the top of their documentation page
* Rename "type-decl" into "item-decl" to reflect the change of usage
2021-10-18 15:06:38 +02:00
Nathaniel Hamovitz
ab9fa25e82 Better testcase names 2021-10-18 04:59:03 -07:00