about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-03-23rustc_metadata: Freeze cstore after the full crate list is queriedVadim Petrochenkov-0/+3
2023-03-23resolve: Rename some cstore methods to match queries and add commentsVadim Petrochenkov-14/+12
about costs associated with replacing them with query calls.
2023-03-23Auto merge of #109517 - matthiaskrgr:rollup-m3orqzd, r=matthiaskrgrbors-246/+730
Rollup of 7 pull requests Successful merges: - #108541 (Suppress `opaque_hidden_inferred_bound` for nested RPITs) - #109137 (resolve: Querify most cstore access methods (subset 2)) - #109380 (add `known-bug` test for unsoundness issue) - #109462 (Make alias-eq have a relation direction (and rename it to alias-relate)) - #109475 (Simpler checked shifts in MIR building) - #109504 (Stabilize `arc_into_inner` and `rc_into_inner`.) - #109506 (make param bound vars visibly bound vars with -Zverbose) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-23Auto merge of #108355 - dpaoliello:dlltoolm, r=michaelwoeristerbors-14/+87
Fix cross-compiling with dlltool for raw-dylib Fix for #103939 Issue Details: When attempting to cross-compile using the `raw-dylib` feature and the GNU toolchain, rustc would attempt to find a cross-compiling version of dlltool (e.g., `i686-w64-mingw32-dlltool`). The has two issues 1) on Windows dlltool is always `dlltool` (no cross-compiling named versions exist) and 2) it only supported compiling to i686 and x86_64 resulting in ARM 32 and 64 compiling as x86_64. Fix Details: * On Windows always use the normal `dlltool` binary. * Add the ARM64 cross-compiling dlltool name (support for this is coming: https://sourceware.org/bugzilla/show_bug.cgi?id=29964) * Provide the `-m` argument to dlltool to indicate the target machine type. (This is the first of two PRs to fix the remaining issues for the `raw-dylib` feature (#58713) that is blocking stabilization (#104218))
2023-03-23Rollup merge of #109506 - BoxyUwU:debugable_bound_var_printing, ↵Matthias Krüger-1/+5
r=compiler-errors make param bound vars visibly bound vars with -Zverbose I was trying to debug some type/const bound var stuff and it was shockingly tricky due to the fact that even with `-Zverbose` enabled the `T` in `for<T> T: Trait` prints as `T` making it seem like its `TyKind::Param` when it is infact `TyKind::Bound`. This PR "fixes" this when `-Zverbose` is set to allow rendering it as `^T` or `^1_T` depending on binder depth. r? ```@compiler-errors```
2023-03-23Rollup merge of #109504 - steffahn:stabilize_a_rc_into_inner, r=joshtriplettMatthias Krüger-23/+6
Stabilize `arc_into_inner` and `rc_into_inner`. Stabilize the `arc_into_inner` and `rc_into_inner` library features and thus close #106894. The changes in this PR also resolve the FIXMEs for adjusting the documentation upon stabilization, and I’ve additionally included some very minor documentation improvements. ```@rustbot``` label +T-libs-api -T-libs
2023-03-23Rollup merge of #109475 - scottmcm:simpler-shifts, r=WaffleLapkinMatthias Krüger-37/+371
Simpler checked shifts in MIR building Doing masking to check unsigned shift amounts is overcomplicated; just comparing the shift directly saves a statement and a temporary, as well as is much easier to read as a human. And shifting by unsigned is the canonical case -- notably, all the library shifting methods (that don't support every type) take shift RHSs as `u32` -- so we might as well make that simpler since it's easy to do so. This PR also changes *signed* shift amounts to `IntToInt` casts and then uses the same check as for unsigned. The bit-masking is a nice trick, but for example LLVM actually canonicalizes it to an unsigned comparison anyway <https://rust.godbolt.org/z/8h59fMGT4> so I don't think it's worth the effort and the extra `Constant`. (If MIR's `assert` was `assert_nz` then the masking might make sense, but when the `!=` uses another statement I think the comparison is better.) To review, I suggest looking at https://github.com/rust-lang/rust/pull/109475/commits/2ee0468c49be9f8ea68b7b935ea1f4c2555849e9 first -- that's the interesting code change and has a MIR diff. My favourite part of the diff: ```diff - _20 = BitAnd(_19, const 340282366920938463463374607431768211448_u128); // scope 0 at $DIR/shifts.rs:+2:34: +2:44 - _21 = Ne(move _20, const 0_u128); // scope 0 at $DIR/shifts.rs:+2:34: +2:44 - assert(!move _21, "attempt to shift right by `{}`, which would overflow", _19) -> [success: bb3, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:34: +2:44 + _18 = Lt(_17, const 8_u128); // scope 0 at $DIR/shifts.rs:+2:34: +2:44 + assert(move _18, "attempt to shift right by `{}`, which would overflow", _17) -> [success: bb3, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:34: +2:44 ```
2023-03-23Rollup merge of #109462 - compiler-errors:alias-relate, r=BoxyUwU,lcnrMatthias Krüger-99/+260
Make alias-eq have a relation direction (and rename it to alias-relate) Emitting an "alias-eq" is too strict in some situations, since we don't always want strict equality between a projection and rigid ty. Adds a relation direction. * I could probably just reuse this [`RelationDir`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/combine/enum.RelationDir.html) -- happy to uplift that struct into middle and use that instead, but I didn't feel compelled to... 🤷 * Some of the matching in `compute_alias_relate_goal` is a bit verbose -- I guess I could simplify it by using [`At::relate`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/at/struct.At.html#method.relate) and mapping the relation-dir to a variance. * Alternatively, I coulld simplify things by making more helper functions on `EvalCtxt` (e.g. `EvalCtxt::relate_with_direction(T, T)` that also does the nested goal registration). No preference. r? ```@lcnr``` cc ```@BoxyUwU``` though boxy can claim it if she wants NOTE: first commit is all the changes, the second is just renaming stuff
2023-03-23Rollup merge of #109380 - Randl:patch-1, r=oli-obkMatthias Krüger-0/+52
add `known-bug` test for unsoundness issue Test for https://github.com/rust-lang/rust/issues/97156
2023-03-23Rollup merge of #109137 - petrochenkov:qcstore2, r=cjgillotMatthias Krüger-47/+18
resolve: Querify most cstore access methods (subset 2) These changes are less likely to cause perf regressions than the rest of https://github.com/rust-lang/rust/pull/108346.
2023-03-23Rollup merge of #108541 - compiler-errors:lol-nested-rpits, r=oli-obkMatthias Krüger-39/+18
Suppress `opaque_hidden_inferred_bound` for nested RPITs They trigger too much, making repos like linkerd/linkerd2-proxy#2275 sad. Ideally, at least for RPITs (and probably TAITs?), specifically when we have `impl Trait<Assoc = impl ..>`, that nested opaque should have the necessary `Assoc` item bounds elaborated into its own item bounds. But that's another story. r? ```@oli-obk```
2023-03-23Auto merge of #109503 - matthiaskrgr:rollup-cnp7kdd, r=matthiaskrgrbors-585/+902
Rollup of 9 pull requests Successful merges: - #108954 (rustdoc: handle generics better when matching notable traits) - #109203 (refactor/feat: refactor identifier parsing a bit) - #109213 (Eagerly intern and check CrateNum/StableCrateId collisions) - #109358 (rustc: Remove unused `Session` argument from some attribute functions) - #109359 (Update stdarch) - #109378 (Remove Ty::is_region_ptr) - #109423 (Use region-erased self type during IAT selection) - #109447 (new solver cleanup + implement coherence) - #109501 (make link clickable) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-23Nested impl traits trigger opaque_hidden_inferred_bound too muchMichael Goulet-39/+18
2023-03-23Remove AliasRelationDirection::SupertypeMichael Goulet-91/+99
2023-03-23Printing alias-relate goals correctlyMichael Goulet-4/+14
2023-03-23Rename AliasEq -> AliasRelateMichael Goulet-53/+57
2023-03-23Include relation direction in AliasEq predicateMichael Goulet-36/+175
2023-03-23Auto merge of #109172 - scottmcm:move-codegen-issues-tests, r=WaffleLapkinbors-0/+0
mv tests/codegen/issue-* tests/codegen/issues/ No changes to the contents; just a move. Like how there's a <https://github.com/rust-lang/rust/tree/master/tests/ui/issues> folder.
2023-03-23Auto merge of #108861 - b-naber:eager-nll-type-relating, r=lcnrbors-199/+159
Make NLL Type Relating Eager We previously instantiated bound regions in nll type relating lazily. Making this eager is more consistent with how we handle type relating in [`higher_ranked_sub`](https://github.com/rust-lang/rust/blob/0a3b557d528dd7c8a88ceca6f7dc0699b89a3ef4/compiler/rustc_infer/src/infer/higher_ranked/mod.rs#L28) and should allow us to short circuit in case there's structural equality.
2023-03-23make param bound vars visibly bound varsBoxy-1/+5
2023-03-23Stabilize `arc_into_inner` and `rc_into_inner`.Frank Steffahn-23/+6
Includes resolving the FIXMEs in the documentation, and some very minor documentation improvements.
2023-03-22Rollup merge of #109501 - lukas-code:link, r=WaffleLapkinMatthias Krüger-1/+1
make link clickable
2023-03-22Rollup merge of #109447 - lcnr:coherence, r=compiler-errorsMatthias Krüger-62/+226
new solver cleanup + implement coherence the cleanup: - change `Certainty::unify_and` to consider ambig + overflow to be ambig - rename `trait_candidate_should_be_dropped_in_favor_of` to `candidate_should_be_dropped_in_favor_of` - remove outdated fixme For coherence I mostly just add an ambiguous candidate if the current trait ref is unknowable. I am doing the same for reservation impl where I also just add an ambiguous candidate.
2023-03-22Rollup merge of #109423 - fmease:iat-selection-erase-regions-in-self-ty, ↵Matthias Krüger-31/+101
r=compiler-errors Use region-erased self type during IAT selection Split off from #109410 as discussed. Fixes #109299. Re UI test: I use a reproducer of #109299 that contains a name resolution error instead of reproducer [`regionck-2.rs`](https://github.com/rust-lang/rust/blob/fc7ed4af165c27ab5914b93251194f826920cc65/tests/ui/associated-inherent-types/regionck-2.rs) (as found in the `AliasKind::Inherent` PR) since it would (incorrectly) pass typeck in this PR due to the lack of regionck and I'd rather not make *that* a regression test (with or without `known-bug`). ``@rustbot`` label F-inherent_associated_types r? ``@compiler-errors``
2023-03-22Rollup merge of #109378 - MU001999:master, r=scottmcmMatthias Krüger-24/+12
Remove Ty::is_region_ptr Fixes #109372
2023-03-22Rollup merge of #109359 - Nilstrieb:bump-stdarch, r=AmanieuMatthias Krüger-0/+1
Update stdarch Bring the the `#![allow(internal_features)]` for #108955 r? `@Amanieu`
2023-03-22Rollup merge of #109358 - petrochenkov:nosess, r=cjgillotMatthias Krüger-299/+173
rustc: Remove unused `Session` argument from some attribute functions (One auxiliary test file containing one of these functions was unused, so I removed it instead of updating.)
2023-03-22Rollup merge of #109213 - oli-obk:cstore, r=cjgillotMatthias Krüger-61/+33
Eagerly intern and check CrateNum/StableCrateId collisions r? ``@cjgillot`` It seems better to check things ahead of time than checking them afterwards. The [previous version](https://github.com/rust-lang/rust/pull/108390) was a bit nonsensical, so this addresses the feedback
2023-03-22Rollup merge of #109203 - Ezrashaw:refactor-ident-parsing, r=NilstriebMatthias Krüger-95/+250
refactor/feat: refactor identifier parsing a bit \+ error recovery for `expected_ident_found` Prior art: #108854
2023-03-22Rollup merge of #108954 - notriddle:notriddle/notable-trait-generic, r=camelidMatthias Krüger-12/+105
rustdoc: handle generics better when matching notable traits This commit makes the `clean::Type::is_same` non-commutative (renaming it `is_doc_subtype_of`), so that a generic `impl` matches a concrete return, but a generic return does not match a concrete `impl`. It makes slice and vector Write for `u8` not match on every generic return value. Fixes #100322 Fixes #55082 Preview: * https://notriddle.com/rustdoc-demo-html-3/notable-trait-generic/std/vec/struct.Vec.html#method.new * https://notriddle.com/rustdoc-demo-html-3/notable-trait-generic/std/vec/struct.Vec.html#method.from-12 * https://notriddle.com/rustdoc-demo-html-3/notable-trait-generic/std/iter/trait.Iterator.html#method.intersperse_with * https://notriddle.com/rustdoc-demo-html-3/notable-trait-generic/std/string/struct.String.html#method.as_bytes
2023-03-22Auto merge of #109497 - matthiaskrgr:rollup-6txuxm0, r=matthiaskrgrbors-54/+153
Rollup of 10 pull requests Successful merges: - #109373 (Set LLVM `LLVM_UNREACHABLE_OPTIMIZE` to `OFF`) - #109392 (Custom MIR: Allow optional RET type annotation) - #109394 (adapt tests/codegen/vec-shrink-panik for LLVM 17) - #109412 (rustdoc: Add GUI test for "Auto-hide item contents for large items" setting) - #109452 (Ignore the vendor directory for tidy tests.) - #109457 (Remove comment about reusing rib allocations) - #109461 (rustdoc: remove redundant `.content` prefix from span/a colors) - #109477 (`HirId` to `LocalDefId` cleanup) - #109489 (More general captures) - #109494 (Do not feed param_env for RPITITs impl side) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-22Use -m option instead of looking for a cross-compiling version of dlltoolDaniel Paoliello-14/+87
2023-03-22make link clickableLukas Markeffsky-1/+1
2023-03-22Generate simpler MIR for shiftsScott McMurray-155/+175
2023-03-22Rollup merge of #109494 - spastorino:new-rpitit-18, r=compiler-errorsMatthias Krüger-5/+5
Do not feed param_env for RPITITs impl side r? `@compiler-errors` I don't think this needs more comments or things that we already have but please let me know if you want some comments or something else in this PR.
2023-03-22Rollup merge of #109489 - est31:generalize_captures, r=WaffleLapkinMatthias Krüger-3/+3
More general captures This avoids repetition of the binding.
2023-03-22Rollup merge of #109477 - lcnr:cleanup, r=cjgillotMatthias Krüger-12/+7
`HirId` to `LocalDefId` cleanup revival of the still relevant parts of #109125
2023-03-22Rollup merge of #109461 - notriddle:notriddle/css-content, r=GuillaumeGomezMatthias Krüger-21/+21
rustdoc: remove redundant `.content` prefix from span/a colors Reverts a1d4ebe4961c107272f9764d1908227a3cd04092, as well as fixing the problem it solved with links losing their color.
2023-03-22Rollup merge of #109457 - Veykril:ribstack, r=petrochenkovMatthias Krüger-1/+0
Remove comment about reusing rib allocations Perf indicates this to not be worth the complexity cc #4948
2023-03-22Rollup merge of #109452 - jfgoog:ignore-vendor, r=ozkanonurMatthias Krüger-0/+1
Ignore the vendor directory for tidy tests. When running `x.py test` on a downloaded source distribution (e.g. https://static.rust-lang.org/dist/rustc-<version>-src.tar.gz), the crates in the vendor directory contain a number of executable files that cause the tidy test to fail with the following message: tidy error: binary checked into source: <path> I see 26 such errors with the 1.68.0 source distribution. A few of these are .rs source files with incorrect executable permission, but most are scripts that are correctly marked executable.
2023-03-22Rollup merge of #109412 - GuillaumeGomez:add-gui-test, r=notriddleMatthias Krüger-1/+52
rustdoc: Add GUI test for "Auto-hide item contents for large items" setting Part of https://github.com/rust-lang/rust/issues/66181. The `browser-ui-test` version update is because there wasn't `null` check for attributes so I added it (PR is [here](https://github.com/GuillaumeGomez/browser-UI-test/pull/440)). r? ``@notriddle``
2023-03-22Rollup merge of #109394 - krasimirgg:llvm-17-vec-panic, r=nikicMatthias Krüger-9/+14
adapt tests/codegen/vec-shrink-panik for LLVM 17 After https://github.com/llvm/llvm-project/commit/0d4a709bb876824a0afa5f86e138e8ffdcaf7661 LLVM now doesn't generate references to panic_cannot_unwind: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/17978#0186ff55-ca6f-4bc5-b1ec-2622c77d0ed5/744-746 Adapted as suggested by ````@nikic```` on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/a.20couple.20codegen.20test.20failures.20after.20llvm.200d4a709bb876824a/near/342664944 >Okay, so LLVM now realizes that double panic is not possible, so that's fine.
2023-03-22Rollup merge of #109392 - cbeuw:composite-ret, r=JakobDegenMatthias Krüger-1/+48
Custom MIR: Allow optional RET type annotation This currently doesn't compile because the type of `RET` is inferred, which fails if RET is a composite type and fields are initialised separately. ```rust #![feature(custom_mir, core_intrinsics)] extern crate core; use core::intrinsics::mir::*; #[custom_mir(dialect = "runtime", phase = "optimized")] fn fn0() -> (i32, bool) { mir! ({ RET.0 = 0; RET.1 = true; Return() }) } ``` ``` error[E0282]: type annotations needed --> src/lib.rs:8:9 | 8 | RET.0 = 0; | ^^^ cannot infer type For more information about this error, try `rustc --explain E0282`. ``` This PR allows the user to manually specify the return type with `type RET = ...;` if required: ```rust #[custom_mir(dialect = "runtime", phase = "optimized")] fn fn0() -> (i32, bool) { mir! ( type RET = (i32, bool); { RET.0 = 0; RET.1 = true; Return() } ) } ``` The syntax is not optimal, I'm happy to see other suggestions. Ideally I wanted it to be a normal type annotation like `let RET: ...;`, but this runs into the multiple parsing options error during macro expansion, as it can be parsed as a normal `let` declaration as well. r? ```@oli-obk``` or ```@tmiasko``` or ```@JakobDegen```
2023-03-22Rollup merge of #109373 - ids1024:llvm-unreachable-optimize, r=ozkanonurMatthias Krüger-1/+2
Set LLVM `LLVM_UNREACHABLE_OPTIMIZE` to `OFF` This option was added to LLVM in https://reviews.llvm.org/D121750?id=416339. It makes `llvm_unreachable` in builds without assertions compile to an `LLVM_BUILTIN_TRAP` instead of `LLVM_BUILTIN_UNREACHABLE` (which causes undefined behavior and is equivalent to `std::hint::unreachable_unchecked`). Having compiler bugs triggering undefined behavior generally seems undesirable and inconsistent with Rust's goals. There is a check in `src/tools/tidy/src/style.rs` to reject code using `llvm_unreachable`. But it is used a lot within LLVM itself. For instance, this changes a failure I get compiling `libcore` for m68k from a `SIGSEGV` to `SIGILL`, which seems better though it still doesn't provide a useful message without switching to an LLVM build with asserts. It may be best not to do this if it noticeably degrades compiler performance, but worthwhile if it doesn't do so in any significant way. I haven't looked into what benchmarks there are for Rustc. That should be considered before merging.
2023-03-22Auto merge of #109496 - Dylan-DPC:rollup-u8rsi3h, r=Dylan-DPCbors-676/+513
Rollup of 11 pull requests Successful merges: - #100311 (Fix handling of trailing bare CR in str::lines) - #108997 (Change text -> rust highlighting in sanitizer.md) - #109179 (move Option::as_slice to intrinsic) - #109187 (Render source page layout with Askama) - #109280 (Remove `VecMap`) - #109295 (refactor `fn bootstrap::builder::Builder::compiler_for` logic) - #109312 (rustdoc: Cleanup parent module tracking for doc links) - #109317 (Update links for custom discriminants.) - #109405 (RPITITs are `DefKind::Opaque` with new lowering strategy) - #109414 (Do not consider synthesized RPITITs on missing items checks) - #109435 (Detect uninhabited types early in const eval) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-23Rollup merge of #109435 - oli-obk:🇨🇭🥚_copy_op, r=RalfJungDylan DPC-38/+38
Detect uninhabited types early in const eval r? `@RalfJung` implements https://github.com/rust-lang/rust/pull/108442#discussion_r1143003840 this is a breaking change, as some UB during const eval is now detected instead of silently being ignored. Users can see this and other UB that may cause future breakage with `-Zextra-const-ub-checks` or just by running miri on their code, which sets that flag by default.
2023-03-23Rollup merge of #109414 - spastorino:new-rpitit-16, r=compiler-errorsDylan DPC-4/+31
Do not consider synthesized RPITITs on missing items checks Without this patch for `tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs` we get ... ``` warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes --> tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs:4:12 | 4 | #![feature(return_position_impl_trait_in_trait)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information = note: `#[warn(incomplete_features)]` on by default error[E0046]: not all trait items implemented, missing: `foo`, `` --> tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs:12:1 | 8 | fn foo(&self) -> impl Sized; | ---------------------------- | | | | | `` from trait | `foo` from trait ... 12 | impl MyTrait for i32 { | ^^^^^^^^^^^^^^^^^^^^ missing `foo`, `` in implementation error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0046`. ``` instead of ... ``` warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/dont-project-to-rpitit-with-no-value.rs:4:12 | LL | #![feature(return_position_impl_trait_in_trait)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information = note: `#[warn(incomplete_features)]` on by default error[E0046]: not all trait items implemented, missing: `foo` --> $DIR/dont-project-to-rpitit-with-no-value.rs:12:1 | LL | fn foo(&self) -> impl Sized; | ---------------------------- `foo` from trait ... LL | impl MyTrait for i32 { | ^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0046`. ``` r? `@compiler-errors`
2023-03-23Rollup merge of #109405 - compiler-errors:rpitit-as-opaques, r=spastorinoDylan DPC-16/+45
RPITITs are `DefKind::Opaque` with new lowering strategy r? `@spastorino` Kinda cherry-picked #109400
2023-03-23Rollup merge of #109317 - ehuss:discriminant-link-fix, r=NilstriebDylan DPC-5/+4
Update links for custom discriminants. The discriminant documentation was updated in https://github.com/rust-lang/reference/pull/1055 which changed the layout a bit. This updates the links to the updated locations.
2023-03-23Rollup merge of #109312 - petrochenkov:docice5, r=GuillaumeGomezDylan DPC-185/+123
rustdoc: Cleanup parent module tracking for doc links Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary. Fixes https://github.com/rust-lang/rust/issues/108501. That issue could be fixed in a more local way, but this refactoring is something that I wanted to do since https://github.com/rust-lang/rust/pull/93805 anyway.