Commit graph

557 commits

Author SHA1 Message Date
Edvin Bryntesson
acd6ba4edb
Port #[instruction_set] to attribute parser 2025-12-31 03:01:05 +01:00
Matthias Krüger
185f7dc044
Rollup merge of #149949 - JonathanBrouwer:error_cleanup, r=jdonszelmann
Cleanup of attribute parsing errors

Removes the specific `UnknownMetaItem` and `IllFormedAttributeInputLint` errors.
Note that `IllFormedAttributeInputLint` is not a lint, contrary to its name

r? ``````@jdonszelmann``````
2025-12-14 20:04:56 +01:00
bors
3f4dc1e02d Auto merge of #146348 - jdonszelmann:eiiv3, r=lcnr,oli-obk
Externally implementable items

Supersedes https://github.com/rust-lang/rust/pull/140010
Tracking issue: https://github.com/rust-lang/rust/issues/125418

Getting started:

```rust
#![feature(eii)]

#[eii(eii1)]
pub fn decl1(x: u64)
// body optional (it's the default)
{
    println!("default {x}");
}

// in another crate, maybe
#[eii1]
pub fn decl2(x: u64) {
    println!("explicit {x}");
}

fn main() {
    decl1(4);
}
```

- tiny perf regression, underlying issue makes multiple things in the compiler slow, not just EII, planning to solve those separately.
- No codegen_gcc support, they don't have bindings for weak symbols yet but could
- No windows support yet for weak definitions

This PR merges the implementation of EII for just llvm + not windows, doesn't yet contain like a new panic handler implementation or alloc handler. With this implementation, it would support implementing the panic handler in terms of EII already since it requires no default implementation so no weak symbols

The PR has been open in various forms for about a year now, but I feel that having some implementation merged to build upon
2025-12-14 04:20:26 +00:00
Jonathan Brouwer
1da1a39c9a
Remove UnknownMetaItem error 2025-12-13 13:44:57 +01:00
Jacob Pratt
6b29f18654
Rollup merge of #149903 - JonathanBrouwer:cfg_old_cleanup, r=jdonszelmann
Remove unused code in `cfg_old`

r? ```@jdonszelmann```

Fixes one of the todos from https://github.com/rust-lang/rust/issues/149865
2025-12-13 00:55:58 -05:00
Jonathan Brouwer
0ab4b8b9e0
Remove the E0536 error code 2025-12-12 14:38:12 +01:00
Jana Dönszelmann
52e0bfccb0
rename feature gate to extern_item_impls 2025-12-12 11:32:35 +01:00
Jana Dönszelmann
a4abfad99b
EII new error code 2025-12-12 11:32:26 +01:00
Matthias Krüger
bf399241fe
Rollup merge of #146584 - cyrgani:error-codes-macro, r=GuillaumeGomez
remove duplicated columns from `rustc_error_code::error_codes!`

Possible because of rust-lang/rust#146308 ~~, but currently still blocked on the next stage0 bump~~.
2025-12-11 22:09:52 +01:00
Matthias Krüger
02434fe718
Rollup merge of #148678 - xonx4l:EO412_replacement_with_EO425, r=Kivooeo
Merge E0412 into E0425

This PR merge E0412 into E0425  as both mean the same thing to users.

This fixes https://github.com/rust-lang/rust/issues/148558.
2025-12-02 22:02:30 +01:00
xonx4l
4b000cfacd Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
reddevilmidzy
d4af0f0772 Fix indent in E0591.md 2025-11-30 21:24:33 +09:00
lcnr
feb13036ef remove support for type-of 2025-11-25 10:19:44 +01:00
bjorn3
973c7527b4 Unify the configuration of the compiler docs
Previously it was rather inconsistent which crates got the rust logo and
which didn't and setting html_root_url was forgotten in many cases.
2025-11-05 11:25:27 +00:00
Jonathan Brouwer
b78800fd5d
Port cfg!() macro to the new attribute parsing system
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-11-03 18:23:41 +01:00
Matthias Krüger
7320d3ed61
Rollup merge of #146585 - hkBst:indexing-1, r=jdonszelmann
indexing: reword help

