This is a patch for #22291.
PLEASE_BENCH=1 adds --bench to the arguments passed to the executable to be tested. At the moment, compiletest does not accept a --bench argument, because it is not needed for any test in src/test/, even the tests in src/test/bench do not use #[bench].
I have updated the makefile to only add the --bench flag for crate tests. I do not think that changing compiletest add --bench to the run arguments of all compile tests makes sense, because it would mess up tests which check command line arguments. Also the bench option can be added as comment in a compile test as well.
It is not totally clear if we should just use whitespace, or if the full
unicode word-breaking algorithm is more correct. If there is demand we
can reconsider this decision (and consider the precise algorithm to use
in detail).
cc #15628.
This commit exposes the `is_sep` function and `MAIN_SEP` constant, as
well as Windows path prefixes. The path prefix enum is safely exposed on
all platforms, but it only yielded as a component for Windows.
Exposing the prefix enum as part of prefix components involved changing
the type from `OsStr` to the `Prefix` enum, which is a:
[breaking-change]
Since `tr` converts lowercase to uppercase according to system locale using `LC_CTYPE` environment variable; on some locales, rustup.sh fails to use correct variables names, thus deletes temporarily downloaded files and gives a meaningless error as shown below. This a simple fix which explictly sets `LC_CTYPE` as `C`.
This includes everything necessary for promoting borrows of constant rvalues to `'static`.
That is, `&expr` will have the type `&'static T` if `const T: &'static T = &expr;` is valid.
There is a small exception, dereferences of raw pointers, as they misbehave.
They still "work" in constants as I didn't want to break legitimate uses (are there any?).
The qualification done here can be expanded to allow simple CTFE via `const fn`.
Nonetheless, as this commit demonstrates, the previous commits was a [breaking-change].
In practice, breakage is focused on functions of this form:
```rust
fn foo(..., object: Box<FnMut()>)
````
where `FnMut()` could be any trait object type. The older scheme defaulted objects in argument
position so that they were bounded by a fresh lifetime:
```rust
fn foo<'a>(..., object: Box<FnMut()+'a>)
```
This meant that the object could contain borrowed data. The newer
scheme defaults to a lifetime bound of `'static`:
```rust
fn foo(..., object: Box<FnMut()+'static>)
```
This means that the object cannot contain borrowed data. In some cases, the best fix
is to stop using `Box`:
```rust
fn foo(..., object: &mut FnMut())
```
but another option is to write an explicit annotation for the `'a`
lifetime that used to be implicit. Both fixes are demonstrated in
this commit.