about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/check
AgeCommit message (Collapse)AuthorLines
2024-07-19LTA: Diag: Detect bivariant ty params that are only used recursivelyLeón Orell Valerian Liehr-36/+37
2024-07-19Rollup merge of #121533 - ratmice:wasm_init_fini_array, r=nnethercoteTrevor Gross-7/+28
Handle .init_array link_section specially on wasm Given that wasm-ld now has support for [.init_array](https://github.com/llvm/llvm-project/blob/8f2bd8ae68883592a333f4bdbed9798d66e68630/llvm/lib/MC/WasmObjectWriter.cpp#L1852), it appears we can easily implement that section by falling through to the normal path rather than taking the typical custom_section path for wasm. The wasm-ld appears to have a bunch of limitations. Only one static with the `link_section` in a crate or else you hit the fatal error in the link above "only one .init_array section fragment supported". They do not get merged. You can still call multiple constructors by setting it to an array. ``` unsafe extern "C" fn ctor() { println!("foo"); } #[used] #[link_section = ".init_array"] static FOO: [unsafe extern "C" fn(); 2] = [ctor, ctor]; ``` Another issue appears to be that if crate *A* depends on crate *B*, but *A* doesn't call any symbols from *B* and *B* doesn't `#[export_name = ...]` any symbols, then crate *B*'s constructor will not be called. The workaround to this is to provide an exported symbol in crate *B*.
2024-07-18Rollup merge of #127929 - estebank:addr_of, r=compiler-errorsMatthias Krüger-13/+22
Use more accurate span for `addr_of!` suggestion Use a multipart suggestion instead of a single whole-span replacement: ``` error[E0796]: creating a shared reference to a mutable static --> $DIR/reference-to-mut-static-unsafe-fn.rs:10:18 | LL | let _y = &X; | ^^ shared reference to mutable static | = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior help: use `addr_of!` instead to create a raw pointer | LL | let _y = addr_of!(X); | ~~~~~~~~~ + ```
2024-07-18Use more accurate span for `addr_of!` suggestionEsteban Küber-13/+22
Use a multipart suggestion instead of a single whole-span replacement: ``` error[E0796]: creating a shared reference to a mutable static --> $DIR/reference-to-mut-static-unsafe-fn.rs:10:18 | LL | let _y = &X; | ^^ shared reference to mutable static | = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior help: use `addr_of!` instead to create a raw pointer | LL | let _y = addr_of!(X); | ~~~~~~~~~ + ```
2024-07-17Account for structs that have unused params in nested types in fieldsMichael Goulet-24/+94
2024-07-17Account for self ty aliasMichael Goulet-5/+10
2024-07-17Mention that type parameters are used recursivelyMichael Goulet-21/+62
2024-07-17Split part of `adt_const_params` into `unsized_const_params`Boxy-18/+33
2024-07-17Forbid `!Sized` types and referencesBoxy-4/+12
2024-07-15Move rustc_infer::infer::error_reporting to rustc_infer::error_reporting::inferMichael Goulet-1/+1
2024-07-08Move trait selection error reporting to its own top-level moduleMichael Goulet-7/+7
2024-07-08Rollup merge of #127452 - fee1-dead-contrib:fx-intrinsic-counting, r=fmease许杰友 Jieyou Xu (Joe)-6/+12
Fix intrinsic const parameter counting with `effects` r? project-const-traits
2024-07-08Rollup merge of #127439 - compiler-errors:uplift-elaborate, r=lcnr许杰友 Jieyou Xu (Joe)-12/+11
Uplift elaboration into `rustc_type_ir` Allows us to deduplicate and consolidate elaboration (including these stupid elaboration duplicate fns i added for pretty printing like 3 years ago) so I'm pretty hyped about this change :3 r? lcnr
2024-07-07Auto merge of #127172 - compiler-errors:full-can_eq-everywhere, r=lcnrbors-49/+43
Make `can_eq` process obligations (almost) everywhere Move `can_eq` to an extension trait on `InferCtxt` in `rustc_trait_selection`, and change it so that it processes obligations. This should strengthen it to be more accurate in some cases, but is most important for the new trait solver which delays relating aliases to `AliasRelate` goals. Without this, we always basically just return true when passing aliases to `can_eq`, which can lead to weird errors, for example #127149. I'm not actually certain if we should *have* `can_eq` be called on the good path. In cases where we need `can_eq`, we probably should just be using a regular probe. Fixes #127149 r? lcnr
2024-07-07Fix intrinsic const parameter counting with `effects`Deadbeef-6/+12
2024-07-07iter_identity is a better nameMichael Goulet-12/+11
2024-07-05Use verbose suggestion for changing arg typeEsteban Küber-3/+3
2024-07-05Rework receiver_is_validMichael Goulet-50/+42
2024-07-05Actually just make can_eq process obligations (almost) everywhereMichael Goulet-9/+3
2024-07-05Process alias-relate obligations when proving receiver_is_validMichael Goulet-1/+9
2024-07-02Rewrite dropckBoxy-9/+25
2024-06-28temporarily disable effects on specialization testsDeadbeef-0/+1
2024-06-28implement new effects desugaringDeadbeef-6/+11
2024-06-26Rollup merge of #126968 - lqd:issue-126670, r=compiler-errorsMatthias Krüger-4/+4
Don't ICE during RPITIT refinement checking for resolution errors after normalization #126670 shows a case where resolution errors after normalization can happen during RPITIT refinement checking. Our tests didn't reach this path before, and we explicitly ICEd until we had a test. We can now delay a bug since we're sure it is reachable and have the test from the isue. The comment I added likely still needs more expert wordsmithing. r? ``@compiler-errors`` who's making me work during vacation (j/k). Fixes #126670
2024-06-25delay bug in RPITIT refinement checking with resolution errorsRémy Rakic-4/+4
2024-06-25Rollup merge of #126868 - bvanjoi:fix-126764, r=davidtwcoMatthias Krüger-5/+12
not use offset when there is not ends with brace Fixes #126764
2024-06-24Split out IntoIterator and non-Iterator constructors for ↵Michael Goulet-4/+12
AliasTy/AliasTerm/TraitRef/projection
2024-06-23not use offset when there is not ends with bracebohan-5/+12
2024-06-22Rollup merge of #126552 - fee1-dead-contrib:rmfx, r=compiler-errorsMatthias Krüger-12/+12
Remove use of const traits (and `feature(effects)`) from stdlib The current uses are already unsound because they are using non-const impls in const contexts. We can reintroduce them by reverting the commit in this PR, after #120639 lands. Also, make `effects` an incomplete feature. cc `@rust-lang/project-const-traits` r? `@compiler-errors`
2024-06-21Rename a bunch of thingsMichael Goulet-9/+9
2024-06-21update intrinsic const param countingDeadbeef-12/+12
2024-06-20Rollup merge of #126717 - nnethercote:rustfmt-use-pre-cleanups, r=jieyouxuMatthias Krüger-0/+1
Clean up some comments near `use` declarations #125443 will reformat all `use` declarations in the repository. There are a few edge cases involving comments on `use` declarations that require care. This PR cleans up some clumsy comment cases, taking us a step closer to #125443 being able to merge. r? ``@lqd``
2024-06-20Rollup merge of #126620 - oli-obk:taint_errors, r=fee1-deadMatthias Krüger-10/+1
Actually taint InferCtxt when a fulfillment error is emitted And avoid checking the global error counter fixes #122044 fixes #123255 fixes #123276 fixes #125799
2024-06-20Add blank lines after module-level `//` comments.Nicholas Nethercote-0/+1
Similar to the previous commit.
2024-06-19Remove a hack that isn't needed anymoreOli Scherer-10/+1
2024-06-19Rollup merge of #125293 - dingxiangfei2009:tail-expr-temp-lifetime, ↵许杰友 Jieyou Xu (Joe)-2/+8
r=estebank,davidtwco Place tail expression behind terminating scope This PR implements #123739 so that we can do further experiments in nightly. A little rewrite has been applied to `for await` lowering. It was previously `unsafe { Pin::unchecked_new(into_async_iter(..)) }`. Under the edition 2024 rule, however, `into_async_iter` gets dropped at the end of the `unsafe` block. This presumably the first Edition 2024 migration rule goes by hoisting `into_async_iter(..)` into `match` one level above, so it now looks like the following. ```rust match into_async_iter($iter_expr) { ref mut iter => match unsafe { Pin::unchecked_new(iter) } { ... } } ```
2024-06-18Prefer `dcx` methods over fields or fields' methodsOli Scherer-1/+1
2024-06-17Rework precise capturing syntaxMichael Goulet-2/+5
2024-06-18tail expression behind terminating scopeDing Xiang Fei-2/+8
2024-06-15Rollup merge of #126417 - beetrees:f16-f128-inline-asm-x86, r=AmanieuMatthias Krüger-0/+4
Add `f16` and `f128` inline ASM support for `x86` and `x86-64` This PR adds `f16` and `f128` input and output support to inline ASM on `x86` and `x86-64`. `f16` vector sizes are taken from [here](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html). Relevant issue: #125398 Tracking issue: #116909 ``@rustbot`` label +F-f16_and_f128
2024-06-14Use is_lang_item more aggressivelyMichael Goulet-2/+2
2024-06-14Update for reviewmatt rice-2/+17
2024-06-13Add `f16` and `f128` inline ASM support for `x86` and `x86-64`beetrees-0/+4
2024-06-07Auto merge of #125918 - oli-obk:const_block_ice, r=compiler-errorsbors-5/+2
Revert: create const block bodies in typeck via query feeding as per the discussion in https://github.com/rust-lang/rust/pull/125806#discussion_r1622563948 It was a mistake to try to shoehorn const blocks and some specific anon consts into the same box and feed them during typeck. It turned out not simplifying anything (my hope was that we could feed `type_of` to start avoiding the huge HIR matcher, but that didn't work out), but instead making a few things more fragile. reverts the const-block-specific parts of https://github.com/rust-lang/rust/pull/124650 `@bors` rollup=never had a small perf impact previously fixes https://github.com/rust-lang/rust/issues/125846 r? `@compiler-errors`
2024-06-07Revert "Create const block DefIds in typeck instead of ast lowering"Oli Scherer-5/+2
This reverts commit ddc5f9b6c1f21da5d4596bf7980185a00984ac42.
2024-06-06Uplift TypeErrorMichael Goulet-0/+1
2024-06-06Auto merge of #124482 - spastorino:unsafe-extern-blocks, r=oli-obkbors-3/+4
Unsafe extern blocks This implements RFC 3484. Tracking issue #123743 and RFC https://github.com/rust-lang/rfcs/pull/3484 This is better reviewed commit by commit.
2024-06-05Basic removal of `Ty` from places (boring)Boxy-3/+0
2024-06-04Add safe/unsafe to static inside extern blocksSantiago Pastorino-1/+2
2024-06-04Handle safety keyword for extern block inner itemsSantiago Pastorino-2/+2