After looking at https://github.com/rust-lang/rust/issues/40850, I thought I'd try to improve wording around error E0608 a bit. Hopefully I've succeeded.
2025-10-02 10:27:49 +02:00
Marijn Schouten
86f2d424c8 indexing: reword help
Co-authored-by: beef <ent3rm4n@gmail.com>
2025-10-01 07:39:03 +00:00
cyrgani
321cd2aa25 remove duplicated columns from rustc_error_code::error_codes! 2025-09-27 12:29:54 +02:00
Jules Bertholet
60dd0df6e7
Address review comments 2025-09-24 13:52:33 -04:00
Jules Bertholet
389907a17e
Enforce E0719 only for trait aliases 2025-09-18 09:16:58 -04:00
Jonathan Brouwer
7db1840569
Changes to the uitests
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-27 20:25:18 +02:00
Stuart Cook
b955aa722e
Rollup merge of #144944 - He1pa:E0793, r=compiler-errors
E0793: Clarify that it applies to unions as well

pick up inactive PR: https://github.com/rust-lang/rust/pull/131472

Also:
Adjust the language slightly to be more consistent with other similar messages (was created instead of got created).
Add a short section on union.
Add an example line showing referencing a field in a packed struct is safe if the field's type isn't more strictly aligned than the pack.

r? compiler-errors
2025-08-15 16:16:32 +10:00
Jonathan Brouwer
5245c39972
Remove the old target checking logic 2025-08-14 18:18:42 +02:00
Vadim Petrochenkov
772493d51d resolve: Split extern prelude into two scopes
One for `--extern` options and another for `extern crate` items.
2025-08-13 17:45:40 +03:00
黑怕
57901fe092 E0793: Clarify that it applies to unions as well 2025-08-12 11:38:33 +08:00
Noratrieb
870b58f4d0 Update E0562 to account for the new impl trait positions 2025-08-02 11:29:04 +02:00
Jonathan Brouwer
3303534dc8
Update uitest stderrs
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-23 13:33:23 +02:00
León Orell Valerian Liehr
cdc3d701cb
Don't reject *multiple* relaxed bounds, reject *duplicate* ones.
Having multiple relaxed bounds like `?Sized + ?Iterator` is actually *fine*.
We actually want to reject *duplicate* relaxed bounds like `?Sized + ?Sized`
because these most certainly represent a user error.

Note that this doesn't mean that we accept more code because a bound like
`?Iterator` is still invalid as it's not relaxing a *default* trait and
the only way to define / use more default bounds is under the experimental
and internal feature `more_maybe_bounds` plus `lang_items` plus unstable
flag `-Zexperimental-default-bounds` (historical context: for the longest
time, bounds like `?Iterator` were actually allowed and lead to a hard
warning).

Ultimately, this simply *reframes* the diagnostic. The scope of
`more_maybe_bounds` / `-Zexperimental-default-bounds` remains unchanged
as well.
2025-07-18 12:24:56 +02:00
Jonathan Brouwer
7a7c74ad89
New example for E0536 2025-07-15 09:21:27 +02:00
Jubilee Young
383d76106b compiler: Trim the misleading C of C-cmse from errors 2025-06-25 00:52:10 -07:00
Jana Dönszelmann
b64fd13a04
convert the optimize attribute to a new parser 2025-06-18 13:48:42 +02:00
Jana Dönszelmann
5ab5f8a24a
make error codes reflect reality better 2025-06-17 23:22:51 +02:00
Ralf Jung
8808c9d34b intrinsics: use const generic to set atomic ordering 2025-06-07 21:45:58 +02:00
maflcko
79fbc38867
doc: Fix inverted meaning in E0783.md 2025-06-05 12:27:08 +02:00
beetrees
467eeabbb5
Stabilise repr128 2025-05-28 15:14:34 +01:00
Vadim Petrochenkov
3eee3dad5c resolve: Support imports of associated types and glob imports from traits 2025-05-02 15:59:38 +03:00
Guillaume Gomez
c02964f446
Rollup merge of #138703 - pudongair:master, r=workingjubilee
chore: remove redundant words in comment

