about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-10-15Duplicate `~const` bounds with a non-const one in effects desugaringDeadbeef-0/+4
2023-10-14Fix a spot I wrote the wrong wordScott McMurray-1/+1
2023-10-14Propagate pattern errors via a new `PatKind::Error` variantNadrieril-6/+27
Instead of via `Const::new_error`
2023-10-14interpret: clean up AllocBytesRalf Jung-13/+5
2023-10-13Format all the let chains in compilerMichael Goulet-30/+71
2023-10-11Suggest `;` after bare `match` expression E0308Esteban Küber-0/+1
Fix #72634.
2023-10-11Rollup merge of #116219 - compiler-errors:relate-alias-ty-with-variance, r=lcnrMatthias Krüger-41/+24
Relate alias ty with variance In the new solver, turns out that the subst-relate branch of the alias-relate predicate was relating args invariantly even for opaques, which have variance :skull:. This change is a bit more invasive, but I'd rather not special-case it [here](https://github.com/rust-lang/rust/blob/aeaa5c30e5c9041264a2e8314b68ad84c2dc3169/compiler/rustc_trait_selection/src/solve/alias_relate.rs#L171-L190) and then have it break elsewhere. I'm doing a perf run to see if the extra call to `def_kind` is that expensive, if it is, I'll reconsider. r? ``@lcnr``
2023-10-11Avoid emitting the non_exhaustive error if other errors already occurredOli Scherer-5/+8
2023-10-11Auto merge of #115948 - notriddle:notriddle/logo-lockup, r=fmeasebors-0/+2
rustdoc: show crate name beside smaller logo *Blocked on https://github.com/rust-lang/cargo/pull/12800* ## Summary In this PR, the crate name and version are always shown in the sidebar, even in subpages, and the lateral navigation is always shown in the sidebar, even in modules. Clicking the crate name does the same thing clicking the logo always did: take you to the crate root (the crate's home page, at least within Rustdoc). The Rust logo is also no longer shown by default for non-Rust docs. ### Screenshots <details><summary>Before</summary> | | Macro | Module | |--|-------|--------| | In crate | ![image](https://github.com/rust-lang/rust/assets/1593513/d5db0a46-2bb6-44a2-a3aa-2d915ecb8595) |![image](https://github.com/rust-lang/rust/assets/1593513/61f8c1ee-c298-4e2c-b791-18ecb79ab83b) | In module[^1] | ![image](https://github.com/rust-lang/rust/assets/1593513/73abca59-0b69-4650-a1e2-7278ca34795c) | ![image](https://github.com/rust-lang/rust/assets/1593513/0baf02c2-2ec7-4674-80e5-a6a74a973376) [^1]: This PR also includes a bug fix for derive macros not showing up in the lateral navigation part of the sidebar </details> #### Whole sidebar screenshots | | Macro | Module | |--|-------|--------| | In crate | ![image](https://github.com/rust-lang/rust/assets/1593513/75d1bd07-41f7-4f11-ba24-fd5476e0586a) | ![image](https://github.com/rust-lang/rust/assets/1593513/52960259-2b65-4131-b380-01826f0a0eb7) | In module | ![image](https://github.com/rust-lang/rust/assets/1593513/06e57928-8cb0-41bd-b152-be16cc53e5ec) | ![image](https://github.com/rust-lang/rust/assets/1593513/37291c69-2a07-4467-a382-d9b029084a47) #### Different logo configurations | | Short crate name | Long crate name | |---------|------------------|-----------------| | Root | ![short-root] | ![long-root] | Subpage | ![short-subpage] | ![long-subpage] [short-root]: https://github.com/rust-lang/rust/assets/1593513/9e2b4fa8-f581-4106-b562-1e0372c13f79 [short-subpage]: https://github.com/rust-lang/rust/assets/1593513/8331cdb8-fa13-4671-a1e2-dcc1cdca7451 [long-root]: https://github.com/rust-lang/rust/assets/1593513/7d377fec-0f1d-4343-9f82-0e35a8f58056 [long-subpage]: https://github.com/rust-lang/rust/assets/1593513/3b3094a4-63c9-477c-8c15-b6075837df30 ##### Without a logo ![image](https://github.com/rust-lang/rust/assets/1593513/66672b79-6c59-4be8-a527-25ef6f0b04ab) ### Preview pages https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rocket/rocket/index.html https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rocket/rocket_sync_db_pools/index.html https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rust-compiler/index.html https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rust/std/index.html https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rocket/tokio/index.html ## Motivation This improves visual information density (the construct with the logo and crate name is *shorter* than the logo on its own, because it's not square) and navigation clarity (we can now see what clicking the Rust logo does, specifically). Compare this with the layout at [Phoenix's Hexdocs] (which is what this proposal is closely based on), the old proposal on [Internals Discourse] (which always says "Rust standard library" in the sidebar, but doesn't do the side-by-side layout). [Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html [Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018 ## Guide-level explanation This PR cleans up some of the sidebar navigation. It makes the logo in the desktop sidebar a bit smaller, and puts the crate name and version next to it (either beside it, or below it, depending on if there's space), making it clearer what clicking on it does: click the crate name to open the crate's home page. It also removes the Rust logo from non-official-Rust crates, again to make the navigation and supply chain clearer (since the crate name has been added, the logo is no longer necessary for navigation). It adds a bit more clarifying information for lateral navigation. On items that don't add their own sidebar items, it just shows its siblings directly below the crate name and logo, but for other items, it shows "In crate alloc" instead of just "In alloc". It also shows the lateral navigation tools on module pages, making modules consistent with every other item. ## Drawbacks While this actually takes up less screen real estate than the old layout on desktop, it takes up more HTML. It's also a bit more visually complex. ## Rationale and alternatives I could do what the Internals POC did and keep the vertically stacked layout all the time, instead of doing a horizontal stack where possible. It would take up more screen real estate, though. ## Prior art This design is lifted almost verbatim from Hexdocs. It seems to work for them. [`opentelemetry_process_propagator`], for example, has a long application name. [`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html ## Unresolved questions Maybe we should encourage crate authors to include their own logo more often? It certainly helps give people a better sense of "place." This seems to be blocked on coming up with an API to do it without requiring them to host the file somewhere. ## Future possibilities Beyond this, plenty of other changes could be made to improve the layout, like * Fix things so that clicking an item in the sidebar doesn't cause it to scroll back to the top. * The [Internals demo](https://utherii.github.io/new.html) does this right: clicking an item in the sidebar changes the content area, but the sidebar itself does not change. This is nice, because clicking is cheap and I can skim the opening few paragraphs while browsing. * The layout of the docs sidebar causes trouble to implement this, because it's different on different pages, but at least fix this on the file browser. * Come up with a less cluttered way to do disclosure. There's a lot of `[-]` on the page. * We don't lack ideas to fix this one. We have *too many*. * Do a better job of separating local navigation (vec::Vec links to vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new). * A possibility: add a Back arrow next to the "In [module]" header? ![image](https://github.com/rust-lang/rust/assets/1593513/e969faf7-7722-457a-b8c6-8d962e9e1e23) * Give readers more control of how much rustdoc shows them, and giving doc authors more control of how much it generates. Basically, https://github.com/rust-lang/rust/pull/115660 is great, let's do it too. But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-10-09Auto merge of #116497 - compiler-errors:impl-span, r=cjgillotbors-4/+7
Extend `impl`'s `def_span` to include its where clauses Typically, we highlight the def-span of an impl in a diagnostic due to either: 1. coherence error 2. trait evaluation cycle 3. invalid implementation of built-in trait I find that an impl's where clauses are very often required to understanding why these errors come about, which is unfortunate since where clauses may be located on different lines and don't show up in the error. This PR expands the def-span of impls to include these where clauses. r? cjgillot since you've touched this code a while back to make some spans shorter, but you can also reassign to wg-diagnostics or compiler if you're busy or have no strong opinions.
2023-10-09Rollup merge of #115882 - aliemjay:diag-name-region-1, r=compiler-errorsMatthias Krüger-10/+15
improve the suggestion of `generic_bound_failure` - Fixes #115375 - suggest the bound in the correct scope: trait or impl header vs assoc item. See `tests/ui/suggestions/lifetimes/type-param-bound-scope.rs` - don't suggest a lifetime name that conflicts with the other late-bound regions of the function: ```rust type Inv<'a> = *mut &'a (); fn check_bound<'a, T: 'a>(_: T, _: Inv<'a>) {} fn test<'a, T>(_: &'a str, t: T, lt: Inv<'_>) { // suggests a new name `'a` check_bound(t, lt); //~ ERROR } ```
2023-10-09Extend impl's def_span to include where clausesMichael Goulet-4/+7
2023-10-08rustdoc: remove rust logo from non-Rust cratesMichael Howell-0/+2
2023-10-08Auto merge of #116454 - tmiasko:small-dominators, r=cjgillotbors-0/+17
Generalize small dominators optimization * Use small dominators optimization from 640ede7b0a1840415cb6ec881c2210302bfeba18 more generally. * Merge `DefLocation` and `LocationExtended` since they serve the same purpose.
2023-10-08improve the suggestion of generic_bound_failureAli MJ Al-Nasrawy-10/+15
2023-10-07Auto merge of #116437 - nnethercote:rustc_features, r=Nilstriebbors-3/+3
Clean up `rustc_features` Plenty more to be done, but this is a decent start. r? `@Nilstrieb`
2023-10-07Auto merge of #116330 - RalfJung:dont-key-on-allocid, r=oli-obkbors-33/+0
remove Key impls for types that involve an AllocId I don't understand how but somehow that leads to issues like https://github.com/rust-lang/rust/issues/83085? Anyway removing unused impls doesn't seem like a bad idea. The concerning part is that of course nothing will stop us from having such impls again in the future, alongside re-introducing bugs like #83085. r? `@oli-obk`
2023-10-07Auto merge of #116457 - RalfJung:try_eval_scalar_int, r=cjgillotbors-15/+15
fix fast-path for try_eval_scalar_int Cc https://github.com/rust-lang/rust/pull/116281 `@Nadrieril`
2023-10-06Rollup merge of #116277 - RalfJung:post-mono, r=oli-obkJubilee-44/+3
dont call mir.post_mono_checks in codegen It seems like all tests are still passing when I remove this... let's see what CI says.
2023-10-06Rollup merge of #116297 - RalfJung:hooks, r=oli-obkMatthias Krüger-0/+5
add some docs to hooks/mod.rs r? `@oli-obk`
2023-10-06add some comments explaining how the required_consts stuff fits togetherRalf Jung-0/+2
2023-10-06Rollup merge of #116329 - RalfJung:swap-comments, r=scottmcmGuillaume Gomez-1/+1
update some comments around swap() Based on ``@eddyb's`` comment [here](https://github.com/rust-lang/unsafe-code-guidelines/issues/461#issuecomment-1742156410). And then I noticed the wrong capitalization for Miri and fixed it in some other places as well.
2023-10-06Auto merge of #116269 - Veykril:rustc-abi, r=WaffleLapkinbors-3/+3
Bring back generic parameters for indices in rustc_abi and make it compile on stable This effectively reverses https://github.com/rust-lang/rust/pull/107163, allowing rust-analyzer to depend on this crate again, It also moves some glob imports / expands them in the first commit because they made it more difficult for me to reason about things.
2023-10-05Move DefLocation from rustc_codegen_ssa to rustc_middleTomasz Miąsko-0/+17
2023-10-05fix fast-path for try_eval_scalar_intRalf Jung-15/+15
2023-10-05Auto merge of #116417 - ouz-a:trait_type_detective, r=compiler-errorsbors-23/+2
Remove is global hack In attempt to fix https://github.com/rust-lang/rust/issues/114057 we found several issues with how compiler computes layouts, this change removes `is_global` from `and` to stop impl from being shadowed. In depth conversation can be read here https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Getting.20different.20types.20from.20almost.20same.20inputs This is a fix candidate opened for performance run. r? `@lcnr`
2023-10-05remove is global hackOğuz Ağcayazı-23/+2
2023-10-05Auto merge of #116427 - cjgillot:no-internal, r=oli-obkbors-35/+3
Remove mir::LocalDecl::internal. It does not serve any purpose, as we don't have typeck-based generator witnesses any more.
2023-10-05Rename `Features::active_features`.Nicholas Nethercote-3/+3
The word "active" is currently used in two different and confusing ways: - `ACTIVE_FEATURES` actually means "available unstable features" - `Features::active_features` actually means "features declared in the crate's code", which can include feature within `ACTIVE_FEATURES` but also others. (This is also distinct from "enabled" features which includes declared features but also some edition-specific features automatically enabled depending on the edition in use.) This commit changes the `Features::active_features` to `Features::declared_features` which actually matches its meaning. Likewise, `Features::active` becomes `Features::declared`.
2023-10-04Auto merge of #116370 - nnethercote:more-arena-stuff, r=cjgillotbors-6/+8
Remove the `TypedArena::alloc_from_iter` specialization. It was added in #78569. It's complicated and doesn't actually help performance. r? `@cjgillot`
2023-10-04Remove mir::LocalDecl::internal.Camille GILLOT-35/+3
2023-10-04Make it clear that args default to being related invariantlyMichael Goulet-10/+10
2023-10-04Remove unnecessary relate implMichael Goulet-13/+0
2023-10-04Relate AliasTy considering varianceMichael Goulet-19/+15
2023-10-03Use consisntent style of `size_of` in query type erasureMaybe Waffle-4/+4
All other impls replace type generics with `()` (or a type implementing the necessery traits) and lifetimes with `'static`, do the same for those impls.
2023-10-03Use `transmute_unchecked` and make the types explicit in query type erasureMaybe Waffle-3/+4
This doesn't really change anything, but makes the code a bit more explicit/readable.
2023-10-03Auto merge of #115301 - Zalathar:regions-vec, r=davidtwcobors-15/+8
coverage: Allow each coverage statement to have multiple code regions The original implementation of coverage instrumentation was built around the assumption that a coverage counter/expression would be associated with *up to one* code region. When it was discovered that *multiple* regions would sometimes need to share a counter, a workaround was found: for the remaining regions, the instrumentor would create a fresh expression that adds zero to the existing counter/expression. That got the job done, but resulted in some awkward code, and produces unnecessarily complicated coverage maps in the final binary. --- This PR removes that tension by changing `StatementKind::Coverage`'s code region field from `Option<CodeRegion>` to `Vec<CodeRegion>`. The changes on the codegen side are fairly straightforward. As long as each `CoverageKind::Counter` only injects one `llvm.instrprof.increment`, the rest of coverage codegen is happy to handle multiple regions mapped to the same counter/expression, with only minor option-to-vec adjustments. On the instrumentor/mir-transform side, we can get rid of the code that creates extra (x + 0) expressions. Instead we gather all of the code regions associated with a single BCB, and inject them all into one coverage statement. --- There are several patches here but they can be divided in to three phases: - Preparatory work - Actually switching over to multiple regions per coverage statement - Cleaning up So viewing the patches individually may be easier.
2023-10-03Rollup merge of #116261 - lcnr:wf-only-clause, r=davidtwcoMatthias Krüger-9/+18
a small wf and clause cleanup - remove `Clause::from_projection_clause`, instead use `ToPredicate` - change `predicate_obligations` to directly take a `Clause` - remove some unnecessary `&` - use clause in `min_specialization` checks where easily applicable
2023-10-03Auto merge of #116376 - matthiaskrgr:rollup-b3d14gq, r=matthiaskrgrbors-6/+6
Rollup of 5 pull requests Successful merges: - #115863 (Add check_unused_messages in tidy) - #116210 (Ensure that `~const` trait bounds on associated functions are in const traits or impls) - #116358 (Rename both of the `Match` relations) - #116371 (Remove unused features from `rustc_llvm`.) - #116374 (Print normalized ty) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-03Auto merge of #115025 - ouz-a:ouz_testing, r=lcnrbors-3/+34
Make subtyping explicit in MIR This adds new mir-opt that pushes new `ProjectionElem` called `ProjectionElem::Subtype(T)` to `Rvalue` of a subtyped assignment so we can unsoundness issues like https://github.com/rust-lang/rust/issues/107205 Addresses https://github.com/rust-lang/rust/issues/112651 r? `@lcnr`
2023-10-03Optimize some `alloc_from_iter` call sites.Nicholas Nethercote-6/+8
There's no need to collect an iterator into a `Vec`, or to call `into_iter` at the call sites.
2023-10-03coverage: Remove `next_id` methods from counter/expression IDsZalathar-10/+0
When these methods were originally written, I wasn't aware that `newtype_index!` already supports addition with ordinary numbers, without needing to unwrap and re-wrap.
2023-10-03coverage: Let each coverage statement hold a vector of code regionsZalathar-5/+8
This makes it possible for a `StatementKind::Coverage` to hold more than one code region, but that capability is not yet used.
2023-10-02Rename both of the Match relationsMichael Goulet-6/+6
2023-10-02have better explanation for `relate_types`ouz-a-5/+12
2023-10-02Add docs, remove code, change subtyper codeouz-a-1/+19
2023-10-02subtyping_projectionsouz-a-1/+7
2023-10-02Implement Deref<LayoutS> for LayoutLukas Wirth-3/+3
2023-10-02`skip_binder` to `instantiate_identity`lcnr-2/+7
2023-10-02remove another unused Key implRalf Jung-9/+0