about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-12-15`pattern_analysis` doesn't need to know what spans areNadrieril-36/+39
2023-12-15Address review commentsNadrieril-12/+4
2023-12-15s/RustcCtxt/RustcMatchCheckCtxt/Nadrieril-38/+48
2023-12-15Make the crate compile on stableNadrieril-3/+25
2023-12-15Make `rustc_index::bit_set` available on stableNadrieril-12/+37
2023-12-15Make the `rustc_data_structures` dependency optionalNadrieril-13/+28
2023-12-15Gate rustc-specific code under a featureNadrieril-16/+41
2023-12-15Iron out last rustc-specific detailsNadrieril-18/+43
2023-12-15Name rustc-specific things "rustc"Nadrieril-48/+42
2023-12-15Abstract `MatchCheckCtxt` into a traitNadrieril-239/+313
2023-12-15Disentangle the arena from `MatchCheckCtxt`Nadrieril-117/+140
2023-12-15Remove all matching on `ty.kind()` outside `cx`Nadrieril-36/+31
2023-12-15Split `Single` ctor into more specific variantsNadrieril-52/+80
2023-12-15Auto merge of #118975 - GuillaumeGomez:rollup-0emhjx0, r=GuillaumeGomezbors-148/+822
Rollup of 4 pull requests Successful merges: - #113091 (Don't merge cfg and doc(cfg) attributes for re-exports) - #115660 (rustdoc: allow resizing the sidebar / hiding the top bar) - #118863 (rustc_mir_build: Enforce `rustc::potential_query_instability` lint) - #118909 (Some cleanup and improvement for invalid ref casting impl) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-15Rollup merge of #118909 - Urgau:cleanup-improvement-invalid_ref_casting, r=est31Guillaume Gomez-65/+116
Some cleanup and improvement for invalid ref casting impl This PR makes some cleanups and improvements to the `invalid_reference_casting` implementation in preparation for linting on new patterns, while reusing most of the logic. r? `@est31` (feel free to re-assign)
2023-12-15Rollup merge of #118863 - Enselic:rustc_mir-build-query-stability, ↵Guillaume Gomez-4/+3
r=michaelwoerister rustc_mir_build: Enforce `rustc::potential_query_instability` lint Stop allowing `rustc::potential_query_instability` on all of `rustc_mir_build` and instead allow it on a case-by-case basis if it is safe to do so. In this crate there was only one instance of the lint, and it was safe to allow. Part of https://github.com/rust-lang/rust/issues/84447 which is E-help-wanted.
2023-12-15Rollup merge of #115660 - notriddle:notriddle/sidebar-resize, r=GuillaumeGomezGuillaume Gomez-30/+625
rustdoc: allow resizing the sidebar / hiding the top bar Fixes #97306 Preview: http://notriddle.com/rustdoc-html-demo-4/sidebar-resize/std/index.html ![image](https://github.com/rust-lang/rust/assets/1593513/a2f40ea2-0436-4e44-99e8-d160dab2a680) ## Summary This feature adds: 1. A checkbox to the Settings popover to hide the persistent navigation bar (the sidebar on large viewports and the top bar on small ones). 2. On large viewports, it adds a resize handle to the persistent sidebar. Resizing it into nothing is equivalent to turning off the persistent navigation bar checkbox in Settings. 3. If the navigation bar is hidden, a toolbar button to the left of the search appears. Clicking it brings the navigation bar back. ## Motivation While "mobile mode" is definitely a good default, it's not the only reason people have wanted to hide the sidebar: * Some people use tiling window managers, and don't like rustdoc's current breakpoints. Changing the breakpoints might help with that, but there's no perfect solution, because there's a gap between "huge screen" and "smartphone" where reasonable people can disagree about whether it makes sense for the sidebar to be on-screen. https://github.com/rust-lang/rust/issues/97306 * Some people ask for ways to reduce on-screen clutter because it makes it easier to focus. There's not a media query for that (and if there was, privacy-conscious users would turn it off). https://github.com/rust-lang/rust/issues/59829 This feature is designed to avoid these problems. Resizing the sidebar especially helps, because it provides a way to hide the sidebar without adding a new top-level button (which would add clutter), and it provides a way to make rustdoc play nicer in complex, custom screen layouts. ## Guide and Reference-level explanation On a desktop or laptop with a mouse, resize the sidebar by dragging its right edge. On any browser, including mobile phones, the sticky top bar or side bar can be hidden from the Settings area (the button with the cog wheel, next to the search bar). When it's hidden, a convenient button will appear on the search bar's left. ## Drawbacks This adds more JavaScript code to the render blocking area. ## Rationale and alternatives The most obvious way to allow people to hide the sidebar would have been to let them "manually enter mobile mode." The upside is that it's a feature we already have. The downside is that it's actually really hard to come up with a terse description. Is it: * A Setting that forces desktop viewers to always have the mobile-style top bar? If so, how do we label it? Should it be visible on mobile, and, if so, does it just not do anything? * A persistent hide/show sidebar button, present on desktop, just like on mobile? That's clutter that I'd like to avoid. ## Prior art * The new file browser in GitHub uses a similar divider with a mouse-over indicator * mdBook and macOS Finder both allow you to resize the sidebar to nothing as a gesture to hide it * https://www.nngroup.com/articles/drag-drop/ ## Future possibilities https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Table.20of.20contents proposes a new, second sidebar (a table of contents). How should it fit in with this feature? Should it be resizeable? Hideable? Can it be accessed on mobile?
2023-12-15Rollup merge of #113091 - GuillaumeGomez:prevent-cfg-merge-reexport, r=rustdocGuillaume Gomez-49/+78
Don't merge cfg and doc(cfg) attributes for re-exports Fixes #112881. ## Explanations When re-exporting things with different `cfg`s there are two things that can happen: * The re-export uses a subset of `cfg`s, this subset is sufficient so that the item will appear exactly with the subset * The re-export uses a non-subset of `cfg`s (e.g. like the example I posted just above where the re-export is ungated), if the non-subset `cfg`s are active (e.g. compiling that example on windows) then this will be a compile error as the item doesn't exist to re-export, if the subset `cfg`s are active it behaves like 1. ### Glob re-exports? **This only applies to non-glob inlined re-exports.** For glob re-exports the item may or may not exist to be re-exported (potentially the `cfg`s on the path up until the glob can be removed, and only `cfg`s on the globbed item itself matter), for non-inlined re-exports see https://github.com/rust-lang/rust/issues/85043. cc `@Nemo157` r? `@notriddle`
2023-12-15Auto merge of #118961 - notriddle:notriddle/varconst, r=GuillaumeGomezbors-2/+8
rustdoc-search: fix a race condition in search index loading `var` declare it in the global scope, and `const` does not. It needs to be declared in global scope. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const > const declarations do not create properties on [globalThis](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis) when declared at the top level of a script. Fixes a regression introduced by https://github.com/rust-lang/rust/pull/118910
2023-12-15Auto merge of #118970 - aliemjay:rollup-or33al2, r=aliemjaybors-55/+165
Rollup of 2 pull requests Successful merges: - #118927 (Erase late bound regions from `Instance::fn_sig()` and add a few more details to StableMIR APIs) - #118964 (Opportunistically resolve region var in canonicalizer (instead of resolving root var)) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-15Rollup merge of #118964 - compiler-errors:resolve, r=aliemjayAli MJ Al-Nasrawy-35/+70
Opportunistically resolve region var in canonicalizer (instead of resolving root var) See comment in `compiler/rustc_type_ir/src/infcx.rs`. The **root** infer region for a given region vid may not actually be nameable from the universe of the original vid. That means that the assertion in the canonicalizer was too strict, since the `EagerResolver` that we use before canonicalizing is doing only as much resolving as it can. This replaces `resolve_lt_var` and `probe_lt_var` in the `rustc_type_ir` API with `opportunistic_resolve_lt_var`, which acts as you expect it should. I left a FIXME that complains about the inconsistency. This test is really gnarly, but I have no idea how to minimize it, since it seems to kind of just be coincidental that it triggered this issue. I hope the underlying root cause is easy enough to understand, though. r? `@lcnr` or `@aliemjay` Fixes #118950
2023-12-15Rollup merge of #118927 - celinval:smir-missing-info, r=compiler-errorsAli MJ Al-Nasrawy-20/+95
Erase late bound regions from `Instance::fn_sig()` and add a few more details to StableMIR APIs The Instance `fn_sig()` still included a late bound regions which needed a new compiler function in order to be erased. I've also bundled the following small fixes in this PR, let me know if you want me to isolate any of them. - Add missing `CoroutineKind::AsyncGen`. - Add optional spread argument to function body which is needed to properly analyze compiler shims. - Add a utility method to iterate over all locals together with their declaration. - Add a method to get the description of `AssertMessage`*. * For the last one, we could consider eventually calling the internal `AssertKind::description()` to avoid code duplication. However, we still don't have ways to convert `AssertMessage`, `Operand`, `Place` and others, in order to use that. The other downside of using the internal method is that it will panic for some of the variants. r ? `@ouz-a`
2023-12-15Auto merge of #118966 - matthiaskrgr:rollup-sdvjwy6, r=matthiaskrgrbors-192/+255
Rollup of 3 pull requests Successful merges: - #116888 (Add discussion that concurrent access to the environment is unsafe) - #118888 (Uplift `TypeAndMut` and `ClosureKind` to `rustc_type_ir`) - #118929 (coverage: Tidy up early parts of the instrumentor pass) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-14Revert signature change for AssertMessage descriptionCelina G. Val-34/+21
2023-12-15Rollup merge of #118929 - Zalathar:look-hir, r=cjgillotMatthias Krüger-70/+77
coverage: Tidy up early parts of the instrumentor pass This is extracted from #118237, which needed to be manually rebased anyway. Unlike that PR, this one only affects the coverage instrumentor, and doesn't attempt to move any code into the MIR builder. That can be left to a future version of #118305, which can still benefit from these improvements. So this is now mostly a refactoring of some internal parts of the instrumentor.
2023-12-15Rollup merge of #118888 - compiler-errors:uplift-more-things, r=jackh726Matthias Krüger-112/+138
Uplift `TypeAndMut` and `ClosureKind` to `rustc_type_ir` Uplifts `TypeAndMut` and `ClosureKind` I know I said I was just going to get rid of `TypeAndMut` (https://github.com/rust-lang/types-team/issues/124) but I think this is much simpler, lol r? `@jackh726` or `@lcnr`
2023-12-15Rollup merge of #116888 - tbu-:pr_unsafe_env, r=AmanieuMatthias Krüger-10/+40
Add discussion that concurrent access to the environment is unsafe The bug report #27970 has existed for 8 years, the actual bug dates back to Rust pre-1.0. I documented it since it's in the interest of the user to be aware of it. The note can be removed once #27970 is fixed.
2023-12-15Opportunistically resolve region var in canonicalizerMichael Goulet-35/+70
2023-12-15Auto merge of #118770 - saethlin:fix-inline-never-uses, r=nnethercotebors-11/+37
Fix cases where std accidentally relied on inline(never) This PR increases the power of `-Zcross-crate-inline-threshold=always` so that it applies through `#[inline(never)]`. Note that though this is called "cross-crate-inlining" in this case especially it is _just_ lazy per-CGU codegen. The MIR inliner and LLVM still respect the attribute as much as they ever have. Trying to bootstrap with the new `-Zcross-crate-inline-threshold=always` change revealed two bugs: We have special intrinsics `assert_inhabited`, `assert_zero_valid`, and `assert_mem_uniniitalized_valid` which codegen backends will lower to nothing or a call to `panic_nounwind`. Since we may not have any call to `panic_nounwind` in MIR but emit one anyway, we need to specially tell `MirUsedCollector` about this situation. `#[lang = "start"]` is special-cased already so that `MirUsedCollector` will collect it, but then when we make it cross-crate-inlinable it is only assigned to a CGU based on whether `MirUsedCollector` saw a call to it, which of course we didn't. --- I started looking into this because https://github.com/rust-lang/rust/pull/118683 revealed a case where we were accidentally relying on a function being `#[inline(never)]`, and cranking up cross-crate-inlinability seems like a way to find other situations like that. r? `@nnethercote` because I don't like what I'm doing to the CGU partitioning code here but I can't come up with something much better
2023-12-14rustdoc-search: fix a race condition in search index loadingMichael Howell-2/+8
`var` declare it in the global scope, and `const` does not. It needs to be declared in global scope.
2023-12-15Auto merge of #118936 - nikic:update-llvm-18, r=cuviperbors-22/+22
Update to LLVM 17.0.6 This is a rebase on the final LLVM 17 release. Includes the RISCV fix requested in https://github.com/rust-lang/llvm-project/pull/157 (and I think this is also the only change in this release that is relevant to rustc). r? `@cuviper` Fixes #117902
2023-12-14Address PR commentsCelina G. Val-50/+53
- Remove `fn_sig()` from Instance. - Change return value of `AssertMessage::description` to `Cow<>`. - Add assert to instance `ty()`. - Generalize uint / int type creation.
2023-12-15Auto merge of #118957 - workingjubilee:rollup-2hcwnp3, r=workingjubileebors-690/+651
Rollup of 4 pull requests Successful merges: - #118908 (Add all known `target_feature` configs to check-cfg) - #118933 (Cleanup errors handlers even more) - #118943 (update `measureme` to 10.1.2 to deduplicate `parking_lot`) - #118948 (Use the `Waker::noop` API in tests) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-14Rollup merge of #118948 - compiler-errors:noop, r=eholkJubilee-82/+41
Use the `Waker::noop` API in tests Avoids the need to duplicate this code over and over again r? eholk
2023-12-14Rollup merge of #118943 - lqd:update-deps2, r=michaelwoeristerJubilee-35/+9
update `measureme` to 10.1.2 to deduplicate `parking_lot` This PR updates `measureme` to the latest release to remove the last duplicates of `parking_lot` 0.11 we had in our dependency tree. ```console Updating measureme v10.1.1 -> v10.1.2 Removing parking_lot v0.11.2 Removing parking_lot_core v0.8.6 ``` Also removes `instant` from the allowed list of dependencies, as it's no longer used. r? `@michaelwoerister` (Thanks for the release in the first place 🙏)
2023-12-14Rollup merge of #118933 - nnethercote:cleanup-errors-even-more, ↵Jubilee-113/+117
r=compiler-errors Cleanup errors handlers even more A sequel to #118587. r? `@compiler-errors`
2023-12-14Rollup merge of #118908 - Urgau:check-cfg-target-features, ↵Jubilee-460/+484
r=TaKO8Ki,GuillaumeGomez,workingjubilee Add all known `target_feature` configs to check-cfg This PR adds all the known `target_feature` from ~~`rustc_codegen_ssa`~~ `rustc_target` to the well known list of check-cfg. It does so by moving the list from `rustc_codegen_ssa` to `rustc_target` ~~`rustc_session` (I not sure about this, but some of the moved function take a `Session`)~~, then using it the `fill_well_known` function. This already proved to be useful since portable-simd had a bad cfg. cc `@nnethercote` (since we discussed it in https://github.com/rust-lang/rust/pull/118494)
2023-12-15coverage: Check that the function signature span precedes the bodyZalathar-2/+4
This will normally be true, but in cases where it's not true we're better off not making any assumptions about the signature.
2023-12-15coverage: Compare span source files without involving `Lrc<SourceFile>`Zalathar-11/+14
If we want to know whether two byte positions are in the same file, we don't need to clone and compare `Lrc<SourceFile>`; we can just get their indices and compare those instead.
2023-12-15coverage: Inline and simplify `fn_sig_and_body`Zalathar-14/+9
2023-12-15coverage: Use `LocalDefId` in `extract_hir_info`Zalathar-10/+8
2023-12-15coverage: Extract helper for getting HIR info for coverageZalathar-28/+35
2023-12-15coverage: Don't bother storing the source file in `Instrumentor`Zalathar-4/+3
We can just as easily look it up again from the source map and body span when needed.
2023-12-15coverage: Extract `is_eligible_for_coverage`Zalathar-14/+25
2023-12-15coverage: Simplify parts of `InstrumentCoverage::run_pass`Zalathar-8/+6
Changes in this patch: - Extract local variable `def_id` - Check `is_fn_like` without retrieving HIR - Inline some locals that are used once and aren't needed for clarity
2023-12-15coverage: Assert that the instrumentor never sees promoted MIRZalathar-9/+3
2023-12-15Split `Handler::emit_diagnostic` in two.Nicholas Nethercote-45/+64
Currently, `emit_diagnostic` takes `&mut self`. This commit changes it so `emit_diagnostic` takes `self` and the new `emit_diagnostic_without_consuming` function takes `&mut self`. I find the distinction useful. The former case is much more common, and avoids a bunch of `mut` and `&mut` occurrences. We can also restrict the latter with `pub(crate)` which is nice.
2023-12-15Remove `Handler::emit_diag_at_span`.Nicholas Nethercote-23/+9
Compare `Handler::warn` and `Handler::span_warn`. Conceptually they are almost identical. But their implementations are weirdly different. `warn`: - calls `DiagnosticBuilder::<()>::new(self, Warning(None), msg)`, then `emit()` - which calls `G::diagnostic_builder_emit_producing_guarantee(self)` - which calls `handler.emit_diagnostic(&mut db.inner.diagnostic)` `span_warn`: - calls `self.emit_diag_at_span(Diagnostic::new(Warning(None), msg), span)` - which calls `self.emit_diagnostic(diag.set_span(sp))` I.e. they both end up at `emit_diagnostic`, but take very different routes to get there. This commit changes `span_*` and similar ones to not use `emit_diag_at_span`. Instead they just call `struct_span_*` + `emit`. Some nice side-effects of this: - `span_fatal` and `span_fatal_with_code` don't need `FatalError.raise()`, because `emit` does that. - `span_err` and `span_err_with_code` doesn't need `unwrap`. - `struct_span_note`'s `span` arg type is changed from `Span` to `impl Into<MultiSpan>` like all the other functions.
2023-12-15Avoid `DiagnosticBuilder::<T>::new` calls.Nicholas Nethercote-4/+4
The `Handler` functions that directly emit diagnostics can be more easily implemented using `struct_foo(msg).emit()`. This mirrors `Handler::emit_err` which just does `create_err(err).emit()`. `Handler::bug` is not converted because of weirdness involving conflation bugs and fatal errors with `EmissionGuarantee`. I'll fix that later.
2023-12-15Change `msg: impl Into<String>` for bug diagnostics.Nicholas Nethercote-13/+15
To `msg: impl Into<DiagnosticMessage>`, like all the other diagnostics. For consistency.