Commit Graph

197934 Commits

Author SHA1 Message Date
Tomasz Miąsko
31d892a942 Fix liveness analysis for yield terminators
A resume place is evaluated and assigned to only after a yield
terminator resumes. Ensure that locals used when evaluating the
resume place are live across the yield.
2022-08-25 07:12:16 +02:00
bors
5462da52ba Auto merge of #99946 - tmiasko:elide-storage-makers, r=oli-obk
Elide superfluous storage markers

Follow the existing strategy of omitting the storage markers for temporaries
introduced for internal usage when elaborating derefs and deref projections.

Those temporaries are simple scalars which are used immediately after being
defined and never have their address taken. There is no benefit from storage
markers from either liveness analysis or code generation perspective.
2022-08-24 23:51:06 +00:00
bors
addacb5878 Auto merge of #100963 - matthiaskrgr:rollup-pjr0lb3, r=matthiaskrgr
Rollup of 15 pull requests

Successful merges:

 - #99993 (linker: Update some outdated comments)
 - #100220 (Properly forward `ByRefSized::fold` to the inner iterator)
 - #100826 (sugg: take into count the debug formatting)
 - #100855 (Extra documentation for new formatting feature)
 - #100888 (Coherence negative impls implied bounds)
 - #100901 (Make some methods private)
 - #100906 (Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing)
 - #100912 (Diagnose missing includes in run-make tests)
 - #100919 (Use par_body_owners for liveness)
 - #100922 (Rewrite error index generator to greatly reduce the size of the pages)
 - #100926 (Update README.md)
 - #100930 (Use `--userns=keep-id` when "docker" is really podman)
 - #100938 (rustdoc: remove unused CSS rule)
 - #100940 (Do not suggest adding a bound to a opaque type)
 - #100945 (Add a missing test case for impl generic mismatch)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-24 19:54:22 +00:00
bors
ebfc7aa531 Auto merge of #100803 - klensy:do-not-encode-preinterned-symbols, r=bjorn3
Symbols: do not write string values of preinterned symbols into compiled artifacts

r? `@bjorn3`

Followup for #98851

https://github.com/rust-lang/rust/pull/98851#issuecomment-1215606291
2022-08-24 16:56:32 +00:00
Matthias Krüger
fb88e25c46
Rollup merge of #100945 - TaKO8Ki:add-missing-test-case-for-impl-generic-mismatch, r=Dylan-DPC
Add a missing test case for impl generic mismatch

This suggestion use different span depending on whether the method has generics or not, so I added a test case about the method with some generics.
2022-08-24 18:20:21 +02:00
Matthias Krüger
75b1b69171
Rollup merge of #100940 - TaKO8Ki:do-not-suggest-adding-bound-to-opaque-type, r=fee1-dead
Do not suggest adding a bound to a opaque type

fixes #100442
2022-08-24 18:20:20 +02:00
Matthias Krüger
a0fbfd8d8f
Rollup merge of #100938 - notriddle:notriddle/fields-table, r=sanxiyn
rustdoc: remove unused CSS rule

According to [blame], this rule was added to support enum struct variants. However, enum struct variants don't use tables in their design any more, so this rule does nothing.

[blame]: 87991d5f5d/src/librustdoc/html/static/css/rustdoc.css (L748)
2022-08-24 18:20:19 +02:00
Matthias Krüger
a81012cd32
Rollup merge of #100930 - cuviper:podman-keep-id, r=jyn514
Use `--userns=keep-id` when "docker" is really podman

Rootless podman creates a separate user namespace, where an inner
`LOCAL_USER_ID` will map to a different subuid range on the host.
The "keep-id" mode maps the current UID directly into the container.

This makes `src/ci/docker/run.sh` work better for testing container
images on systems running podman, where "docker" is just a shim.
2022-08-24 18:20:18 +02:00
Matthias Krüger
234a1cc456
Rollup merge of #100926 - tusharxoxoxo:master, r=Dylan-DPC
Update README.md

Fixed Small grammatical Errors
2022-08-24 18:20:17 +02:00
Matthias Krüger
fe1f1f1282
Rollup merge of #100922 - GuillaumeGomez:rewrite-error-index, r=notriddle
Rewrite error index generator to greatly reduce the size of the pages

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

Instead of having all error codes in a same page (making the DOM way too big), I split the output into multiple files and generated a list of links (if there is an explanation) to the error codes' explanation into the already existing file.

I also used this opportunity to greatly simplify the code. Instead of needing a `build.rs`, I simply imported the file we want and wrote the macro which generates a function containing everything we need. We just need to call it to get the error codes and their explanation (if any). Also, considering the implementations between markdown and HTML formats differed even further, the `Formatter` trait was becoming too problematic so I removed it too.

