Suggest trait bound on type parameter when it is unconstrained
Given
```
trait Foo { fn method(&self) {} }
fn call_method<T>(x: &T) {
x.method()
}
```
suggest constraining `T` with `Foo`.
Fix#21673, fix#41030.
Remove uses of mem::uninitialized from std::sys::cloudabi
Addresses #62397 for std::sys::cloudabi, excluding the tests within cloudabi, which will be a separate PR
Instead of
```
mod allocator_abi { /* methods */ }
```
we now generate
```
const _: () = { /* methods */ }
```
and use `std_path` for paths referring to standard library entities.
This way we no longer need to generate `use` and `extern crate` imports, and `#[global_allocator]` starts working inside unnamed blocks.
Rollup of 14 pull requests
Successful merges:
- #60951 (more specific errors in src/librustc/mir/interpret/error.rs)
- #62523 (Delay bug to resolve HRTB ICE)
- #62656 (explain how to search in slice without owned data)
- #62791 (Handle more cases of typos misinterpreted as type ascription)
- #62804 (rustc_typeck: improve diagnostics for _ const/static declarations)
- #62808 (Revert "Disable stack probing for gnux32.")
- #62817 (Tweak span for variant not found error)
- #62842 (Add tests for issue-58887)
- #62851 (move unescape module to rustc_lexer)
- #62859 (Place::as_place_ref is now Place::as_ref)
- #62869 (add rustc_private as a proper language feature gate)
- #62880 (normalize use of backticks in compiler messages for librustc_allocator)
- #62885 (Change "OSX" to "macOS")
- #62889 (Update stage0.txt)
Failed merges:
r? @ghost
In `configure.py`, using the `o` function creates an enable/disable
boolean setting, and writes `true` or `false` in `config.toml`. However,
rustbuild is expecting to parse a `u32` debuginfo level. We can change
to the `v` function to have the options require a value.
add rustc_private as a proper language feature gate
At the moment, `rustc_private` as a (library) feature exists by
accident: `char::is_xid_start`, `char::is_xid_continue` methods in
libcore define it.
cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/How.20to.20declare.20new.20langauge.20feature.3F
I don't know if this is at all reasonable, but at least tests seem to pass locally. That probably means that we can remove/rename to something more resonable the feature in libcore in the next release?
move unescape module to rustc_lexer
It makes sense to keep the definition of escape sequences closer to the lexer itself, and it is also a bit of code that I would like to share with rust-analyzer.
r? @petrochenkov