about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/main_shim.rs
AgeCommit message (Collapse)AuthorLines
2025-06-05Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of NoneOli Scherer-2/+2
2025-04-14Move `has_self` field to `hir::AssocKind::Fn`.Nicholas Nethercote-2/+2
`hir::AssocItem` currently has a boolean `fn_has_self_parameter` field, which is misplaced, because it's only relevant for associated fns, not for associated consts or types. This commit moves it (and renames it) to the `AssocKind::Fn` variant, where it belongs. This requires introducing a new C-style enum, `AssocTag`, which is like `AssocKind` but without the fields. This is because `AssocKind` values are passed to various functions like `find_by_ident_and_kind` to indicate what kind of associated item should be searched for, and having to specify `has_self` isn't relevant there. New methods: - Predicates `AssocItem::is_fn` and `AssocItem::is_method`. - `AssocItem::as_tag` which converts `AssocItem::kind` to `AssocTag`. Removed `find_by_name_and_kinds`, which is unused. `AssocItem::descr` can now distinguish between methods and associated functions, which slightly improves some error messages.
2025-04-10Rename some `name` variables as `ident`.Nicholas Nethercote-1/+1
It bugs me when variables of type `Ident` are called `name`. It leads to silly things like `name.name`. `Ident` variables should be called `ident`, and `name` should be used for variables of type `Symbol`. This commit improves things by by doing `s/name/ident/` on a bunch of `Ident` variables. Not all of them, but a decent chunk.
2025-02-08Rustfmtbjorn3-3/+6
2025-01-21remove support for the #[start] attributeRalf Jung-13/+8
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-06Remove polymorphizationBen Kimock-6/+4
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-3/+3
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-9/+6
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+1
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-02Fix spansMichael Goulet-2/+3
2024-07-02Give Instance::expect_resolve a spanMichael Goulet-0/+2
2024-06-30Merge commit '49cd5dd454d0115cfbe9e39102a8b3ba4616aa40' into ↵bjorn3-7/+3
sync_cg_clif-2024-06-30
2024-05-13Merge commit '3270432f4b0583104c8b9b6f695bf97d6bbf3ac2' into ↵bjorn3-1/+1
sync_cg_clif-2024-05-13
2024-04-23Merge commit 'de5d6523738fd44a0521b6abf3e73ae1df210741' into ↵bjorn3-0/+1
sync_cg_clif-2024-04-23
2024-03-10use Instance::expect_resolve() instead of unwraping Instance::resolve()Ralf Jung-6/+2
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-2/+2
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-3/+3
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-2/+2
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
2023-03-15Merge commit 'dec0daa8f6d0a0e1c702f169abb6bf3eee198c67' into ↵bjorn3-1/+1
sync_cg_clif-2023-03-15
2023-02-24Rename many interner functions.Nicholas Nethercote-2/+2
(This is a large commit. The changes to `compiler/rustc_middle/src/ty/context.rs` are the most important ones.) The current naming scheme is a mess, with a mix of `_intern_`, `intern_` and `mk_` prefixes, with little consistency. In particular, in many cases it's easy to use an iterator interner when a (preferable) slice interner is available. The guiding principles of the new naming system: - No `_intern_` prefixes. - The `intern_` prefix is for internal operations. - The `mk_` prefix is for external operations. - For cases where there is a slice interner and an iterator interner, the former is `mk_foo` and the latter is `mk_foo_from_iter`. Also, `slice_interners!` and `direct_interners!` can now be `pub` or non-`pub`, which helps enforce the internal/external operations division. It's not perfect, but I think it's a clear improvement. The following lists show everything that was renamed. slice_interners - const_list - mk_const_list -> mk_const_list_from_iter - intern_const_list -> mk_const_list - substs - mk_substs -> mk_substs_from_iter - intern_substs -> mk_substs - check_substs -> check_and_mk_substs (this is a weird one) - canonical_var_infos - intern_canonical_var_infos -> mk_canonical_var_infos - poly_existential_predicates - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter - intern_poly_existential_predicates -> mk_poly_existential_predicates - _intern_poly_existential_predicates -> intern_poly_existential_predicates - predicates - mk_predicates -> mk_predicates_from_iter - intern_predicates -> mk_predicates - _intern_predicates -> intern_predicates - projs - intern_projs -> mk_projs - place_elems - mk_place_elems -> mk_place_elems_from_iter - intern_place_elems -> mk_place_elems - bound_variable_kinds - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter - intern_bound_variable_kinds -> mk_bound_variable_kinds direct_interners - region - intern_region (unchanged) - const - mk_const_internal -> intern_const - const_allocation - intern_const_alloc -> mk_const_alloc - layout - intern_layout -> mk_layout - adt_def - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid) - alloc_adt_def(!) -> mk_adt_def - external_constraints - intern_external_constraints -> mk_external_constraints Other - type_list - mk_type_list -> mk_type_list_from_iter - intern_type_list -> mk_type_list - tup - mk_tup -> mk_tup_from_iter - intern_tup -> mk_tup
2023-02-17Replace `mk_foo` calls with `infer_foo` where possible.Nicholas Nethercote-1/+1
There are several `mk_foo`/`intern_foo` pairs, where the former takes an iterator and the latter takes a slice. (This naming convention is bad, but that's a fix for another PR.) This commit changes several `mk_foo` occurrences into `intern_foo`, avoiding the need for some `.iter()`/`.into_iter()` calls. Affected cases: - mk_type_list - mk_tup - mk_substs - mk_const_list
2023-01-27Auto merge of #107055 - kylematsuda:eb-fn-sig, r=lcnrbors-1/+1
Switch to `EarlyBinder` for `fn_sig` query Part of the work to finish #105779 (also see https://github.com/rust-lang/types-team/issues/78). Several queries `X` have a `bound_X` variant that wraps the output in [`EarlyBinder`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/struct.EarlyBinder.html). This adds `EarlyBinder` to the return type of the `fn_sig` query and removes `bound_fn_sig`. r? `@lcnr`
2023-01-26add EarlyBinder::no_bound_varsKyle Matsuda-1/+1
2023-01-26change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add ↵Kyle Matsuda-1/+1
EarlyBinder to fn_sig in metadata
2023-01-26replace usages of fn_sig query with bound_fn_sigKyle Matsuda-1/+1
2023-01-24Merge commit '598f0909568a51de8a2d1148f55a644fd8dffad0' into ↵bjorn3-2/+13
sync_cg_clif-2023-01-24
2022-12-14Merge commit '2bb3996244cf1b89878da9e39841e9f6bf061602' into ↵bjorn3-3/+3
sync_cg_clif-2022-12-14
2022-11-17Use custom entry name in craneliftAyush Singh-2/+6
This is a continuation of 9f0a8620bd7d325e6d42417b08daff3e55cb88f6 for cranelift. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-10-23Merge commit '266e96785ab71834b917bf474f130a6d8fdecd4b' into ↵bjorn3-1/+1
sync_cg_clif-2022-10-23
2022-08-28Support `#[unix_sigpipe = "inherit|sig_dfl|sig_ign"]` on `fn main()`Martin Nordholts-6/+9
This makes it possible to instruct libstd to never touch the signal handler for `SIGPIPE`, which makes programs pipeable by default (e.g. with `./your-program | head -n 1`) without `ErrorKind::BrokenPipe` errors.
2022-07-25Merge commit 'c19edfd71a1d0ddef86c2c67fdb40718d40a72b4' into ↵bjorn3-1/+2
sync_cg_clif-2022-07-25
2022-02-23Normalize main return type during mono item collection & codegenTomasz Miąsko-1/+4
2022-02-23Merge commit '35d9c6bf256968e1b40e0d554607928bdf9cebea' into ↵bjorn3-3/+1
sync_cg_clif-2022-02-23
2021-05-27Merge commit '40dd3e2b7089b5e96714e064b731f6dbf17c61a9' into ↵bjorn3-2/+7
sync_cg_clif-2021-05-27
2021-05-12Use () for entry_fn.Camille GILLOT-1/+1
2021-04-30Sync rustc_codegen_cranelift 'ddd4ce25535cf71203ba3700896131ce55fde795'Erin Power-12/+58
2021-04-29Implement RFC 1260 with feature_name `imported_main`.Charles Lew-1/+1
2021-03-29Merge commit '0969bc6dde001e01e7e1f58c8ccd7750f8a49ae1' into ↵bjorn3-6/+3
sync_cg_clif-2021-03-29
2021-03-05Merge commit '9a0c32934ebe376128230aa8da3275697b2053e7' into ↵bjorn3-24/+5
sync_cg_clif-2021-03-05
2021-02-01Merge commit 'd556c56f792756dd7cfec742b9f2e07612dc10f4' into ↵bjorn3-2/+2
sync_cg_clif-2021-02-01
2020-11-16update `cg_clif`Bastian Kauschke-1/+1
2020-11-03Merge commit '03f01bbe901d60b71cf2c5ec766aef5e532ab79d' into ↵bjorn3-1/+1
update_cg_clif-2020-11-01
2020-10-26Add 'compiler/rustc_codegen_cranelift/' from commit ↵bjorn3-0/+130
'793d26047f994e23415f8f6bb5686ff25d3dda92' git-subtree-dir: compiler/rustc_codegen_cranelift git-subtree-mainline: cf798c1ec65a5ec3491846777f9003fabb881b4a git-subtree-split: 793d26047f994e23415f8f6bb5686ff25d3dda92