Commit graph

152075 commits

Author SHA1 Message Date
bors b2b7c859c1 Auto merge of #87287 - oli-obk:fixup_fixup_fixup_opaque_types, r=spastorino
Make mir borrowck's use of opaque types independent of the typeck query's result

fixes #87218
fixes #86465

we used to use the typeck results only to generate an obligation for the mir borrowck type to be equal to the typeck result.

When i removed the `fixup_opaque_types` function in #87200, I exposed a bug that showed that mir borrowck can't doesn't get enough information from typeck in order to build the correct lifetime mapping from opaque type usage to the actual concrete type. We therefor now fully compute the information within mir borrowck (we already did that, but we only used it to verify the typeck result) and stop using the typeck information.

We will likely be able to remove most opaque type information from the borrowck results in the future and just have all current callers use the mir borrowck result instead.

r? `@spastorino`
2021-07-23 03:40:26 +00:00
chaz-kiker 831ac19639 Squash all commits.
add test for issue 86507

add stderr for issue 86507

update issue-86507 UI test

add comment for the expected error in UI test file

add proper 'refers to <ref_type>' in suggestion

update diagnostic phrasing; update test to match new phrasing; re-organize logic for checking T: Sync

evaluate additional obligation to figure out if T is Sync

run './x.py test tidy --bless'

incorporate changes from review; reorganize logic for readability
2021-07-22 15:42:42 -05:00
Alex Macleod 8837bf1acd Remove Option from BufWriter
Fixes #72925
2021-07-22 20:59:06 +01:00
Noah Lev 97623bf051 Don't hide fields of enum struct variants
* The toggle adds visual clutter
* It's easy to miss that there are fields
* Tuple variant fields are always shown, so it is inconsistent to hide
  struct variant fields
* It's annoying to have to click the toggle every time
2021-07-22 12:52:33 -07:00
Alex Macleod 470d378646 Add regression tests for the impl_trait_in_bindings ICEs 2021-07-22 19:43:29 +01:00
bors 027187094e Auto merge of #86212 - pnkfelix:mainline-targetted-revert-81473-warn-write-only-fields, r=simulacrum
Revert PR 81473 to resolve (on mainline) issues 81626 and 81658.

This is a nightly-targetted variant of PR #83171

The intent is to just address issue #81658 on all release channels, rather that keep repeatedly reverting PR #83171 on beta.

However, our intent is *also* to reland PR #83171 after we have addressed issue #81658 , most likely by coupling the re-landing of PR #83171 with an enhancement like PR #83004
2021-07-22 18:41:27 +00:00
Joshua Nelson 6194cc8f48 Don't default to submodules = true unless the rust repo has a .git directory 2021-07-22 14:20:46 -04:00
Thomas de Zeeuw 49b1be2c32 Change rustdoc logo to use the full container size
We have a logo in svg that scales nicely to large sizes, but by default
is only 5px large, i.e. very small. With the change the logo expands to
the full size. By only setting the height to 100% we ensure that the
width-height ratio isn't changed.
2021-07-22 18:05:06 +02:00
Charles Lew fbb353ae2b Add comment and more tests. 2021-07-22 23:29:53 +08:00
Piotr Kubaj 763bc13ccc Add support for powerpc-unknown-freebsd 2021-07-22 17:29:33 +02:00
Aaron Hill 0ebd6e4891
Extend HIR WF checking to fields 2021-07-22 10:22:00 -05:00
bors e742158ef5 Auto merge of #87371 - ehuss:update-cargo, r=ehuss
Update cargo

