about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-03-23Auto merge of #109538 - matthiaskrgr:rollup-ct58npj, r=matthiaskrgrbors-266/+566
Rollup of 8 pull requests Successful merges: - #106964 (Clarify `Error::last_os_error` can be weird) - #107718 (Add `-Z time-passes-format` to allow specifying a JSON output for `-Z time-passes`) - #107880 (Lint ambiguous glob re-exports) - #108549 (Remove issue number for `link_cfg`) - #108588 (Fix the ffi_unwind_calls lint documentation) - #109231 (Add `try_canonicalize` to `rustc_fs_util` and use it over `fs::canonicalize`) - #109472 (Add parentheses properly for method calls) - #109487 (Move useless_anynous_reexport lint into unused_imports) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-23Rollup merge of #109487 - GuillaumeGomez:move-useless-reexport-check, ↵Matthias Krüger-141/+70
r=petrochenkov Move useless_anynous_reexport lint into unused_imports As mentioned in https://github.com/rust-lang/rust/pull/109003, this check should have been merged with `unused_imports` in the start. r? `@petrochenkov`
2023-03-23Rollup merge of #109472 - MU001999:patch-3, r=eholkMatthias Krüger-7/+53
Add parentheses properly for method calls Fixes #109436
2023-03-23Rollup merge of #109231 - Zoxc:fs-non-canon, r=eholkMatthias Krüger-14/+31
Add `try_canonicalize` to `rustc_fs_util` and use it over `fs::canonicalize` This adds `try_canonicalize` which tries to call `fs::canonicalize`, but falls back to `std::path::absolute` if it fails. Existing `canonicalize` calls are replaced with it. `fs::canonicalize` is not guaranteed to work on Windows.
2023-03-23Rollup merge of #108588 - ehuss:lint-docs-produces, r=eholkMatthias Krüger-40/+64
Fix the ffi_unwind_calls lint documentation This fixes the [`ffi_unwind_calls`](https://doc.rust-lang.org/nightly/rustc/lints/listing/allowed-by-default.html#ffi-unwind-calls) documentation to show its output correctly. Currently it is showing the text `{{produces}}` which is not how it should look. This fixes it by not ignoring the example. I'm not sure why it was ignored, as the way the lint currently works it doesn't seem to require external linkage. This also fixes several mistakes in the example: * There is no `ffi_unwind_calls` feature. * Denies the lint (which is otherwise allow be default). * Removes the `mod impl` which is not valid Rust syntax, and doesn't appear to be needed anyways. The output now looks like: ``` warning: call to foreign function with FFI-unwind ABI --> lint_example.rs:10:14 | 10 | unsafe { foo(); } | ^^^^^ call to foreign function with FFI-unwind ABI | note: the lint level is defined here --> lint_example.rs:2:9 | 2 | #![warn(ffi_unwind_calls)] | ^^^^^^^^^^^^^^^^ warning: call to function pointer with FFI-unwind ABI --> lint_example.rs:12:14 | 12 | unsafe { ptr(); } | ^^^^^ call to function pointer with FFI-unwind ABI ``` This also includes some updates to the lint-docs tool to help with this issue: * Adds a check if a lint documentation has `{{produces}}` with an ignored example, and generates an error. * All instances of a lint are now displayed. Previously it only showed the first time the lint fires. Some examples may trigger a lint multiple times, and they are all now displayed.
2023-03-23Rollup merge of #108549 - clubby789:fix-link-cfg-issue, r=eholkMatthias Krüger-3/+2
Remove issue number for `link_cfg` Fixes #72059 Per #37406 and its [unstable book entry](https://doc.rust-lang.org/beta/unstable-book/language-features/link-cfg.html), this is an internal feature, and therefore perma-unstable and not being tracked
2023-03-23Rollup merge of #107880 - jieyouxu:issue-107563, r=petrochenkovMatthias Krüger-27/+229
Lint ambiguous glob re-exports Attempts to fix #107563. We currently already emit errors for ambiguous re-exports when two names are re-exported *specifically*, i.e. not from glob exports. This PR attempts to emit deny-by-default lints for ambiguous glob re-exports.
2023-03-23Rollup merge of #107718 - Zoxc:z-time, r=nnethercoteMatthias Krüger-32/+107
Add `-Z time-passes-format` to allow specifying a JSON output for `-Z time-passes` This adds back the `-Z time` option as that is useful for [my rustc benchmark tool](https://github.com/Zoxc/rcb), reverting https://github.com/rust-lang/rust/pull/102725. It now uses nanoseconds and bytes as the units so it is renamed to `time-precise`.
2023-03-23Rollup merge of #106964 - ↵Matthias Krüger-2/+10
workingjubilee:crouching-ioerror-hidden-documentation, r=ChrisDenton Clarify `Error::last_os_error` can be weird Fundamentally, querying the OS for error codes is a process that is deeply subject to the whims of chance and fortune. We can account for OS, but not for every combination of platform APIs. A compiled binary may not recognize new errors introduced years later. We should clarify a few especially odd situations, and what they mean: We can effectively promise nothing... if you ask for Rust to decode errors where none have occurred. This allows removing mention of ErrorKind::Uncategorized. That error variant is hidden deliberately, so we should not explicitly mention it. This fixes #106937. Since you had an opinion also: Does this solution seem acceptable? r? ``@ChrisDenton``
2023-03-23Auto merge of #108442 - scottmcm:mir-transmute, r=oli-obkbors-188/+953
Add `CastKind::Transmute` to MIR ~~Nothing actually produces it in this commit, so I don't know how to test it, but it also means it shouldn't be possible for it to break anything.~~ Includes lowering `transmute` calls to it, so it's used. Zulip Conversation: <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Good.20first.20isssue/near/321849610>
2023-03-23Auto merge of #108221 - petrochenkov:cratecfg, r=michaelwoeristerbors-128/+207
rustc_interface: Add a new query `pre_configure` It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early. Crate-level cfg attributes on the crate itself are then expanded normally during the main expansion pass, like attributes on any other nodes. This is a continuation of https://github.com/rust-lang/rust/pull/92473 and one more step to very unstable crate-level proc macro attributes maybe actually working. Previously crate attributes were pre-configured simultaneously with feature extraction, and then written directly into `ast::Crate`.
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-23rustc_interface: Add a new query `pre_configure`Vadim Petrochenkov-84/+108
It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early. Crate-level cfg attributes are then expanded normally during the main expansion pass, like attributes on any other nodes.
2023-03-23Add some tests for the current `#![cfg(FALSE)]` crate behaviorVadim Petrochenkov-0/+72
2023-03-23expand: Pass `ast::Crate` by reference to AST transforming passesVadim Petrochenkov-79/+62
Also some more attributes are passed by reference.
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-23Use span_look_ahead instead of next_pointMu42-6/+3
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-22Add `CastKind::Transmute` to MIRScott McMurray-188/+953
Updates `interpret`, `codegen_ssa`, and `codegen_cranelift` to consume the new cast instead of the intrinsic. Includes `CastTransmute` for custom MIR building, to be able to test the extra UB.
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.