about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2022-08-27remove an ineffective check in const_propRalf Jung-25/+58
2022-08-27Auto merge of #100946 - jyn514:query-system-3, r=cjgillotbors-16/+16
Simplify the arguments to macros generated by the `rustc_queries` proc macro Very small cleanup. Based on https://github.com/rust-lang/rust/pull/100436 which modifies some of the same code. r? `@cjgillot`
2022-08-27Auto merge of #101074 - JohnTitor:rollup-zwznihq, r=JohnTitorbors-33/+11
Rollup of 11 pull requests Successful merges: - #96240 (Stabilize `const_ptr_offset_from`.) - #99784 (Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default) - #100811 (Fix wrong compiletest filters on Windows) - #100924 (Smaller improvements of tidy and the unicode generator) - #100953 (Update documentation for `write!` and `writeln!`) - #101018 (rustdoc: omit start/end tags for empty item description blocks) - #101044 (rustdoc: remove unused CSS for `hidden-by-*-hider`) - #101046 (rustdoc: remove incorrect CSS selector `.impl-items table td`) - #101057 (Merge implementations of HIR fn_decl and fn_sig.) - #101062 (rustdoc: remove empty extern_crates and type="text/javascript" on script) - #101063 (Merge duplicated CSS rules) Failed merges: - #101055 (Use smaller span for suggestions) r? `@ghost` `@rustbot` modify labels: rollup
2022-08-27Rollup merge of #101057 - cjgillot:one-fn-sig, r=compiler-errorsYuki Okushi-31/+9
Merge implementations of HIR fn_decl and fn_sig.
2022-08-27Rollup merge of #99784 - est31:deny_cfg_attr_crate_type_name, r=Mark-SimulacrumYuki Okushi-2/+2
Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default Turns the forward compatibility lint added by #83744 to deprecate `cfg_attr` usage with `#![crate_type]` and `#![crate_name]` attributes into deny by default. Copying the example from #83744: ```Rust #![crate_type = "lib"] // remains working #![cfg_attr(foo, crate_type = "bin")] // will stop working ``` Over 8 months have passed since #83744 was merged so I'd say this gives ample time for people to have been warned, so we can make the warning stronger. No usage was found via grep.app except for one, which was in an unmaintained code base that didn't seem to be used in the open source eco system. The crater run conducted in #83744 also didn't show up anything. cc #91632 - tracking issue for the lint
2022-08-27Auto merge of #100732 - dpaoliello:import_name_type, r=wesleywiserbors-40/+216
Implementation of import_name_type Fixes #96534 by implementing https://github.com/rust-lang/compiler-team/issues/525 Symbols that are exported or imported from a binary on 32bit x86 Windows can be named in four separate ways, corresponding to the [import name types](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-name-type) from the PE-COFF spec. The exporting and importing binaries must use the same name encoding, otherwise mismatches can lead to link failures due to "missing symbols" or to 0xc0000139 (`STATUS_ENTRYPOINT_NOT_FOUND`) errors when the executable/library is loaded. For details, see the comments on the raw-dylib feature's https://github.com/rust-lang/rust/issues/58713. To generate the correct import libraries for these DLLs, therefore, rustc must know the import name type for each `extern` function, and there is currently no way for users to provide this information. This change adds a new `MetaNameValueStr` key to the `#[link]` attribute called `import_name_type`, and which accepts one of three values: `decorated`, `noprefix`, and `undecorated`. A single DLL is likely to export all its functions using the same import type name, hence `import_name_type` is a parameter of `#[link]` rather than being its own attribute that is applied per-function. It is possible to have a single DLL that exports different functions using different import name types, but users could express such cases by providing multiple export blocks for the same DLL, each with a different import name type. Note: there is a fourth import name type defined in the PE-COFF spec, `IMPORT_ORDINAL`. This case is already handled by the `#[link_ordinal]` attribute. While it could be merged into `import_type_name`, that would not make sense as `#[link_ordinal]` provides per-function information (namely the ordinal itself). Design decisions (these match the MCP linked above): * For GNU, `decorated` matches the PE Spec and MSVC rather than the default behavior of `dlltool` (i.e., there will be a leading `_` for `stdcall`). * If `import_name_type` is not present, we will keep our current behavior of matching the environment (MSVC vs GNU) default for decorating. * Using `import_name_type` on architectures other than 32bit x86 will result in an error. * Using `import_name_type` with link kinds other than `"raw-dylib"` will result in an error.
2022-08-27Auto merge of #101064 - compiler-errors:rollup-fwm5m5f, r=compiler-errorsbors-927/+2402
Rollup of 9 pull requests Successful merges: - #100724 (Migrate ast lowering to session diagnostic) - #100735 (Migrate `rustc_ty_utils` to `SessionDiagnostic`) - #100738 (Diagnostics migr const eval) - #100744 (Migrate rustc_mir_dataflow to diagnostic structs) - #100776 (Migrate `rustc_lint` errors to `SessionDiagnostic`) - #100817 (sugg: suggest the usage of boolean value when there is a typo in the keyword) - #100836 (Migrate `rustc_attr` crate diagnostics) - #100890 (Migrate rustc_driver to SessionDiagnostic) - #100900 (on `region_errors.rs`) Failed merges: - #100831 (Migrate `symbol_mangling` module to new diagnostics structs) r? `@ghost` `@rustbot` modify labels: rollup
2022-08-26Rollup merge of #100900 - AndyJado:diag-migrate, r=davidtwcoMichael Goulet-76/+211
on `region_errors.rs` `@rustbot` label +A-translation
2022-08-26Rollup merge of #100890 - adriantombu:migrate_diagnostic_rustc_driver, ↵Michael Goulet-12/+94
r=davidtwco Migrate rustc_driver to SessionDiagnostic First timer noob here 👋🏽 I'm having a problem understanding how I can retrieve the span, and how to properly construct the error structs to avoid the current compilation errors. Any help pointing me in the right direction would be much appreciated 🙌🏽
2022-08-26Rollup merge of #100836 - hampuslidin:migrate-attr-crate-diagnostics, ↵Michael Goulet-217/+621
r=davidtwco Migrate `rustc_attr` crate diagnostics Hi! This is my first PR to the rustc project, excited to be part of the development! This PR is part of the diagnostics effort, to make diagnostics translatable. `@rustbot` label +A-translation
2022-08-26Rollup merge of #100817 - vincenzopalazzo:macros/bool_spelling_sugg, r=davidtwcoMichael Goulet-5/+22
sugg: suggest the usage of boolean value when there is a typo in the keyword Fixes https://github.com/rust-lang/rust/issues/100686 This adds a new suggestion when there is a well-known typo With the following program ```rust fn main() { let x = True; } ``` Now we have the following suggestion ``` error[E0425]: cannot find value `True` in this scope --> test.rs:2:13 | 2 | let x = True; | ^^^^ not found in this scope | help: you may want to use a bool value instead | 2 | let x = true; | ~~~~ error: aborting due to previous error ``` Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-08-26Rollup merge of #100776 - Rejyr:diagnostic-migration-rustc-lint, r=davidtwcoMichael Goulet-124/+297
Migrate `rustc_lint` errors to `SessionDiagnostic` Draft PR for migrating `rustc_lint` to `SessionDiagnostic`, as part of the [recent blog post](https://blog.rust-lang.org/inside-rust/2022/08/16/diagnostic-effort.html)
2022-08-26Rollup merge of #100744 - 5225225:migrate-rustc-mir-dataflow, r=davidtwcoMichael Goulet-22/+126
Migrate rustc_mir_dataflow to diagnostic structs
2022-08-26Rollup merge of #100738 - nidnogg:diagnostics_migr_const_eval, r=davidtwcoMichael Goulet-115/+228
Diagnostics migr const eval This PR should eventually contain all diagnostic migrations for the `rustc_const_eval` crate. r? `@davidtwco` `@rustbot` label +A-translation
2022-08-26Rollup merge of #100735 - Facel3ss1:ty-utils-translation, r=davidtwcoMichael Goulet-94/+207
Migrate `rustc_ty_utils` to `SessionDiagnostic` I have migrated the `rustc_ty_utils` crate to use `SessionDiagnostic`, motivated by the [recent blog post about the diagnostic translation effort](https://blog.rust-lang.org/inside-rust/2022/08/16/diagnostic-effort.html). This is my first PR to the Rust repository, so if I have missed anything, or anything needs to be changed, please let me know! 😄 `@rustbot` label +A-translation
2022-08-26Rollup merge of #100724 - ↵Michael Goulet-262/+596
JeanCASPAR:migrate-ast_lowering-to-session-diagnostic, r=davidtwco Migrate ast lowering to session diagnostic I migrated the whole rustc_ast_lowering crate to session diagnostic *except* the for the use of `span_fatal` at /compiler/rustc_ast_lowering/src/expr.rs#L1268 because `#[fatal(...)]` is not yet supported (see https://github.com/rust-lang/rust/pull/100694).
2022-08-26Auto merge of #100043 - RalfJung:scalar-always-init, r=RalfJungbors-506/+224
interpret: remove support for uninitialized scalars With Miri no longer supporting `-Zmiri-allow-uninit-numbers`, we no longer need to support storing uninit data in a `Scalar`. We anyway already only use this representation for types with *initialized* `Scalar` layout (and we have to, due to partial initialization), so let's get rid of the `ScalarMaybeUninit` type entirely. I tried to stage this into meaningful commits, but the one that changes `read_immediate` to always trigger UB on uninit is the largest chunk of the PR and I don't see how it could be subdivided. Fixes https://github.com/rust-lang/miri/issues/2187 r? `@oli-obk`
2022-08-26Merge implementations of HIR fn_decl and fn_sig.Camille GILLOT-31/+9
2022-08-26Auto merge of #101039 - ouz-a:issue-100991, r=compiler-errorsbors-1/+4
Don't catch overflow when running with cargo doc Fixes #100991 r? `@compiler-errors`
2022-08-26Don't catch overflow when running with cargo docouz-a-1/+4
2022-08-26remove now-unused ScalarMaybeUninitRalf Jung-134/+1
2022-08-26make read_immediate error immediately on uninit, so ImmTy can carry ↵Ralf Jung-318/+209
initialized Scalar
2022-08-26remove some now-unnecessary parameters from check_bytesRalf Jung-31/+7
2022-08-26remove enforce_number_init machine hook that Miri no longer needsRalf Jung-24/+8
2022-08-26fix an outdated machine hook nameRalf Jung-7/+7
2022-08-26Implementation of import_name_typeDaniel Paoliello-40/+216
2022-08-26Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiserbors-18/+135
session: stabilize split debuginfo on linux Stabilize the `-Csplit-debuginfo` flag... - ...on Linux for all values of the flag. Split DWARF has been implemented for a few months, hasn't had any bug reports and has had some promising benchmarking for incremental debug build performance. - ..on other platforms for the default value. It doesn't make any sense that `-Csplit-debuginfo=packed` is unstable on Windows MSVC when that's the default behaviour, but keep the other values unstable.
2022-08-26Migrate rustc_ty_utils to use SessionDiagnosticPeter Medus-94/+207
2022-08-26Auto merge of #100944 - nnethercote:shrink-thir-Expr, r=cjgillotbors-141/+179
Shrink `thir::Expr` r? `@cjgillot`
2022-08-26Auto merge of #100705 - compiler-errors:issue-100620, r=oli-obkbors-3/+10
Avoid reporting overflow in `is_impossible_method` Fixes #100620 We're evaluating a new predicate in a different param-env than it was checked during typeck, so be more careful about handling overflow errors. Instead of using `FulfillmentCtxt`, using `InferCtxt::evaluate_obligation` by itself will give us back the overflow error, so we can throw it away properly. This may give us more false-positives, but it doesn't regress the `<HashMap as Iterator>::rev` example that originally motivated adding `is_impossible_method` in the first place.
2022-08-26diag-migAndyJado-76/+211
2022-08-26Rollup merge of #100978 - nnethercote:fix-100948, r=petrochenkovYuki Okushi-1/+3
Handle `Err` in `ast::LitKind::to_token_lit`. Fixes #100948. r? ``@petrochenkov``
2022-08-26Rollup merge of #100604 - dtolnay:okorerr, r=m-ou-seYuki Okushi-17/+11
Remove unstable Result::into_ok_or_err Pending FCP: https://github.com/rust-lang/rust/issues/82223#issuecomment-1214920203 ```@rustbot``` label +waiting-on-fcp
2022-08-26Rollup merge of #100034 - tmiasko:elaborate-box-derefs, r=oli-obkYuki Okushi-142/+75
Elaborate all box dereferences in `ElaborateBoxDerefs` so that it is the only pass responsible for elaboration, instead of splitting this responsibility between the `StateTransform` and `ElaborateBoxDerefs`.
2022-08-26Rollup merge of #99920 - emarteca:custom-allocator-support, r=oli-obkYuki Okushi-11/+16
Custom allocator support in `rustc_serialize` Adding support for `rustc_serialize` encode/decode for `Box` and `Vec` that use a custom allocator.
2022-08-26Rollup merge of #99064 - lyming2007:issue-97687-fix, r=estebankYuki Okushi-10/+23
distinguish the method and associated function diagnostic information Methods are defined within the context of a struct and their first parameter is always self Associated functions don’t take self as a parameter ``` modified: compiler/rustc_typeck/src/check/method/suggest.rs modified: src/test/ui/auto-ref-slice-plus-ref.stderr modified: src/test/ui/block-result/issue-3563.stderr modified: src/test/ui/issues/issue-28344.stderr modified: src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr modified: src/test/ui/suggestions/suggest-methods.stderr modified: src/test/ui/traits/trait-upcasting/subtrait-method.stderr ```
2022-08-25Auto merge of #100748 - SparrowLii:query_depth, r=cjgillotbors-54/+83
add `depth_limit` in `QueryVTable` to avoid entering a new tcx in `layout_of` Fixes #49735 Updates #48685 The `layout_of` query needs to check whether it overflows the depth limit, and the current implementation needs to create a new `ImplicitCtxt` inside `layout_of`. However, `start_query` will already create a new `ImplicitCtxt`, so we can check the depth limit in `start_query`. We can tell whether we need to check the depth limit simply by whether the return value of `to_debug_str` of the query is `layout_of`. But I think adding the `depth_limit` field in `QueryVTable` may be more elegant and more scalable.
2022-08-25Adding support for rustc_serialize encode and decode for Box and Vec that ↵Ellen Arteca-11/+16
use a custom allocator
2022-08-25Code cleaningAdrian Tombu-10/+9
2022-08-25Replace spaghetti with a simple errors enumAdrian Tombu-77/+65
2022-08-25Start adding enum errors for deserialize_rlinkAdrian Tombu-10/+76
2022-08-25Use std::io::Error and remove useless to_stringAdrian Tombu-6/+6
2022-08-25Fixes fmt & SessionDiagnostic structsAdrian Tombu-31/+9
2022-08-25Start moving rustc_driver to SessionDiagnosticAdrian Tombu-5/+56
2022-08-25Inline trivial `From<Local> for Place<'_>` implTomasz Miąsko-0/+1
2022-08-25Add method that applies DefUse effectTomasz Miąsko-15/+11
2022-08-25Elaborate all box dereferences in `ElaborateBoxDerefs`Tomasz Miąsko-102/+9
so that it is the only pass responsible for elaboration, instead of splitting this responsibility between the `StateTransform` and `ElaborateBoxDerefs`.
2022-08-25Auto merge of #100571 - cjgillot:mir-cost-visit, r=compiler-errorsbors-108/+236
Check projection types before inlining MIR Fixes https://github.com/rust-lang/rust/issues/100550 I'm very unhappy with this solution, having to duplicate MIR validation code, but at least it removes the ICE. r? `@compiler-errors`
2022-08-25Auto merge of #100436 - jyn514:macro-query-system, r=cjgillotbors-113/+120
try and simplify some things in the query system
2022-08-25Fix liveness analysis for yield terminatorsTomasz Miąsko-32/+61
A resume place is evaluated and assigned to only after a yield terminator resumes. Ensure that locals used when evaluating the resume place are live across the yield.