Fix ICE when `main` is declared in an `extern` block
Changes in #84401 to implement `imported_main` changed how the crate entry point is found, and a declared `main` in an `extern` block was detected erroneously. This was causing the ICE described in #86110.
This PR adds a check for this case and emits an error instead. Previously a `main` declaration in an `extern` block was not detected as an entry point at all, so emitting an error shouldn't break anything that worked previously. In 1.52.1 stable this is demonstrated, with a `` `main` function not found`` error.
Fixes#86110
Remove unused dependencies from compiler crates
Various compiler crates have dependencies that they don't appear to use. I used some scripting to detect such dependencies, filtered them based on some manual review, and removed those that do indeed appear to be entirely unused.
Test cross-crate usage of `feature(const_trait_impl)`
This PR does two things:
- Fixes metadata not encoded properly for functions in const trait impls.
- Adds tests for using const trait impls cross-crate with the feature gate on the user crate either enabled or disabled.
AFAIK, this means we can now constify some trait impls in the standard library 🎉
See #67792 for the tracking issue, cc `@oli-obk`
Fix rustdoc query type filter
I realized while reviewing #86659 that the type filter was broken on search so I'd prefer it to get merged before merging #86659.
r? `@notriddle`
copy rust-lld as ld in dist
Fixes bug in https://github.com/rust-lang/rust/pull/85961. Linking seems to work for pure Rust projects, but not when a C library needs to be dynamically linked.
Check node kind to avoid ICE in `check_expr_return()`
This PR fixes#86721. The ICE described there is apparently due to a misunderstanding:
e98897e5dc/compiler/rustc_typeck/src/check/expr.rs (L684-L685)
Intuitively, one would think that calling `expect_item()` after `get_parent_item()` should succeed, but as it turns out, `get_parent_item()` can also return foreign, trait, and impl items as well as crates, whereas `expect_item()` specifically expects a `Node::Item`. I have therefore added an extra check to prevent this ICE.
Introduce -Zprofile-closures to evaluate the impact of 2229
This creates a CSV with name "closure_profile_XXXXX.csv", where the
variable part is the process id of the compiler.
To profile a cargo project you can run one of the following depending on
if you're compiling a library or a binary:
```
cargo +nightly rustc --lib -- -Zprofile-closures
cargo +nightly rustc --bin {binary_name} -- -Zprofile-closures
```
r? `@nikomatsakis`
Fix boldness (put it back where needed)
I realized that I created a GUI test that wasn't run because it had ".rs" extension instead of ".goml" so I moved its content into `font-weight.goml` (since it was checking font weight).
Only include lint in future_incompatible lint group if not an edition lint
A follow up to #86330 - this only includes lints annotated with `FutureIncompatibleInfo` in the `future_incompatibile` lint group if the future compatibility is not tied to an edition.
We probably want to rename `FutureIncompatibleInfo` to something else since this type is now used to indicate future breakages of all kinds (even those that happen in editions). I'd prefer to do that in a separate PR though.
r? `@nikomatsakis`
Move some UI tests to more suitable subdirs
cc #73494
The classified result is here: https://gist.github.com/JohnTitor/c9e00840990b5e4a8fc562ec3571e427
- issues/issue-27060.rs: misclassified, should be packed.
- issues/issue-45157.rs: moved to nll.
- issues/issue-69532.rs: ~~couldn't figured out the best place, placed a new `llvm` dir~~ moved to consts.
- fsu-moves-and-copies.rs: moved to borrowck.
- issues/issue-36638.rs: misclassified, moved to keyword.
- issues/issue-48636.rs: moved to parser.
- issues/issue-37655.rs: I'm not sure but associated-types shouldn't the best, moved to coercion but region may be better.
- issues/issue-20005.rs: moved to associated-types.
- issues/issue-82869.rs: moved to asm.
- issues/issue-24535-allow-mutable-borrow-in-match-guard.rs: moved to nll.
- issues/issue-52169.rs: moved to macros.
- test-passed.rs: moved to test-attrs along with `test-` prefixed tests.
- test-cfg.rs: moved to conditional-compilation.
- non-integer-atomic.rs: moved to intrinsics.
- issues/issue-54521-2.rs: moved to parser.
- issues/issue-17756.rs: moved to consts.
- conversion-methods.rs: ~~moved to suggestions~~ moved to typeck.
r? `@petrochenkov`
Change vtable memory representation to use tcx allocated allocations.
This fixes https://github.com/rust-lang/rust/issues/86324. However i suspect there's more to change before it can land.
r? `@bjorn3`
cc `@rust-lang/miri`
Don't make `rustc_insignificant_dtor` feature gate
This isn't a feature gate, it's an attribute that is feature gated behind the `rustc_attrs` attribute. Closes#85680.