Commit Graph

1724 Commits

Author SHA1 Message Date
bors 0c0f27afd4 Auto merge of #147695 - cjgillot:deduce-param-freeze, r=tmiasko
deduced_param_attrs: check Freeze on monomorphic types.

`deduced_param_attrs` currently checks `Freeze` bound on polymorphic MIR. This pessimizes the deduction, as generic types are not `Freeze` by default.

This moves the check to the ABI adjustment.
2025-10-18 12:37:45 +00:00
Camille Gillot 97f88f5603 Generalize the non-freeze and needs_drop handling. 2025-10-17 16:28:37 +00:00
Cameron Steffen b323f567d9 Remove Option from impl_trait_header 2025-10-17 08:36:34 -05:00
bjorn3 88e9820683 Fix review comments 2025-10-10 13:51:52 +00:00
bjorn3 116f4ae171 Support #[alloc_error_handler] without the allocator shim
Currently it is possible to avoid linking the allocator shim when
__rust_no_alloc_shim_is_unstable_v2 is defined when linking rlibs
directly as some build systems need. However this requires liballoc to
be compiled with --cfg no_global_oom_handling, which places huge
restrictions on what functions you can call and makes it impossible to
use libstd. Or alternatively you have to define
__rust_alloc_error_handler and (when using libstd)
__rust_alloc_error_handler_should_panic
using #[rustc_std_internal_symbol]. With this commit you can either use
libstd and define __rust_alloc_error_handler_should_panic or not use
libstd and use #[alloc_error_handler] instead. Both options are still
unstable though.

Eventually the alloc_error_handler may either be removed entirely
(though the PR for that has been stale for years now) or we may start
using weak symbols for it instead. For the latter case this commit is a
prerequisite anyway.
2025-10-10 13:04:53 +00:00
usamoi 21dd997aec support link modifier as-needed for raw-dylib-elf 2025-10-06 08:56:40 +08:00
Kivooeo 67bc030833 change flt back to ftl 2025-10-04 18:18:58 +00:00
Li-yao Xia c0e0d4b68d Make def_path_hash_to_def_id not panic when passed an invalid hash 2025-09-26 18:36:15 +02:00
Ben Kimock 888679013d Add panic=immediate-abort 2025-09-21 13:12:18 -04:00
Cameron Steffen b995a55caf Don't store defaultness for inherent impl items 2025-09-12 15:14:15 -05:00
Cameron Steffen 9615ec7d10 Split AssocContainer::{InherentImpl,TraitImpl} 2025-09-12 15:14:15 -05:00
Cameron Steffen 5590e55b03 Rename AssocItemContainer -> AssocContainer 2025-09-12 15:10:30 -05:00
bors b3cfb8faf8 Auto merge of #138736 - azhogin:azhogin/sanitizers-target-modificators, r=rcvalle
Sanitizers target modificators

Depends on bool flag fix: https://github.com/rust-lang/rust/pull/138483.

Some sanitizers need to be target modifiers, and some do not. For now, we should mark all sanitizers as target modifiers except for these: AddressSanitizer, LeakSanitizer

For kCFI, the helper flag -Zsanitizer-cfi-normalize-integers should also be a target modifier.

Many test errors was with sanizer flags inconsistent with std deps. Tests are fixed with `-C unsafe-allow-abi-mismatch`.
2025-09-04 22:51:33 +00:00
Nicholas Nethercote 301655eafe Revert introduction of [workspace.dependencies].
This was done in #145740 and #145947. It is causing problems for people
using r-a on anything that uses the rustc-dev rustup package, e.g. Miri,
clippy.

This repository has lots of submodules and subtrees and various
different projects are carved out of pieces of it. It seems like
`[workspace.dependencies]` will just be more trouble than it's worth.
2025-09-02 19:12:54 +10:00
Stuart Cook 2246dda682 Rollup merge of #145947 - nnethercote:workspace-members-2, r=Kobzol
Add more to the `[workspace.dependencies]` section in the top-level `Cargo.toml`

Following on from rust-lang/rust#145740.

