1
Fork 0
Commit graph

283826 commits

Author SHA1 Message Date
Nicholas Nethercote
8af0aa25c3 Remove [lints.rust] section from rustc_type_ir.
It was added in #129523 to enable building on stable when there were
`cfg(bootstrap)` occurrences in the crate. But those are gone now, so
the section can be removed.
2025-03-08 08:38:28 +11:00
Thalia Archibald
38fad984c6 compiler: Use size_of from the prelude instead of imported
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the
prelude instead of importing or qualifying them.

These functions were added to all preludes in Rust 1.80.
2025-03-07 13:37:04 -08:00
Guillaume Gomez
17dd2b179c Mention env and option_env macros in std::env::var docs 2025-03-07 22:00:36 +01:00
Matthias Krüger
e0c2636df5 remove clones 2025-03-07 21:48:54 +01:00
bors
f5a1ef7121 Auto merge of #138177 - matthiaskrgr:rollup-y0ikkzz, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #134797 (Ergonomic ref counting)
 - #137549 (Clean up various LLVM FFI things in codegen_llvm)
 - #137977 (Reduce `kw::Empty` usage, part 1)
 - #138042 (Suggest struct or union to add generic that impls trait)
 - #138141 (tests: fix some typos in comment)
 - #138150 (Streamline HIR intravisit `visit_id` calls for items)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-07 20:36:56 +00:00
Thalia Archibald
06eecca264 Allow anyone to relabel CI-spurious-* 2025-03-07 12:36:33 -08:00
Prajwal S N
b6f1ce8071
fix: do not apply editorconfig to git commit msg
The `max_line_length` property was set to 100 for all filetypes, which
led to git commit messages being wrapped at 100 characters instead of
the usual 75. This introduces an exception for the special file used by
git to write commit messages.

Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-03-08 01:44:27 +05:30
Prajwal S N
e98837f558
fix(hir): VariantDef is impl HasSource
A new syntax node `ast::VariantDef` has been introduced to map between the HIR node and the AST.
The files have been updated with `cargo test -p xtask`.

Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-03-08 01:25:27 +05:30
bjorn3
22d0440993 Add comments 2025-03-07 19:11:13 +00:00
bjorn3
ae5687e4b0 Fully test the alloc crate through alloctests
For the tests that make use of internal implementation details, we
include the module to test using #[path] in alloctests now.
2025-03-07 19:11:13 +00:00
bjorn3
701bedc323 Move last remaining Rc test to alloctests 2025-03-07 19:11:13 +00:00
bjorn3
be1e0b786d Move most Rc tests to alloctests 2025-03-07 19:11:13 +00:00
bjorn3
fb04372dc5 Move all alloc integration tests to a new alloctests crate 2025-03-07 19:11:11 +00:00
Matthias Krüger
b772fa6165
Rollup merge of #138150 - nnethercote:streamline-intravisit-visit_id, r=oli-obk
Streamline HIR intravisit `visit_id` calls for items

A small clean up.
2025-03-07 19:15:36 +01:00
Matthias Krüger
282a37fa75
Rollup merge of #138141 - tcpdumppy:master, r=compiler-errors
tests: fix some typos in comment

fix some typos in comment
2025-03-07 19:15:36 +01:00
Matthias Krüger
e70adad70a
Rollup merge of #138042 - xizheyin:issue-135759, r=nnethercote
Suggest struct or union to add generic that impls trait

Fixes #135759

cc ```@tdittr```
2025-03-07 19:15:35 +01:00
Matthias Krüger
0defc4f27f
Rollup merge of #137977 - nnethercote:less-kw-Empty-1, r=spastorino
Reduce `kw::Empty` usage, part 1

This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way.

r? ```@spastorino```
2025-03-07 19:15:34 +01:00
Matthias Krüger
63c548d82c
Rollup merge of #137549 - oli-obk:llvm-ffi, r=davidtwco
Clean up various LLVM FFI things in codegen_llvm

cc ```@ZuseZ4``` I touched some autodiff parts

