Commit Graph

290443 Commits

Author SHA1 Message Date
bjorn3
4aed799d34 Update tidy exceptions 2025-05-25 18:58:21 +00:00
bjorn3
3816385b09 Merge commit '979dcf8e2f213e4f4b645cb62e7fe9f4f2c0c785' into sync_cg_clif-2025-05-25 2025-05-25 18:51:16 +00:00
bendn
245bf503e2 increase perf of charsearcher for single ascii characters 2025-05-26 01:50:13 +07:00
bjorn3
979dcf8e2f Rustup to rustc 1.89.0-nightly (5e16c6620 2025-05-24) 2025-05-25 18:39:17 +00:00
bjorn3
aa04a27268 Sync from rust 5e16c66206 2025-05-25 18:33:21 +00:00
quininer
45ed022d63 Add compiler tests for xray 2025-05-26 00:39:23 +08:00
Urgau
4765fd6b76 Fix unused_braces lint suggestion when encountering attributes 2025-05-25 18:17:43 +02:00
Michael Goulet
295a8d56f5 Make UNNECESSARY_TRANSMUTES into a HIR lint 2025-05-25 15:57:48 +00:00
Michael Goulet
5370c5753f Make PTR_TO_INTEGER_TRANSMUTE_IN_CONSTS into a HIR lint 2025-05-25 15:57:48 +00:00
Michael Goulet
a8ae2af967 hir_body_const_context should take LocalDefId 2025-05-25 15:57:24 +00:00
Urgau
77e295c39c Improve ambiguous_wide_pointer_comparisons lint compare diagnostics 2025-05-25 17:08:58 +02:00
bors
283db70ace Auto merge of #141545 - GuillaumeGomez:rollup-myrvuqq, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#141413 (Make #[cfg(version)] respect RUSTC_OVERRIDE_VERSION_STRING)
 - rust-lang/rust#141443 (make teach_help message for cast-before-pass-to-variadic more precise)
 - rust-lang/rust#141508 (bootstrap: clippy: set TESTNAME based on given paths)
 - rust-lang/rust#141512 (Avoid extra path trimming in method not found error)
 - rust-lang/rust#141530 (Added unstable feature doc comments to unstable book)
 - rust-lang/rust#141541 (Random nits)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-25 14:46:28 +00:00
Michael Goulet
84a3255cc3 Fast path fold_predicate in old canonicalizer 2025-05-25 14:12:17 +00:00
Guillaume Gomez
ec97b0f0b5 Update to new API 2025-05-25 15:27:32 +02:00
Guillaume Gomez
43cb506383 Rollup merge of #141541 - compiler-errors:nits, r=lcnr
Random nits

Two completely random commits that I didn't know where to integrate into another PR.

* Don't use the full type relation machinery to equate two regions (it's overkill).
* Add a comment that `select_in_new_trait_solver` shouldn't be used directly.

r? lcnr or reassign
2025-05-25 15:11:49 +02:00
Guillaume Gomez
5cc27332b5 Rollup merge of #141530 - ranger-ross:unstable-feature-doc-comments, r=Urgau
Added unstable feature doc comments to unstable book

This PR adds doc comments for unstables features in [compiler/rustc_feature/src/unstable.rs](d3a2440384/compiler/rustc_feature/src/unstable.rs (L190-L191)) to the unstable book feature pages.

Fixes rust-lang/rust#141528

Example features rendered

