Specifically, remove both `-Z no_integrated_as` and
`TargetOptions::no_integrated_as`. The latter was only used for the
`msp430_none_elf` platform, for which it's no longer required.
Decouple `rustc_hir::print` into `rustc_hir_pretty`
High level summary:
- The HIR pretty printer, `rustc_hir::print` is moved into a new crate `rustc_hir_pretty`.
- `rustc_ast_pretty` and `rustc_errors` are dropped as `rustc_hir` dependencies.
- The dependence on HIR pretty is generally reduced, leaving `rustc_save_analysis`, `rustdoc`, `rustc_metadata`, and `rustc_driver` as the remaining clients.
The main goal here is to reduce `rustc_hir`'s dependencies and its size such that it can start and finish earlier, thereby working towards https://github.com/rust-lang/rust/issues/65031.
r? @Zoxc
Allow obtaining &mut OsStr
```rust
impl DerefMut for OsString {...} // type Target = OsStr
impl IndexMut<RangeFull> for OsString {...} // type Output = OsStr
```
---
This change is pulled out of #69937 per @dtolnay
This implements `DerefMut for OsString` to allow obtaining a `&mut OsStr`. This also implements `IndexMut for OsString`, which is used by `DerefMut`. This pattern is the same as is used by `Deref`.
This is necessary to for methods like `make_ascii_lowercase` which need to mutate the underlying value.
Fix cycle error when emitting suggestion for mismatched `fn` type
Fixes#66667
Previously, we called `tcx.typeck_tables_of` when determining whether or
not to emit a suggestion for a type error. However, we might already be
type-checking the `DefId` we pass to `typeck_tables_of` (it could be
anywhere in the query stack).
Fortunately, we only need the function signature, not the entire
`TypeckTables`. By using `tcx.fn_sig`, we avoid the possibility of cycle
errors while retaining the ability to emit a suggestion.
Remove framework in `dataflow/mod.rs` in favor of "generic" one
This is the culmination of the work described in rust-lang/compiler-team#202. All dataflow analyses (including the one in `clippy`) have been ported to use the framework in `dataflow/generic`, which can efficiently handle both gen/kill and generic problems. This PR moves the framework in `dataflow/generic` to `dataflow/framework`, and removes the gen/kill framework in `dataflow/mod.rs`.
More comprehensive documentation for the new framework is tracked in rust-lang/rustc-guide#564.
`clippy` will need to change the path it uses to import the dataflow analysis traits.
`error_bad_item_kind`: add help text
For example, this adds:
```
= help: consider moving the `use` import out to a nearby module scope
```
r? @petrochenkov @estebank
Fixes https://github.com/rust-lang/rust/issues/37205.
add 'fn write_u16s' to Memory
Added new function `Memory::write_u16s`. Needed in `MIRI` for implementing helper function to write wide_str to memory (for Windows).
- Added `Iterator::fold_first`, which is like `fold`, but uses the first element in the iterator as the initial accumulator
- Includes doc and doctest
- Rebase commit; see #65222 for details
Co-Authored-By: Tim Vermeulen <tvermeulen@me.com>
Rollup of 5 pull requests
Successful merges:
- #68004 (permit negative impls for non-auto traits)
- #70385 (Miri nits: comment and var name improvement)
- #70411 (Fix for #62691: use the largest niche across all fields)
- #70417 (parser: recover on `...` as a pattern, suggesting `..`)
- #70424 (simplify match stmt)
Failed merges:
r? @ghost
simplify match stmt
We actually have a surprising amount of
```rust
match expr {
$($p:pat)|+ => true,
_ => false,
}
```
While I would prefer this to be replaced with `matches!`, most cases are
fairly readable anyway so we can just let them be for now.
Fix for #62691: use the largest niche across all fields
fixes#62691
(The second commit is a small optimization but it makes the code less pretty and i don't know if it is worth it.)
permit negative impls for non-auto traits
This is a prototype impl that extends `impl !Trait` beyond auto traits. It is not integrated with coherence or anything else, and hence only serves to prevent downstream impls (but not to allow downstream crates to rely on the absence of such impls for coherence purposes).
Fixes https://github.com/rust-lang/rust/issues/66544
TODO:
- [x] need a test that you can't rely on negative impls for coherence purposes
- [x] test that negative impls cannot specialize positive ones
- [x] test that positive impls cannot specialize negative ones
- [x] extend negative impl to `Clone` in order to fully fix#66544
- [x] and maybe make `CoerceUnsized` unsafe? -- that problem is now split out into https://github.com/rust-lang/rust/issues/68015
- [x] introduce feature flag and prepare a write-up
- [x] improve diagnostics?