Commit Graph

285180 Commits

Author SHA1 Message Date
Matthias Krüger
3e968c7e9f
Rollup merge of - oli-obk:resolver-item-lifetime, r=compiler-errors
Do not treat lifetimes from parent items as influencing child items

```rust
struct A;
impl Bar<'static> for A {
    const STATIC: &str = "";
    //            ^ no future incompat warning
}
```

has no future incompat warning, because there is no ambiguity. But

```rust
struct C;
impl Bar<'_> for C {
//       ^^ this lifeimte
    const STATIC: &'static str = {
        struct B;
        impl Bar<'static> for B {
            const STATIC: &str = "";
            // causes     ^ to emit a future incompat warning
        }
        ""
    };
}
```

had one before this PR, because the impl for `B` (which is just a copy of `A`) thought it was influenced by a lifetime on the impl for `C`.

I double checked all other `lifetime_ribs` iterations and all of them do check for `Item` boundaries. This feels very fragile tho, and ~~I think we should do not even be able to see ribs from parent items, but that's a different refactoring that I'd rather not do at the same time as a bugfix~~. EDIT: ah nevermind, this is needed for improving diagnostics like "use of undeclared lifetime" being "can't use generic parameters from outer item" instead.

r? `@compiler-errors`
2025-03-28 21:18:32 +01:00
Matthias Krüger
7c0a14f030
Rollup merge of - a1phyr:better_take, r=joboet
`io::Take`: avoid new `BorrowedBuf` creation in some case

If `self.limit == buf.capacity()`, doing the whole `BorrowedBuf` dance is not necessary.
2025-03-28 21:18:31 +01:00
Matthias Krüger
b6699318fa
Rollup merge of - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2025-03-28 21:18:30 +01:00
Matthias Krüger
52aed95060
Rollup merge of - fmease:fix-tait-atpit-gating, r=oli-obk
Fix TAIT & ATPIT feature gating in the presence of anon consts

