rust/compiler
Matthias Krüger ded16b3a97
Rollup merge of #122842 - pacak:explicit_name, r=michaelwoerister
Don't emit an error about failing to produce a file with a specific name if user never gave an explicit name

Fixes #122509

You can ask `rustc` to produce some intermediate results with `--emit foo`, this operation comes in two flavors: `--emit asm` and `--emit asm=foo.s`. First one produces one or more `.s` files without any name guarantees, second one renames it into `foo.s`. Second version only works when compiler produces a single file - for asm files this means using a single compilation unit for example.

In case compilation produced more than a single file `rustc` runs following check to emit some warnings:

```rust
            if crate_output.outputs.contains_key(&output_type) {
                // 2) Multiple codegen units, with `--emit foo=some_name`. We have
                //    no good solution for this case, so warn the user.
                sess.dcx().emit_warn(errors::IgnoringEmitPath { extension });
            } else if crate_output.single_output_file.is_some() {
                // 3) Multiple codegen units, with `-o some_name`. We have
                //    no good solution for this case, so warn the user.
                sess.dcx().emit_warn(errors::IgnoringOutput { extension });
            } else {
                // 4) Multiple codegen units, but no explicit name. We
                //    just leave the `foo.0.x` files in place.
                // (We don't have to do any work in this case.)
            }
```

Comment in the final `else` branch implies that if user didn't ask for a specific name - there's no need to emit warnings. However because of the internal representation of `crate_output.outputs` - this doesn't work as expected: if user asked to produce an asm file without giving it an implicit name it will contain `Some(None)`.

