### What does this PR try to resolve?
This is part of #12207. I found these while implementing frontmatter
support within rustc.
I'll likely do another pass when I finish rustc support to
- Unify tests between cargo and rustc
- Improve error messages
### How should we test and review this PR?
### Additional information
It's very common for users to attempt to use the pseudo-URLs that GitHub
or other providers provide in the form
`git@github.com:rust-lang/rust.git` as a source in Cargo.toml, which are
the default format accepted by OpenSSH. Unfortunately, these are not
actually URLs, and unsurprisingly, the `url` crate doesn't accept them.
However, our error message is unhelpful and looks like this:
invalid url `git@github.com:rust-lang/rust.git`: relative URL without a base
This is technically true, but we can do better. The user actually wants
to write a real SSH URL, so if the non-URL starts with `git@`, let's
rewrite it into a real URL for them to help them and include that in the
error message.
`git@` is the prefix used by all major forges, as well as the default
configuration for do-it-yourself implementations like Gitolite. While
other options are possible, they are much less common, and this is an
extremely easy and cheap heuristic that does not necessitate complicated
parsing, but which we can change in the future should that be necessary.
This also avoids the problem where users try to turn the pseudo-URL into
a real URL by just prepending `ssh://`, which causes an error message
about the invalid port number due to the colon which they have not
changed. Since they can just copy and paste the proposed answer,
they'll be less likely to attempt this invalid approach.
### What does this PR try to resolve?
This preps more features for cargo-script support and makes it clearer
where we don't yet support it.
### How should we test and review this PR?
### Additional information
rustc considers the following valid and without a shebang:
```rust
// Hello
[allow(dead_code)]
fn main() {
println!("Hello, world!");
}
```
and
```rustc
[allow(dead_code)]
fn main() {
println!("Hello, world!");
}
```
In both cases, we consider it to have a shebang. This commit documents
that intention.
We could add our own heuristics
(e.g. `#!` with only whitespace is not a shebang)
but we should either be a subset or intentionally different than rustc
(e.g. require a non `[`-prefixes interpreter)
rather than do both.
This will be reflected in the tracking issue which will handle the final
decision for the team on this matter.
Fixes#15170
### What does this PR try to resolve?
This is a part of #12207
Now that the experiment is over and we can be intrusive, this merges all
of the permanent cargo-script manifest logic into the regular manifest
loading code path with the goal of reducing the number of places people
need to be aware to check to know how things work so we're less likely
to overlook them (e.g. `package.name`s being optional). This should also
make error reporting better as we will eventually only use the real
manifest users specify, instead of one with a lot of edits by us.
This comes at the cost of some uglier code needed to check some of these
cases.
### How should we test and review this PR?
### Additional information
### What does this PR try to resolve?
Some very small simplifications made while poking around the resolver. I
was trying to understand when we would end up hitting a `continue` in
the code. The easiest way was to run the tests with a panic instead.
Turns out I was right, we cannot/(can no longer) hit that code path.
Which allowed us to simplify some other surrounding code.
### How should we test and review this PR?
All tests pass on each commit.
### Additional information
### What does this PR try to resolve?
Fixes https://github.com/rust-lang/cargo/issues/12978
currently, if `--package `and `--workspace` passe in the same time, the
`--package` will be ignore even the package doesnt exist in the
workspace, this PR regards this behavior as an error
### How should we test and review this PR?
one commit add test, one commit fixes the issue.
### Additional information