Turn down the myriad-closures test
This tests takes nearly 5 minutes to compile on CI where the CPUs we
have aren't exactly the fastest. This test does actually require all
closures to exist to exhibit the original bug, but it seems a little
excessive to test a single bug on CI on all platforms which simply pegs
a single CPU for 5 minutes with no parallelism opportunities, so this
turns down the test to still exercise it somewhat at least.
rustc: remove 'x: 'y bounds (except where necessary or from comments/strings).
This PR removes all lifetime-lifetime "outlives" bounds (e.g. `'tcx: 'a`) bounds except a few necessary ones (see the `reintroduce lifetime bounds where necessary` commit).
Some of these bounds kept around otherwise-unused lifetimes (e.g. `<'a, 'tcx: 'a>` followed by uses of `'tcx` but not `'a`) - these lifetimes (i.e. `'a`) were then removed.
(maybe they should be considered unused by the lint? cc @matthewjasper @zackmdavis)
r? @oli-obk cc @rust-lang/compiler
Make use of `ptr::null(_mut)` instead of casting zero
There are few places that I don't replace the zero casting pointer with `ptr::null`
or `ptr::null_mut`:
```bash
% git grep -E '[ ([{]0 as \*'
src/libcore/ptr/mod.rs:216:pub const fn null<T>() -> *const T { 0 as *const T }
src/libcore/ptr/mod.rs:231:pub const fn null_mut<T>() -> *mut T { 0 as *mut T }
src/test/run-pass/consts/const-cast-ptr-int.rs:12:static a: TestStruct = TestStruct{x: 0 as *const u8};
src/test/ui/issues/issue-45730.rs:5: let x: *const _ = 0 as *const _; //~ ERROR cannot cast
src/test/ui/issues/issue-45730.rs:8: let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast
src/test/ui/issues/issue-45730.stderr:14:LL | let x: *const _ = 0 as *const _;
src/test/ui/issues/issue-45730.stderr:24:LL | let x = 0 as *const i32 as *const _ as *mut _;
src/test/ui/lint/lint-forbid-internal-unsafe.rs:15: println!("{}", evil!(*(0 as *const u8)));
src/test/ui/order-dependent-cast-inference.rs:5: let mut y = 0 as *const _;
src/test/ui/order-dependent-cast-inference.stderr:4:LL | let mut y = 0 as *const _;
```
r? @sfackler
don't ICE on large files
This is an extremely marginal error, so the cost of properly threading
`Handler` everywhere just not seemed justified. However, it's useful
to panic when we create a file, and not when we slice strings with
overflown indexes somewhere in the guts of the compiler.
For this reason, while we provide safe `try_new_source_file`, we don't
change the existing public interface and just panic more or less
cleanly.
closes#61904
r? @petrochenkov
make `Weak::ptr_eq`s into methods
This makes the `Weak::ptr_eq`s associated function into methods. There's no reason for methods on `Weak`s to be associated functions, as there is no `Dered` thus no possibility of a collision. Also: methods can be called using the associated function syntax.
follow up on https://github.com/rust-lang/rust/pull/55987
[Tracking issue for weak_ptr_eq](https://github.com/rust-lang/rust/issues/55981)
Help LLVM better optimize slice::Iter(Mut)::len
r? @RalfJung
I've included a codegen test that fails without this change as a demonstration of usefulness.
Replace some uses of NodeId with HirId
We are still using `NodeId` in some spots where we could use `HirId` instead; this PR targets some of these spots and removes some of the associated `hir::map` functions.
test more variants of enum-int-casting
As I learned in https://github.com/rust-lang/rust/pull/61673#issuecomment-500213506, there is a code path we are not testing yet. Looks like enum-int-casting with and without an intermediate let-binding is totally different.
EDIT: The reason for this is to get rid of the cycle in definitions such as:
```rust
enum Foo {
A = 0,
B = Foo::A as isize + 2,
}
```
This has historically been supported, so a hack adding special treatment to `Enum::Variant as _` was added to keep supporting it.