The major change of this PR is [bfd88ce](https://github.com/rust-lang/rust/pull/137549/commits/bfd88cead0dd79717f123ad7e9a26ecad88653cb) which makes `CodegenCx` generic just like `GenericBuilder`

The other commits mostly took advantage of the new feature of making extern functions safe, but also just used some wrappers that were already there and shrunk unsafe blocks.

best reviewed commit-by-commit
2025-03-07 19:15:34 +01:00
Matthias Krüger
f5a143f796
Rollup merge of #134797 - spastorino:ergonomic-ref-counting-1, r=nikomatsakis
Ergonomic ref counting

This is an experimental first version of ergonomic ref counting.

This first version implements most of the RFC but doesn't implement any of the optimizations. This was left for following iterations.

RFC: https://github.com/rust-lang/rfcs/pull/3680
Tracking issue: https://github.com/rust-lang/rust/issues/132290
Project goal: https://github.com/rust-lang/rust-project-goals/issues/107

r? ```@nikomatsakis```
2025-03-07 19:15:33 +01:00
Esteban Küber
db2fb7102e fix rebase 2025-03-07 17:55:08 +00:00
Esteban Küber
a04c47a0f3 Make trimming logic work on more than one span at a time 2025-03-07 17:55:08 +00:00
Esteban Küber
c75da0eda6 Fix multiline span start special case 2025-03-07 17:55:08 +00:00
Esteban Küber
cb82b79f02 Fix rustdoc test 2025-03-07 17:55:08 +00:00
Esteban Küber
f1c751bc1a Refactor emitter to better account for unicode chars when trimming
Change the way that underline positions are calculated by delaying using
the "visual" column position until the last possible moment, instead
using the "file"/byte position in the file, and then calculating visual
positioning as late as possible. This should make the underlines more
resilient to non-1-width unicode chars.

Unfortunately, as part of this change (which fixes some visual bugs)
comes with the loss of some eager tab codepoint handling, but the output
remains legible despite some minor regression on the "margin trimming"
logic.
2025-03-07 17:55:08 +00:00
Esteban Küber
72326bfe40 On long spans, trim the middle of them to make them fit in the terminal width
When encountering a single line span that is wider than the terminal, we keep context at the start and end of the span but otherwise remove the code from the middle. This is somewhat independent from whether the left and right margins of the output have been trimmed as well.

```
error[E0308]: mismatched types
  --> $DIR/long-span.rs:6:15
   |
LL | ... = [0, 0, 0, 0, ..., 0, 0];
   |       ^^^^^^^^^^^^^...^^^^^^^ expected `u8`, found `[{integer}; 1681]`
```

Address part of #137680 (missing handling of the long suggestion). Fix #125581.
2025-03-07 17:55:08 +00:00
Esteban Küber
d975bd3a67 Remove highlighting of spans on -Zteach
`-Zteach` is perma-unstable, barely used, the highlighting logic buggy and the flag being passed around is tech-debt. We should likely remove `-Zteach` in its entirely.
2025-03-07 17:55:08 +00:00
Chris Denton
3cb53df1fe
Return OutOfMemoryError and update docs 2025-03-07 17:51:56 +00:00
Chris Denton
0dfe2ae3fb
Windows: Use MoveFileEx by default in fs:rename 2025-03-07 17:51:49 +00:00
Michael Goulet
bbc80a819b Delay bug for negative auto trait rather than ICEing 2025-03-07 17:20:57 +00:00
Jana Dönszelmann
4203e9c56d
depend more on attr_data_structures and move find_attr! there 2025-03-07 18:05:42 +01:00
bors
c53af1ccd0 Auto merge of #138148 - onur-ozkan:fix-llvm-bitcode-build, r=jieyouxu
use target compiler on llvm-bitcode-linker

The build compiler is already resolved inside the `ToolBuild` step, so we should pass only the target compilers for `Mode::ToolRustc` tools.

Fixes https://github.com/rust-lang/rust/issues/138123

r? ghost

try-job: dist-powerpc64le-linux
2025-03-07 16:49:59 +00:00
Arthur Baars
bdf602a594 Log build script error output in load_cargo::load_workspace_at 2025-03-07 16:07:56 +01:00
bors
03eb454523 Auto merge of #138155 - matthiaskrgr:rollup-xq5buio, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #137674 (Enable `f16` for LoongArch)
 - #138034 (library: Use `size_of` from the prelude instead of imported)
 - #138060 (Revert #138019 after further discussion about how hir-pretty printing should work)
 - #138073 (Break critical edges in inline asm before code generation)
 - #138107 (`librustdoc`: clippy fixes)
 - #138111 (Use `default_field_values` for `rustc_errors::Context`, `rustc_session::config::NextSolverConfig` and `rustc_session::config::ErrorOutputType`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-07 13:47:27 +00:00
许杰友 Jieyou Xu (Joe)
c9c572cd92 Document that rmake.rs/run-make-support may not use unstable features 2025-03-07 19:09:41 +08:00
许杰友 Jieyou Xu (Joe)
224f287f32 Fix broken-pipe-no-ice to not depend on unstable anonymous_pipe feature 2025-03-07 19:08:11 +08:00
许杰友 Jieyou Xu (Joe)
d47e5a371b Temporarily depend on os_pipe in run-make-support and re-export it
For `broken-pipe-no-ice` until std `anonymous_pipe` stabilizes.
2025-03-07 19:08:11 +08:00
许杰友 Jieyou Xu (Joe)
9befcfd0f4 Fix cross-lang-lto to not use path_file_prefix 2025-03-07 19:08:05 +08:00
许杰友 Jieyou Xu (Joe)
da57f1418f Fix issue-107495-archive-permissions to not rely on rustc_private 2025-03-07 19:07:55 +08:00
许杰友 Jieyou Xu (Joe)
bd884d8043 Prevent rmake.rs from using any nightly/unstable features 2025-03-07 19:07:27 +08:00
Jieyou Xu
ec3cde249f Apply --cfg windows_raw_dylib for bootstrap tools too
This is already applied for rustc/std tools. This is needed to make
`windows` crates avoid trying to depend on a generated
`windows.0.xx.0.lib`.
2025-03-07 19:07:27 +08:00
bors
59a9b9e9d7 Auto merge of #138151 - matthiaskrgr:rollup-j0p6ed1, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #136667 (Revert vita's c_char back to i8)
 - #137107 (Override default `Write` methods for cursor-like types)
 - #137777 (Specialize `OsString::push` and `OsString as From` for UTF-8)
 - #137832 (Fix crash in BufReader::peek())
 - #137904 (Improve the generic MIR in the default `PartialOrd::le` and friends)
 - #138115 (Suggest typo fix for static lifetime)
 - #138125 (Simplify `printf` and shell format suggestions)
 - #138129 (Stabilize const_char_classify, const_sockaddr_setters)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-07 10:40:12 +00:00
Nicholas Nethercote
af92a33dee Make synthetic RPITIT assoc ty name handling more rigorous.
Currently it relies on special treatment of `kw::Empty`, which is really
easy to get wrong. This commit makes the special case clearer in the
type system by using `Option`. It's a bit clumsy, but the synthetic name
handling itself is a bit clumsy; better to make it explicit than sneak
it in.

Fixes #133426.
2025-03-07 20:59:45 +11:00
Nicholas Nethercote
7943932384 Pass Option<Symbol> to def_path_data/create_def methods.
It's clearer than using `kw::Empty` to mean `None`.
2025-03-07 20:53:00 +11:00
Nicholas Nethercote
e7bea57ce4 Fix a typo in the crashtest output. 2025-03-07 20:44:08 +11:00
Matthias Krüger
acc7de6c77
Rollup merge of #138111 - estebank:use-dfv, r=nnethercote
Use `default_field_values` for `rustc_errors::Context`, `rustc_session::config::NextSolverConfig` and `rustc_session::config::ErrorOutputType`

Wanted to see  where `#![feature(default_field_values)]` could be used in the codebase. These three seemed like no-brainers. There are a bunch of more places where we could remove manual `Default` impls, but they `derive` other traits that rely on `syn`, which [doesn't yet support `default_field_values`](https://github.com/dtolnay/syn/issues/1774).
2025-03-07 10:12:48 +01:00
Matthias Krüger
4b6a22d05c
Rollup merge of #138107 - yotamofek:pr/rustdoc/clippy, r=GuillaumeGomez
`librustdoc`: clippy fixes

First commit is all machine-generated fixes,
next two are some more lints fixed by hand/misc. cleanups

Inspired by the redundant `.and_then()` added in https://github.com/rust-lang/rust/pull/137320 , and [this comment](https://github.com/rust-lang/rust/pull/138090#discussion_r1983111856)

r? ```@GuillaumeGomez```
2025-03-07 10:12:47 +01:00
Matthias Krüger
1155f01c5a
Rollup merge of #138073 - tmiasko:inline-asm-critical-edges, r=bjorn3
Break critical edges in inline asm before code generation

An inline asm terminator defines outputs along its target edges -- a
fallthrough target and labeled targets. Code generation implements this
by inserting code directly into the target blocks. This approach works
only if the target blocks don't have other predecessors.

Establish required invariant by extending existing code that breaks
critical edges before code generation.

Fixes #137867.

r? ``@bjorn3``
2025-03-07 10:12:46 +01:00
Matthias Krüger
f42c933c29
Rollup merge of #138060 - jdonszelmann:revert-138019, r=compiler-errors
Revert #138019 after further discussion about how hir-pretty printing should work

After some more discussion, #138019 was probably merged a little fast. Though there probably is a real bug in pretty printing, it is not feasible to add similar pretty printing routines for all attributes, and making this specific exception is likely not desired either. For more context, see post-merge comments on #138019

I kept the tests around, but reverted the hir-pretty change.

r? ```@compiler-errors```
2025-03-07 10:12:45 +01:00
Matthias Krüger
b834632071
Rollup merge of #138034 - thaliaarchi:use-prelude-size-of, r=tgross35
library: Use `size_of` from the prelude instead of imported

Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them.

These functions were added to all preludes in Rust 1.80.

try-job: test-various
try-job: x86_64-gnu
try-job: x86_64-msvc-1
2025-03-07 10:12:44 +01:00
Matthias Krüger
6e7d1353d1
Rollup merge of #137674 - heiher:enable-f16-loong, r=tgross35
Enable `f16` for LoongArch

Blocked on https://github.com/rust-lang/compiler-builtins/pull/770

r? ```@tgross35```

Tracking issue for f16: https://github.com/rust-lang/rust/issues/116909

try-job: dist-loongarch64-linux
try-job: dist-loongarch64-musl
2025-03-07 10:12:43 +01:00