Commit Graph

270270 Commits

Author SHA1 Message Date
Ralf Jung
10723c2896 remove support for extern-block const intrinsics 2024-11-04 23:27:45 +01:00
Ralf Jung
7934f26613 convert all const-callable intrinsics into the new form (without extern block) 2024-11-04 23:21:22 +01:00
Ralf Jung
ffad9aac27 mark some target features as 'forbidden' so they cannot be (un)set
For now, this is just a warning, but should become a hard error in the future
2024-11-04 22:56:47 +01:00
Jonathan Dönszelmann
f4b72dcff0
Move two attribute lints to be early pass (post expansion) 2024-11-04 22:47:22 +01:00
bors
fbab78289d Auto merge of #132594 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-11-04 20:20:16 +00:00
NotWearingPants
107b4fdba2
docs: fix grammar in doc comment at unix/process.rs 2024-11-04 20:42:21 +02:00
Eduardo Sánchez Muñoz
4872b6bcbd Improve example of impl Pattern for &[char]
The previous version used `['l', 'l']` as pattern, which would suggest that it matches the `ll` of `Hello world` as a whole.
2024-11-04 19:08:28 +01:00
Eugene Shamis
65d8f1b8bf Fixed typo, rebased 2024-11-04 12:43:57 -05:00
bors
82c24eccad Auto merge of #132603 - matthiaskrgr:rollup-ikzofgc, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #132355 (Fix compiler panic with a large number of threads)
 - #132486 (No need to instantiate binder in `confirm_async_closure_candidate`)
 - #132544 (Use backticks instead of single quotes for library feature names in diagnostics)
 - #132559 (find the generic container rather than simply looking up for the assoc with const arg)
 - #132579 (add rustc std workspace crate sources)
 - #132583 (Suggest creating unary tuples when types don't match a trait)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-04 17:39:34 +00:00
Eugene Shamis
37f48da802 Updated SAFETY comment to address underflow 2024-11-04 12:36:24 -05:00
Eugene Shamis
02a1ab8071 Replace checked slice indexing by unchecked to support panic-free code
Fixes #126425

Replace the potentially panicking `[]` indexing with `get_unchecked()`
to prevent linking with panic-related code.
2024-11-04 12:36:24 -05:00
rustbot
75c943ed2d Update books 2024-11-04 09:29:10 -08:00
Matthias Krüger
a4f323ce9c
Rollup merge of #132583 - mejrs:tuples, r=compiler-errors
Suggest creating unary tuples when types don't match a trait

When you want to have a variadic function, a common workaround to implement this is to create a trait and then implement that trait for various tuples. For example in `pyo3` there exists
```rust
/// Calls the object with only positional arguments.
pub fn call1(&self, args: impl IntoPy<Py<PyTuple>>) -> PyResult<&PyAny> {
   ...
}
```

with various impls like
```rust
impl<A: IntoPy<PyObject> IntoPy<Py<PyAny>> for (A,)
impl<A: IntoPy<PyObject, B: IntoPy<PyObject> IntoPy<Py<PyAny>> for (A, B)
... etc
```

This means that if you want to call the method with a single item you have to create a unary tuple, like `(x,)`, rather than just `x`.

This PR implements a suggestion to do that, if applicable.
2024-11-04 18:12:48 +01:00
Matthias Krüger
46ae1555e2
Rollup merge of #132579 - RalfJung:rustc-std-workspace-crates, r=Amanieu
add rustc std workspace crate sources

This adds the sources for the crates listed at https://crates.io/search?q=rustc-std-workspace in this repo. The first commit adds the original sources as downloaded from crates.io (with `Cargo.toml.orig` moved back over `Cargo.toml`), and adds a README explaining what this is about. The 2nd commit updates the sources to make the core and alloc crates re-exports of the "actual" core and alloc crates, as was already the case with `std`, and also adds a `repository` link to the manifest so one can figure out where to find these crates.

I bumped the version for the core and alloc crates in the hope that the new versions can be published on crates.io shortly after this PR lands.

