rust/compiler
bors aadb5718dd Auto merge of #116001 - fmease:validate-crate-name-extern-cli-opt, r=est31
[breaking change] Validate crate name in `--extern` [MCP 650]

Reject non-ASCII-identifier crate names passed to the CLI option `--extern` (`rustc`, `rustdoc`).
Implements [MCP 650](https://github.com/rust-lang/compiler-team/issues/650) (except that we only allow ASCII identifiers not arbitrary Rust identifiers).
Fixes #113035.

[As mentioned on Zulip](376826988), doing a crater run probably doesn't make sense since it wouldn't yield anything. Most users don't interact with `rustc` directly but only ever through Cargo which always passes a valid crate name to `--extern` when it invokes `rustc` and `rustdoc`. In any case, the user wouldn't be able to use such a crate name in the source code anyway.

Note that I'm not using [`rustc_session::output::validate_crate_name`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/output/fn.validate_crate_name.html) (used for `--crate-name` and `#![crate_name]`) since the latter doesn't reject non-ASCII crate names and ones that start with a digit.

As an aside, I've also thought about getting rid of `validate_crate_name` entirely in a separate PR (with another MCP) in favor of `is_ascii_ident` to reject more weird `--crate-name`s, `#![crate_name]`s and file names but I think that would lead to a lot of actual breakage, namely because of file names starting with a digit. In `tests/ui` 9 tests would be impacted for example.

CC `@estebank`
r? `@est31`
2023-09-22 19:57:07 +00:00
..
rustc inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
rustc_abi turns out Layout has some more things to worry about -- move ABI comparison into helper function 2023-09-08 09:14:07 +02:00
rustc_arena Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
rustc_ast Auto merge of #114452 - weiznich:feature/diagnostic_on_unimplemented, r=compiler-errors 2023-09-17 10:00:15 +00:00
rustc_ast_lowering Record asyncness span in HIR 2023-09-21 19:18:14 +00:00
rustc_ast_passes Move let expression checking to parsing 2023-09-11 15:51:18 +00:00
rustc_ast_pretty Move let expression checking to parsing 2023-09-11 15:51:18 +00:00
rustc_attr Auto merge of #114201 - Centri3:explicit-repr-rust, r=WaffleLapkin 2023-08-25 00:02:54 +00:00
rustc_baked_icu_data
rustc_borrowck Record asyncness span in HIR 2023-09-21 19:18:14 +00:00
rustc_builtin_macros Rollup merge of #115891 - RalfJung:structural-trait-derive, r=nnethercote 2023-09-18 18:27:20 +02:00
rustc_codegen_cranelift Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obk 2023-09-21 13:25:39 +02:00
rustc_codegen_gcc fix gcc, cranelift build 2023-09-15 10:43:44 +02:00
rustc_codegen_llvm coverage: Don't bother renumbering expressions on the Rust side 2023-09-21 18:32:49 +10:00
rustc_codegen_ssa Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obk 2023-09-21 13:25:39 +02:00
rustc_const_eval Auto merge of #116010 - RalfJung:more-typed-immediates, r=oli-obk 2023-09-21 14:02:55 +00:00
rustc_data_structures Auto merge of #115230 - Vtewari2311:mod-hurd-latest, r=b-naber 2023-09-21 19:24:01 +00:00
rustc_driver
rustc_driver_impl Auto merge of #115627 - compiler-errors:icedump-no-std, r=m-ou-se 2023-09-19 16:56:25 +00:00
rustc_error_codes Auto merge of #115334 - RalfJung:transparent-aligned-zst, r=compiler-errors 2023-09-17 15:20:44 +00:00
rustc_error_messages Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
rustc_errors Auto merge of #115690 - ShE3py:Z-treat-err-as-bug, r=petrochenkov 2023-09-22 13:01:30 +00:00
rustc_expand Enable incremental-relative-spans by default. 2023-09-07 20:21:13 +00:00
rustc_feature Auto merge of #114452 - weiznich:feature/diagnostic_on_unimplemented, r=compiler-errors 2023-09-17 10:00:15 +00:00
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir Record asyncness span in HIR 2023-09-21 19:18:14 +00:00
rustc_hir_analysis Rollup merge of #116039 - estebank:nested-tait, r=compiler-errors 2023-09-22 12:15:27 +02:00
rustc_hir_pretty Record asyncness span in HIR 2023-09-21 19:18:14 +00:00
rustc_hir_typeck Auto merge of #114776 - fee1-dead-contrib:enable-effects-in-libcore, r=oli-obk 2023-09-22 07:00:52 +00:00
rustc_incremental Move DepKind to rustc_query_system and define it as u16 2023-09-21 17:06:14 +02:00
rustc_index Auto merge of #115094 - Mark-Simulacrum:bootstrap-update, r=ozkanonur 2023-08-24 11:10:52 +00:00
rustc_infer Auto merge of #115696 - RalfJung:closure-ty-print, r=oli-obk 2023-09-22 15:19:38 +00:00
rustc_interface Move DepKind to rustc_query_system and define it as u16 2023-09-21 17:06:14 +02:00
rustc_lexer Update lexer emoji diagnostics to Unicode 15.0 2023-07-29 08:47:21 +08:00
rustc_lint make the reason: field mandatory for @future_incompatible lints 2023-09-22 08:59:32 +02:00
rustc_lint_defs make the reason: field mandatory for @future_incompatible lints 2023-09-22 08:59:32 +02:00
rustc_llvm llvm-wrapper: adapt for LLVM API changes 2023-09-15 14:31:43 +00:00
rustc_log inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
rustc_macros Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
rustc_metadata Auto merge of #115920 - Zoxc:depkind-u16, r=cjgillot 2023-09-22 00:46:13 +00:00
rustc_middle Auto merge of #115696 - RalfJung:closure-ty-print, r=oli-obk 2023-09-22 15:19:38 +00:00
rustc_mir_build Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obk 2023-09-21 13:25:39 +02:00
rustc_mir_dataflow rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
rustc_mir_transform Auto merge of #116010 - RalfJung:more-typed-immediates, r=oli-obk 2023-09-21 14:02:55 +00:00
rustc_monomorphize Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obk 2023-09-21 13:25:39 +02:00
rustc_parse Auto merge of #115677 - matthewjasper:let-expr-recovery, r=b-naber 2023-09-14 19:56:55 +00:00
rustc_parse_format Rollup merge of #115611 - lukas-code:format!("{r#ident}"), r=compiler-errors 2023-09-17 11:23:25 +00:00
rustc_passes Auto merge of #114776 - fee1-dead-contrib:enable-effects-in-libcore, r=oli-obk 2023-09-22 07:00:52 +00:00
rustc_plugin_impl
rustc_privacy Rollup merge of #115727 - fee1-dead-contrib:effect-fallback, r=oli-obk 2023-09-11 17:03:31 +02:00
rustc_query_impl Move DepKind to rustc_query_system and define it as u16 2023-09-21 17:06:14 +02:00
rustc_query_system Move DepKind to rustc_query_system and define it as u16 2023-09-21 17:06:14 +02:00
rustc_resolve fix confusing let chain indentation in rustc_resolve 2023-09-19 21:21:01 +01:00
rustc_serialize PR feedback 2023-09-20 16:49:13 -04:00
rustc_session Auto merge of #116001 - fmease:validate-crate-name-extern-cli-opt, r=est31 2023-09-22 19:57:07 +00:00
rustc_smir Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obk 2023-09-21 13:25:39 +02:00
rustc_span Auto merge of #115549 - saethlin:include-bytes-resilient, r=jackh726 2023-09-21 02:50:54 +00:00
rustc_symbol_mangling the Const::eval_bits methods don't need to be given the Ty 2023-09-20 07:27:21 +02:00
rustc_target Auto merge of #115230 - Vtewari2311:mod-hurd-latest, r=b-naber 2023-09-21 19:24:01 +00:00
rustc_trait_selection Auto merge of #115920 - Zoxc:depkind-u16, r=cjgillot 2023-09-22 00:46:13 +00:00
rustc_traits Detect cycle errors hidden by opaques during monomorphization 2023-09-13 17:35:44 +00:00
rustc_transmute make the eval() functions on our const types return the resulting value 2023-09-13 07:29:34 +02:00
rustc_ty_utils Record asyncness span in HIR 2023-09-21 19:18:14 +00:00
rustc_type_ir make more pretty 2023-09-18 17:29:13 +01:00