You can test it [here](https://rustdoc.crud.net/imperio/rewrite-error-index/error-index.html).

cc ``@jsha``
r? ``@notriddle``
2022-08-24 18:20:16 +02:00
Matthias Krüger
8cdf4080c1
Rollup merge of #100919 - sanxiyn:parallel-liveness, r=oli-obk
Use par_body_owners for liveness

I did this refactoring while working on something else. Liveness is about bodies, there is no reason to use par_for_each_module here.

Tests are updated because things are visited in a different order. I checked diagnostics are same, just in a different (and IMO, better) order.
2022-08-24 18:20:15 +02:00
Matthias Krüger
ecf14d459c
Rollup merge of #100912 - tmiasko:make-include, r=TaKO8Ki
Diagnose missing includes in run-make tests
2022-08-24 18:20:14 +02:00
Matthias Krüger
95135bed61
Rollup merge of #100906 - ChayimFriedman2:map-index-mut, r=davidtwco
Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing

The error can be quite confusing to newcomers.

Fixes #100873.

I'm not so sure about the message, open to wording suggestions.
2022-08-24 18:20:13 +02:00
Matthias Krüger
1c0f60f904
Rollup merge of #100901 - TaKO8Ki:make-some-methods-private, r=sanxiyn
Make some methods private
2022-08-24 18:20:12 +02:00
Matthias Krüger
0fcabec620
Rollup merge of #100888 - spastorino:coherence-negative-impls-implied-bounds, r=lcnr
Coherence negative impls implied bounds

Fixes #93875

This PR is rebased on top of #100789 and it would need to include that one which is already r+ed.

r? ``@nikomatsakis``

cc ``@lcnr`` (which I've talked about 3222f420d9, I guess after you finish your reordering of modules and work with OutlivesEnvironmentEnv this commit can just be reverted).
2022-08-24 18:20:11 +02:00
Matthias Krüger
e802df9e8b
Rollup merge of #100855 - IsaacCloos:master, r=joshtriplett
Extra documentation for new formatting feature

Documentation of this feature was added in #90473 and released in Rust 1.58. However, high traffic macros did not receive new examples. Namely `println!()` and `format!()`.

The doc comments included in Rust are super important to the community- especially newcomers. I have met several other newbies like myself who are unaware of this recent (well about 7 months old now) update to the language allowing for convenient intra-string identifiers.

Bringing small examples of this feature to the doc comments of `println!()` and `format!()` would be helpful to everyone learning the language.

[Blog Post Announcing Feature](https://blog.rust-lang.org/2022/01/13/Rust-1.58.0.html)
[Feature PR](https://github.com/rust-lang/rust/pull/90473) - includes several instances of documentation of the feature- minus the macros in question for this PR

*This is my first time contributing to a project this large. Feedback would mean the world to me 😄*

---

*Recreated; I violated the [No-Merge Policy](https://rustc-dev-guide.rust-lang.org/git.html#no-merge-policy)*
2022-08-24 18:20:10 +02:00
Matthias Krüger
f8e128f8ad
Rollup merge of #100826 - vincenzopalazzo:macros/wrong_sugg_with_positional_arg, r=TaKO8Ki
sugg: take into count the debug formatting

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

This PR will fix a suggestion error by taking into consideration also the `:?` symbol and act in a different way

``@rustbot`` r? ``@compiler-errors``

N.B: I did not find a full way to test the change, any idea?
2022-08-24 18:20:09 +02:00
Matthias Krüger
6deca5f067
Rollup merge of #100220 - scottmcm:fix-by-ref-sized, r=joshtriplett
Properly forward `ByRefSized::fold` to the inner iterator

cc ``@timvermeulen,`` who noticed this mistake in https://github.com/rust-lang/rust/pull/100214#issuecomment-1207317625
2022-08-24 18:20:08 +02:00
Matthias Krüger
bc05045a01
Rollup merge of #99993 - petrochenkov:linkdated, r=bjorn3
linker: Update some outdated comments

r? ``@bjorn3``
2022-08-24 18:20:07 +02:00
Takayuki Maeda
c57ecfae0e use a minimized example 2022-08-25 00:42:34 +09:00
bors
4a24f08ba4 Auto merge of #100942 - ehuss:update-cargo, r=ehuss
Update cargo

7 commits in 9809f8ff33c2b998919fd0432c626f0f7323697a..6da726708a4406f31f996d813790818dce837161
2022-08-16 22:10:06 +0000 to 2022-08-23 21:39:56 +0000
- Update non-ASCII crate name warning message (rust-lang/cargo#11017)
- Add more tests for aggressive or precise update (rust-lang/cargo#11011)
- Ignore broken but excluded file during traversing (rust-lang/cargo#11008)
- Improve error message for wrong target names (rust-lang/cargo#10999)
- Bump snapbox to 0.3 (rust-lang/cargo#11005)
- remove missed reference to workspace inheritance in unstable.md (rust-lang/cargo#11001)
- Warning when precise or aggressive without -p flag (rust-lang/cargo#10988)
2022-08-24 05:34:43 +00:00
Takayuki Maeda
56f9e29d2a add a missing test case for impl generic mismatch 2022-08-24 14:09:55 +09:00
Eric Huss
6e4603e09f Update cargo 2022-08-23 20:58:12 -07:00
Takayuki Maeda
3855e039a2 do not suggest adding a bound to a opaque type 2022-08-24 11:34:14 +09:00
bors
25ea5a36c6 Auto merge of #96869 - sunfishcode:main, r=joshtriplett
Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8.

Add a `is_known_utf8` flag to `Wtf8Buf`, which tracks whether the
string is known to contain UTF-8. This is efficiently computed in many
common situations, such as when a `Wtf8Buf` is constructed from a `String`
or `&str`, or with `Wtf8Buf::from_wide` which is already doing UTF-16
decoding and already checking for surrogates.

This makes `OsString::into_string` O(1) rather than O(N) on Windows in
common cases.

And, it eliminates the need to scan through the string for surrogates in
`Args::next` and `Vars::next`, because the strings are already being
translated with `Wtf8Buf::from_wide`.

Many things on Windows construct `OsString`s with `Wtf8Buf::from_wide`,
such as `DirEntry::file_name` and `fs::read_link`, so with this patch,
users of those functions can subsequently call `.into_string()` without
paying for an extra scan through the string for surrogates.

r? `@ghost`
2022-08-24 01:17:52 +00:00
Michael Howell
b1925b811e rustdoc: remove unused CSS rule
According to [blame], this rule was added to support enum struct
variants. However, enum struct variants don't use tables in their design
any more, so this rule does nothing.

[blame]: 87991d5f5d/src/librustdoc/html/static/css/rustdoc.css (L748)
2022-08-23 18:15:53 -07:00
bors
87991d5f5d Auto merge of #100675 - Xiretza:fluent-mandate-crate-prefix, r=davidtwco
fluent: mandate slug names to be prefixed by crate name

This is currently only convention, but not actively checked for.

Additionally, improve error messages to highlight the path of the offending fluent file rather than the identifier preceding it.

This will conflict with #100671, so I'll leave it as draft until that's merged.
2022-08-23 22:30:07 +00:00
Josh Stone
4eb748bf39 Use --userns=keep-id when "docker" is really podman
Rootless podman creates a separate user namespace, where an inner
`LOCAL_USER_ID` will map to a different subuid range on the host.
The "keep-id" mode maps the current UID directly into the container.

This makes `src/ci/docker/run.sh` work better for testing container
images on systems running podman, where "docker" is just a shim.
2022-08-23 15:10:36 -07:00
Vincenzo Palazzo
3d8c7d2c0a sugg: take into count the debug formatting
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-08-23 21:57:30 +00:00
bors
060e47f74a Auto merge of #99917 - yaahc:error-in-core-move, r=thomcc
Move Error trait into core

This PR moves the error trait from the standard library into a new unstable `error` module within the core library. The goal of this PR is to help unify error reporting across the std and no_std ecosystems, as well as open the door to integrating the error trait into the panic reporting system when reporting panics whose source is an errors (such as via `expect`).

This PR is a rewrite of https://github.com/rust-lang/rust/pull/90328 using new compiler features that have been added to support error in core.
2022-08-23 19:48:55 +00:00
Guillaume Gomez
4398d9229a Fix links to error codes 2022-08-23 21:47:31 +02:00
Guillaume Gomez
c664a36033 Handle error code hash by redirecting to the correct error code page 2022-08-23 21:44:29 +02:00
Tushar Dahiya
9397b6c38d
Update README.md 2022-08-23 23:27:23 +05:30
Guillaume Gomez
8ad36c45f8 Rewrite error index generator to greatly reduce the size of the pages 2022-08-23 18:27:18 +02:00
Chayim Refael Friedman
b0255a1849 Suggest alternatives when trying to mutate a HashMap/BTreeMap via indexing
The error can be quite confusing to newcomers.
2022-08-23 15:15:34 +00:00
bors
a1bea1551b Auto merge of #100920 - Dylan-DPC:rollup-vlcw3sr, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #99249 (Do not re-parse function signatures to suggest generics)
 - #100309 (Extend comma suggestion to cases where fields arent missing)
 - #100368 (InferCtxt tainted_by_errors_flag should be Option<ErrorGuaranteed>)
 - #100768 (Migrate `rustc_plugin_impl` to `SessionDiagnostic`)
 - #100835 (net listen backlog update, follow-up from #97963.)
 - #100851 (Fix rustc_parse_format precision & width spans)
 - #100857 (Refactor query modifier parsing)
 - #100907 (Fix typo in UnreachableProp)
 - #100909 (Minor `ast::LitKind` improvements)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-23 15:12:09 +00:00
Dylan DPC
28ead17745
Rollup merge of #100909 - nnethercote:minor-ast-LitKind-improvement, r=petrochenkov
Minor `ast::LitKind` improvements

r? `@petrochenkov`
2022-08-23 20:40:09 +05:30
Dylan DPC
12c1ac0a67
Rollup merge of #100907 - Nilstrieb:unrachable-typo-lol, r=Dylan-DPC
Fix typo in UnreachableProp

r? ``@Dylan-DPC``
2022-08-23 20:40:08 +05:30
Dylan DPC
fd93ab43ef
Rollup merge of #100857 - camsteffen:query-parse-refactor, r=davidtwco
Refactor query modifier parsing

Reduce redundancy and improve error spans.
2022-08-23 20:40:07 +05:30
Dylan DPC
110d8d99b2
Rollup merge of #100851 - Alexendoo:rpf-width-prec-spans, r=fee1-dead
Fix rustc_parse_format precision & width spans

When a `precision`/`width` was `CountIsName - {:name$}` or `CountIs - {:10}` the `precision_span`/`width_span` was set to `None`

For `width` the name span in `CountIsName(_, name_span)` had its `.start` off by one

r? ``@fee1-dead`` / cc ``@PrestonFrom`` since this is similar to #99987
2022-08-23 20:40:06 +05:30
Dylan DPC
a163659b1b
Rollup merge of #100835 - devnexen:listener_followups, r=devnexen
net listen backlog update, follow-up from #97963.

FreeBSD and using system limit instead for others.
2022-08-23 20:40:05 +05:30
Dylan DPC
35f2d125ca
Rollup merge of #100768 - Facel3ss1:plugin-impl-translation, r=davidtwco
Migrate `rustc_plugin_impl` to `SessionDiagnostic`

Migration of the `rustc_plugin_impl` crate.
~Draft PR because it is blocked on #100694 for `#[fatal(...)]` support~ (this has been merged, and I've changed over to `#[diag(...)]` now too), but I would also like to know if what I did with `LoadPluginError` is okay, because all it does is display the error message from `libloading` ([See conversation on zulip](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.23100717.20diagnostic.20translation/near/294327843)). This crate is apparently for a deprecated feature which is used by servo, so I don't know how much this matters anyway.
2022-08-23 20:40:04 +05:30
Dylan DPC
f42cdf76e1
Rollup merge of #100368 - chenyukang:fix-100321, r=lcnr
InferCtxt tainted_by_errors_flag should be Option<ErrorGuaranteed>

Fixes #100321.
Use Cell<Option<ErrorGuaranteed>> to guarantee that we emit an error when that flag is set.
2022-08-23 20:40:03 +05:30
Dylan DPC
8733550870
Rollup merge of #100309 - compiler-errors:issue-100300, r=sanxiyn
Extend comma suggestion to cases where fields arent missing

Fixes #100300
2022-08-23 20:40:02 +05:30
Dylan DPC
4d1c273b32
Rollup merge of #99249 - cjgillot:no-reparse-fn, r=fee1-dead
Do not re-parse function signatures to suggest generics

This PR uses the existing resolution rib infrastructure to channel the correct span information to suggest generic parameters.  This allows to avoid re-parsing a function's source code.

Drive-by cleanup: this removes useless `FnItemRibKind` from late resolution ribs.  All the use cases are already covered by `ItemRibKind` and `AssocItemRibKind` which have more precise semantics.
2022-08-23 20:40:01 +05:30
Santiago Pastorino
4da14ef50e
Use CRATE_HIR_ID and CRATE_DEF_ID for obligations from foreign crates 2022-08-23 09:08:30 -03:00
Santiago Pastorino
4cb492e740
Do not use unneeded extra errors variable 2022-08-23 08:55:43 -03:00
Santiago Pastorino
ac0b6af37b
Permit negative impls coherence to take advantage of implied bounds 2022-08-23 08:55:43 -03:00
Santiago Pastorino
5ff45dc89e
Move InferCtxtExt to rustc_trait_selection 2022-08-23 08:55:43 -03:00
Seo Sanghyeon
f280138c7c Use par_body_owners for liveness 2022-08-23 20:53:02 +09:00