Lint overflowing integer casts in const prop
This extends the invalid cases we catch in const prop to include
overflowing integer casts using the same machinery as the overflowing
binary and unary operation logic.
r? @oli-obk
parser: reduce diversity in error handling mechanisms
Instead of having e.g. `span_err`, `fatal`, etc., we prefer to move towards uniformly using `struct_span_err` thus making it harder to emit fatal and/or unstructured diagnostics.
This PR also de-fatalizes some diagnostics.
r? @estebank
Support `-Z ui-testing=yes/no`
`ui-testing` is now a boolean option (`-Z ui-testing=yes/no`) and can be specified multiple times with later values overriding earlier values (`-Z ui-testing=yes -Z ui-testing=no` == `-Z ui-testing=no`), so it can be set in a hierarchical way, e.g. UI testing infra may enable it by default with specific tests being able to opt-out.
This way we can remove the special opt-out support from `compiletest`.
Inspired by https://github.com/rust-lang/rust/pull/67709.
it uses normalize-stderr-test because not all targets hit the same OS error number nor message ...
... and ignores tidy since I dont know how to make the normalize line shorter ...
and has effectively a no-op for its error-pattern because the targets' error
messages are so wildly different (and the error-pattern check occurs *before*
stderr normalization.)
This extends the invalid cases we catch in const prop to include
overflowing integer casts using the same machinery as the overflowing
binary and unary operation logic.
Resolve long compile times when evaluating always valid constants
This extends the existing logic which skips validating every integer or
floating point number type to also skip validating empty structs because
they are also trivially valid.
Fixes#67539
r? @oli-obk
cc @RalfJung @spastorino
Rollup of 10 pull requests
Successful merges:
- #64273 (Stabilize attribute macros on inline modules)
- #67287 (typeck: note other end-point when checking range pats)
- #67564 (docs: Iterator adapters have unspecified results after a panic)
- #67622 (Some keyword documentation.)
- #67657 (Clean up const-hack PRs now that const if / match exist.)
- #67677 (resolve: Minor cleanup of duplicate macro reexports)
- #67687 (Do not ICE on lifetime error involving closures)
- #67698 (Move reachable_set and diagnostic_items to librustc_passes.)
- #67701 (tidy: Enforce formatting rather than just check it if `--bless` is specified)
- #67715 (Typo fix)
Failed merges:
r? @ghost
resolve: Minor cleanup of duplicate macro reexports
Enabled by https://github.com/rust-lang/rust/pull/65785 which changed `duplicate_macro_exports` from a lint to a hard error.
typeck: note other end-point when checking range pats
Fixes#57389, alternative to #67214 that should be less invasive to type checking logic.
r? @estebank
When encountering `_` type placeholder in fn arguments and return type,
suggest using generic type parameters.
Expand what counts as an inferable return type to slice, array and
tuples of `_`.
Work around a resolve bug in const prop
r? @wesleywiser @anp
This isn't exposed right now, but further changes to rustc may start causing bugs without this.
This extends the existing logic which skips validating every integer or
floating point number type to also skip validating empty structs because
they are also trivially valid.
Fixes#67539
Refactor expression parsing thoroughly
Based on https://github.com/rust-lang/rust/pull/66994 together with which this has refactored basically the entirety of `expr.rs`.
r? @estebank
Teach `compiletest` to ignore platform triples
The UI tests are written assuming `--remap-path-prefix` is *not used* (`remap-debuginfo` in `config.toml`). The consequence is that the error messages may include paths and snippets into the standard library. When `remap-debuginfo` is enabled, these messages change in format and structure because `rustc` will not show paths and snippets into the standard library.
This normally isn't a problem for the "main" platforms (linux/macos/windows), because the CI infrastructure is set up so that the tests run without `remap-debuginfo`, but the `dist` artifacts are built separately with `remap-debuginfo` enabled. However, some of the lower-tier platforms perform both tests and distribution in a single step with `remap-debuginfo` enabled. This also affects developers and distributors who use `remap-debuginfo`.
To sidestep this problem, we add a way to ignore tests in specific platform triples, and update the overly broad `ignore-x86` rule in affected tests.
Address #46948, #54546, #53081.
We only want to return specializations when `Reveal::All` is passed, not
when `Reveal::UserFacing` is. Resolving this fixes several issues with
the `ConstProp`, `SimplifyBranches`, and `Inline` MIR optimization
passes.
Fixes#66901
No functional changes are made, and all APIs are moved to strictly less
restrictive bounds.
These APIs changed from the old bound listed to the new bound:
T: Hash + Eq -> T
* new
* with_capacity
T: Eq + Hash, S: BuildHasher -> T
* with_hasher
* with_capacity_and_hasher
* hasher
T: Eq + Hash + Debug -> T: Debug
S: BuildHasher -> S
<HashSet as Debug>
T: Eq + Hash -> T
S: BuildHasher + Default -> S: Default
<HashSet as Default>