introduce local-scope to prevent `StorageLive`/`StorageDead` in statics
In investigating #36799, I found that we were creating storage-live/storage-dead instructions in statics/constants, where they are not needed. This arose due to the fix for local scopes. This PR tries to fix that (and adds a test -- I'm curious if there is a way to make that test more targeted, though).
r? @arielb1
remove interior mutability of type-flags
We were previously using the flags on `Ty<'tcx>` instances to do some ad-hoc caching schemes around things like `is_sized()`, `is_freeze()`, and `moves_by_default()`. This PR replaces those schemes with a proper query; the query key is based on the pair of a `(ParameterEnvironment<'tcx>, Ty<'tcx>)` pair. This is also intended to be a preliminary template for what trait-selection and projection will eventually look like.
I did some performance measurements. In the past, I observed a noticeable speedup (6%) for building rustc, but since I've rebased, the numbers appear to be more of a wash:
| Crate | Before | After | Percentage |
| --- | --- | --- | -- |
| syntax | 167s | 166s | 0.6% faster |
| rustc | 376s | 382s | 1.5% slower |
Some advantages of this new scheme:
- `is_sized` etc are proper queries
- we get caching across generic fns, so long as trait environment is identical
- dependency tracking is correct
Mention Vec::into_boxed_slice in documentation of [T]::into_vec
This is a documentation fix.
`Vec::into_boxed_slice` and `[T]::into_vec` are inverses, so it makes sense to mention the other in their respective documentation for visibility. `Vec::into_boxed_slice` already mentions `[T]::into_vec`, but not the other way around until now.
Tagging @steveklabnik per his request.
make ui test output patch compatible #41948
Hello!
Previously with #41474 I've changed the internals of UI test output comparison mechanism.
That change didn't change the diff format that we were producing but we needed to improve it anyway.
This makes unified diff lines a little bit more `patch` compatible.
Also I tried to introduce a unit test to check this but couldn't decide which of the following to implement:
1. Should I replace `println` macros with `Writer`s? And access the produced output within a test?
2. Should I add an external test (something like `src/test/run-pass/command-exec.rs`)
3. There are crates that capture `stdout`. Are they safe to use here? (I don't think so)
Thanks!
cc @nikomatsakis
Add better error message when == operator is badly used
Part of #40660.
With the following code:
```rust
fn foo<T: PartialEq>(a: &T, b: T) {
a == b;
}
fn main() {
foo(&1, 1);
}
```
It prints:
```
error[E0277]: the trait bound `&T: std::cmp::PartialEq<T>` is not satisfied
--> test.rs:2:5
|
2 | a == b;
| ^^^^^^ can't compare `&T` with `T`
|
= help: the trait `std::cmp::PartialEq<T>` is not implemented for `&T`
= help: consider adding a `where &T: std::cmp::PartialEq<T>` bound
error: aborting due to previous error
```
Ideally, we'd have the `Ty` inserted directly in the dep-node, but since
we can't do that yet, we extract the characteristic def-id of the type
in question.
Use the trait-environment+type as the key. Note that these
are only invoked on types that live for the entire compilation
(no inference artifacts). We no longer need the various special-case
bits and caches that were in place before.
`Vec::into_boxed_slice` and `[T]::into_vec` are inverses, so it makes sense
to mention the other in their respective documentation for visibility.
`Vec::into_boxed_slice` already mentions `[T]::into_vec`, but not the other
way around until now.
bootstrap: fix minor comment typos in lib.rs
I noticed these while reading through the build system
documentation. They're hardly worth fixing, but I'm also using this to
get my feet wet with the rustc contribution system.
I noticed these while reading through the build system
documentation. They're hardly worth fixing, but I'm also using this to
get my feet wet with the rustc contribution system.
Update rust-installer to normalize manifest paths
This fixes the backslash-paths found in the manifests of installers that are built on Windows. This is the most problematic part of #42121, leaving just the non-executable install.sh.
r? @alexcrichton