Encourage developers not to use periods in target names
They can cause issues in e.g. cargo.
This commit is contained in:
parent
9340e5c1b9
commit
5dd073e7e1
2 changed files with 19 additions and 1 deletions
|
@ -158,6 +158,8 @@ approved by the appropriate team for that shared code before acceptance.
|
|||
the name of the target makes people extremely likely to form incorrect
|
||||
beliefs about what it targets, the name should be changed or augmented to
|
||||
disambiguate it.
|
||||
- If possible, use only letters, numbers, dashes and underscores for the name.
|
||||
Periods (`.`) are known to cause issues in Cargo.
|
||||
- Tier 3 targets may have unusual requirements to build or use, but must not
|
||||
create legal issues or impose onerous legal terms for the Rust project or for
|
||||
Rust developers or users.
|
||||
|
|
|
@ -44,7 +44,23 @@ fn main() {
|
|||
target, filename, src
|
||||
);
|
||||
}
|
||||
if !missing.is_empty() || !extra.is_empty() {
|
||||
// Check target names for unwanted characters like `.` that can cause problems e.g. in Cargo.
|
||||
// See also Tier 3 target policy.
|
||||
// If desired, target names can ignore this check.
|
||||
let ignore_target_names =
|
||||
vec!["thumbv8m.base-none-eabi", "thumbv8m.main-none-eabi", "thumbv8m.main-none-eabihf"];
|
||||
let mut invalid_target_name_found = false;
|
||||
for target in &target_list {
|
||||
if !ignore_target_names.contains(target)
|
||||
&& !target.chars().all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_')
|
||||
{
|
||||
invalid_target_name_found = true;
|
||||
eprintln!(
|
||||
"error: Target name `{target}` contains other characters than ASCII alphanumeric (a-z, A-Z, 0-9), dash (-) or underscore (_)."
|
||||
);
|
||||
}
|
||||
}
|
||||
if !missing.is_empty() || !extra.is_empty() || invalid_target_name_found {
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue