Small bootstrap improvements
- i/o-less check for `xz` availability
- cache result of NixOS detection
- load correct `bootstrap` module even when a package of that name is installed
- no `-W semicolon_in_expressions_from_macros` – it is warn-by-default
- one type per variable (making dynamic typing less confusing)
- integrate python-side `--help` flag into the argument parser (makes `-hv` work as a short form of `--help --verbose`)
I even checked that it works with Python 2.
improve panic message for slice windows and chunks
before:
```text
thread 'main' panicked at 'size is zero', /rustc/1e225413a21fa69570bd3fefea9eb05e33f8b917/library/core/src/slice/mod.rs:809:44
```
```text
thread 'main' panicked at 'assertion failed: `(left != right)`
left: `0`,
right: `0`: chunks cannot have a size of zero', /rustc/1e225413a21fa69570bd3fefea9eb05e33f8b917/library/core/src/slice/mod.rs:843:9
```
after:
```text
thread 'main' panicked at 'chunk size must be non-zero', src/main.rs:4:22
```
fixes https://github.com/rust-lang/rust/issues/107437
Fixing confusion between mod and remainder
Like many programming languages, rust too confuses remainder and modulus. The `%` operator and the associated `Rem` trait is (as the trait name suggests) the remainder, but since most people are linguistically more familiar with the modulus the documentation sometimes claims otherwise. This PR tries to fix this problem in rustc.
Replace unwrap with ? in TcpListener doc
The example in TcpListener doc returns `std::io::Result<()>` but the code inside the function uses `unwrap()` instead of `?`.
PointeeInfo is advisory only
https://github.com/rust-lang/rust/pull/107248 fixed PointeeInfo being used in ways that don't actually work. Hopefully this comments helps avoid such issues in the future.
Cc ``@eddyb``
Track bound types like bound regions
When we instantiate bound types into placeholder types, we throw away the names for some reason. These names are particularly useful for error reporting once we have `for<T>` binders.
r? types
small refactor to new projection code
extract `eq_term_and_make_canonical_response` into a helper function which also is another guarantee that the expected term does not influence candidate selection for projections.
also change `evaluate_all(vec![single_goal])` to use `evaluate_goal`.
the second commit now also adds a `debug_assert!` to `evaluate_goal`.
Include both md and yaml ICE ticket templates
* Existing compilers link to the md version
* The YAML version field for the backtrace *doesn't let us paste a full backtrace*
* We will need the YAML version in order to be able to submit reports once we start storing the backtrace to disk
Follow up to #106831. Reaction to #106874, which made me realize that *really* long backtraces are rejected by GitHub Forms. A single backtrace won't hit this, but ICEs sometimes compound.
make unaligned_reference a hard error
The `unaligned_references` lint has been warn-by-default since Rust 1.53 (https://github.com/rust-lang/rust/pull/82525) and deny-by-default with mention in cargo future-incompat reports since Rust 1.62 (https://github.com/rust-lang/rust/pull/95372). Current nightly will become Rust 1.66, so (unless major surprises show up with crater) I think it is time we make this a hard error, and close this old soundness gap in the language.
EDIT: Turns out this will only land for Rust 1.67, so there is another 6 weeks of time here for crates to adjust.
Fixes https://github.com/rust-lang/rust/issues/82523.
Bump bootstrap compiler to 1.68
This also changes our stage0.json to include the rustc component for the rustfmt pinned nightly toolchain, which is currently necessary due to rustfmt dynamically linking to that toolchain's librustc_driver and libstd.
r? `@pietroalbini`
Modify primary span label for E0308
Looking at the reactions to https://hachyderm.io/`@ekuber/109622160673605438,` a lot of people seem to have trouble understanding the current output, where the primary span label on type errors talks about the specific types that diverged, but these can be deeply nested type parameters. Because of that we could see "expected i32, found u32" in the label while the note said "expected Vec<i32>, found Vec<u32>". This understandably confuses people. I believe that once people learn to read these errors it starts to make more sense, but this PR changes the output to be more in line with what people might expect, without sacrificing terseness.
Fix#68220.
incremental: migrate diagnostics
- Apply the diagnostic migration lints to more functions on `Session`, namely: `span_warn`, `span_warn_with_code`, `warn` `note_without_error`, `span_note_without_error`, `struct_note_without_error`.
- Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path` and `std::path::PathBuf`.
- Migrate the `rustc_incremental` crate's diagnostics to translatable diagnostic structs.
r? `@compiler-errors`
cc #100717
Rollup of 8 pull requests
Successful merges:
- #107245 (Implement unsizing in the new trait solver)
- #107445 (Remove `GenFuture` from core)
- #107473 (Update books)
- #107476 (rustdoc: remove unnecessary wrapper `div.item-decl` from HTML)
- #107477 (Migrate last part of CSS themes to CSS variables)
- #107479 (Use `ObligationCtxt::new_in_snapshot` in `satisfied_from_param_env`)
- #107482 (rustdoc: remove meta keywords from HTML)
- #107494 (fix link in std::path::Path::display())
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Use `ObligationCtxt::new_in_snapshot` in `satisfied_from_param_env`
We can evaluate nested `ConstEvaluatable` obligations in an evaluation probe, which will ICE if we use `ObligationCtxt::new`.
Fixes#107474Fixes#106666
r? `@BoxyUwU` but feel free to reassign
cc `@JulianKnodt` who i think added this assertion code
Not sure if the rustdoc test is needed, but can't hurt. They're the same root cause, though.
Migrate last part of CSS themes to CSS variables
No changes in the output. This is already tested in `tests/rustdoc-gui/search-tab.goml` so no need to add a GUI test.
r? `@notriddle`
Update books
## rust-lang/book
2 commits in 2cd1b5593d26dc6a03c20f8619187ad4b2485552..f2a78f64b668f63f581203c6bac509903f7c00ee
2023-01-23 18:19:32 UTC to 2023-01-23 15:15:22 UTC
- Change CamelCase to UpperCamelCase
- Fix broken link to the No Starch Press version (rust-lang/book#3513)
## rust-embedded/book
3 commits in 19f798d448835a4888e3b3eae7fe69f1d61d8681..f1a4614aa41cc544b91b79760a709e113f3451d7
2023-01-26 15:21:58 UTC to 2023-01-18 07:51:06 UTC
- Fix typo in the registers.md (rust-embedded/book#343)
- Macports install instructions (rust-embedded/book#342)
- remove extern crate statements (rust-embedded/book#340)
## rust-lang/nomicon
2 commits in 960d610e7f33889a2577f5f17c26f0d5c82b30df..bd1829d235296952bf72ca55635e360584b8805e
2023-01-18 03:14:58 UTC to 2023-01-17 20:05:07 UTC
- Copyedits to FFI and unwinding section (rust-lang/nomicon#396)
- Fix typo in dropck documentation (rust-lang/nomicon#397)
## rust-lang/reference
2 commits in 2cb0ed9ba56360949f492f9866afe8c293f9f9da..22882fb3f7b4d69fdc0d1731e8b9cfcb6910537d
2023-01-23 13:21:28 UTC to 2023-01-20 18:38:44 UTC
- Fix typo “assigment” (…and more) (rust-lang/reference#1322)
- Syntax correction for trait-bounds.md (rust-lang/reference#1319)
## rust-lang/rust-by-example
1 commits in a9fb7d13eadfcc5f457962731f105b97f9a7474a..134376872e8c387ef369507e0ee9b5a0e3272718
2023-01-25 11:56:37 UTC to 2023-01-25 11:56:37 UTC
- update std_misc/file/create.md: fixed grammar (rust-lang/rust-by-example#1668)
## rust-lang/rustc-dev-guide
12 commits in 7352353ae91c48b136d2ca7d03822e1448165e1e..e359ee27fc3da3356d71a732128c0a1abe02e53a
2023-01-30 15:08:16 UTC to 2023-01-17 12:44:19 UTC
- New infcx usage (rust-lang/rustc-dev-guide#1571)
- Create a chapter for AST validation (rust-lang/rustc-dev-guide#1524)
- Use ephemeral PAT for linkcheck (rust-lang/rustc-dev-guide#1569)
- add section for the new trait solver (rust-lang/rustc-dev-guide#1551)
- version 5 is now not supported (rust-lang/rustc-dev-guide#1568)
- there are still no locale bundles (rust-lang/rustc-dev-guide#1567)
- bumpt date-check examples to current month (rust-lang/rustc-dev-guide#1566)
- Update hir.md (rust-lang/rustc-dev-guide#1565)
- rustc_typeck exists no more (rust-lang/rustc-dev-guide#1559)
- Correct tests misplacement (rust-lang/rustc-dev-guide#1564)
- Update resolution.md (rust-lang/rustc-dev-guide#1561)
- Update asm.md (rust-lang/rustc-dev-guide#1560)
Remove `GenFuture` from core
The handling of async constructs in the compiler does not rely on `GenFuture` anymore since `1.67`, so this code can now be removed from `core`.
Implement unsizing in the new trait solver
This makes hello world compile! Ignore the first commit, that's just #107146 which is waiting on merge.
I'll leave some comments inline about design choices that might be debatable.
r? `@lcnr` (until we have a new trait solver reviewer group...)
Fix invalid float literal suggestions when recovering an integer
Only suggest adding a zero to integers with a preceding dot when the change will result in a valid floating point literal.
For example, `.0x0` should not be turned into `0.0x0`.
r? nnethercote