about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-11-01Rollup merge of #103575 - Xiretza:suggestions-style-attr, r=davidtwcoManish Goregaokar-78/+229
Change #[suggestion_*] attributes to use style="..." As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20tool_only_span_suggestion), this changes `#[(multipart_)suggestion_{short,verbose,hidden}(...)]` attributes to plain `#[(multipart_)suggestion(...)]` attributes with a `style = "{short,verbose,hidden}"` parameter. It also adds a new style, `tool-only`, that corresponds to `tool_only_span_suggestion`/`tool_only_multipart_suggestion` and causes the suggestion to not be shown in human-readable output at all. Best reviewed commit-by-commit, there's a bit of noise in there. cc #100717 `@compiler-errors` r? `@davidtwco`
2022-11-01Rollup merge of #103072 - cuviper:compiletest-path, r=Mark-SimulacrumManish Goregaokar-33/+37
compiletest: set the dylib path when gathering target cfg If the compiler is built with `rpath = false`, then it won't find its own libraries unless the library search path is set. We already do that while running the actual compiletests, but #100260 added another rustc command for getting the target cfg. Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) thread 'main' panicked at 'error: failed to get cfg info from "[...]/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" --- stdout --- stderr [...]/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-a2a76dc626cd02d2.so: cannot open shared object file: No such file or directory ', src/tools/compiletest/src/common.rs:476:13 Now the library path is set here as well, so it works without rpath.
2022-11-01Auto merge of #103217 - mejrs:track, r=eholkbors-0/+210
Track where diagnostics were created. This implements the `-Ztrack-diagnostics` flag, which uses `#[track_caller]` to track where diagnostics are created. It is meant as a debugging tool much like `-Ztreat-err-as-bug`. For example, the following code... ```rust struct A; struct B; fn main(){ let _: A = B; } ``` ...now emits the following error message: ``` error[E0308]: mismatched types --> src\main.rs:5:16 | 5 | let _: A = B; | - ^ expected struct `A`, found struct `B` | | | expected due to this -Ztrack-diagnostics: created at compiler\rustc_infer\src\infer\error_reporting\mod.rs:2275:31 ```
2022-11-01Rollup merge of #103833 - lnicola:rust-analyzer-2022-11-01, r=lnicolaDylan DPC-404/+824
:arrow_up: rust-analyzer r? `@ghost`
2022-11-01Rollup merge of #103817 - notriddle:notriddle/attribute-css, r=GuillaumeGomezDylan DPC-16/+16
rustdoc: rename syntax highlighting CSS class `attribute` to `attr` Link classes use the abbreviation `attr` ... https://github.com/rust-lang/rust/blob/2afca78a0b03db144c5d8b9f8868feebfe096309/src/librustdoc/html/static/css/rustdoc.css#L255-L259 ... so why does syntax highlighting use the full word? https://github.com/rust-lang/rust/blob/2afca78a0b03db144c5d8b9f8868feebfe096309/src/librustdoc/html/static/css/rustdoc.css#L1095-L1097
2022-11-01Rollup merge of #103813 - notriddle:notriddle/search-results-clear-both, ↵Dylan DPC-2/+0
r=GuillaumeGomez rustdoc: remove unnecessary CSS `.search-results { clear: both }` Since the tabs use flexbox instead of float as of 44d9b8d07014d976c88f541dbe0af37e64e37bdd, clearing does nothing.
2022-11-01Rollup merge of #103760 - petrochenkov:macimp, r=cjgillotDylan DPC-7/+28
resolve: Turn the binding from `#[macro_export]` into a proper `Import` Continuation of https://github.com/rust-lang/rust/pull/91795. ```rust #[macro_export] macro_rules! m { /*...*/ } ``` is desugared to something like ```rust macro_rules! m { /*...*/ } // Non-modularized macro_rules item pub use m; // It's modularized reexport ``` This PR adjusts the internal representation to better match this model.
2022-11-01Rollup merge of #84022 - Aaron1011:remove-derive-res-fallback, r=petrochenkovDylan DPC-100/+36
Make PROC_MACRO_DERIVE_RESOLUTION_FALLBACK a hard error r? `@ghost`
2022-11-01:arrow_up: rust-analyzerLaurențiu Nicola-404/+824
2022-11-01Rollup merge of #103759 - cjgillot:adt-collect, r=davidtwcoDylan DPC-3/+3
Use `adt_def` during type collection. This removes a wrapper which is close to what `adt_def` does.
2022-11-01Rollup merge of #103706 - zbyrn:issue-101637-fix, r=estebankDylan DPC-19/+111
Fix E0433 No Typo Suggestions Fixes #48676 Fixes #87791 Fixes #96625 Fixes #95462 Fixes #101637 Follows up PR #72923 Several open issues refer to the problem that E0433 does not suggest typos like other errors normally do. This fix augments the implementation of PR #72923. **Background** When the path of a function call, e.g. `Struct::foo()`, involves names that cannot be resolved, there are two errors that could be emitted by the compiler: - If `Struct` is not found, it is ``E0433: failed to resolve: use of undeclared type `Struct` ``. - If `foo` is not found in `Struct`, it is ``E0599: no function or associated item named `foo` found for struct `Struct` in the current scope`` When a name is used as a type, `e.g. fn foo() -> Struct`, and the name cannot be resolved, it is ``E0412: cannot find type `Struct` in this scope``. Before #72923, `E0433` does not implement any suggestions, and the PR introduces suggestions for missing `use`s. When a resolution error occurs in the path of a function call, it tries to smart resolve just the type part of the path, e.g. `module::Struct` of a call to `module::Struct::foo()`. However, along with the suggestions, the smart-resolve function will report `E0412` since it only knows that it is a type that we cannot resolve instead of being a part of the path. So, the original implementation swap out `E0412` errors returned by the smart-resolve function with the real `E0433` error, but keeps the "missing `use`" suggestions to be reported to the programmer. **Issue** The current implementation only reports if there are "missing `use`" suggestions returned by the smart-resolve function; otherwise, it would fall back the normal reporting, which does not emit suggestions. But the smart-resolve function could also produce typo suggestions, which are omitted currently. Also, it seems like that not all info has been swapped out when there are missing suggestions. The error message underlining the name in the snippet still says ``not found in this scope``, which is a `E0412` messages, if there are `use` suggestions, but says the normal `use of undeclared type` otherwise. **Fixes** This fix swaps out all fields in `Diagnostic` returned by the smart-resolve function except for `suggestions` with the current error, and merges the `suggestions` of the returned error and that of the current error together. If there are `use` suggestions, the error is saved to `use_injection` to be reported at the end; otherwise, the error is emitted immediately as `Resolver::report_error` does. Some tests are updated to use the correct underlining error messages, and one additional test for typo suggestion is added to the test suite. r? rust-lang/diagnostics
2022-11-01Rollup merge of #103584 - ouz-a:issue-102303, r=oli-obkDylan DPC-15/+69
Remove bounds check when array is indexed by enum As the title says, this reverts the behavior introduced with 1.64. Fixes #102303 r? `@oli-obk`
2022-11-01Rollup merge of #103061 - Amanieu:rewrite_alloc_error_handler, r=bjorn3Dylan DPC-31/+135
Rewrite implementation of `#[alloc_error_handler]` The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-11-01Rollup merge of #103805 - Mark-Simulacrum:forward-port, r=jyn514Yuki Okushi-0/+3
Enable RUSTC_BOOTSTRAP for a few steps This forward-ports this commit so we don't need to keep applying it when branching beta (as done in 1.64, 1.65, and 1.66 beta bumps).
2022-11-01Rollup merge of #103799 - GuillaumeGomez:search-index-tuple-struct-field, ↵Yuki Okushi-15/+40
r=notriddle Remove generation of tuple struct fields in the search index This comes from [this discussion](https://github.com/rust-lang/rust/pull/103710) as they're not very useful. r? `@notriddle`
2022-11-01Rollup merge of #103793 - notriddle:notriddle/rustdoc-toggle-in-impl-items, ↵Yuki Okushi-6/+42
r=GuillaumeGomez rustdoc: add margins to all impl-item toggles, not just methods Fixes #103782 ## Before ![image](https://user-images.githubusercontent.com/1593513/198943087-8cab8b25-2092-49d6-89b4-caa2989dedf0.png) ## After ![image](https://user-images.githubusercontent.com/1593513/198943111-bc08c2d6-f058-4362-b999-0caf09eb93bf.png)
2022-11-01Rollup merge of #103788 - chenyukang:yukang/fix-ice-103783, r=compiler-errorsYuki Okushi-0/+33
Fix ICE in checking transmutability of NaughtyLenArray Fixes #103783
2022-11-01Rollup merge of #103772 - compiler-errors:better-strict-coherence-err, ↵Yuki Okushi-0/+17
r=davidtwco better error for `rustc_strict_coherence` misuse Fixes #103753
2022-11-01Rollup merge of #103749 - est31:reduce_irrefutable_let_else_span, r=cjgillotYuki Okushi-5/+18
Reduce span of let else irrefutable_let_patterns warning Huge spans aren't good for IDE users as they underline constructs that are possibly multiline. Similar PR to #90761 which did the same for the `unused_macros` lint.
2022-11-01Rollup merge of #103674 - ehuss:split-debuginfo-doc-unstable, r=davidtwcoYuki Okushi-2/+4
Update note about unstable split-debuginfo flag. split-debuginfo was effectively stabilized in #98051. The note about it requiring `-Z unstable-options` is no longer accurate. The rules for when it is gated and when it is supported are somewhat complex. I considered removing the note entirely, or making it more generic, but opted to instead try to summarize the current state.
2022-10-31Auto merge of #102950 - oli-obk:check_miri, r=RalfJungbors-53/+26
Enable `x.py check` for miri Now that the miri subtree is working properly, let's add it to x.py check. cc `@rust-lang/miri`
2022-10-31rustdoc: rename syntax highlighting CSS class `attribute` to `attr`Michael Howell-16/+16
Link classes use the abbreviation `attr`, so why shouldn't syntax highlighting?
2022-10-31rustdoc: remove unnecessary CSS `.search-results { clear: both }`Michael Howell-2/+0
Since the tabs use flexbox instead of float as of 44d9b8d07014d976c88f541dbe0af37e64e37bdd, clearing does nothing.
2022-10-31Auto merge of #103795 - thomcc:untest, r=Mark-Simulacrumbors-0/+25
Include both benchmarks and tests in the numbers given to `TeFiltered{,Out}` Fixes #103794 `#[bench]` is broken on nightly without this, sadly. It apparently has no test coverage. In addition to manually testing, I've added a run-make smokecheck for this (which would have caught the issue), but it would be nice to have a better way to test, err, libtest. For now we should get this in ASAP IMO
2022-10-31resolve: Turn the binding from `#[macro_export]` into a proper `Import`Vadim Petrochenkov-7/+28
2022-10-31Rewrite implementation of `#[alloc_error_handler]`Amanieu d'Antras-31/+135
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-10-31Add more track_callermejrs-1/+28
2022-10-31Enable RUSTC_BOOTSTRAP for a few stepsMark Rousskov-0/+3
2022-10-31rustdoc: add test case for associated type marginsMichael Howell-0/+34
2022-10-31bump up recursion limit for miri crateRalf Jung-0/+2
2022-10-31Add `ignore-cross-compile` to the `#[bench]` smoketest, and move it back to ↵Thom Chiovoloni-1/+3
run-make
2022-10-31move libtest bench smoketest to run-make-fulldepsThom Chiovoloni-1/+1
2022-10-31Use AdtDef to check enum.Camille GILLOT-3/+3
2022-10-31smoketest that libtest doesn't panic in `#[bench]`Thom Chiovoloni-0/+23
2022-10-31Remove bounds check with enum castouz-a-15/+69
2022-10-31Add test for tuple struct field generation in search indexGuillaume Gomez-0/+18
2022-10-31Don't generate tuple struct fields into the search indexGuillaume Gomez-15/+22
2022-10-31Rollup merge of #103732 - Mark-Simulacrum:revert-compiler-builtins, r=jyn514Dylan DPC-40/+22
Revert "Make the `c` feature for `compiler-builtins` opt-in instead of inferred" This reverts commit 3acb505ee560770c62bad5362f6caf7567d467b9 (PR #101833). The changes in this commit caused several bugs/incompatibilities (https://github.com/rust-lang/rust/pull/101833#issuecomment-1270191721, https://github.com/rust-lang/rust/issues/102560). For now we're reverting this commit and will re-land it alongside fixes for those bugs. Re-opens #101172 cc #102560 cc #102579
2022-10-31Rollup merge of #103603 - camsteffen:refactor-lang, r=oli-obkDylan DPC-39/+29
Lang item cleanups Various cleanups related to lang items.
2022-10-31Rollup merge of #103338 - l4l:enum-unreachable-pub, r=nagisaDylan DPC-0/+45
Fix unreachable_pub suggestion for enum with fields Resolves #103317
2022-10-30rustdoc: add margins to all impl-item toggles, not just methodsMichael Howell-6/+8
Fixes #103782
2022-10-31Auto merge of #103787 - notriddle:rollup-q1vmxsb, r=notriddlebors-152/+424
Rollup of 8 pull requests Successful merges: - #97971 (Enable varargs support for calling conventions other than C or cdecl ) - #101428 (Add mir building test directory) - #101944 (rustdoc: clean up `#toggle-all-docs`) - #102101 (check lld version to choose correct option to disable multi-threading in tests) - #102689 (Add a tier 3 target for the Sony PlayStation 1) - #103746 (rustdoc: add support for incoherent impls on structs and traits) - #103758 (Add regression test for reexports in search results) - #103764 (All verbosity checks in `PrettyPrinter` now go through `PrettyPrinter::should_print_verbose`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-30Rollup merge of #103764 - SarthakSingh31:issue-94187-2, r=compiler-errorsMichael Howell-5/+11
All verbosity checks in `PrettyPrinter` now go through `PrettyPrinter::should_print_verbose` Follow-up to #103428. That pr only partially fixed #94187. In some cases (like closures) `std::any::type_name` was still producing a different output when `-Zverbose` was enabled. This pr fixes those cases and adds a new function `PrettyPrinter::should_print_verbose`. This function should always be used over `self.tcx().sess.verbose()` inside a `impl PrettyPrinter`. Maybe closes #94187 now. r? ``@compiler-errors``
2022-10-30Rollup merge of #103758 - GuillaumeGomez:reexports-search-result-test, ↵Michael Howell-0/+28
r=notriddle Add regression test for reexports in search results Fixes https://github.com/rust-lang/rust/issues/86337. r? ``@notriddle``
2022-10-30Rollup merge of #103746 - notriddle:notriddle/incoherent-dyn-trait, ↵Michael Howell-0/+50
r=GuillaumeGomez rustdoc: add support for incoherent impls on structs and traits Fixes #103170
2022-10-30Rollup merge of #102689 - ayrtonm:master, r=cjgillotMichael Howell-0/+51
Add a tier 3 target for the Sony PlayStation 1 This adds a tier 3 target, `mipsel-sony-psx`, for the Sony PlayStation 1. I've tested it pretty thoroughly with [this SDK](https://github.com/ayrtonm/psx-sdk-rs) I wrote for it. From the [tier 3 target policy](https://doc.rust-lang.org/rustc/target-tier-policy.html#tier-3-target-policy) (I've omitted the subpoints for brevity, but read over everything) > A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.) I'd be the designated developer > Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target. The target name follows the conventions of the existing PSP target (`mipsel-sony-psp`) and uses `psx` following the convention of the broader [PlayStation homebrew community](https://psx-spx.consoledev.net/). > Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users. No legal issues with this target. > Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions. :+1: > Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions. The psx supports `core` and `alloc`, but will likely not support `std` anytime soon. > The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary. This target has an SDK and a `cargo-psx` tool for formatting binaries as psx executables. Documentation and examples are provided in the [psx-sdk-rs README](https://github.com/ayrtonm/psx-sdk-rs#psx-sdk-rs), the SDK and cargo tool are both available through crates.io and docs.rs has [SDK documentation](https://docs.rs/psx/latest/psx/). > Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages. :+1: > Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target. No problem
2022-10-30Rollup merge of #102101 - BelovDV:new-check-lld-version, r=petrochenkovMichael Howell-9/+22
check lld version to choose correct option to disable multi-threading in tests Testing compiler with 'use-lld = true' may be incorrect with old lld. Flag, disabling multi-threading, should consider lld version. r? ``@petrochenkov``
2022-10-30Rollup merge of #101944 - notriddle:notriddle/toggle-all-docs, ↵Michael Howell-7/+14
r=jsha,GuillaumeGomez rustdoc: clean up `#toggle-all-docs` This change converts the element from an `<a>` link to a button. It's pretty much directly trading slightly more CSS for slightly less HTML, and it's also semantically correct (so you don't get a broken "bookmark" option when you right click on it). While doing this, I also got rid of the unnecessary `class="inner"` attribute on the inner span. There was a style targeting `.collapse-toggle > .inner`, but no CSS ever targeted the `#toggle-all-docs > .inner`. Preview: https://notriddle.com/notriddle-rustdoc-test/button-toggle-all-docs/index.html
2022-10-30Rollup merge of #101428 - JakobDegen:build-tests, r=oli-obkMichael Howell-110/+134
Add mir building test directory The first commit renames `mir-map.0` mir dumps to `built.after` dumps. I am happy to drop this commit if someone can explain the origin of the name. The second commit moves a bunch of mir building tests into their own directory. I did my best to make sure that all of these tests are actually testing mir building, and not just incidentally using `built.after` r? ``@oli-obk``
2022-10-30Rollup merge of #97971 - Soveu:varargs, r=jackh726Michael Howell-21/+114
Enable varargs support for calling conventions other than C or cdecl This patch makes it possible to use varargs for calling conventions, which are either based on C (efiapi) or C is based on them (sysv64 and win64). Also pinging ``@phlopsi,`` because he noticed first this oversight when writing a library for UEFI.