about summary refs log tree commit diff
path: root/compiler/rustc_passes/src
AgeCommit message (Collapse)AuthorLines
2024-10-07Add sugar for &pin (const|mut) typesEric Holk-23/+27
2024-10-07Auto merge of #131235 - ↵bors-15/+14
codemountains:rename-nestedmetaitem-to-metaitemlnner, r=nnethercote Rename `NestedMetaItem` to `MetaItemInner` Fixes #131087 r? `@nnethercote`
2024-10-06various fixes for `naked_asm!` implementationFolkert de Vries-19/+14
- fix for divergence - fix error message - fix another cranelift test - fix some cranelift things - don't set the NORETURN option for naked asm - fix use of naked_asm! in doc comment - fix use of naked_asm! in run-make test - use `span_bug` in unreachable branch
2024-10-06remove checks that are now performed during macro expansion of `naked_asm!`Folkert de Vries-60/+8
2024-10-06disallow `asm!` in `#[naked]` functionsFolkert de Vries-23/+32
also disallow the `noreturn` option, and infer `naked_asm!` as `!`
2024-10-06Rename NestedMetaItem to MetaItemInnercodemountains-15/+14
2024-10-04rm `ItemKind::OpaqueTy`Noah Lev-13/+4
This introduce an additional collection of opaques on HIR, as they can no longer be listed using the free item list.
2024-10-02Remove redundant in_trait from hir::TyKind::OpaqueDefMichael Goulet-1/+1
2024-10-01Remove anon struct and union typesMichael Goulet-2/+0
2024-09-30Validate ExistentialPredicate argsMichael Goulet-1/+1
2024-09-23Check vtable projections for validity in miriMichael Goulet-2/+2
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-251/+214
2024-09-21remove `#[cmse_nonsecure_entry]`Folkert-24/+0
2024-09-18Rollup merge of #129422 - compiler-errors:repr-rust, r=fmeaseJubilee-0/+9
Gate `repr(Rust)` correctly on non-ADT items #114201 added `repr(Rust)` but didn't add any attribute validation to it like `repr(C)` has, to only allow it on ADT items. I consider this code to be nonsense, for example: ``` #[repr(Rust)] fn foo() {} ``` Reminder that it's different from `extern "Rust"`, which *is* valid on function items. But also this now disallows `repr(Rust)` on modules, impls, traits, etc. I'll crater it, if it looks bad then I'll add an FCW. --- https://github.com/rust-lang/rust/labels/relnotes: Compatibility (minor breaking change).
2024-09-18Rollup merge of #130457 - nnethercote:cleanup-codegen-traits, r=bjorn3Matthias Krüger-3/+1
Cleanup codegen traits The traits governing codegen are quite complicated and hard to follow. This PR cleans them up a bit. r? `@bjorn3`
2024-09-17Use associative type defaults in `{Layout,FnAbi}OfHelpers`.Nicholas Nethercote-3/+1
This avoids some repetitive boilerplate code.
2024-09-16layout computation: eagerly error for unexpected unsized fieldsLukas Markeffsky-1/+1
2024-09-13Remove `sess` from `CheckLoopVisitor`.Nicholas Nethercote-17/+11
2024-09-13Remove unnecessary lifetime from `CheckLoopVisitor`.Nicholas Nethercote-6/+6
2024-09-13Remove unnecessary lifetime from `FeaturePreviouslyDeclared`.Nicholas Nethercote-2/+2
2024-09-12Rollup merge of #130235 - compiler-errors:nested-if, r=michaelwoeristerStuart Cook-30/+22
Simplify some nested `if` statements Applies some but not all instances of `clippy::collapsible_if`. Some ended up looking worse afterwards, though, so I left those out. Also applies instances of `clippy::collapsible_else_if` Review with whitespace disabled please.
2024-09-11Rollup merge of #130114 - eduardosm:needless-returns, r=compiler-errorsJubilee-5/+2
Remove needless returns detected by clippy in the compiler
2024-09-11Also fix if in elseMichael Goulet-20/+14
2024-09-11Simplify some nested if statementsMichael Goulet-10/+8
2024-09-10disallow `naked_asm!` outside of `#[naked]` functionsFolkert de Vries-11/+44
2024-09-09Remove needless returns detected by clippy in the compilerEduardo Sánchez Muñoz-5/+2
2024-09-05Rollup merge of #128919 - Nadrieril:lint-query-leaks, r=cjgillotMatthias Krüger-32/+8
Add an internal lint that warns when accessing untracked data Some methods access data that is not tracked by the query system and should be used with caution. As suggested in https://github.com/rust-lang/rust/pull/128815#issuecomment-2275488683, in this PR I propose a lint (modeled on the `potential_query_instability` lint) that warns when using some specially-annotatted functions. I can't tell myself if this lint would be that useful, compared to renaming `Steal::is_stolen` to `is_stolen_untracked`. This would depend on whether there are other functions we'd want to lint like this. So far it seems they're called `*_untracked`, which may be clear enough. r? ``@oli-obk``
2024-09-03Add an internal lint that warns when accessing untracked dataNadrieril-32/+8
2024-09-03Rollup merge of #128701 - veera-sivarajan:fix-128604, r=estebankMatthias Krüger-14/+26
Don't Suggest Labeling `const` and `unsafe` Blocks Fixes #128604 Previously, both anonymous constant blocks (E.g. The labeled block inside `['_'; 'block: { break 'block 1 + 2; }]`) and inline const blocks (E.g. `const { ... }`) were considered to be the same kind of blocks. This caused the compiler to incorrectly suggest labeling both the blocks when only anonymous constant blocks can be labeled. This PR adds an other enum variant to `Context` so that both the blocks can be handled appropriately. Also, adds some doc comments and removes unnecessary `&mut` in a couple of places.
2024-09-02Rollup merge of #129877 - Sajjon:sajjon_fix_typos_batch_2, r=fee1-deadMatthias Krüger-2/+2
chore: Fix typos in 'compiler' (batch 2) Batch 2/3: Fixes typos in `compiler` (See [issue](https://github.com/rust-lang/rust/issues/129874) tracking all PRs with typos fixes)
2024-09-02chore: Fix typos in 'compiler' (batch 2)Alexander Cyon-2/+2
2024-09-01Revert "Auto merge of #127537 - veluca93:struct_tf, r=BoxyUwU"Jakub Beránek-37/+5
This reverts commit acb4e8b6251f1d8da36f08e7a70fa23fc581839e, reversing changes made to 100fde5246bf56f22fb5cc85374dd841296fce0e.
2024-08-31don't take reachability into account when warning about missing-const-stabilityRalf Jung-2/+1
2024-08-29Add `warn(unreachable_pub)` to `rustc_passes`.Nicholas Nethercote-192/+197
2024-08-28Auto merge of #127537 - veluca93:struct_tf, r=BoxyUwUbors-5/+37
Implement a first version of RFC 3525: struct target features This PR is an attempt at implementing https://github.com/rust-lang/rfcs/pull/3525, behind a feature gate `struct_target_features`. There's obviously a few tasks that ought to be done before this is merged; in no particular order: - add proper error messages - add tests - create a tracking issue for the RFC - properly serialize/deserialize the new target_features field in `rmeta` (assuming I even understood that correctly :-)) That said, as I am definitely not a `rustc` expert, I'd like to get some early feedback on the overall approach before fixing those things (and perhaps some pointers for `rmeta`...), hence this early PR :-) Here's an example piece of code that I have been using for testing - with the new code, the calls to intrinsics get correctly inlined: ```rust #![feature(struct_target_features)] use std::arch::x86_64::*; /* // fails to compile #[target_feature(enable = "avx")] struct Invalid(u32); */ #[target_feature(enable = "avx")] struct Avx {} #[target_feature(enable = "sse")] struct Sse(); /* // fails to compile extern "C" fn bad_fun(_: Avx) {} */ /* // fails to compile #[inline(always)] fn inline_fun(_: Avx) {} */ trait Simd { fn do_something(&self); } impl Simd for Avx { fn do_something(&self) { unsafe { println!("{:?}", _mm256_setzero_ps()); } } } impl Simd for Sse { fn do_something(&self) { unsafe { println!("{:?}", _mm_setzero_ps()); } } } struct WithAvx { #[allow(dead_code)] avx: Avx, } impl Simd for WithAvx { fn do_something(&self) { unsafe { println!("{:?}", _mm256_setzero_ps()); } } } #[inline(never)] fn dosomething<S: Simd>(simd: &S) { simd.do_something(); } fn main() { /* // fails to compile Avx {}; */ if is_x86_feature_detected!("avx") { let avx = unsafe { Avx {} }; dosomething(&avx); dosomething(&WithAvx { avx }); } if is_x86_feature_detected!("sse") { dosomething(&unsafe { Sse {} }) } } ``` Tracking: - https://github.com/rust-lang/rust/issues/129107
2024-08-28Rollup merge of #129421 - jdonszelmann:naked-repr-align-functions, ↵Matthias Krüger-0/+1
r=workingjubilee,compiler-errors add repr to the allowlist for naked functions Fixes #129412 (combining unstable features #90957 (`#![feature(naked_functions)]`) and #82232 (`#![feature(fn_align)]`)
2024-08-28Implement RFC 3525.Luca Versari-5/+37
2024-08-27add repr to the allowlist for naked functions, and test that it worksjdonszelmann-0/+1
2024-08-26Rollup merge of #129544 - mu001999-contrib:dead-code/clean, r=compiler-errorsMatthias Krüger-7/+0
Removes dead code from the compiler Detected by #128637
2024-08-26Rollup merge of #129525 - notriddle:notriddle/fake-variadic-tuple-array, ↵Matthias Krüger-0/+10
r=GuillaumeGomez rustdoc: clean up tuple <-> primitive conversion docs This adds a minor missing feature to `fake_variadic`, so that it can render `impl From<(T,)> for [T; 1]` correctly.
2024-08-25Removes dead code from the compilermu001999-7/+0
2024-08-24rustdoc: clean up tuple <-> primitive conversion docsMichael Howell-0/+10
This adds a minor missing feature to `fake_variadic`, so that it can render `impl From<(T,)> for [T; 1]` correctly.
2024-08-24New `#[rustc_pub_transparent]` attributePavel Grigorenko-0/+22
2024-08-22Gate repr(Rust) correctly on non-ADT itemsMichael Goulet-0/+9
2024-08-21Use bool in favor of Option<()> for diagnosticsMichael Goulet-5/+4
2024-08-18Fix wording of misapplied `must_not_suspend` errorGoldstein-1/+1
2024-08-18Check that `#[may_dangle]` is properly appliedGoldstein-1/+29
It's only valid when applied to a type or lifetime parameter in `Drop` trait implementation.
2024-08-18Rollup merge of #129203 - compiler-errors:extern_crate_data, r=jieyouxu许杰友 Jieyou Xu (Joe)-2/+2
Use cnum for extern crate data key Noticed this when fixing #129184. I still have yet to put up a fix for that (mostly because I'm too lazy to minimize a test, that will come soon though).
2024-08-17Use cnum for extern crate dataMichael Goulet-2/+2
2024-08-17Rollup merge of #128989 - s7tya:check-linkage-attribute-pos, r=petrochenkovMatthias Krüger-1/+23
Emit an error for invalid use of the linkage attribute fixes #128486 Currently, the use of the linkage attribute for Mod, Impl,... is incorrectly permitted. This PR will correct this issue by generating errors, and I've also added some UI test cases for it. Related: #128552.