This resolves some issues that remained after adding support for monomorphizing unboxed closures in trans.
There were a few places where a set of substitutions for an unboxed closure type were dropped on the floor and later recalculated from scratch based on the def ID, but this failed spectacularly when the closure originated from a different param environment. The substitutions are now plumbed through end-to-end. Closes#18661
There was also a conflict in the meaning of the self param space within the body of the unboxed closure. Trans attempted to insert the unboxed closure type as the self type, but this could conflict with the self type from the param environment when an unboxed closure was used within a default method on a trait. Since the body of an unboxed closure cannot refer to its own self type or value, there's no need for it to actually use the self space. The downstream consumers of the substitutions in trans do not seem to need it either since they look up the type of the closure some other way, so I just stopped setting it. Closes#18685.
r? @pcwalton @nikomatsakis
1. Introduce `putpathvar` function that prints variable shell-quoted by using `%q` format specifier. This function is used within `probe` to save the result into `config.tmp`.
2. Removes search-and-replace pattern that transforms `\` into `/` as it messes up shell-quoted strings.
Fixes#18567. `Struct{x:foo, .. with_expr}` did not walk `with_expr`, which allowed
using moved variables in some cases. The CFG for structs also built up with
`with_expr` happening before the fields, which is now reversed. (Fields are now
before the `with_expr` in the CFG)
- When selecting an implicit trait impl for an unboxed closure, plumb
through and use the substitutions from impl selection instead of
using those from the current param environment in trans, which may
be incorrect.
- When generating a function declaration for an unboxed closure, plumb
through the substitutions from the param environment of the closure
as above. Also normalize the type to avoid generating duplicate
declarations due to regions being inconsistently replaced with
ReStatic elsewhere.
- Do not place the closure type in the self param space when
translating the unboxed closure callee, etc. It is not actually
used, and doing so conflicts with the self substitution from
default trait methods.
Closes#18661Closes#18685
* `from_str_radix_float` gives incorrect results for negative float strings. Changes the accumulator used to start at -0.0 instead of -1.0.
* Adds missing tests
To make progress on #18585 we're paring down the distribution to theoretically
"only libstd", and this commit makes progress on this by removing the rlibc
crate from the distribution.
The crate has now been moved into an external cargo package located in the rust
lang organization [1]. This is a breaking change due to this removal, and
existing crates depending on `rlibc` should use the Cargo crate instead.
[1]: https://github.com/rust-lang/rlibc
[breaking-change]
cc #18585