bors 694a579566 Auto merge of #12349 - epage:sanitize, r=weihanglo
fix(embedded): Always generate valid package names

### What does this PR try to resolve?

The sanitization logic uses a placeholder for the first character that isn't valid in the first character position.  #12329 took the approach of always using `_` which has the problem of mixing separators if the user used `-` or we had other placeholders to insert.  Instead, this takes the approach of stripping the leading invalid characters and using a placeholder name if nothing is left.

Fixes #12330

### How should we test and review this PR?

Per-commit.  The first adds tests so the change in behavior can be observed over each additional commit.

### Additional information

I was also hoping to make the binary name not use placeholders by setting `bin.name` to `file_stem` but then I got
```
   Compiling s-h-w-c- v0.0.0 (/home/epage/src/personal/cargo/target/tmp/cit/t133/foo)
error: invalid character `'.'` in crate name: `s_h.w§c!`

error: invalid character `'§'` in crate name: `s_h.w§c!`

error: invalid character `'!'` in crate name: `s_h.w§c!`

error: could not compile `s-h-w-c-` (bin "s-h.w§c!") due to 3 previous errors
```
I decided to not get into what are or aren't valid characters according to rustc.
2023-07-11 22:28:29 +00:00
..
2023-05-23 10:36:48 +08:00
2023-02-20 12:20:26 -06:00
2023-02-14 12:26:01 -08:00
2023-04-12 09:56:43 -07:00
2023-06-05 11:27:31 +02:00
2023-06-17 19:34:34 +02:00
2023-05-26 20:27:34 +02:00
2023-03-31 14:04:48 -07:00
2023-06-05 11:27:31 +02:00
2023-04-12 09:56:43 -07:00
2022-12-13 23:49:07 +00:00
2023-02-20 12:21:27 -06:00
2022-05-08 01:07:28 +08:00
2022-12-19 10:50:55 -07:00
2023-04-02 15:37:53 -07:00
2022-08-10 23:19:35 +08:00
2022-12-13 23:49:07 +00:00