See [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/rustc-std-workspace-core.20crate.20is.20empty) for a bit more context.

r? `@Amanieu`
2024-11-04 18:12:47 +01:00
Matthias Krüger
909574e411
Rollup merge of #132559 - bvanjoi:fix-132534, r=compiler-errors
find the generic container rather than simply looking up for the assoc with const arg

Fixes #132534

This issue is caused by mismatched generic parameters. Previously, it tried to find `T` in `trait X`, but after this change, it will find `T` in `fn a`.

r? `@compiler-errors`  as this assertion was introduced by you.
2024-11-04 18:12:47 +01:00
Matthias Krüger
b9db639ea5
Rollup merge of #132544 - dianne:unstable-library-feature-backticks, r=compiler-errors
Use backticks instead of single quotes for library feature names in diagnostics

This PR changes the text of library feature errors for using unstable or body-unstable items. Displaying library feature names in backticks is consistent with other diagnostics (e.g. those from `rustc_passes`) and with the `reason`s on unstable attributes in the library. Additionally, this simplifies diagnostics when supporting multiple unstable attributes on items (see #131824) since `DiagSymbolList` also displays symbols using backticks.
2024-11-04 18:12:46 +01:00
Matthias Krüger
c89a6cd0ad
Rollup merge of #132486 - compiler-errors:no-binder, r=lcnr
No need to instantiate binder in `confirm_async_closure_candidate`

Removes a FIXME that is redundant. No longer needed since #122267.
2024-11-04 18:12:45 +01:00
Matthias Krüger
31ad4e4a54
Rollup merge of #132355 - practicalrs:fix_117638, r=SparrowLii
Fix compiler panic with a large number of threads

Hi,

This PR is an attempt to fix the problem described here https://github.com/rust-lang/rust/issues/117638 using the solution suggested in this comment https://github.com/rust-lang/rust/issues/117638#issuecomment-1800925067

Best regards,
Michal
2024-11-04 18:12:45 +01:00
mejrs
c88ba28d9a document type_implements_trait 2024-11-04 18:08:30 +01:00
Guillaume Gomez
5dfbc0383d Rename DocContext::is_json into DocContext::is_json_output 2024-11-04 17:29:57 +01:00
Guillaume Gomez
0eff07ee4e Add UI regressions tests for rustdoc --show-coverage option 2024-11-04 14:46:04 +01:00
Guillaume Gomez
e9161db5b5 Fix invalid coverage computation when --output-format=json is enabled 2024-11-04 14:28:35 +01:00
bors
432972cae6 Auto merge of #132275 - compiler-errors:deref-effects, r=fee1-dead
Register `~const` preds for `Deref` adjustments in HIR typeck

This doesn't *do* anything yet, since `Deref` and `DerefMut` aren't constified, and we explicitly don't error on calling non-const trait methods in HIR yet -- presumably that will wait until std is re-constified. But I'm confident this logic is correct, and this (afaict?) is the only major hole left in enforcing `~const` in HIR typeck.

r? fee1-dead
2024-11-04 12:12:55 +00:00
Gabriel Bjørnager Jensen
7faa84e20e Stabilise 'const_char_encode_utf16'; 2024-11-04 13:09:44 +01:00
mejrs
5a48fe2c20 Suggest creating unary tuples 2024-11-04 12:06:19 +01:00
bors
ca87b535a0 Auto merge of #132250 - nnethercote:rustc_borrowck-cleanups, r=compiler-errors
`rustc_borrowck` cleanups

A bunch of cleanups I made while reading over this crate.

r? `@lqd`
2024-11-04 09:19:05 +00:00
Laurențiu Nicola
0cd3fb2da9
Merge pull request #18472 from lnicola/reinterpret-function-casing
minor: Fix feature name casing
2024-11-04 08:39:50 +00:00
Laurențiu Nicola
9f4e71940f Fix feature name casing 2024-11-04 10:27:32 +02:00
Ralf Jung
b2fe71a2fe miri: update ABI compat checks to accept Option-like types 2024-11-04 07:50:40 +01:00
bors
56c6a2f9b1 Auto merge of #132586 - workingjubilee:rollup-qrmn49a, r=workingjubilee
Rollup of 4 pull requests

Successful merges:

 - #131222 (Generate correct symbols.o for sparc-unknown-none-elf)
 - #132423 (remove const-support for align_offset and is_aligned)
 - #132565 (Reduce dependence on the target name)
 - #132576 (remove attribute ids from hir stats (they're simply not needed))

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-04 06:45:33 +00:00
Ralf Jung
b12745863e update rustc-std-workspace crates
- make rustc-std-workspace-core/alloc re-exports of their underlying crates, like std
= cleanup manifests
2024-11-04 07:45:15 +01:00
Nicholas Nethercote
e0e7a432db BorrowckDiags tweaks.
- Store a mut ref to a `BorrowckDiags` in `MirBorrowckCtxt` instead of
  owning it, to save having to pass ownership in and out of
  `promoted_mbcx`.
- Use `buffer_error` in a couple of suitable places.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
ce2f0b4ce9 Simplify LocalUseMapBuild.
It has four different `insert` methods, with some duplication. This
commit finds the commonality and removes them all.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
6ecf80e1ad Merge BorrowCheckContext into TypeChecker.
Because there is no real reason for it to be a separate struct.
- It has no methods.
- It's easy to confuse with the nearby `BorrowckInferContext` (which
  does have methods).