To fix the problem new code actually checks if user gave an explicit name. I think this was an original intentional behavior, at least comments imply that.
2024-03-25 17:05:32 +01:00
..
rustc
rustc_abi Auto merge of #121668 - erikdesjardins:commonprim, r=scottmcm,oli-obk 2024-03-13 15:25:35 +00:00
rustc_arena rename ptr::invalid -> ptr::without_provenance 2024-02-21 20:15:52 +01:00
rustc_ast Auto merge of #122869 - matthiaskrgr:rollup-0navj4l, r=matthiaskrgr 2024-03-22 12:29:42 +00:00
rustc_ast_ir Fix typo in VisitorResult 2024-03-08 23:20:29 -05:00
rustc_ast_lowering Rename hir::Node::Local into hir::Node::LetStmt 2024-03-22 20:48:36 +01:00
rustc_ast_passes Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_ast_pretty Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_attr Rename IntoDiagnostic as Diagnostic. 2024-03-11 09:15:09 +11:00
rustc_baked_icu_data
rustc_borrowck Rollup merge of #122969 - cuviper:borrowck-rposition, r=matthewjasper 2024-03-23 22:59:43 -07:00
rustc_builtin_macros Auto merge of #119552 - krtab:dead_code_priv_mod_pub_field, r=cjgillot,saethlin 2024-03-23 00:37:05 +00:00
rustc_codegen_cranelift move assert_unsafe_preconditions to its own file 2024-03-23 18:44:17 +01:00
rustc_codegen_gcc Rollup merge of #122937 - Zalathar:unbox, r=oli-obk 2024-03-24 17:08:16 +01:00
rustc_codegen_llvm Rollup merge of #122937 - Zalathar:unbox, r=oli-obk 2024-03-24 17:08:16 +01:00
rustc_codegen_ssa Rollup merge of #122842 - pacak:explicit_name, r=michaelwoerister 2024-03-25 17:05:32 +01:00
rustc_const_eval Rollup merge of #122937 - Zalathar:unbox, r=oli-obk 2024-03-24 17:08:16 +01:00
rustc_data_structures Auto merge of #122568 - RalfJung:mentioned-items, r=oli-obk 2024-03-21 09:01:18 +00:00
rustc_driver
rustc_driver_impl Rollup merge of #122847 - workingjubilee:suggest-rust-min-stack-workaround-on-overflow, r=TaKO8Ki 2024-03-22 11:37:02 +01:00
rustc_error_codes Auto merge of #122055 - compiler-errors:stabilize-atb, r=oli-obk 2024-03-19 00:04:09 +00:00
rustc_error_messages Rename SubdiagnosticMessage as SubdiagMessage. 2024-03-05 12:14:49 +11:00
rustc_errors Rollup merge of #122737 - ytmimi:conditionally_ignore_fatal_diagnostic, r=davidtwco 2024-03-24 17:08:15 +01:00
rustc_expand Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_feature Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_fluent_macro Rename SubdiagnosticMessage as SubdiagMessage. 2024-03-05 12:14:49 +11:00
rustc_fs_util Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_graphviz Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_hir Rename hir::Node::Local into hir::Node::LetStmt 2024-03-22 20:48:36 +01:00
rustc_hir_analysis Rollup merge of #121940 - veera-sivarajan:bugfix-121593, r=fmease 2024-03-23 22:59:40 -07:00
rustc_hir_pretty Rename hir::Node::Local into hir::Node::LetStmt 2024-03-22 20:48:36 +01:00
rustc_hir_typeck Rollup merge of #122780 - GuillaumeGomez:rename-hir-local, r=oli-obk 2024-03-23 15:00:18 +01:00
rustc_incremental Auto merge of #122721 - oli-obk:merge_queries, r=davidtwco 2024-03-25 01:33:46 +00:00
rustc_index doc: Add better explanation 2024-03-06 16:54:42 +01:00
rustc_index_macros Remove SpecOptionPartialEq 2024-03-19 16:32:01 +00:00
rustc_infer Rollup merge of #122217 - estebank:issue-119685, r=fmease 2024-03-24 01:05:51 +01:00
rustc_interface Rollup merge of #122737 - ytmimi:conditionally_ignore_fatal_diagnostic, r=davidtwco 2024-03-24 17:08:15 +01:00
rustc_lexer Silence redundant error on char literal that was meant to be a string in 2021 edition 2024-03-17 23:35:19 +00:00
rustc_lint Rollup merge of #122780 - GuillaumeGomez:rename-hir-local, r=oli-obk 2024-03-23 15:00:18 +01:00
rustc_lint_defs Rollup merge of #121720 - tmandry:split-refining, r=compiler-errors 2024-03-16 23:28:47 +01:00
rustc_llvm Update the minimum external LLVM to 17 2024-03-17 10:11:04 -07:00
rustc_log rustc_log: expose tracing-tree "wraparound" in an env var 2024-03-03 12:33:26 +01:00
rustc_macros Rename diagnostic derive things. 2024-03-11 10:06:34 +11:00
rustc_metadata Rollup merge of #122757 - h1467792822:priv-dep, r=davidtwco 2024-03-24 17:08:15 +01:00
rustc_middle Auto merge of #122721 - oli-obk:merge_queries, r=davidtwco 2024-03-25 01:33:46 +00:00
rustc_mir_build Auto merge of #122721 - oli-obk:merge_queries, r=davidtwco 2024-03-25 01:33:46 +00:00
rustc_mir_dataflow refactor check_{lang,library}_ub: use a single intrinsic, put policy into library 2024-03-23 18:45:05 +01:00
rustc_mir_transform Auto merge of #122721 - oli-obk:merge_queries, r=davidtwco 2024-03-25 01:33:46 +00:00
rustc_monomorphize Auto merge of #122852 - compiler-errors:raw-ptr, r=lcnr 2024-03-22 20:34:14 +00:00
rustc_next_trait_solver Rollup merge of #122907 - compiler-errors:uniquify-reerror, r=lcnr 2024-03-24 01:05:53 +01:00
rustc_parse Clarify parse_dot_suffix_expr. 2024-03-25 13:08:07 +11:00
rustc_parse_format Extend format arg help for simple tuple index access expression 2024-03-16 22:33:02 +00:00
rustc_passes Rollup merge of #122780 - GuillaumeGomez:rename-hir-local, r=oli-obk 2024-03-23 15:00:18 +01:00
rustc_pattern_analysis Programmatically convert some of the pat ctors 2024-03-22 11:13:29 -04:00
rustc_privacy Rename hir::Local into hir::LetStmt 2024-03-22 20:36:21 +01:00
rustc_query_impl Verify that query keys result in unique dep nodes 2024-03-12 05:31:41 +01:00
rustc_query_system Rollup merge of #122245 - saethlin:check-dep-graph-size, r=petrochenkov 2024-03-12 09:04:00 -07:00
rustc_resolve Don't suggest deref macro since it's unstable 2024-03-21 11:42:49 -04:00
rustc_serialize Stabilize associated type bounds 2024-03-08 20:56:25 +00:00
rustc_session Rollup merge of #122842 - pacak:explicit_name, r=michaelwoerister 2024-03-25 17:05:32 +01:00
rustc_smir refactor check_{lang,library}_ub: use a single intrinsic, put policy into library 2024-03-23 18:45:05 +01:00
rustc_span refactor check_{lang,library}_ub: use a single intrinsic, put policy into library 2024-03-23 18:45:05 +01:00
rustc_symbol_mangling Rollup merge of #123005 - maurer:cfi-arbitrary-receivers, r=compiler-errors 2024-03-25 11:00:14 +01:00
rustc_target Rollup merge of #121940 - veera-sivarajan:bugfix-121593, r=fmease 2024-03-23 22:59:40 -07:00
rustc_trait_selection Auto merge of #122802 - estebank:unconstrained-generic-const, r=Nadrieril 2024-03-25 09:59:37 +00:00
rustc_traits Merge check_mod_impl_wf and check_mod_type_wf 2024-03-07 06:27:09 +00:00
rustc_transmute Rollup merge of #122784 - jswrenn:tag_for_variant, r=compiler-errors 2024-03-22 20:31:29 +01:00
rustc_ty_utils -Zprint-type-sizes: print the types of awaitees and unnamed coroutine locals. 2024-03-22 18:07:15 -07:00
rustc_type_ir Programmatically convert some of the pat ctors 2024-03-22 11:13:29 -04:00
stable_mir Rollup merge of #122762 - RoboSchmied:RoboSchmied-typo, r=workingjubilee 2024-03-23 22:59:41 -07:00