r? `@Kobzol`
2025-08-29 12:54:12 +10:00
Nicholas Nethercote 20d03752c5 Add odht to [workspace.dependencies]. 2025-08-28 20:12:16 +10:00
Nicholas Nethercote 77d2f0c16e Add tempfile to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
Nicholas Nethercote 12dc789bc6 Add libc to [workspace.dependencies]. 2025-08-28 20:10:54 +10:00
Jonathan Brouwer e8d08b5416 Port the #[link] attribute to the new parser 2025-08-27 20:25:16 +02:00
Nicholas Nethercote c50d2cc807 Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
Nicholas Nethercote 82c4b9c51b Add bitflags to [workspace.dependencies]. 2025-08-27 13:59:32 +10:00
Andrew Zhogin 6d637dfecc -Zsanitize and -Zsanitizer-cfi-normalize-integers flags are now target modifiers with custom consistency check function 2025-08-21 16:08:00 +07:00
bors 05f5a58e84 Auto merge of #145600 - jieyouxu:rollup-jw0bpnt, r=jieyouxu
Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#145338 (actually provide the correct args to coroutine witnesses)
 - rust-lang/rust#145429 (Couple of codegen_fn_attrs improvements)
 - rust-lang/rust#145452 (Do not strip binaries in bootstrap everytime if they are unchanged)
 - rust-lang/rust#145464 (Stabilize `const_pathbuf_osstring_new` feature)
 - rust-lang/rust#145474 (Properly recover from parenthesized use-bounds (precise capturing lists) plus small cleanups)
 - rust-lang/rust#145486 (Fix `unicode_data.rs` mention message)
 - rust-lang/rust#145490 (Trace some basic I/O operations in bootstrap)
 - rust-lang/rust#145493 (remove `should_render` in `PrintAttribute` derive)
 - rust-lang/rust#145500 (Port must_use to the new target checking)
 - rust-lang/rust#145505 (Simplify span caches)
 - rust-lang/rust#145510 (Visit and print async_fut local for async drop.)
 - rust-lang/rust#145511 (Rust build fails on OpenBSD after using file_lock feature)
 - rust-lang/rust#145532 (resolve: debug for block module)
 - rust-lang/rust#145533 (Reorder `lto` options from most to least optimizing)
 - rust-lang/rust#145537 (Do not consider a `T: !Sized` candidate to satisfy a `T: !MetaSized` obligation.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-19 19:26:10 +00:00
Esteban Küber 8baab4cdf7 Detect missing derive on unresolved attribute even when not imported
```
error: cannot find attribute `sede` in this scope
  --> $DIR/missing-derive-3.rs:20:7
   |
LL |     #[sede(untagged)]
   |       ^^^^
   |
help: the derive macros `Deserialize` and `Serialize` accept the similarly named `serde` attribute
   |
LL |     #[serde(untagged)]
   |         +

error: cannot find attribute `serde` in this scope
  --> $DIR/missing-derive-3.rs:14:7
   |
LL |     #[serde(untagged)]
   |       ^^^^^
   |
note: `serde` is imported here, but it is a crate, not an attribute
  --> $DIR/missing-derive-3.rs:4:1
   |
LL | extern crate serde;
   | ^^^^^^^^^^^^^^^^^^^
help: `serde` is an attribute that can be used by the derive macros `Deserialize` and `Serialize`, you might be missing a `derive` attribute
   |
LL + #[derive(Deserialize, Serialize)]
LL | enum B {
   |
```
2025-08-15 15:56:45 +00:00
bjorn3 460519a7f5 Merge link_name and export_name 2025-08-15 10:04:04 +00:00
Josh Triplett 0b855bcdc9 Switch to a bitflags MacroKinds to support macros with more than one kind
Review everything that uses `MacroKind`, and switch anything that could
refer to more than one kind to use `MacroKinds`.

Add a new `SyntaxExtensionKind::MacroRules` for `macro_rules!` macros,
using the concrete `MacroRulesMacroExpander` type, and have it track
which kinds it can handle. Eliminate the separate optional `attr_ext`,
now that a `SyntaxExtension` can handle multiple macro kinds.

This also avoids the need to downcast when calling methods on
`MacroRulesMacroExpander`, such as `get_unused_rule`.

Integrate macro kind checking into name resolution's
`sub_namespace_match`, so that we only find a macro if it's the right
type, and eliminate the special-case hack for attributes.
2025-08-12 09:24:45 -07:00
Esteban Küber 464a6b1b4a Detect struct construction with private field in field with default
When trying to construct a struct that has a public field of a private type, suggest using `..` if that field has a default value.

```
error[E0603]: struct `Priv1` is private
  --> $DIR/non-exhaustive-ctor.rs:25:39
   |
LL |     let _ = S { field: (), field1: m::Priv1 {} };
   |                            ------     ^^^^^ private struct
   |                            |
   |                            while setting this field
   |
note: the struct `Priv1` is defined here
  --> $DIR/non-exhaustive-ctor.rs:14:4
   |
LL |    struct Priv1 {}
   |    ^^^^^^^^^^^^
help: the field `field1` you're trying to set has a default value, you can use `..` to use it
   |
LL |     let _ = S { field: (), .. };
   |                            ~~
```
2025-08-10 19:15:18 +00:00
bors 41ede7bd9b Auto merge of #145146 - fee1-dead-contrib:push-zmqrkurlzrxy, r=nnethercote
remove `P`