- The `mut` ref to it in `TypeChecker` makes it seem like any of the
  fields within might be mutable, but only two (`all_facts` and
  `constraints`) actually are.
- Two of the fields are `pub(crate)` but can be private.

This change makes a lot of code more concise and readable.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
f86c76a782 Remove unnecessary qualifiers. 2024-11-04 17:36:25 +11:00
Nicholas Nethercote
a07011bde2 Remove unnecessary continue. 2024-11-04 17:36:25 +11:00
Nicholas Nethercote
e23bdd68f9 Remove ToUniverseInfo impl for CanonicalQueryInput<CustomTypeOp>.
It's unused.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
7901c03d2d Merge UniverseInfo and UniverseInfoInner.
It's strange to have a struct that contains a single anonymous field
that is an enum. This commit merges them. This does require increasing
the visibility of `TypeOfInfo` to `pub(crate)`, but that seems
worthwhile.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
bf1a5c2b7f Tidy up comments and some formatting.
Mostly by wrapping overly long comment lines, plus a few other things.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
ad875529bf Move some use declarations.
So they're all in the one place. Also prepend with `crate::`, à la the
`unqualified_local_imports` lint.
2024-11-04 17:36:23 +11:00
Nicholas Nethercote
981dc02eaf Revert "Avoid nested replacement ranges" from #129346.
It caused a test regression in the `cfg_eval.rs` crate. (The bugfix
in #129346 was in a different commit; this commit was just a code
simplification.)
2024-11-04 15:57:35 +11:00
Michael Goulet
e3bd6b27f3 Fix minicore, add tests based off of it 2024-11-04 04:51:32 +00:00
Michael Goulet
7bd595d216 Make sure to enforce ~const DerefMut on mutability fixup 2024-11-04 04:51:32 +00:00
Michael Goulet
e03e9abe3c Register const preds for Deref adjustments in HIR typeck 2024-11-04 04:51:31 +00:00
Michael Goulet
d458f850aa ty::BrK -> ty::BoundRegionKind::K 2024-11-04 04:45:52 +00:00
Michael Goulet
883f8705d4 Remove BorrowKind glob, make names longer 2024-11-04 04:45:52 +00:00
Michael Goulet
be4b0261c2 ty::KContainer -> ty::AssocItemContainer::K 2024-11-04 04:45:52 +00:00
Michael Goulet
8e6af16192 Remove the trivial constkind imports 2024-11-04 04:45:51 +00:00
Nicholas Nethercote
6676cec925 Reduce visibilities. 2024-11-04 15:43:45 +11:00
bohan
6026a0f6c9 find the generic container rather than simply looking up for the assoc with const arg 2024-11-04 12:17:44 +08:00