Commit Graph

269884 Commits

Author SHA1 Message Date
Laurențiu Nicola
7ec20428cb
Merge pull request #18412 from lnicola/windows-no-gz
internal: Stop producing .gz artifacts for Windows
2024-10-28 10:11:29 +00:00
Guillaume Gomez
7cfbe23bc8 Unify variant struct fields margins with struct fields 2024-10-28 11:06:48 +01:00
Ralf Jung
f370f3493d bump stdarch 2024-10-28 09:42:42 +01:00
bors
66701c4226 Auto merge of #132251 - jieyouxu:rollup-mtv9mpd, r=jieyouxu
Rollup of 7 pull requests

Successful merges:

 - #131633 (error on alignments greater than `isize::MAX`)
 - #132086 (Tweak E0277 highlighting and "long type" path printing)
 - #132220 (Add GUI regression test for doc struct fields margins)
 - #132225 (Dynamically link run-make support)
 - #132227 (Pass constness with span into lower_poly_trait_ref)
 - #132242 (Support `char::is_digit` in const contexts.)
 - #132243 (Remove `ObligationCause::span()` method)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-28 07:14:11 +00:00
Jubilee Young
3f73fe7db4 compiler: Depend on rustc_abi in rustc_lint 2024-10-27 23:59:31 -07:00
Adwin White
e3bf50ede2 more consistent debug_assertions 2024-10-28 14:13:39 +08:00
Adwin White
1a39247d8d Add duplicate lowering check 2024-10-28 14:13:36 +08:00
Adwin White
cb08e08722 Lower AST node id only once 2024-10-28 14:12:17 +08:00
Zalathar
dfafbc41d8 Known-bug test for keyword_idents lint not propagating to other files 2024-10-28 16:57:08 +11:00
许杰友 Jieyou Xu (Joe)
3e3feac7c3
Rollup merge of #132243 - compiler-errors:no-span, r=jieyouxu
Remove `ObligationCause::span()` method

I think it's an incredibly confusing footgun to expose both `obligation_cause.span` and `obligation_cause.span()`. Especially because `ObligationCause::span()` (the method) seems to just be hacking around a single quirk in the way we set up obligation causes for match arms.