Previous work: rust-lang/rust#141603
MCP: https://github.com/rust-lang/compiler-team/issues/878

cc `@nnethercote`
2025-08-09 23:27:55 +00:00
Deadbeef ad1113f87e remove P 2025-08-09 15:47:01 +08:00
Stuart Cook d0ddce8585 Rollup merge of #145103 - fee1-dead-contrib:push-plompruwywvk, r=compiler-errors
rustc_metadata: remove unused private trait impls

These are impls for non-reachable traits that don't appear to be used. Please let me know if there is value in keeping some of them for now.

cc `@cjgillot`
2025-08-09 13:58:52 +10:00
Deadbeef dbc6f5836c rustc_metadata: remove unused private trait impls 2025-08-08 23:19:09 +08:00
Mads Marquart d434cae18f Add target_env = "macabi" and target_env = "sim" 2025-08-08 13:29:46 +02:00
bjorn3 186cef0f51 Move metadata symbol export from exported_non_generic_symbols to exported_symbols
The metadata symbol must not be encoded in the crate metadata, and must
be exported from proc-macros. Handling the export of the metadata symbol
in exported_symbols handles both things at once without requiring manual
fixups elsewhere.
2025-08-07 14:30:43 +00:00
Jana Dönszelmann e1d3ad89c7 remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
Nicholas Nethercote 66fd421208 Move rustc_middle::parameterized to rustc_metadata.
It's only used there.
2025-07-31 15:14:34 +10:00
Kornel 276c4238a7 Support multiple crate versions in --extern-html-root-url 2025-07-28 13:34:03 +01:00
Kornel 8a0f976047 Save names of used extern crates
Tracks association between `self.sess.opts.externs` (aliases in `--extern alias=rlib`) and resolved `CrateNum`

Intended to allow Rustdoc match the aliases in `--extern-html-root-url`

Force-injected extern crates aren't included, since they're meant for the linker only
2025-07-28 13:34:03 +01:00
Kornel 671e083391 Clarify update_extern_crate 2025-07-28 13:34:03 +01:00
Kornel e008fe0c18 Avoid redundant lookup in CrateLoader::existing_match 2025-07-28 13:34:03 +01:00
bors d242a8bd5a Auto merge of #144469 - Kivooeo:chains-cleanup, r=SparrowLii
Some `let chains` clean-up

Not sure if this kind of clean-up is welcoming because of size, but I decided to try out one

r? compiler
2025-07-28 05:25:23 +00:00
Kivooeo bae38bad78 use let chains in hir, lint, mir 2025-07-28 06:10:14 +05:00
Jonathan Brouwer ec637000c6 Use the new attributes throughout the codebase
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-26 20:26:05 +02:00
Cameron Steffen cf4d7938cf Limit defaultness to impl of trait 2025-07-25 08:49:31 -05:00
usamoi e31876c143 generate elf symbol version in raw-dylib 2025-07-24 19:04:00 +08:00
Matthias Krüger 3a3a411980 Rollup merge of #144059 - LorrensP-2158466:remove-crate-loader, r=petrochenkov
Refactor `CrateLoader` into the `CStore`

Removes the `CrateLoader` and moves the code to `CStore`. Now, if you want to use the `CrateLoader`, you can just use `CStore`.

Should we rename `creader.rs` to `cstore.rs`?

r? ``@petrochenkov``
2025-07-18 19:14:46 +02:00
LorrensP-2158466 466d33cb5c inline CrateLoader inside of CStore 2025-07-18 13:16:09 +02:00
Deadbeef 69326878ee parse const trait Trait 2025-07-17 18:06:26 +08:00
Vadim Petrochenkov babe2c0d0f resolve: Merge NameBindingKind::Module into NameBindingKind::Res 2025-07-16 08:28:17 +03:00
Jonathan Brouwer a14baf1e56 Define datastructures for #[cfg] attribute, move StrippedCfgItem 2025-07-15 09:01:00 +02:00
Jakub Beránek 93c10272d0 Rollup merge of #143217 - Periodic1911:link-ordinal, r=jdonszelmann
Port #[link_ordinal] to the new attribute parsing infrastructure

Ports link_ordinal to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197
2025-07-14 11:04:52 +02:00