Add track_caller attribute to Result::unwrap_or_else
Fixes issue where panics in unwrap_or_else callbacks marked with the `track_caller` attribute appear as errors in core.
Stdio support for UEFI
- Uses Simple Text Output Protocol and Simple Text Input Protocol
- Reading is done one character at a time
- Writing is done with max 4096 characters
# Quirks
## Output Newline
- UEFI uses CRLF for newline. So when running the application in UEFI shell (qemu VGA), the output of `println` looks weird.
- However, since the UEFI shell supports piping output, I am unsure if doing any output post-processing is a good idea. UEFI shell `cat` command seems to work fine with just LF.
## Input Newline
- `Stdin.read_line()` method is broken in UEFI shell. Pressing enter seems to be read as CR, which means LF is never encountered.
- Works fine with input redirection from file.
CC `@dvdhrm`
Cleanup number handling in match exhaustiveness
Doing a little bit of cleanup; handling number constants was somewhat messy. In particular, this:
- evals float consts once instead of repetitively
- reduces `Constructor` from 88 bytes to 56 (`mir::Const` is big!)
The `fast_try_eval_bits` function was mostly constructed from inlining existing code but I don't fully understand it; I don't follow how consts work and are evaluated very well.
coverage: Regression test for functions with unreachable bodies
This is a regression test for the coverage issue that was addressed temporarily by #116166, and is tracked by #116171.
---
If we instrument a function for coverage, but all of its counter-increment statements are removed by MIR optimizations, LLVM will think it isn't instrumented and it will disappear from coverage maps and coverage reports.
Most MIR opts won't cause this because they tend not to remove statements from bb0, but `UnreachablePropagation` can do so if it sees that bb0 ends with `TerminatorKind::Unreachable`.
Currently we have worked around this by turning off `UnreachablePropagation` when coverage instrumentation is enabled, which is why this test is able to pass.
---
`@rustbot` label +A-code-coverage
- Uses Simple Text Output Protocol and Simple Text Input Protocol
- Reading is done one character at a time
- Writing is done with max 4096 characters
Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
resolve: skip underscore character during candidate lookup
Fixes#116164
In use statement, an underscore is merely a placeholder symbol and does not bind to any name. Therefore, it can be safely ignored.
Build `rustc` with a single CGU on x64 Linux
This PR adds the `rust.codegen-units=1` setting when compiling the 64-bit Linux `rustc` artifact (the one used for try builds and Linux rustup distribution). This had mixed results in the past, however after the bump to LLVM 17, the results now seem pretty [incredible](https://github.com/rust-lang/rust/pull/115554#issuecomment-1706518199). Instruction counts, cycles, wall time, max RSS and even artifact sizes see large improvements.
The last [try build](https://github.com/rust-lang-ci/rust/actions/runs/6077686494/job/16487768049) with this setting took 1h 8m, which is basically the same duration for try builds that we have seen recently. So there shouldn't be any large hit to CI/build time.
I hope that this could potentially also reduce codegen noise of `rustc` a little bit, since small changes within a single `rustc` crate should no longer perturb optimizations because of CGU movement. We still do cross-crate LTO, so it won't eliminate it though.
r? `@Mark-Simulacrum`
Rollup of 3 pull requests
Successful merges:
- #116292 (warn if source is not either a git clone or a dist tarball)
- #116295 (Fix `core::mem::drop` docs inaccuracy)
- #116299 (Update location of `auxiliary/lint-plugin-test.rs`)
r? `@ghost`
`@rustbot` modify labels: rollup
Update location of `auxiliary/lint-plugin-test.rs`
**PR Summary**:
PR updates the location of `auxiliary/lint-plugin-test.rs` file which was moved in PR #110478.
warn if source is not either a git clone or a dist tarball
When the repository is downloaded directly via HTTP(as in #115041), builds may fail due to missing submodules.
This PR adds a check that warns people in such cases.
Partially outline code inside the panic! macro
This outlines code inside the panic! macro in some cases. This is split out from https://github.com/rust-lang/rust/pull/115562 to exclude changes to rustc.
Add integration for new bors
I think that the best way to test the [new bors](https://github.com/rust-lang/bors/tree/staging) implementation is to start using it in the wild. This PR integrates this repo with the bot (some more integration has to be done externally through GitHub). For now, I would suggest to integrate it e.g. under the ``@borsnew`` name, and start testing its try build functionality. The bot cannot do merges or approvals yet, and it doesn't touch `master` in any way, so hopefully it shouldn't cause any troubles for this repo.
r? `@Mark-Simulacrum`
Pass `-jN` from Make to `BOOTSTRAP_ARGS`
Enables the same functionality as `x -jN` in Make by passing the `-jN` arg from Make to the `BOOTSTRAP_ARGS` if it is specified.
Document that Instant may or may not include system-suspend time
Since people are still occasionally surprised by this let's make it more explicit. This doesn't add any new guarantees, only documents the status quo.
Related issues: #87906#79462
Assorted improvements for `rustc_middle::mir::traversal`
r? `@cjgillot`
I'm not _entirely_ sure about all changes, although I do like all of them. If you'd like I can drop some commits. Best reviewed on a commit-by-commit basis, I think, since they are fairly isolated.