First commit removes the need for that hack, with only one diagnostic span changing (but IMO not really getting worse -- I'd argue that it was already confusing).
2024-10-28 13:36:21 +08:00
许杰友 Jieyou Xu (Joe)
f14637b025
Rollup merge of #132242 - ultrabear:const_is_digit, r=scottmcm
Support `char::is_digit` in const contexts.

This PR implements [`feature(const_char_is_digit)` #132241](https://github.com/rust-lang/rust/issues/132241)
2024-10-28 13:36:20 +08:00
许杰友 Jieyou Xu (Joe)
a9ee1d025b
Rollup merge of #132227 - compiler-errors:better-const-span, r=Nadrieril
Pass constness with span into lower_poly_trait_ref

Gives us a span to point at for ~const/const on non-const traits.

Split from #132209. r? Nadrieril
2024-10-28 13:36:20 +08:00
许杰友 Jieyou Xu (Joe)
afc93a9128
Rollup merge of #132225 - clubby789:run-make-dynamic, r=jieyouxu
Dynamically link run-make support

Fixes #131810

r? `@jieyouxu`
2024-10-28 13:36:19 +08:00
许杰友 Jieyou Xu (Joe)
5c14e3d54c
Rollup merge of #132220 - GuillaumeGomez:gui-test-struct-fields-margins, r=notriddle
Add GUI regression test for doc struct fields margins

Fixes #131402.

r? `@notriddle`
2024-10-28 13:36:19 +08:00
许杰友 Jieyou Xu (Joe)
20d2a546fa
Rollup merge of #132086 - estebank:long-types, r=jieyouxu
Tweak E0277 highlighting and "long type" path printing

Partially address #132013.

![Output from this PR for the repro case in #132013](https://github.com/user-attachments/assets/a073ba37-4adc-411e-81f7-6cb9a945ce3d)
2024-10-28 13:36:18 +08:00
许杰友 Jieyou Xu (Joe)
95a9d496f3
Rollup merge of #131633 - asquared31415:align_isize_max, r=jieyouxu
error on alignments greater than `isize::MAX`

Fixes #131122

On zulip someone had a concern that it was legal to create a type with alignment `isize::MAX + 1`, but I do not believe this should be allowed for `repr(align)`, as `repr(align)` also increases the *size* of the type, and that would be larger than the maximum allowed size of objects.

(cc `@workingjubilee` #131276)
2024-10-28 13:36:17 +08:00
Jubilee Young
2a9239a105 rust-analyzer: Rename LayoutS to LayoutData 2024-10-27 22:32:58 -07:00
Jubilee Young
9015c6deca cg_clif: Rename LayoutS to LayoutData 2024-10-27 22:32:40 -07:00
Jubilee Young
e1781297f3 compiler: Rename LayoutS to LayoutData
The last {UninternedType}S is in captivity. The galaxy is at peace.
2024-10-27 22:31:14 -07:00
asquared31415
6fc7ce43d2 Error on alignments greater than isize::MAX
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
2024-10-28 13:17:37 +08:00
bors
6929a48275 Auto merge of #132200 - Mark-Simulacrum:strengthen-cross-lang, r=RalfJung
Make clearer that guarantees in ABI compatibility are for Rust only

cc https://github.com/rust-lang/rust/pull/132136#issuecomment-2439737631 -- it looks like we already had a note that I missed in my initial look here, but this goes further to emphasize the guarantees, including uplifting it to the top of the general documentation.

r? `@RalfJung`
2024-10-28 04:47:06 +00:00
Jubilee Young
4839d6e6e5 compiler: Add rustc_abi dependence to the compiler
Depend on rustc_abi in compiler crates that use it indirectly but have
not yet taken on that dependency, and are not entangled in my other PRs.
This leaves an "excise rustc_target" step after the dust settles.
2024-10-27 21:10:58 -07:00
Jubilee Young
27207069d8 rustc_transmute: Directly use types from rustc_abi 2024-10-27 20:29:27 -07:00
Nicholas Nethercote
dd2b027d5d Tweak more warnings.
Much like the previous commit.

I think the removal of "the token" in each message is fine here. There
are many more error messages that mention tokens without saying "the
token" than those that do say it.
2024-10-28 14:20:28 +11:00
Nicholas Nethercote
a201fab208 Tweak expand_incomplete_parse warning.
By using `token_descr`, as is done for many other errors, we can get
slightly better descriptions in error messages, e.g.
"macro expansion ignores token `let` and any following" becomes
"macro expansion ignores keyword `let` and any tokens following".

This will be more important once invisible delimiters start being
mentioned in error messages -- without this commit, that leads to error
messages such as "error at ``" because invisible delimiters are
pretty printed as an empty string.
2024-10-28 14:12:45 +11:00
jyn
675f447d88 don't pass -L .../auxiliary unless it exists
this avoids warnings from macOS ld
2024-10-27 21:23:28 -04:00
jyn
f1e5b365f0 port tests/ui/linkage-attr/framework to run-make
this makes it much easier to understand test failures.

before:
```
diff of stderr:

1 error: linking with `LINKER` failed: exit status: 1
2    |
-            ld: Undefined symbols:
4              _CFRunLoopGetTypeID, referenced from:
5            clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

after:
```
=== HAYSTACK ===
error: linking with `cc` failed: exit status: 1
  |
  = note: use `--verbose` to show all linker arguments
  = note: Undefined symbols for architecture arm64:
            "_CFRunLoopGetTypeID", referenced from:
                main::main::hbb553f5dda62d3ea in main.main.d17f5fbe6225cf88-cgu.0.rcgu.o
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to 1 previous error

=== NEEDLE ===
_CFRunLoopGetTypeID\.?, referenced from:
thread 'main' panicked at /Users/jyn/git/rust-lang/rust/tests/run-make/linkage-attr-framework/rmake.rs:22:10:
needle was not found in haystack
```

this also fixes a failure related to missing whitespace; we don't actually care about whitespace in this test.
2024-10-27 21:23:28 -04:00
jyn
3141a65d25 give a better error for tuple structs in derive(Diagnostic) 2024-10-27 21:23:28 -04:00
jyn
d792e1f50a remove dead code in CGREP script 2024-10-27 21:23:28 -04:00
Michael Goulet
7f54b9ecef Remove ObligationCause::span() method 2024-10-27 23:54:06 +00:00
Michael Goulet
2507e83d7b Stop using the whole match expr span for an arm's obligation span 2024-10-27 22:48:03 +00:00
LastExceed
b889a11d79 add test 2024-10-27 23:29:14 +01:00
LastExceed
47e5759da9 add LetStmt arm 2024-10-27 23:29:14 +01:00
ultrabear
66209cd9b5
Support char::is_digit in const contexts 2024-10-27 14:31:58 -07:00
bors
df4ca44d3f Auto merge of #132237 - matthiaskrgr:rollup-ulogwtd, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #132043 (Simplify param handling in `resolve_bound_vars`)
 - #132214 (Cleanup: Move an impl-Trait check from AST validation to AST lowering)
 - #132221 (Clean up some comments on lint implementation)
 - #132228 (Revert "ci update freebsd version proposal, freebsd 12 being eol.")
 - #132234 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-27 20:00:19 +00:00
Urgau
ad80da6729 Use Hacker's Delight impl in i64::midpoint instead of wide i128 impl
As LLVM seems to be outperformed by the complexity of signed 128-bits
number compared to our Hacker's Delight implementation.[^1]

It doesn't seems like it's an improvement for the other sizes[^2], so we
let them with the wide implementation.

[^1]: https://rust.godbolt.org/z/ravE75EYj
[^2]: https://rust.godbolt.org/z/fzr171zKh
2024-10-27 20:34:13 +01:00
Matthias Krüger
0cace65e8f
Rollup merge of #132234 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-10-27 19:49:09 +01:00
Matthias Krüger
afd889732f
Rollup merge of #132228 - devnexen:ci_update_fbsd_revert, r=workingjubilee
Revert "ci update freebsd version proposal, freebsd 12 being eol."

This reverts commit 1239c81c14.

Fix GH-132185 revert for now until early next year/FreeBSD 13.3 becomes EOL.
2024-10-27 19:49:09 +01:00
Matthias Krüger
4649a1b141
Rollup merge of #132221 - ehuss:lint-docs, r=compiler-errors
Clean up some comments on lint implementation

This updates some doc comments that have gotten very out of date. Some of these macros were removed or renamed in #57726 and #104863 and others. Manual emitting of lints was significantly reworked when the `Diagnostic` infrastructure was added.

Rather than try to replicate the high-level documentation, I added pointers to the rustc-dev-guide.

I linkified some types so that if they are renamed/removed without updating the docs, it will break CI.
2024-10-27 19:49:08 +01:00
Matthias Krüger
574a8ba6af
Rollup merge of #132214 - fmease:mv-impl-trait-val-paths, r=compiler-errors
Cleanup: Move an impl-Trait check from AST validation to AST lowering

Namely the one that rejects `impl Trait` in qself types and non-final path segments.
There's no good reason to perform this during AST validation.
We have better infrastructure in place in the AST lowerer (`ImplTraitContext`).
This shaves off a lot of code.
We now lower `impl Trait` in bad positions to `{type error}` which allows us to
remove a special case from HIR ty lowering.

Coincidentally fixes #126725. Well, it only *masks* it by passing `{type error}` to HIR analysis instead of a "bad" opaque. I was able to find a new reproducer for it. See the issue.
2024-10-27 19:49:07 +01:00
Matthias Krüger
60beb5979b
Rollup merge of #132043 - compiler-errors:simplify-rbv, r=cjgillot
Simplify param handling in `resolve_bound_vars`

I always found the flow of the `ResolvedArg` constructors to be a bit confusing; turns out they're also kinda redundantly passing around their data, too.

Also, deduplicate some code handling early-bound var to late-bound var conversion between return type notation's two styles: `where <T as Trait>::method(..): Bound` and `where T: Trait<method(..): Bound>`.
2024-10-27 19:49:06 +01:00
Lukas Markeffsky
4a71a59281 Rc/Arc: don't leak the allocation if drop panics 2024-10-27 18:32:36 +01:00
Lukas Markeffsky
8a9f40043f add test for panicking drop in Box/Rc/Arc 2024-10-27 18:32:36 +01:00
Chayim Refael Friedman
709805a5fd Properly resolve prelude paths inside modules inside blocks
I.e. the following situation:
```
fn foo() {
    mod bar {
        fn qux() {
            // Prelude path here (e.g. macro use prelude or extern prelude).
        }
    }
}
```
Those were previously unresolved, because, in order to support `self` and `super` properly, since #15148 we do not ascend block paths when there is a module in between, but only crate def maps register preludes, not block def maps, and we can't change this because block def map prelude can always be overridden by another block. E.g.
```
fn foo() {
    struct WithTheSameNameAsPreludeItem;
    {
        WithTheSameNameAsPreludeItem
    }
}
```
Here `WithTheSameNameAsPreludeItem` refer to the item from the top block, but if we would register prelude items in each block the child block would overwrite it incorrectly.
2024-10-27 19:23:12 +02:00
bors
81d6652e74 Auto merge of #131284 - dingxiangfei2009:rename-smart-ptr-to-coerce-referent, r=compiler-errors
Rename macro `SmartPointer` to `CoercePointee`

As per resolution #129104 we will rename the macro to better reflect the technical specification of the feature and clarify the communication.

- `SmartPointer` is renamed to `CoerceReferent`
- `#[pointee]` attribute is renamed to `#[referent]`
- `#![feature(derive_smart_pointer)]` gate is renamed to `#![feature(derive_coerce_referent)]`.
- Any mention of `SmartPointer` in the file names are renamed accordingly.

r? `@compiler-errors`

cc `@nikomatsakis` `@Darksonn`
2024-10-27 17:04:12 +00:00
David Carlier
4ccaef12a6 Revert "ci update freebsd version proposal, freebsd 12 being eol."
This reverts commit 1239c81c14.

Fix GH-132185 revert for now until early next year/FreeBSD 13.3
becomes EOL.
2024-10-27 16:20:14 +00:00
clubby789
9bb6e0789c Dynamically link run-make support 2024-10-27 14:56:35 +00:00
Shoyu Vanilla
0abb563bf1 fix: Allow public re-export of extern crate import 2024-10-27 23:44:44 +09:00
bors
5f5c243ca0 Auto merge of #132215 - onur-ozkan:bootstrap-git, r=Kobzol
simplify force-recompile logic for "library"

It’s kind of self-explanatory when looking at it commit by commit.
2024-10-27 13:03:40 +00:00
Eric Huss
924ded6b72 Clean up some comments on lint implementation 2024-10-27 04:30:51 -07:00