about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-11-20Auto merge of #117783 - tmiasko:inline-ret, r=cjgillotbors-725/+356
Fix insertion of statements to be executed along return edge in inlining Inlining creates additional statements to be executed along the return edge: an assignment to the destination, storage end for temporaries. Previously those statements where inserted directly into a call target, but this is incorrect when the target has other predecessors. Avoid the issue by creating a new dedicated block for those statements. When the block happens to be redundant it will be removed by CFG simplification that follows inlining. Fixes #117355
2023-11-20Fix insertion of statements to be executed along return edge in inliningTomasz Miąsko-605/+237
Inlining creates additional statements to be executed along the return edge: an assignment to the destination, storage end for temporaries. Previously those statements where inserted directly into a call target, but this is incorrect when the target has other predecessors. Avoid the issue by creating a new dedicated block for those statements. When the block happens to be redundant it will be removed by CFG simplification that follows inlining. Fixes #117355
2023-11-20Auto merge of #115526 - arttet:master, r=jackh726bors-18/+179
Add arm64e-apple-ios & arm64e-apple-darwin targets This introduces * `arm64e-apple-ios` * `arm64e-apple-darwin` Rust targets for support `arm64e` architecture on `iOS` and `Darwin`. So, this is a first approach for integrating to the Rust compiler. ## Tier 3 Target Policy > * 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 will be the target maintainer. > * 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. Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it. If possible, use only letters, numbers, dashes and underscores for the name. Periods (.) are known to cause issues in Cargo. The target names `arm64e-apple-ios`, `arm64e-apple-darwin` were derived from `aarch64-apple-ios`, `aarch64-apple-darwin`. In this [ticket,](#73628) people discussed the best suitable names for these targets. > In some cases, the arm64e arch might be "different". For example: > * `thread_set_state` might fail with (os/kern) protection failure if we try to call it from arm64 process to arm64e process. > * The returning value of dlsym is PAC signed on arm64e, while left untouched on arm64 > * Some function like pthread_create_from_mach_thread requires a PAC signed function pointer on arm64e, which is not required on arm64. So, I have chosen them because there are similar triplets in LLVM. I think there are no more suitable names for these targets. > * 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. The target must not introduce license incompatibilities. Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0). The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements. Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3. "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users. No dependencies were added to Rust. > * 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. > * This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements. Understood. I am not a member of a Rust team. > * 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. Understood. `std` is supported. > * 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. Building is described in the derived target doc. > * 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. > * Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications. Understood. > * 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. > * In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target. These targets are not fully ABI compatible with arm64e code. #73628
2023-11-19Auto merge of #116828 - compiler-errors:nightlyify-rustc_type_ir, r=jackh726bors-102/+214
Begin to abstract `rustc_type_ir` for rust-analyzer This adds the "nightly" feature which is used by the compiler, and falls back to more simple implementations when that is not active. r? `@lcnr` or `@jackh726`
2023-11-19Use let else to reduce indentationTomasz Miąsko-124/+123
2023-11-19Auto merge of #117683 - estebank:priv-builder-sugg, r=cjgillotbors-124/+464
When encountering struct fn call literal with private fields, suggest all builders When encountering code like `Box(42)`, suggest `Box::new(42)` and *all* other associated functions that return `-> Box<T>`. Add a way to give pre-sorted suggestions.
2023-11-19Auto merge of #117500 - RalfJung:aggregate-abi, r=davidtwcobors-77/+265
Ensure sanity of all computed ABIs This moves the ABI sanity assertions from the codegen backend to the ABI computation logic. Sadly, due to past mistakes, we [have to](https://github.com/rust-lang/rust/pull/117351#issuecomment-1788495503) be able to compute a sane ABI for nonsensical function types like `extern "C" fn(str) -> str`. So to make the sanity check pass we first need to make all ABI adjustment deal with unsized types... and we have no shared infrastructure for those adjustments, so that's a bunch of copy-paste. At least we have assertions failing loudly when one accidentally sets a different mode for an unsized argument. To achieve this, this re-lands the parts of https://github.com/rust-lang/rust/pull/80594 that got reverted in https://github.com/rust-lang/rust/pull/81388. To avoid breaking wasm ABI again, that ABI now explicitly opts-in to the (wrong, broken) ABI that we currently keep for backwards compatibility. That's still better than having *every* ABI use the wrong broken default! Cc `@bjorn3` Fixes https://github.com/rust-lang/rust/issues/115845
2023-11-19fix rebaseEsteban Küber-2/+7
2023-11-19fmtEsteban Küber-1/+2
2023-11-19review commentsEsteban Küber-43/+24
2023-11-19Account for number of arguments in suggestionEsteban Küber-20/+39
2023-11-19fix tidyEsteban Küber-1/+1
2023-11-19Suggest Default::default() for struct literals with private fieldsEsteban Küber-0/+25
2023-11-19Suggest builder functions on struct literal with private fieldsEsteban Küber-2/+109
2023-11-19Remove unnecessary .collect()Esteban Küber-7/+7
2023-11-19Suggest using builder on curly brace struct called as fnEsteban Küber-172/+211
2023-11-19Do not suggest struct literal when fields are privateEsteban Küber-36/+65
2023-11-19Add test for public struct with private fieldsEsteban Küber-1/+19
2023-11-19On private tuple struct, suggest `Default::default` when possibleEsteban Küber-1/+60
2023-11-19Don't sort `span_suggestions`, leave that to callerEsteban Küber-29/+31
2023-11-19When encountering struct fn call literal with private fields, suggest all ↵Esteban Küber-43/+98
builders When encountering code like `Box(42)`, suggest `Box::new(42)` and *all* other associated functions that return `-> Box<T>`.
2023-11-19Auto merge of #117888 - notriddle:notriddle/releases, r=Mark-Simulacrumbors-9/+111
doc: add release notes to standalone doc bundle Preview: http://notriddle.com/rustdoc-html-demo-5/release-notes/releases.html This is a workaround for #101714 on top of being a useful addition in its own right. It is intended to change the "canonical URL" for viewing the release notes from GitHub, which is relatively slow, to a pre-rendered HTML file that loads from the same CDN as the standard library docs. It also means you get a copy of the release notes when installing the rust-docs with rustup.
2023-11-19make_direct_deprecated: dont overwrite already set attributesRalf Jung-4/+10
2023-11-19Fix outdated doc comment on Releases doc build stepMichael Howell-7/+4
2023-11-19Auto merge of #118024 - notriddle:notriddle/search-speed, r=GuillaumeGomezbors-150/+188
rustdoc-search: optimize unifyFunctionTypes Final profile output: https://notriddle.com/rustdoc-html-demo-5/profile-4/index.html This PR contains three commits that improve performance of this hot inner loop: reduces the number of allocations, a fast path for the 1-element basic query case, and reconstructing the multi-element query case to use recursion instead of an explicit `backtracking` array. It also adds new test cases that I found while working on this. r? `@GuillaumeGomez`
2023-11-19disable csky test on CIRalf Jung-3/+5
2023-11-19Auto merge of #118054 - max-niederman:pinned-must-use, r=Nilstriebbors-0/+83
Lint pinned `#[must_use]` pointers (in particular, `Box<T>` where `T` is `#[must_use]`) in `unused_must_use`. Fixes: #111458 This is motivated by a common async/await pattern: ```rs fn foo() -> Pin<Box<dyn Future<Output = i32>>> { Box::pin(async { 42 }) } // call `foo`, but forget to await the result foo(); ``` Unlike with `async fn` or return position `impl Future`, this does not currently warn the user that the `Future` is unused. To fix this, I've extended the `unused_must_use` lint to catch `Pin<P>`, where `P` must be used. In particular, this applies to `Pin<Box<T>>`, where `T` must be used. I'm not sure if there are other pointers where this applies, but I can't think of any situation the user wouldn't want to be warned.
2023-11-19Auto merge of #118051 - GuillaumeGomez:cleanup-rustdoc, r=notriddlebors-4/+4
Remove unneeded `unknown` variable and `Symbol` creation when iterating over items in rustdoc rendering I realized that we were creating a `Symbol` but never actually used it since we check that `item.name` is always `Some()`. r? `@notriddle`
2023-11-19Auto merge of #117807 - RalfJung:raw-str-slice, r=davidtwcobors-6/+28
patterns: don't ice when encountering a raw str slice Fixes https://github.com/rust-lang/rust/issues/117806
2023-11-19Auto merge of #117364 - BlackHoleFox:farewell-bitcode-no-remorse, r=davidtwcobors-94/+0
Remove legacy bitcode defaults from all Apple specs Xcode 14 [deprecated bitcode with warnings](https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations) and now [Xcode 15 has dropped it completely](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Deprecations). `rustc` should follow what the platform tooling is doing as well since it just increases binary sizes for no gain at this point. `cc` made a [similar change last month](https://github.com/rust-lang/cc-rs/pull/812). Two things show this should have minimal impact: - Apple has stopped accepting apps built with versions of Xcode (<14) that generate bitcode - The app store has been stripping bitcode off IPA releases for over 2 years now. I didn't nuke all the bitcode changes added in https://github.com/rust-lang/rust/pull/71970/ since maybe another target in the future could need mandatory bitcode embedding. Staticlibs built for iOS still link correctly with XCode 15 against a test app when using a compiler built from this branch. cc `@thomcc` `@keith`
2023-11-18add test for pinned `must_use` pointersMax Niederman-0/+65
2023-11-18catch pinned `must_use` types in `unused_must_use`Max Niederman-0/+18
2023-11-19Auto merge of #117895 - mzohreva:mz/fix-sgx-backtrace, r=Mark-Simulacrumbors-1/+14
Adjust frame IP in backtraces relative to image base for SGX target This is followup to https://github.com/rust-lang/backtrace-rs/pull/566. The backtraces printed by `panic!` or generated by `std::backtrace::Backtrace` in SGX target are not usable. The frame addresses need to be relative to image base address so they can be used for symbol resolution. Here's an example panic backtrace generated before this change: ``` $ cargo r --target x86_64-fortanix-unknown-sgx ... stack backtrace: 0: 0x7f8fe401d3a5 - <unknown> 1: 0x7f8fe4034780 - <unknown> 2: 0x7f8fe401c5a3 - <unknown> 3: 0x7f8fe401d1f5 - <unknown> 4: 0x7f8fe401e6f6 - <unknown> ``` Here's the same panic after this change: ``` $ cargo +stage1 r --target x86_64-fortanix-unknown-sgx stack backtrace: 0: 0x198bf - <unknown> 1: 0x3d181 - <unknown> 2: 0x26164 - <unknown> 3: 0x19705 - <unknown> 4: 0x1ef36 - <unknown> ``` cc `@jethrogb` and `@workingjubilee`
2023-11-19Auto merge of #117868 - ferrocene:pa-omit-git-hash, r=Mark-Simulacrumbors-0/+7
Set `CFG_OMIT_GIT_HASH=1` during builds when `omit-git-hash` is enabled This environment variable will allow tools like Cargo to disable their own detection when `omit-git-hash` is set to `true`. I created this PR because of https://github.com/rust-lang/cargo/pull/12968. There is not a dependency between the two PRs, they can land in any order. They just won't do anything until both of them are merged into the repo.
2023-11-18Do not call dry_run twiceMichael Howell-2/+3
Co-authored-by: Onur Özkan <onurozkan.dev@outlook.com>
2023-11-18rustdoc-search: switch to recursive backtrackingMichael Howell-157/+87
This is significantly faster, because - It allows the one-element fast path to kick in on multi- element queries. - It constructs intermediate data structures more lazily than the old system did. It's measurably faster than the old algo even without the fast path, but that fast path still helps significantly.
2023-11-18Auto merge of #117813 - onur-ozkan:simplify-download-ci-llvm-option, ↵bors-19/+18
r=Mark-Simulacrum deprecate `if-available` value of `download-ci-llvm` This PR deprecates the use of the `if-available` value for `download-ci-llvm` since `if-unchanged` serves the same purpose when no changes are detected. In cases where changes are present, it is assumed that compiling LLVM is acceptable (otherwise, why make changes there?). This was probably missing in the #110087 issue before. cc `@RalfJung`
2023-11-18Remove unneeded `unknown` variable and `Symbol` creation when iterating over ↵Guillaume Gomez-4/+4
items in rustdoc rendering
2023-11-18Auto merge of #118046 - TaKO8Ki:rollup-6jdgwe5, r=TaKO8Kibors-364/+604
Rollup of 5 pull requests Successful merges: - #116750 (Add Seek::seek_relative) - #117110 (Suggest field typo through derefs) - #117961 (Add `x suggest` entries for testing `mir-opt` and `coverage`) - #118020 (Fix links to `From<{OwnedHandle, OwnedFd}> for std::process::Child{Stdin, Stdout, Stderr}` in 1.74 release notes) - #118034 (bump few deps to fix unsoundness and drop few dup deps) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-19Rollup merge of #118034 - klensy:dep-up-18-11-23, r=Mark-SimulacrumTakayuki Maeda-104/+41
bump few deps to fix unsoundness and drop few dup deps jsondocck: bump jsonpath to 0.3, dropping few dup dependencies changes: https://github.com/freestrings/jsonpath/compare/v0.2.6...v0.3.0 self_cell: bump to 0.10.3 due to RUSTSEC-2023-0070 https://rustsec.org/advisories/RUSTSEC-2023-0070.html https://github.com/Voultapher/self_cell/issues/49 bump h2 to 0.3.22, dropping few dup crate versions https://github.com/hyperium/h2/blob/v0.3.22/CHANGELOG.md
2023-11-19Rollup merge of #118020 - Lireer:patch-1, r=Mark-SimulacrumTakayuki Maeda-2/+2
Fix links to `From<{OwnedHandle, OwnedFd}> for std::process::Child{Stdin, Stdout, Stderr}` in 1.74 release notes
2023-11-19Rollup merge of #117961 - Zalathar:suggest, r=Mark-SimulacrumTakayuki Maeda-17/+30
Add `x suggest` entries for testing `mir-opt` and `coverage` The `x suggest` subcommand uses git to find paths that have been modified, and uses those paths to suggest relevant test suites to run. This PR adds suggestions for `x test mir-opt` and `x test coverage` .
2023-11-19Rollup merge of #117110 - estebank:deref-field-suggestion, r=b-naberTakayuki Maeda-241/+491
Suggest field typo through derefs Take into account implicit dereferences when suggesting fields. ``` error[E0609]: no field `longname` on type `Arc<S>` --> $DIR/suggest-field-through-deref.rs:10:15 | LL | let _ = x.longname; | ^^^^^^^^ help: a field with a similar name exists: `long_name` ``` CC https://github.com/rust-lang/rust/issues/78374#issuecomment-719564114
2023-11-19Rollup merge of #116750 - fintelia:seek_seek_relative, r=Mark-SimulacrumTakayuki Maeda-0/+40
Add Seek::seek_relative The `BufReader` struct has a `seek_relative` method because its `Seek::seek` implementation involved dumping the internal buffer (https://github.com/rust-lang/rust/issues/31100). Unfortunately, there isn't really a good way to take advantage of that method in generic code. This PR adds the same method to the main `Seek` trait with the straightforward default method, and an override for `BufReader` that calls its implementation. _Also discussed in [this](https://internals.rust-lang.org/t/add-seek-seek-relative/19546) internals.rust-lang.org thread._
2023-11-18Auto merge of #118002 - nnethercote:unify-input-no-input, r=bjorn3bors-109/+80
Unify "input" and "no input" paths in `run_compiler` A follow-up to #117649. r? `@bjorn3`
2023-11-18Auto merge of #118037 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 11 commits in 2c03e0e2dcd05dd064fcf10cc1050d342eaf67e3..9765a449d9b7341c2b49b88da41c2268ea599720 2023-11-16 04:21:44 +0000 to 2023-11-17 20:58:23 +0000 - refactor(toml): Clean up workspace inheritance (rust-lang/cargo#12971) - docs: Recommend a wider selection of libsecret-compatible password managers (rust-lang/cargo#12993) - feat(cli): add color output for `cargo --list` (rust-lang/cargo#12992) - refactor: log when loading config from file (rust-lang/cargo#12991) - Link to rustc lint levels (rust-lang/cargo#12990) - chore(ci): Catch naive use of AtomicU64 early (rust-lang/cargo#12988) - cargo-credential-1password: Add missing `--account` argument to `op signin` command (rust-lang/cargo#12985) - chore: dogfood Cargo `-Zlints` table feature (rust-lang/cargo#12178) - cargo-credential-1password: Fix README (rust-lang/cargo#12986) - Fix a rustflags test using a wrong buildfile name (rust-lang/cargo#12987) - Fix some test output validation. (rust-lang/cargo#12982) r? ghost
2023-11-18Update cargoWeihang Lo-0/+0
2023-11-18Auto merge of #117525 - GKFX:remove_option_payload_ptr, r=petrochenkovbors-171/+16
Remove option_payload_ptr; redundant to offset_of The `option_payload_ptr` intrinsic is no longer required as `offset_of` supports traversing enums (#114208). This PR removes it in order to dogfood offset_of (as suggested at https://github.com/rust-lang/rust/issues/106655#issuecomment-1790907626). However, it will not build until those changes reach beta (which I think is within the next 8 days?) so I've opened it as a draft.
2023-11-18Update based on petrochenkov's reviewGeorge Bateman-3/+4
2023-11-18Auto merge of #117924 - estebank:issue-53841, r=petrochenkovbors-0/+22
When a local binding shadows a fn, point at fn def in call failure When a local binding shadows a function that is then called, this local binding will cause an E0618 error. We now point not only at the binding definition, but also at the locally defined function of the same name. ``` error[E0618]: expected function, found `&str` --> $DIR/issue-22468.rs:3:13 | LL | let foo = "bar"; | --- `foo` has type `&str` LL | let x = foo("baz"); | ^^^------- | | | call expression requires function ... LL | fn foo(file: &str) -> bool { | -------------------------- this function of the same name is available here, but it shadowed by the local binding of the same name ``` Fix #53841