![image](https://github.com/user-attachments/assets/2b65f534-26f8-441f-ba29-65554c9154b7)

![image](https://github.com/user-attachments/assets/6077491b-ddaf-447e-9519-0bc110c7a893)

r? `@jyn514`
2025-05-25 15:11:49 +02:00
Guillaume Gomez
9460f64362 Rollup merge of #141512 - Noratrieb:stop-trimming-this-much, r=compiler-errors
Avoid extra path trimming in method not found error

Method errors have an extra check that force trim paths whenever the normal string is longer than 10 characters, which can be quite unhelpful when multiple items have the same name (for example an `Error`).

A user reported this force trimming as being quite unhelpful when they had a method error where the precise path of the `Error` mattered.

The code uses `tcx.short_string` already to get the normal path, which tries to be clever around trimming paths if necessary, so there is no reason for this extra force trimming.
2025-05-25 15:11:48 +02:00
Guillaume Gomez
c747b7da6c Rollup merge of #141508 - xtexx:gh-104200, r=onur-ozkan
bootstrap: clippy: set TESTNAME based on given paths

This addresses #104200 by setting the TESTNAME environment variable automatically based on the paths from run configs, marking a selected set of UI tests to be run.

Note that this does not filter out other unit tests using #[test].
2025-05-25 15:11:48 +02:00
Guillaume Gomez
d72bc29a33 Rollup merge of #141443 - RalfJung:c-variadic-teach-help, r=workingjubilee
make teach_help message for cast-before-pass-to-variadic more precise

r? `@workingjubilee`
based on your comment [here](https://github.com/rust-lang/rust/issues/44930#issuecomment-2199663198)
2025-05-25 15:11:47 +02:00
Guillaume Gomez
b0ae228007 Rollup merge of #141413 - est31:cfg_version_env_var, r=jieyouxu
Make #[cfg(version)] respect RUSTC_OVERRIDE_VERSION_STRING

The `#[cfg(version(...))]` feature is currently under-tested. Part of it is the difficulty that it is hard to write a test that never changes, while the version of the Rust compiler indeed *does* change.

PR #81468 added the first and so far only test of `#[cfg(version(...))]`'s functionality (there is one other test for the *syntax*, that also acts as feature gate). But that test uses a proc macro that parses the version: the text of the test doesn't contain the actual `#[cfg(version(...))]`.

This PR makes `#[cfg(version(...))]` respect `RUSTC_OVERRIDE_VERSION_STRING`, added by PR #124339, allowing us to virtually pin the rustc version and write tests from all directions against some specific version.

The PR also adds a functional test of `#[cfg(version(...))]` that leverages `RUSTC_OVERRIDE_VERSION_STRING`.

Pulled out of #141137.

Tracking issue: #64796
2025-05-25 15:11:47 +02:00
Guillaume Gomez
3646a09811 Improve code 2025-05-25 15:10:50 +02:00
Guillaume Gomez
2b292d1b78 Add regression test for #140739 2025-05-25 15:10:24 +02:00
Guillaume Gomez
4f3dd7b018 Tweak attribute rendering depending on wether or not it is a type alias 2025-05-25 15:10:23 +02:00
Guillaume Gomez
eb9f05481b Rename the document_* argument/field into is_type_alias 2025-05-25 15:09:12 +02:00
Guillaume Gomez
4194745687 Split Item::attributes method into three 2025-05-25 15:08:23 +02:00
Guillaume Gomez
560aec13ba Unify rendering of type aliases without ADT items 2025-05-25 15:05:56 +02:00
Guillaume Gomez
5f857a9871 Rename clean::Enum::variants method into non_stripped_variants 2025-05-25 15:05:56 +02:00
jyn
231e8cb34e add "Compiler environment variables" section to the unstable book 2025-05-25 08:46:58 -04:00
bors
88b3b520e8 Auto merge of #141086 - a1phyr:spec_advance_by, r=jhpratt
Implement `advance_by` via `try_fold` for `Sized` iterators

When `try_fold` is overriden, it is usually easier for compilers to optimize.

Example difference: https://iter.godbolt.org/z/z8cEfnKro
2025-05-25 11:34:43 +00:00
Ross Sullivan
3850b1faa2 feat(unstable-book): Added unstable feature doc comments as feature descriptions 2025-05-25 20:00:14 +09:00
Michael Goulet
9a8cf3dd0c Comment for not using select_in_new_trait_solver 2025-05-25 10:37:58 +00:00
Michael Goulet
7820d2caba Don't use relation just to equate regions in response 2025-05-25 10:37:43 +00:00
Chris Denton
c299e297ee Implement normalize lexically 2025-05-25 08:11:41 +00:00
bors
aa57e46e24 Auto merge of #141529 - jhpratt:rollup-8dle839, r=jhpratt
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#139831 (rustdoc: on mobile, make the sidebar full width and linewrap)
 - rust-lang/rust#140950 (More option optimization tests)
 - rust-lang/rust#141108 (Docs(lib): Fix `extract_if` docs)
 - rust-lang/rust#141361 (use `cfg_select!` to select the right `VaListImpl` definition)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-25 07:37:05 +00:00
Ralf Jung
4e8b8dad7f fix help message
Co-authored-by: Jubilee <workingjubilee@gmail.com>
2025-05-25 09:35:36 +02:00
Jacob Pratt
c27b7c2214 Rollup merge of #141361 - folkertdev:varargs-cfg, r=workingjubilee
use `cfg_select!` to select the right `VaListImpl` definition

tracking issue: https://github.com/rust-lang/rust/issues/44930

Just a bit of cleanup really.

We could use `PhantomInvariantLifetime<'f>` (https://github.com/rust-lang/rust/issues/135806) to make it more precise what that `PhantomData<&'f mut &'f c_void>` marker is doing. I'm not sure how ready that feature is though, `@jhpratt` are these types good to use internally?

---

Some research into the lifetimes of `VaList` and `VaListImpl`:

It's easy to see why the lifetime of these types should not be extended, a `VaList` or `VaListImpl` escaping its function is a bad idea. I don't currently see why coercing the lifetime to a shorter lifetime is problematic though, but probably I just don't understand variance well enough to see it. The history does not provide much explanation:

- 08140878fe original implementation
- b9ea653aee adds `VaListImpl<'f>`, but it is only covariant in `'f`
- https://github.com/rust-lang/rust/pull/62639 makes `VaListImpl<'f>` invariant over `'f` (because `VaList<'a, 'f>` is already invariant over `'f`, but I think that is just an implementation detail?)

Beyond that I don't see how the lifetime situation can be simplified significantly, e.g. this function really needs `'copy` to be unconstrained.

```rust
/// Copies the `va_list` at the current location.
pub unsafe fn with_copy<F, R>(&self, f: F) -> R
where
    F: for<'copy> FnOnce(VaList<'copy, 'f>) -> R,
{
    let mut ap = self.clone();
    let ret = f(ap.as_va_list());
    // SAFETY: the caller must uphold the safety contract for `va_end`.
    unsafe {
        va_end(&mut ap);
    }
    ret
}
```

`@rustbot` label +F-c_variadic
r? `@workingjubilee`
2025-05-25 04:00:57 +02:00
Jacob Pratt
3338ff7dcf Rollup merge of #141108 - PaulDance:fix-extract_if-docs, r=Mark-Simulacrum
Docs(lib): Fix `extract_if` docs

Various fixes to the documentation comments of the several `extract_if` collection methods available. It originally started with a small typo fix in `Vec`'s spotted when reading the 1.87 release notes, but then by looking at the others' for comparison in order to try determining what was the intended sentence, some inconsistencies were spotted. Therefore, some other changes are also proposed here to reduce these avoidable differences, going more and more nit-picky along the way. See the individual commits for more details about each change.

`@rustbot` label T-libs A-collections A-docs
2025-05-25 04:00:56 +02:00
Jacob Pratt
3f91bbcd5f Rollup merge of #140950 - clubby789:nonzero-ord-test, r=Mark-Simulacrum
More option optimization tests

I noticed that although adding a manual implementation for PartialOrd on Option in #122024, I didn't add a test so that we can easily check if this behavior has improved.

This also adds a couple of `should-fail` tests - this will allow us to remove these hacky implementations if upstream LLVM improves.
2025-05-25 04:00:55 +02:00
Jacob Pratt
045ac21c6f Rollup merge of #139831 - lolbinarycat:rustdoc-mobile-sidebar, r=GuillaumeGomez
rustdoc: on mobile, make the sidebar full width and linewrap

this is because the mobile sidebar cannot be resized, unlike on desktop.
2025-05-25 04:00:55 +02:00
xtex
4350fd170e bootstrap: clippy: set TESTNAME based on given paths
This addresses issue 104200 by setting the TESTNAME environment
variable automatically based on the paths from run configs,
marking a selected set of UI tests to be run.

Note that this does not filter out other unit tests using #[test].
2025-05-25 09:55:50 +08:00
jyn
4de3f8975a document existing setup 2025-05-24 19:49:21 -04:00
est31
f3245e48f9 Make #[cfg(version)] respect RUSTC_OVERRIDE_VERSION_STRING 2025-05-24 23:54:17 +02:00
Fluid
6d47489e56 improve the std::fs::create_dir_all docs related to atomicity 2025-05-25 00:34:56 +03:00
Noratrieb
01503d0c1e Avoid extra path trimming in method not found error
Method errors have an extra check that force trim paths whenever the
normal string is longer than 10 characters, which can be quite unhelpful
when multiple items have the same name (for example an `Error`).

A user reported this force trimming as being quite unhelpful when they
had a method error where the precise path of the `Error` mattered.

The code uses `tcx.short_string` already to get the normal path, which
tries to be clever around trimming paths if necessary, so there is no
reason for this extra force trimming.
2025-05-24 23:31:07 +02:00
bors
3d86494a0d Auto merge of #141518 - GuillaumeGomez:rollup-ivjep2j, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#140066 (Stabilize `<[T; N]>::as_mut_slice` as `const`)
 - rust-lang/rust#141105 (additional edge cases tests for `path.rs` 🧪 )
 - rust-lang/rust#141487 (Update askama to `0.14.0`)
 - rust-lang/rust#141498 (Use C-string literals to reduce boilerplate)
 - rust-lang/rust#141505 (rename internal panicking::try to catch_unwind)
 - rust-lang/rust#141511 (Cleanup CodegenFnAttrFlags)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-24 21:00:10 +00:00
Guillaume Gomez
7cd749deff Rollup merge of #141511 - Noratrieb:codegen-fn-attrs, r=compiler-errors
Cleanup CodegenFnAttrFlags

- Rename `USED` to `USED_COMPILER` to better reflect its behavior.
- Reorder some items to group the used and allocator flags together
- Renumber them without gaps
2025-05-24 21:23:50 +02:00
Guillaume Gomez
76ca0e2d62 Rollup merge of #141505 - RalfJung:catch_unwind, r=Noratrieb
rename internal panicking::try to catch_unwind

The public function is called `catch_unwind`, the intrinsic at some point got renamed to `catch_unwind` -- there's no reason to have the internal implementation of this still be called `try`, so let's rename it to match the rest.
2025-05-24 21:23:49 +02:00
Guillaume Gomez
c4a313ad06 Rollup merge of #141498 - tamird:cstr-example-noise, r=jhpratt
Use C-string literals to reduce boilerplate

Reduce boilerplate in doctests by replacing fallible function calls with
literals.
2025-05-24 21:23:49 +02:00
Guillaume Gomez
0846035d2d Rollup merge of #141487 - GuillaumeGomez:update-askama, r=notriddle
Update askama to `0.14.0`

[Askama 0.14.0 release notes](https://github.com/askama-rs/askama/releases/tag/v0.14.0)

Just one change needed for a filter in rustdoc.

r? ```@notriddle```
2025-05-24 21:23:48 +02:00
Guillaume Gomez
284aaee0c1 Rollup merge of #141105 - GrantBirki:grantbirki/path-tests, r=jhpratt
additional edge cases tests for `path.rs` 🧪

This pull request adds a few new edge case tests to the `std::path` module. The new tests cover scenarios such as paths with only separators, non-ASCII and Unicode characters, embedded new lines, etc. Each new test is documented with some helpful in-line comments as well.
2025-05-24 21:23:48 +02:00