remove redundant words in comment
2025-05-01 22:27:19 +02:00
Folkert de Vries
df8a3d5f1d
stabilize naked_functions 2025-04-20 11:18:38 +02:00
Folkert de Vries
41ddf86722
Make #[naked] an unsafe attribute 2025-04-19 00:03:35 +02:00
Folkert de Vries
f472cc8cd4
error on unsafe attributes in pre-2024 editions
the `no_mangle`, `link_section` and `export_name` attributes are exceptions, and can still be used without an unsafe in earlier editions
2025-04-13 01:22:59 +02:00
Oli Scherer
b2aa9d0620 Remove some dead or leftover code related to rustc-intrinsic abi removal 2025-04-09 07:57:13 +00:00
Bennet Bleßmann
7dd57f085c
update/bless tests 2025-04-06 21:41:47 +02:00
pudongair
cf26d82daf chore: remove redundant words in comment
Signed-off-by: pudongair <744355276@qq.com>
2025-03-26 15:28:51 +08:00
Nicholas Nethercote
867da30cc7 Avoid kw::Empty when dealing with rustc_allowed_through_unstable_modules.
The existing code produces `Some(kw::Empty)` for these invalid forms:

- a non-name-value, e.g. `#[rustc_allowed_through_unstable_modules]`

- a non-string arg, e.g. `#[rustc_allowed_through_unstable_modules = 3]`

The new code avoids the `kw::Empty` and is a little shorter. It will
produce `None` in those cases, which means E0789 won't be produced if
the `stable` attribute is missing for these invalid forms. This doesn't
matter, because these invalid forms will trigger an "malformed
`rustc_allowed_through_unstable_modules` attribute" anyway.
2025-03-25 16:48:03 +11:00
Matthias Krüger
f7f287077b
Rollup merge of #138364 - BLANKatGITHUB:compiler, r=RalfJung
ports the compiler test cases to new rust_intrinsic format

pr is part of #132735
2025-03-21 15:48:51 +01:00
Mara Bos
6c865c1e14 Allow builtin macros to be used more than once.
This removes E0773 "A builtin-macro was defined more than once."
2025-03-19 14:12:47 +01:00
aaishwarymishra@gmail.com
a3669b8982 updated compiler tests for rustc_intrinsic'
Update compiler/rustc_error_codes/src/error_codes/E0622.md

Co-authored-by: Ralf Jung <post@ralfj.de>

reverted chages on E0622.md

updated E0622.md
2025-03-18 16:22:42 +00:00
Marijn Schouten
50c659fcba Clarify "owned data" in E0515.md
This clarifies the explanation of why this is not allowed and also what to do instead.

Fixes 62071

PS There was suggestion of adding a link to the book. I did not yet do that, but if desired that could be added.
2025-03-14 19:28:59 +01:00
Matthias Krüger
d93ef397ce
Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, r=onur-ozkan,jieyouxu
Use `RUSTC_LINT_FLAGS` more

An alternative to the failed #138084.

Fixes #138106.

r? ````@jieyouxu````
2025-03-12 17:59:08 +01:00
bors
6650252439 Auto merge of #128440 - oli-obk:defines, r=lcnr
Add `#[define_opaques]` attribute and require it for all type-alias-impl-trait sites that register a hidden type

Instead of relying on the signature of items to decide whether they are constraining an opaque type, the opaque types that the item constrains must be explicitly listed.

A previous version of this PR used an actual attribute, but had to keep the resolved `DefId`s in a side table.

Now we just lower to fields in the AST that have no surface syntax, instead a builtin attribute macro fills in those fields where applicable.

Note that for convenience referencing opaque types in associated types from associated methods on the same impl will not require an attribute. If that causes problems `#[defines()]` can be used to overwrite the default of searching for opaques in the signature.

One wart of this design is that closures and static items do not have generics. So since I stored the opaques in the generics of functions, consts and methods, I would need to add a custom field to closures and statics to track this information. During a T-types discussion we decided to just not do this for now.

fixes #131298
2025-03-11 18:13:31 +00:00