2 commits in 4e143fd131e0c16cefd008456e974236ca54e62e..cebef2951ee69617852844894164b54ed478a7da
2021-07-20 21:55:45 +0000 to 2021-07-22 13:01:52 +0000
- Changes rustc argument from `--force-warns` to `--force-warn` (rust-lang/cargo#9714)
- Display registry name instead of registry URL when possible (rust-lang/cargo#9632)
2021-07-22 15:10:19 +00:00
Guillaume Gomez ef953b096e Move calls to test_main into one function 2021-07-22 17:01:12 +02:00
Eric Huss 9c40255e48 Update cargo 2021-07-22 07:58:45 -07:00
bors 1158367a6d Auto merge of #87366 - GuillaumeGomez:rollup-7muueab, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #87270 (Don't display <table> in item summary)
 - #87281 (Normalize generic_ty before checking if bound is met)
 - #87288 (rustdoc: Restore --default-theme, etc, by restoring varname escaping)
 - #87307 (Allow combining -Cprofile-generate and -Cpanic=unwind when targeting MSVC.)
 - #87343 (Regression fix to avoid further beta backports: Remove unsound TrustedRandomAccess implementations)
 - #87357 (Update my name/email in .mailmap)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-22 12:29:30 +00:00
Guillaume Gomez ab9ea543f8
Rollup merge of #87357 - lilyball:mailmap, r=jyn514
Update my name/email in .mailmap

I should have done this years ago.

My name is also scattered across many other rust-lang repos, but none of the other repos I've looked at have a `.mailmap`. Is there any particular reason for this, or any process for updating my name/email everywhere?
2021-07-22 13:39:25 +02:00
Guillaume Gomez aece3df81e
Rollup merge of #87343 - steffahn:fix_unsound_zip_optimization_only_regression_fix, r=cuviper
Regression fix to avoid further beta backports: Remove unsound TrustedRandomAccess implementations

Removes the implementations that depend on the user-definable trait `Copy`.

Only fix regressions to ensure merge in 1.55: Does not modify `vec::IntoIter`.

<hr>

This PR applies the beta-`1.53` backport #86222 (merged as part of #86225), a reduced version of #85874 that only fixes regressions, to `master` in order to avoid the need for further backports from `1.55` onwards. Beta-`1.54` backport already happened with #87136. In case that #85874 gets merged quickly (within a week), this PR would be unnecessary.

r? `@cuviper`
2021-07-22 13:39:24 +02:00
Guillaume Gomez 90d6d3327d
Rollup merge of #87307 - michaelwoerister:pgo-unwind-msvc, r=nagisa
Allow combining -Cprofile-generate and -Cpanic=unwind when targeting MSVC.

The LLVM limitation that previously prevented this has been fixed in LLVM 9 which is older than the oldest LLVM version we currently support.

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

r? ``@nagisa`` (or anyone else from ``@rust-lang/wg-llvm)``
2021-07-22 13:39:23 +02:00
Guillaume Gomez 8dba89823a
Rollup merge of #87288 - ijackson:rustdoc-theme, r=GuillaumeGomez
rustdoc: Restore --default-theme, etc, by restoring varname escaping

In #86157

    cd0f93193c
    Use Tera templates for rustdoc.

dropped the following transformation from the keys of the default settings element's `data-` attribute names:

    .map(|(k, v)| format!(r#" data-{}="{}""#, k.replace('-', "_"), Escape(v)))

The `Escape` part is indeed no longer needed, because Tera does that for us.  But the massaging of `-` to `_` is needed, for the (bizarre) reasons explained in the new comments.

I have tested that the default theme function works again for me.  I have also verified that passing (in shell syntax)

    '--default-theme="zork&"'

escapes the value in the HTML.

Closes #87263
2021-07-22 13:39:22 +02:00
Guillaume Gomez e16d023a5e
Rollup merge of #87281 - rust-lang:issue-81487, r=nikomatsakis
Normalize generic_ty before checking if bound is met

Fixes #81487

r? `@nikomatsakis`
2021-07-22 13:39:21 +02:00
Guillaume Gomez aa3d64ef90
Rollup merge of #87270 - GuillaumeGomez:item-summary-table, r=notriddle
Don't display <table> in item summary

Fixes #87231.

r? `@notriddle`
2021-07-22 13:39:20 +02:00
Oli Scherer d10385242d bless nll tests 2021-07-22 11:26:42 +00:00
Oli Scherer f2d2fd38eb Add a regression test 2021-07-22 11:20:29 +00:00
Oli Scherer 9f09a5eb8b Resolve nested inference variables.
I attempted that with the previous code, but I misunderstdood how
`shallow_resolve` works.
2021-07-22 11:20:29 +00:00
Oli Scherer a8551abd47 Remove an unnecessary variable 2021-07-22 11:20:29 +00:00
Oli Scherer bdc20e372b Use instrument debugging for more readable logs 2021-07-22 11:20:29 +00:00
Oli Scherer 6d76002baf Make mir borrowck's use of opaque types independent of the typeck query's result 2021-07-22 11:20:29 +00:00
Oli Scherer d693a98f4e Fix VecMap::iter_mut
It used to allow you to mutate the key, even though that can invalidate the map by creating duplicate keys.
2021-07-22 11:20:29 +00:00
Guillaume Gomez df6bdd764a Move implementors directly into lib2 2021-07-22 12:58:59 +02:00
Guillaume Gomez 174728d045 Add tests for default-settings 2021-07-22 12:58:59 +02:00
bors f913a4fe90 Auto merge of #86619 - rylev:incr-hashing-profiling, r=wesleywiser
Profile incremental compilation hashing fingerprints

Adds profiling instrumentation for the hashing of incremental compilation fingerprints per query.

This will eventually feed into the `measureme` and `rustc-perf` infrastructure for tracking if computing hashes changes over time.

TODOs:
* [x] Address the FIXME where we are including node interning in the hash timing.
* [ ] Update measureme/summarize to handle this new data: https://github.com/rust-lang/measureme/pull/166
* [ ] ~Update rustc-perf to handle the new data from measureme~ (will be done at a later time)

r? `@ghost`

cc `@michaelwoerister`
2021-07-22 10:04:44 +00:00
bors 7c89e389d0 Auto merge of #87265 - Aaron1011:hir-wf-fn, r=estebank
Support HIR wf checking for function signatures

During function type-checking, we normalize any associated types in
the function signature (argument types + return type), and then
create WF obligations for each of the normalized types. The HIR wf code
does not currently support this case, so any errors that we get have
imprecise spans.

This commit extends `ObligationCauseCode::WellFormed` to support
recording a function parameter, allowing us to get the corresponding
HIR type if an error occurs. Function typechecking is modified to
pass this information during signature normalization and WF checking.
The resulting code is fairly verbose, due to the fact that we can
no longer normalize the entire signature with a single function call.

As part of the refactoring, we now perform HIR-based WF checking
for several other 'typed items' (statics, consts, and inherent impls).

As a result, WF and projection errors in a function signature now
have a precise span, which points directly at the responsible type.
If a function signature is constructed via a macro, this will allow
the error message to point at the code 'most responsible' for the error
(e.g. a user-supplied macro argument).
2021-07-22 07:21:45 +00:00
inquisitivecrystal a60f6275fd Make x.py d an alias for x.py doc 2021-07-21 23:44:09 -07:00
bors 7db08eeb00 Auto merge of #87250 - robojumper:87199-sized-relaxation, r=nikomatsakis
Fix implicit Sized relaxation when attempting to relax other, unsupported trait

Fixes #87199.

Do note that this bug fix causes code like the `ref_arg::<[i32]>(&[5]);` line in the test case in combination with an affected function to no longer compile.
2021-07-22 05:02:50 +00:00
Felix S. Klock II ee2bb1f338 temporarily ignore a test until we reland PR 83171. 2021-07-21 23:03:06 -04:00
Felix S. Klock II b6e9d069eb Allow some temporarily dead code.
I expect these two methods to come back very soon; noise of removing them to satisfy lint seems wrong.
2021-07-21 22:57:10 -04:00
Felix S. Klock II cf337d1119 Revert PR 81473 to resolve (on mainline) issues 81626 and 81658.
Revert "Add missing brace"

This reverts commit 85ad773049.

Revert "Simplify base_expr"

This reverts commit 899aae465e.

Revert "Warn write-only fields"

This reverts commit d3c69a4c0d.
2021-07-21 22:49:52 -04:00
Joshua Nelson a02756c14a Fix --dry-run when download-ci-llvm is set
Previously it would error out:

```
$ x check --dry-run
thread 'main' panicked at 'std::fs::read_to_string(ci_llvm.join("link-type.txt")) failed with No such file or directory (os error 2) ("CI llvm missing: /home/joshua/rustc3/build/tmp-dry-run/x86_64-unknown-linux-gnu/ci-llvm")', src/bootstrap/config.rs:795:33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Build completed unsuccessfully in 0:00:10
```
2021-07-22 02:22:41 +00:00
bors 8024983ea7 Auto merge of #87246 - rust-lang:placeholder-pretty, r=nikomatsakis
When pretty printing, name placeholders as bound regions

Split from #85499

When we see a placeholder that we are going to print, treat it as a bound var (and add it to a `for<...>`
2021-07-22 02:22:02 +00:00
Lily Ballard 4f98d51f98 Update my name/email in .mailmap 2021-07-21 16:53:19 -07:00
bors 602150f21f Auto merge of #86946 - Aaron1011:eval-proj-obligation, r=nikomatsakis
Improve caching during trait evaluation

Previously, we would 'forget' that we had `'static` regions in some
place during trait evaluation. This lead to us producing
`EvaluatedToOkModuloRegions` when we could have produced
`EvaluatedToOk`, causing us to perform unnecessary work.

This PR preserves `'static` regions when we canonicalize a predicate for
`evaluate_obligation`, and when we 'freshen' a predicate during trait
evaluation. Thie ensures that evaluating a predicate containing
`'static` regions can produce `EvaluatedToOk` (assuming that we
don't end up introducing any region dependencies during evaluation).

Building off of this improved caching, we use
`predicate_must_hold_considering_regions` during fulfillment of
projection predicates to see if we can skip performing additional work.
We already do this for trait predicates, but doing this for projection
predicates lead to mixed performance results without the above caching
improvements.
2021-07-21 23:18:19 +00:00
Aaron Hill 3291218f47
Improve caching during trait evaluation
Previously, we would 'forget' that we had `'static` regions in some
place during trait evaluation. This lead to us producing
`EvaluatedToOkModuloRegions` when we could have produced
`EvaluatedToOk`, causing us to perform unnecessary work.

This PR preserves `'static` regions when we canonicalize a predicate for
`evaluate_obligation`, and when we 'freshen' a predicate during trait
evaluation. Thie ensures that evaluating a predicate containing
`'static` regions can produce `EvaluatedToOk` (assuming that we
don't end up introducing any region dependencies during evaluation).

Building off of this improved caching, we use
`predicate_must_hold_considering_regions` during fulfillment of
projection predicates to see if we can skip performing additional work.
We already do this for trait predicates, but doing this for projection
predicates lead to mixed performance results without the above caching
improvements.
2021-07-21 17:54:05 -05:00
bors 32c9b7b091 Auto merge of #87351 - ehuss:rollup-pga85az, r=ehuss
Rollup of 5 pull requests

Successful merges:

 - #81864 (docs: GlobalAlloc: completely replace example with one that works)
 - #87024 (rustdoc: show count of item contents when hidden)
 - #87278 (⬆️ rust-analyzer)
 - #87326 (Update cargo)
 - #87346 (Rename force-warns to force-warn)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-21 19:50:10 +00:00
Igor Matuszewski 5fcb726f6c Fix formatting in tidy exception list 2021-07-21 21:08:39 +02:00
Igor Matuszewski bf12f340ee Clean up now unused deps from the exceptions list 2021-07-21 20:37:50 +02:00
Guillaume Gomez 3bafcf87aa Remove cargo workspace to build rustdoc-gui test crates because of cargo config not being applied 2021-07-21 20:07:50 +02:00
Guillaume Gomez de25b1c740 Add test to ensure tables are not inside items summary 2021-07-21 20:06:06 +02:00
Guillaume Gomez f423ef51d3 Don't render <table> in items' summary 2021-07-21 20:05:27 +02:00
Ian Jackson 1bf8a839d3 Run rustfmt
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-07-21 19:54:27 +02:00
Ian Jackson 155b055478 rustdoc: Restore --default-theme, etc, by restoring varname escaping
In #86157

    cd0f93193c
    Use Tera templates for rustdoc.

dropped the following transformation from the keys of the default
settings element's `data-` attribute names:

    .map(|(k, v)| format!(r#" data-{}="{}""#, k.replace('-', "_"), Escape(v)))

The `Escape` part is indeed no longer needed, because Tera does that
for us.  But the massaging of `-` to `_` is needed, for the (bizarre)
reasons explained in the new comments.

I have tested that the default theme function works again for me.  I
have also verified that passing

    --default-theme="zork&"

escapes the value in the HTML.

Closes #87263.

CC: Jacob Hoffman-Andrews <github@hoffman-andrews.com>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-07-21 19:54:27 +02:00