Commit Graph

143146 Commits

Author SHA1 Message Date
bors fe3eae3f31 Auto merge of #114938 - flip1995:clippy_backport, r=matthiaskrgr
Clippy backport

r? `@Manishearth`

This is the accompanying PR to https://github.com/rust-lang/rust/pull/114937. This needs to be merged before tomorrow, so that it gets into master, before beta is branched.

The second commit is pretty much an out-of cycle sync, so that we don't get backport-debt for next release cycle right away.

cc `@Mark-Simulacrum` also mentioning you here, to make sure this is included in the beta branching.
2023-08-18 02:06:50 +00:00
Josh Stone cd50556e90
Rollup merge of #113715 - kadiwa4:lang_items_doc, r=JohnTitor
Unstable Book: update `lang_items` page and split it

[`lang_items` rendered](https://github.com/kadiwa4/rust/blob/lang_items_doc/src/doc/unstable-book/src/language-features/lang-items.md), [`start` rendered](https://github.com/kadiwa4/rust/blob/lang_items_doc/src/doc/unstable-book/src/language-features/start.md)
Closes #110274
Rustonomicon PR: rust-lang/nomicon#413, Rust Book PR: rust-lang/book#3705

A lot of information doesn't belong on the `lang_items` page. I added a separate page for the `start` feature and moved some text into the Rustonomicon because the `lang_items` page should not be a tutorial on how to build a `#![no_std]` executable.
The list of existing lang items is too long/unstable, so I removed it.

The doctests still don't work. :(
2023-08-17 15:40:08 -07:00
bors ff89efeda2
Auto merge of #11314 - GuillaumeGomez:needless_ref_mut_async_block, r=Centri3
Correctly handle async blocks for NEEDLESS_PASS_BY_REF_MUT

Fixes https://github.com/rust-lang/rust-clippy/issues/11299.

The problem was that the `async block`s are popping a closure which we didn't go into, making it miss the mutable access to the variables.

cc `@Centri3`

changelog: none
2023-08-17 18:06:36 +02:00
bors 09d05c04da
Auto merge of #11070 - y21:issue11065, r=flip1995
[`useless_conversion`]: only lint on paths to fn items and fix FP in macro

Fixes #11065 (which is actually two issues: an ICE and a false positive)

It now makes sure that the function call path points to a function-like item (and not e.g. a `const` like in the linked issue), so that calling `TyCtxt::fn_sig` later in the lint does not ICE (fixes https://github.com/rust-lang/rust-clippy/issues/11065#issuecomment-1616836099).
It *also* makes sure that the expression is not part of a macro call (fixes https://github.com/rust-lang/rust-clippy/issues/11065#issuecomment-1616919639). ~~I'm not sure if there's a better way to check this other than to walk the parent expr chain and see if any of them are expansions.~~ (edit: it doesn't do this anymore)

changelog: [`useless_conversion`]: fix ICE when call receiver is a non-fn item
changelog: [`useless_conversion`]: don't lint if argument is a macro argument (fixes a FP)

r? `@llogiq` (reviewed #10814, which introduced these issues)
2023-08-17 18:06:36 +02:00
bors 4a0402cd80 Auto merge of #114932 - RalfJung:miri, r=RalfJung
update Miri

r? `@ghost`
2023-08-17 14:04:37 +00:00
bors d4a881e143 Auto merge of #114922 - matthiaskrgr:rollup-qktdihi, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #112751 (rustdoc: Fixes with --test-run-directory and relative paths.)
 - #114749 (Update `mpsc::Sender` doc to reflect that it implements `Sync`)
 - #114876 (Don't ICE in `is_trivially_sized` when encountering late-bound self ty)
 - #114881 (clarify CStr lack of layout guarnatees)
 - #114921 (Remove Folyd from librustdoc static files)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-17 07:21:53 +00:00
Matthias Krüger da541088ef
Rollup merge of #112751 - ehuss:persist-test-run-directory, r=jsha
rustdoc: Fixes with --test-run-directory and relative paths.

Fixes #112191
Fixes #112210

This fixes some issues with `--test-run-directory` and its interaction with `--runtool` and `--persist-doctests`. Relative directories don't work with `Command::current_dir` very well because it has platform-specific behavior with relative paths. This fixes it by avoiding the use of relative paths.

This is needed because cargo is switching to use `--test-run-directory`, and it uses relative paths when interacting with rustdoc/rustc.
2023-08-17 08:39:20 +02:00
Zalathar bfb16545a3 coverage: Anonymize line numbers in `run-coverage` test snapshots
This makes the test snapshots less sensitive to lines being added/removed.
2023-08-17 10:03:32 +10:00
Matthias Krüger 82b92ad738
Rollup merge of #114878 - tshepang:tshepang-patch-1-1, r=davidtwco
rustc book: make more pleasant to search
2023-08-16 20:10:38 +02:00
Matthias Krüger 6533929ae0
Rollup merge of #114822 - GuillaumeGomez:code-readability-improvement, r=notriddle
Improve code readability by moving fmt args directly into the string

There are some of occurrences where I also transformed `write!(f, "{}", x)` into `f.write_str(x.as_str())`.

r? `@notriddle`
2023-08-16 20:10:38 +02:00
Matthias Krüger 52d69476a6
Rollup merge of #113115 - tshepang:patch-5, r=est31
we are migrating to askama

see https://github.com/rust-lang/rust/issues/108868
2023-08-16 20:10:37 +02:00
bors 6249c70dbb Auto merge of #3027 - ttsugriy:range-map, r=RalfJung
Avoid unnecessary Vec resize.

If `size > 0` current implementation will first create an empty vec and then push an element into it, which will cause a resize that can be easily avoided.

It's obviously not a big deal, but this also gets rid of `mut` local variable.
2023-08-16 17:13:42 +00:00
Taras Tsugrii ac0a8ca40d Avoid unnecessary Vec resize.
If `size > 0` current implementation will first create an empty
vec and then push an element into it, which will cause a resize
that can be easily avoided.

It's obviously not a big deal, but this also gets rid of `mut`
local variable.
2023-08-16 10:05:14 -07:00
Guillaume Gomez 16b34bfae3 Use more named format args 2023-08-16 16:35:23 +02:00
Guillaume Gomez a1a94b1c0f Improve code readability by moving fmt args directly into the string 2023-08-16 16:35:23 +02:00
bors 2bc7929138 Auto merge of #114847 - nikic:update-llvm-12, r=cuviper
Update LLVM submodule

Merge the current release/17.x branch.

Fixes #114691.
Fixes #114312.

The test for the latter is taken from #114726.
2023-08-16 09:19:38 +00:00
Ralf Jung f71d76e0dd on out-of-bounds error, show where the allocation was created 2023-08-16 10:49:08 +02:00
bors 22f5aadd1d Auto merge of #2940 - saethlin:use-after-free-spans, r=RalfJung
When reporting a heap use-after-free, say where the allocation was allocated and deallocated

This is a partial solution to: https://github.com/rust-lang/miri/issues/2917

Currently in the interpreter, we only have accurate information for where heap allocations are allocated and deallocated (see https://github.com/rust-lang/miri/pull/2940#discussion_r1243559711). So this just implements support for allocations where the information is already available, and the full support will require more interpreter tweaks.
2023-08-16 08:00:33 +00:00
bors edc6fc12e3 Auto merge of #3028 - ttsugriy:range-map-find-offset, r=RalfJung
Replace hand-written binary search with Vec::binary_search_by.

It's similar to https://github.com/rust-lang/miri/pull/3021 and should improve maintainability.
2023-08-16 07:26:49 +00:00
The Miri Conjob Bot 50b4bc0758 Merge from rustc 2023-08-16 05:32:16 +00:00
The Miri Conjob Bot a4d2130a4c Preparing for merge from rustc 2023-08-16 05:25:49 +00:00
Tshepang Mbambo 50ca860b5f
rustc book: make more pleasant to search 2023-08-16 06:33:31 +02:00
bors 656ee47db3 Auto merge of #114689 - m-ou-se:stabilize-thread-local-cell-methods, r=thomcc
Stabilize thread local cell methods.

Closes #92122.
2023-08-16 02:37:29 +00:00
Taras Tsugrii 0711c01709 Replace hand-written binary search with Vec::binary_search_by.
It's similar to https://github.com/rust-lang/miri/pull/3021 and
should improve maintainability.
2023-08-15 19:02:12 -07:00
Ben Kimock 6235604f70 Tidy up the implementation 2023-08-15 19:32:40 -04:00
Ben Kimock 63a51a6b19
Explain why we save spans for some memory types and not others
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-08-15 19:26:53 -04:00
Matthias Krüger fa15f94e42
Rollup merge of #114826 - xzmeng:fix-typos, r=JohnTitor
Fix typos
2023-08-15 20:34:25 +02:00
Matthias Krüger 8db5a6d8ee
Rollup merge of #114819 - estebank:issue-78124, r=compiler-errors
Point at return type when it influences non-first `match` arm

When encountering code like

```rust
fn foo() -> i32 {
    match 0 {
        1 => return 0,
        2 => "",
        _ => 1,
    }
}
```

Point at the return type and not at the prior arm, as that arm has type `!` which isn't influencing the arm corresponding to arm `2`.

Fix #78124.
2023-08-15 20:34:25 +02:00
Guillaume Gomez f0987ab45b
Rollup merge of #114772 - fee1-dead-contrib:typed-did, r=b-naber
Add `{Local}ModDefId` to more strongly type DefIds`

Based on #110862 by `@Nilstrieb`
2023-08-15 14:29:45 +02:00
bors 5b9168a32d Auto merge of #2972 - RalfJung:c-mem-functions, r=RalfJung
C `mem` function shims: consistently treat "invalid" pointers as UB

Depends on https://github.com/rust-lang/rust/pull/113435.
2023-08-15 12:18:56 +00:00
Ralf Jung 6147260f38 C string function shims: consistently treat "invalid" pointers as UB 2023-08-15 13:33:52 +02:00
bors 46aa9bc7f9 Auto merge of #3018 - ttsugriy:ttsugriy-patch-1, r=RalfJung
[nit][typo] Fix out of order words.
2023-08-15 11:30:37 +00:00
Nikita Popov 64cc56b31d Update LLVM submodule 2023-08-15 11:14:01 +02:00
Meng Xiangzhuo fe6d541540 Fix typos in rustc doc platform x86_64h-apple-darwin 2023-08-15 08:07:11 +08:00
Meng Xiangzhuo aa6c02dd40 Fix typos in rustc doc platform loongarch-linux 2023-08-15 08:07:11 +08:00
Meng Xiangzhuo 29a1e46817 Fix typos in rustc doc codegen-options 2023-08-15 08:07:11 +08:00
Meng Xiangzhuo 1b6cf74390 Fix typos in rustc doc platform aarch64-unknown-teeos 2023-08-15 08:06:53 +08:00
Meng Xiangzhuo f8bda1824e Fix typos in rustc doc platform netbsd 2023-08-15 07:55:18 +08:00
Meng Xiangzhuo c3889d1a14 Fix typos in unstable-book 2023-08-15 07:54:36 +08:00
bors 3276b29ddb Auto merge of #114824 - weihanglo:update-cargo, r=weihanglo
Update cargo

6 commits in 7e9de3f4ec3708f500bec142317895b96131e47c..7c3904d6c3ed54e8a413023519b55a536ad44d5b
2023-08-13 00:47:32 +0000 to 2023-08-14 20:11:43 +0000
- fix(lints): Doctest extraction should respect `[lints]` (rust-lang/cargo#12501)
- test: relax assertions of panic message (again) (rust-lang/cargo#12500)
- doc(unstable): `cargo test` does not provide `--keep-going` (rust-lang/cargo#12492)
- fix(log): enable ansi color only in terminal (rust-lang/cargo#12488)
- Update cargo-yank.md (rust-lang/cargo#12490)
- test: bypass `rustc --test` impl details for `-Zfuture-incompat-test` (rust-lang/cargo#12491)

r? `@ghost`
2023-08-14 23:43:49 +00:00
Weihang Lo 6d31b1489d
Update cargo 2023-08-14 23:59:06 +01:00
Esteban Küber 58aa903848 bless clippy test 2023-08-14 22:00:46 +00:00
bors 180dffba14 Auto merge of #113658 - Dirreke:csky-unknown-linux-gunabiv2, r=bjorn3
add a csky-unknown-linux-gnuabiv2 target

This is the rustc side changes to support csky based Linux target(`csky-unknown-linux-gnuabiv2`).

Tier 3 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 pledge to do my best maintaining it.

> 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.

This `csky`  section is the arch name and the `unknown-linux` section is the same as other linux target, and `gnuabiv2` is from the  cross-compile toolchain of  `gcc`

> 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.

I think the explanation in platform support doc is enough to make this aspect clear.

> 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.

It's using open source tools only.

> The target must not introduce license incompatibilities.

No new license

> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).

Understood.

> 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.

There are no new dependencies/features required.

> 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.

As previously said it's using open source tools only.

> "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.

There are no such terms present/

> 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.

I'm not the reviewer here.

> 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.

I'm not the reviewer here.

> 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.

It supports for std

> 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.

I have added the documentation, and I think it's clear.

> 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.

Understood.

> 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.

I believe I didn't break any other 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.

I think there are no such problems in this PR.
2023-08-14 21:53:27 +00:00
Esteban Küber 5021dde1a0 Move scrutinee `HirId` into `MatchSource::TryDesugar` 2023-08-14 21:43:56 +00:00
Matthias Krüger e0ee40ff6e
Rollup merge of #114815 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

3 commits in 668c64760b5c7ea654facb4ba5fe9faddfda27cc..72187f5cd0beaaa9c6f584156bcd88f921871e83
2023-08-04 14:42:07 UTC to 2023-08-03 13:36:44 UTC

- redirects: change link for the `#![no_std]` tutorial (rust-lang/book#3705)
- [chpt10.2] - Small wording changes (rust-lang/book#3724)
- Improve sentence (rust-lang/book#3725)

## rust-embedded/book

1 commits in 1e5556dd1b864109985d5871616ae6b9164bcead..99ad2847b865e96d8ae7b333d3ee96963557e621
2023-08-11 06:31:04 UTC to 2023-08-11 06:31:04 UTC

- Fix a small typo in qemu.md (rust-embedded/book#359)

## rust-lang/nomicon

1 commits in 302b995bcb24b70fd883980fd174738c3a10b705..388750b081c0893c275044d37203f97709e058ba
2023-08-10 21:15:21 UTC to 2023-08-10 21:15:21 UTC

- Document thiscall abi (rust-lang/nomicon#311)

## rust-lang/reference

10 commits in 1ea0178266b3f3f613b0fabdaf16a83961c99cdb..d43038932adeb16ada80e206d4c073d851298101
2023-08-12 19:07:28 UTC to 2023-07-16 20:12:46 UTC

- Document thiscall abi (rust-lang/reference#1092)
- add section about implied bounds (rust-lang/reference#1261)
- Clearly specify the `instruction_set` effects (rust-lang/reference#1307)
- Fix merge queue building twice. (rust-lang/reference#1383)
- Clarify UB around immutability & mutation (rust-lang/reference#1385)
- mention the extra const UB (rust-lang/reference#1273)
- Operator expressions: make the note about division by zero clearer. (rust-lang/reference#1384)
- Make unsafe keyword docs less confusing (rust-lang/reference#1379)
- Say that division by zero for primitive types panics (rust-lang/reference#1382)
- Add CI trigger for merge queues. (rust-lang/reference#1381)

## rust-lang/rust-by-example

3 commits in 8a87926a985ce32ca1fad1be4008ee161a0b91eb..07e0df2f006e59d171c6bf3cafa9d61dbeb520d8
2023-07-24 11:37:55 UTC to 2023-07-24 11:35:36 UTC

- Added attribute unused_labels - fixed warning. (rust-lang/rust-by-example#1729)
- more explanation about panic (rust-lang/rust-by-example#1728)
- chore: add the portuguese version of this project to `readme.md` (rust-lang/rust-by-example#1727)

## rust-lang/rustc-dev-guide

31 commits in b5a12d95e32ae53791cc6ab44417774667ed2ac6..b123ab4754127d822ffb38349ce0fbf561f1b2fd
2023-08-14 08:34:59 UTC to 2023-07-11 06:02:34 UTC

- fix: stabilize debugger_visualizer (rust-lang/rustc-dev-guide#1766)
- feat(part-5-intro): make "Part 5" obvious (rust-lang/rustc-dev-guide#1753)
- Update from `#[warn_]` to `#[warning]` diagnostic attributes (rust-lang/rustc-dev-guide#1765)
- Add RPITIT documentation (rust-lang/rustc-dev-guide#1764)
- fix(visitor.md): fix a type name in a code sample (rust-lang/rustc-dev-guide#1762)
- fix(name-resolution): remove unnecessary closing paranthesis (rust-lang/rustc-dev-guide#1760)
- fix(macro-expansion.md): fix the article `an` to `a` (rust-lang/rustc-dev-guide#1759)
- fix(serialization.md): fix the name of a derive macro (rust-lang/rustc-dev-guide#1756)
- fix(serialization.md): add a necessary plural suffix (rust-lang/rustc-dev-guide#1757)
- fix(salsa.md): add punctuation to prevent confusion (rust-lang/rustc-dev-guide#1754)
- fix(salsa.md): remove duplicate "To Be" verb (rust-lang/rustc-dev-guide#1755)
- feat(fuzzing.md): make `halfempty` word a link (rust-lang/rustc-dev-guide#1750)
- fix(about.md): use `a` instead of `an` (rust-lang/rustc-dev-guide#1751)
- refactor(git.md): make git-scm links clickable (rust-lang/rustc-dev-guide#1747)
- fix(walkthrough.md) add a comma operator to eliminate ambiguity (rust-lang/rustc-dev-guide#1749)
- fix(git.md): remove a confusing end of sentence character (rust-lang/rustc-dev-guide#1748)
- refactor(profiling/with_perf): remove a wrong to be verb (rust-lang/rustc-dev-guide#1746)
- refactor(tests/headers): remove duplicate list item (rust-lang/rustc-dev-guide#1745)
- refactor(test/headers.md): make the meaning more obvious (rust-lang/rustc-dev-guide#1744)
- refactor(tests/ui): remove unnecessary duplicate word (rust-lang/rustc-dev-guide#1743)
- refactor(compiletest): remove unnecessary duplicate word (rust-lang/rustc-dev-guide#1742)
- generic_arguments.md: substs -> GenericArgs (rust-lang/rustc-dev-guide#1741)
- fix(suggested): remove an unnecessary and confusing statement (rust-lang/rustc-dev-guide#1739)
- fix(how-to-build-and-run): fix a typo ("fromer" -> "former") (rust-lang/rustc-dev-guide#1736)
- fix(how-to-build-and-run): remove a wrong paragraph (rust-lang/rustc-dev-guide#1735)
- coverage code has moved (rust-lang/rustc-dev-guide#1728)
- linked issue is closed (rust-lang/rustc-dev-guide#1729)
- remove duplicate reference in about-this-guide.md (rust-lang/rustc-dev-guide#1734)
- Explain more in depth what early and late bound generic parameters are (rust-lang/rustc-dev-guide#1732)
- add section for normalization with the new solver (rust-lang/rustc-dev-guide#1731)
- Improve cleanup-crew.md with an example post (rust-lang/rustc-dev-guide#1730)
2023-08-14 21:57:52 +02:00
dirreke 6d9847e50e update Cargo.lock 2023-08-15 01:27:26 +08:00
rustbot cd09d98fd2 Update books 2023-08-14 13:01:06 -04:00
bors 475be26d99 Auto merge of #114781 - fee1-dead-contrib:param-impl-source, r=davidtwco
Remove constness from `ImplSource::Param`
2023-08-14 15:24:41 +00:00
dirreke 74817b7053 Upgrade Object and related deps 2023-08-14 23:05:45 +08:00
Dirreck 712f448168 Update llvm.rs 2023-08-14 23:02:37 +08:00