Fixes  (https://github.com/rust-lang/rust/issues/119924#issuecomment-1928659690).

r? oli-obk or anybody else
2025-03-28 21:18:30 +01:00
Matthias Krüger
660e8633f3
Rollup merge of - barafael:patch-1, r=joboet
Fix formatting nit in process.rs

Minor formatting issue in `process.rs`.
2025-03-28 21:18:29 +01:00
Matthias Krüger
3060c77815
Rollup merge of - m-ou-se:pin-macro-tests, r=joboet
Put pin!() tests in the right file.

In , these tests were put in `tests/pin.rs`, but they should go in `tests/pin_macro.rs`.

r? `@jdonszelmann`
2025-03-28 21:18:28 +01:00
Matthias Krüger
e82557e9ad
Rollup merge of - xizheyin:issue-138969, r=RalfJung
Explain one-past-the-end pointer in std library

Closing 

r? libs
2025-03-28 21:18:27 +01:00
León Orell Valerian Liehr
7a295d1be0
Fix TAIT & ATPIT feature gating in the presence of anon consts 2025-03-28 18:15:23 +01:00
Oli Scherer
dabee5d563 Do not treat lifetimes from parent items as influencing child items 2025-03-28 17:06:00 +00:00
bors
19f42cb9bb Auto merge of - matthiaskrgr:rollup-2bk2fb4, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 -  (update outdated doc with new example)
 -  (Greatly simplify doctest parsing and information extraction)
 -  (rustc_resolve: fix instability in lib.rmeta contents)
 -  (feat(config): Add ChangeId enum for suppressing warnings)
 -  (Update target maintainers for thumb targets to reflect new REWG Arm team name)
 -  (bootstrap: update `test_find` test)
 -  (Remove ScopeDepth)

Failed merges:

 -  (bootstrap: Avoid cloning `change-id` list)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-28 16:37:12 +00:00
Benoît du Garreau
9055765ce1 io::Take: avoid new BorrowedBuf creation in some case 2025-03-28 16:36:49 +01:00
xizheyin
074edbd89c std: Explain range follows standard half-open range in offset
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-03-28 22:28:48 +08:00
Ralf Jung
7310925076 update lockfile 2025-03-28 15:28:14 +01:00
Ralf Jung
a8616f2115
Merge pull request from RalfJung/mangle_internal_symbol_cache
cache mangle_internal_symbol results
2025-03-28 13:42:50 +00:00
Rafael Bachmann
0f418520c6
Fix formatting nit in process.rs 2025-03-28 13:22:09 +01:00
Matthias Krüger
310bebc487
Rollup merge of - m-ou-se:remove-scope-depth, r=oli-obk
Remove ScopeDepth

The scope depth was tracked, but never seemed to be used for anything.

Every single place that used `(Scope, ScopeDepth)`, matched it on `(p, _)`.
2025-03-28 12:59:58 +01:00
Matthias Krüger
ea56904feb
Rollup merge of - onur-ozkan:less-verbose-bootstrap-test, r=Kobzol
bootstrap: update `test_find` test

`cc::Build::get_archiver` is noisy on the `arm-linux-androideabi` target and constantly printing `llvm-ar --version` output during bootstrap tests on all platforms.
2025-03-28 12:59:58 +01:00
Matthias Krüger
5261a0aedf
Rollup merge of - adamgreig:thumb-target-maintainers, r=Noratrieb
Update target maintainers for thumb targets to reflect new REWG Arm team name

Closes 

The name of the team responsible for these targets has changed as the team was merged with other Arm-related teams (see https://github.com/rust-embedded/wg/pull/818). The link gives an up-to-date list of github usernames that can be pinged, whereas the old email address is not very actively maintained or tracked.
2025-03-28 12:59:57 +01:00
Matthias Krüger
60833b1475
Rollup merge of - Shourya742:2025-03-25-add-ignore-to-change-id, r=Kobzol
feat(config): Add ChangeId enum for suppressing warnings

closes: 
2025-03-28 12:59:56 +01:00
Matthias Krüger
bdc5adfe78
Rollup merge of - durin42:rmeta-stability, r=fmease
rustc_resolve: fix instability in lib.rmeta contents

rust-lang/rust@23032f31c9 accidentally introduced some nondeterminism in the ordering of lib.rmeta files, which we caught in our bazel-based builds only recently due to being further behind than normal. In my testing, this fixes the issue.
2025-03-28 12:59:55 +01:00
Matthias Krüger
ad87732cae
Rollup merge of - GuillaumeGomez:simplify-doctest-parsing, r=fmease
Greatly simplify doctest parsing and information extraction

The original process was pretty terrible, as it tried to extract information such as attributes by performing matches over tokens like `#!`, which doesn't work very well considering you can have `#   ! [`, which is valid.

Also, it now does it in one pass: if the parser is happy, then we try to extract information, otherwise we return early.

r? `@fmease`
2025-03-28 12:59:55 +01:00
Matthias Krüger
9597bf72dd
Rollup merge of - mu001999-contrib:update-doc, r=wesleywiser
update outdated doc with new example

update the illegal definition example because we can compile `struct Ref<'a, T> { x: &'a T }` ([play](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=2eb2f8800d423c316b545c864623ae16))
2025-03-28 12:59:54 +01:00
Ralf Jung
024c8c3063 cache mangle_internal_symbol results 2025-03-28 12:07:33 +01:00
bors
2a06022951 Auto merge of - bjorn3:string_merging, r=tmiasko
Avoid wrapping constant allocations in packed structs when not necessary

This way LLVM will set the string merging flag if the alloc is a nul terminated string, reducing binary sizes.

try-job: armhf-gnu
2025-03-28 10:18:32 +00:00
Guillaume Gomez
87d524bef6 Update coverage-run-rustdoc output 2025-03-28 10:35:53 +01:00
bjorn3
5c82a59bd3 Add test and comment 2025-03-28 09:19:57 +00:00
bjorn3
a5fa12b6b9 Avoid wrapping constant allocations in packed structs when not necessary
This way LLVM will set the string merging flag if the alloc is a nul
terminated string, reducing binary sizes.
2025-03-28 09:19:57 +00:00
Mara Bos
c41476034d Put pin!() tests in the right file. 2025-03-28 10:18:04 +01:00
Mara Bos
deeac1c588 Remove outdated comment. 2025-03-28 08:36:16 +01:00
Mara Bos
3a9a5770ef Remove ScopeDepth entirely.
The scope depth was tracked, but never actually used for anything.
2025-03-28 08:31:47 +01:00
onur-ozkan
d5f7e71d5c bootstrap: update test_find test
`cc::Build::get_archiver` is noisy on the `arm-linux-androideabi` target and
constantly printing `llvm-ar --version` output during bootstrap tests on all platforms.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-28 10:15:51 +03:00
bors
e77a8f439c Auto merge of - jhpratt:rollup-4c74y8a, r=jhpratt
Rollup of 6 pull requests

Successful merges:

 -  (Specify a concrete stack size in channel tests)
 -  (Improve `xcrun` error handling)
 -  (std: get rid of pre-Vista fallback code)
 -  (Do not trim paths in MIR validator)
 -  (Use `abs_diff` where applicable)
 -  (saethlin goes on vacation)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-28 06:28:48 +00:00
bors
3f690c2257 Auto merge of - nnethercote:less-kw-Empty-hir-Lifetime, r=lcnr
Remove `kw::Empty` uses from `hir::Lifetime::ident`

`hir::Lifetime::ident` is sometimes set to `kw::Empty` and it's really confusing. This PR stops that. Helps with .

r? `@lcnr`
2025-03-28 03:20:06 +00:00
bit-aloo
b24083bccc
Add new change-id option in bootstrap.example.toml and update the change-id description references 2025-03-28 08:40:24 +05:30
Adam Greig
3b7d59ad12
Update target maintainers for thumb targets to reflect new REWG Arm team name 2025-03-28 01:54:35 +00:00
Jacob Pratt
63718922df
Rollup merge of - saethlin:vacation, r=Noratrieb
saethlin goes on vacation

Someone should bug me in about 2 weeks if I don't remember to undo this
2025-03-27 21:41:50 -04:00
Jacob Pratt
2465b62858
Rollup merge of - yotamofek:pr/abs-diff, r=compiler-errors
Use `abs_diff` where applicable

Very small cleanup, dogfooding a [new clippy lint](https://github.com/rust-lang/rust-clippy/pull/14482) I'm trying to add
2025-03-27 21:41:50 -04:00
Jacob Pratt
d837ab4489
Rollup merge of - compiler-errors:trim-validator-err, r=jieyouxu
Do not trim paths in MIR validator

From my inline comment:

```
// The type checker formats a bunch of strings with type names in it, but these strings
// are not always going to be encountered on the error path since the inliner also uses
// the validator, and there are certain kinds of inlining (even for valid code) that
// can cause validation errors (mostly around where clauses and rigid projections).
```

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

r? `@jieyouxu`
2025-03-27 21:41:49 -04:00
Jacob Pratt
5bd0fd6323
Rollup merge of - joboet:pre-vista-fallback, r=ChrisDenton
std: get rid of pre-Vista fallback code

We haven't had any Windows XP targets for a long while now...

r? ChrisDenton
2025-03-27 21:41:49 -04:00
Jacob Pratt
0b40e6e2cf
Rollup merge of - madsmtm:parse-xcrun-better, r=wesleywiser
Improve `xcrun` error handling

The compiler invokes `xcrun` on macOS when linking Apple targets, to find the Xcode SDK which contain all the necessary linker stubs. The error messages that `xcrun` outputs aren't always that great though, so this PR tries to improve that by providing extra context when an error occurs.

Fixes https://github.com/rust-lang/rust/issues/56829.
Fixes https://github.com/rust-lang/rust/issues/84534.
Part of https://github.com/rust-lang/rust/issues/129432.
See also the alternative https://github.com/rust-lang/rust/pull/131433.

Tested on:
- `x86_64-apple-darwin`, MacBook Pro running Mac OS X 10.12.6
    - With no tooling installed
    - With Xcode 9.2
    - With Xcode 9.2 Commandline Tools
- `aarch64-apple-darwin`, MacBook M2 Pro running macOS 14.7.4
    - With Xcode 13.4.1
    - With Xcode 16.2
    - Inside `nix-shell -p xcbuild` (nixpkgs' `xcrun` shim)
- `aarch64-apple-darwin`, VM running macOS 15.3.1
    - With no tooling installed
    - With Xcode 16.2 Commandline Tools

``@rustbot`` label O-apple
r? compiler
CC ``@BlackHoleFox`` ``@thomcc``
2025-03-27 21:41:48 -04:00
Jacob Pratt
3e274bd1a5
Rollup merge of - Jeff-A-Martin:channel-stack-overflow-test-fuchsia, r=wesleywiser
Specify a concrete stack size in channel tests

The channel-stack-overflow-issue-102246 regression test fails on platforms with a small default stack size (e.g. Fuchsia, with a default of 256KiB). Update the test to specify an exact stack size for both the sender and receiver operations, to ensure it is platform agnostic.

Set the stack size to less than the total allocation size of the mpsc channel, to continue to prove that the allocation is on the heap.
2025-03-27 21:41:48 -04:00
Nicholas Nethercote
8d2c63f514 Don't use kw::Empty in hir::Lifetime::ident.
`hir::Lifetime::ident` currently sometimes uses `kw::Empty` for elided
lifetimes and sometimes uses `kw::UnderscoreLifetime`, and the
distinction is used when creating some error suggestions, e.g. in
`Lifetime::suggestion` and `ImplicitLifetimeFinder::visit_ty`. I found
this *really* confusing, and it took me a while to understand what was
going on.

This commit replaces all uses of `kw::Empty` in `hir::Lifetime::ident`
with `kw::UnderscoreLifetime`. It adds a new field
`hir::Lifetime::is_path_anon` that mostly replaces the old
empty/underscore distinction and makes things much clearer.

Some other notable changes:

- Adds a big comment to `Lifetime` talking about permissable field
  values.

- Adds some assertions in `new_named_lifetime` about what ident values
  are permissible for the different `LifetimeRes` values.

- Adds a `Lifetime::new` constructor that does some checking to make
  sure the `is_elided` and `is_anonymous` states are valid.

- `add_static_impl_trait_suggestion` now looks at `Lifetime::res`
  instead of the ident when creating the suggestion. This is the one
  case where `is_path_anon` doesn't replace the old empty/underscore
  distinction.

- A couple of minor pretty-printing improvements.
2025-03-28 10:15:23 +11:00
bors
7586a9f99a Auto merge of - m-ou-se:spawn-in-atexit, r=Mark-Simulacrum
Allow spawning threads after TLS destruction

Fixes 
2025-03-27 21:46:58 +00:00
Nicholas Nethercote
cfd00f9c16 Remove ImplicitObjectLifetimeDefault case from suggestion.
It has no effect on anything in the test suite.

This means it can also be rewritten as a neater pairwise `match`.
2025-03-28 08:25:07 +11:00
Nicholas Nethercote
c6d8d65496 Remove LifetimeSuggestionPosition and Lifetime::suggestion_position.
They both are only used in `Lifetime::suggestion`. This commit inlines
and removes them.
2025-03-28 08:25:07 +11:00
Nicholas Nethercote
4924e0a067 Add a HIR pretty-printing test focused on lifetimes.
HIR printing currently gets very little testing. This increases coverage
a bit, with a focus on lifetimes.

There are some FIXME comments for cases that are printed in a dubious
fashion. This PR won't address those; the point of adding this test is
to ensure that the subsequent commits don't hurt pretty-printing.
2025-03-28 08:25:06 +11:00
Ben Kimock
c9adf541a8 saethlin goes on vacation 2025-03-27 15:40:03 -04:00
bors
3f5502370b Auto merge of - jhpratt:rollup-4ou6ei4, r=jhpratt
Rollup of 7 pull requests

Successful merges:

 -  (expand: Leave traces when expanding `cfg` attributes)
 -  (Remove `kw::Empty` uses from `rustc_middle`.)
 -  (Clean up a few things in rustc_hir_analysis::check::region)
 -  (Report compiletest pass mode if forced)
 -  (Improve suggest construct with literal syntax instead of calling)
 -  (Remove unneeded LLVM CI test assertions)
 -  (Add job duration changes to post-merge analysis report)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-27 18:33:31 +00:00
Yotam Ofek
bec69704c0 Use abs_diff where applicable 2025-03-27 18:29:06 +00:00
Michael Goulet
ed0a798828 Drive-by get rid of a bunch of unnecessary :? 2025-03-27 17:45:18 +00:00