This commit makes valid shim asserts more specific - checking for the
specific types that are valid for a given type of shim - and removes
asserts for types which require substitutions.
Signed-off-by: David Wood <david@davidtw.co>
This commit adds type metadata for generic parameters (that arise from
polymorphization). Generic parameter metadata is considered zero-sized
and named after the generic parameter.
Signed-off-by: David Wood <david@davidtw.co>
This commit skips generating debuginfo type metadata if substitutions
are required by the type. This avoids ICEs that result from layouts
of types with substitutions being computed.
Signed-off-by: David Wood <david@davidtw.co>
This commit adds doc comments to the `param_at`, `region_param` and
`const_param` methods on the `Generics` struct.
Signed-off-by: David Wood <david@davidtw.co>
This commit modifies the `substitute_normalize_and_test_predicates`
query, renaming it to `impossible_predicates` and only checking
predicates which do not require substs. By making this change,
polymorphization doesn't have to explicitly support vtables.
Signed-off-by: David Wood <david@davidtw.co>
This commit modifies the `substitute_normalize_and_test_predicates`
query, renaming it to `impossible_predicates` and only checking
predicates which do not require substs. By making this change,
polymorphization doesn't have to explicitly support vtables.
Signed-off-by: David Wood <david@davidtw.co>
This commit modifies the `STILL_FURTHER_SPECIALIZABLE` flag so that the
flag isn't set by the parent substs of closures or generators.
Signed-off-by: David Wood <david@davidtw.co>
This commit renames `should_monomorphize_locally` to
`should_codegen_locally` which better describes what the function
determines once polymorphization is added.
Signed-off-by: David Wood <david@davidtw.co>
This commit avoids a natural, free-range double substitution error by
monomorphizing the projection element before getting the type.
Signed-off-by: David Wood <david@davidtw.co>
Use italics for O notation
In documentation, I think it makes sense to italicize O notation (*O(n)*) as opposed to using back-ticks (`O(n)`). Visually, back-ticks focus the reader on the literal characters being used, making them ideal for representing code. Using italics, as far I can tell, more closely follows typographic conventions in mathematics and computer science.
Just a suggestion, of course! 😇
This commit extends current well-formedness checking to apply to foreign
function declarations, re-using the existing machinery for regular
functions. In doing this, later parts of the compiler (such as the
`improper_ctypes` lint) can rely on being operations not failing as a
result of invalid code which would normally be caught earlier.
Signed-off-by: David Wood <david@davidtw.co>
std: Fix compilation without backtrace feature
This should hopefully handle #74484 but in any case fixes compilation of
the standard library without the `backtrace` feature. The need for this
feature is somewhat unclear now because the `backtrace` crate should
always compile (no more C code!) but we can handle that later if
necessary.
fix documentation surrounding the `in` and `for` keywords
Addresses #74529
The `in` keyword incorrectly referenced the `Iterator` trait. This reference was changed to `IntoIterator` without changing the underlying link.
Additionally, the `IntoIterator` trait was referenced towards the end of the documentation for `for`. An additional reference was added earlier and broadened the existing documentation from any iterator to anything that can be turned into an iterator.
Only skip impls of foreign unstable traits
Previously unstable impls were skipped, which meant that any impl with an unstable method would get skipped.
Fixes#74531.
Add myself to toolstate change notifications for rustfmt
I'd like to get the toolstate change notifications for rustfmt as well so that I'll know when things break.
Have spoken with @topecongiro about this offline already.
Improve documentation for `core::fmt` internals
The public interface of `core::fmt` is well-documented, but the internals have very minimal documentation.
do not try fetching the ancestors of errored trait impls
fixes#74483
While building the specialization graph, we use `tcx.all_impls` which discards impls with incorrect self types,
we do however call `trait_def.ancestors` with these impls which caused an ICE as they aren't part of the
specialization graph.
Improve Read::read_exact documentation
Fixes#72186.
For now I simply added a link to `Read::read` and held off changing the text in `Read::read_exact`. I can do it if it is deemed necessary.
@rustbot modify labels: C-enhancement, T-libs
Ignore not really redundant clones of ManuallyDrop
"Redundant" clones of `ManuallyDrop` are sometimes used for the side effect of
invoking the clone, without running the drop implementation of the inner type.
In other words, they aren't really redundant. For example, futures-rs crate:
```rust
#[allow(clippy::redundant_clone)] // The clone here isn't actually redundant.
unsafe fn increase_refcount<T: ArcWake>(data: *const ()) {
// Retain Arc, but don't touch refcount by wrapping in ManuallyDrop
let arc = mem::ManuallyDrop::new(Arc::<T>::from_raw(data as *const T));
// Now increase refcount, but don't drop new refcount either
let _arc_clone: mem::ManuallyDrop<_> = arc.clone();
}
```
changelog: Ignore redundant clone lint for ManuallyDrop.
This should hopefully handle #74484 but in any case fixes compilation of
the standard library without the `backtrace` feature. The need for this
feature is somewhat unclear now because the `backtrace` crate should
always compile (no more C code!) but we can handle that later if
necessary.
"Redundant" clones of `ManuallyDrop` are sometimes used for the side effect of
invoking the clone, without running the drop implementation of the inner type.
In other words, they aren't really redundant. For example, futures-rs crate:
```rust
#[allow(clippy::redundant_clone)] // The clone here isn't actually redundant.
unsafe fn increase_refcount<T: ArcWake>(data: *const ()) {
// Retain Arc, but don't touch refcount by wrapping in ManuallyDrop
let arc = mem::ManuallyDrop::new(Arc::<T>::from_raw(data as *const T));
// Now increase refcount, but don't drop new refcount either
let _arc_clone: mem::ManuallyDrop<_> = arc.clone();
}
```
Ignore redundant clone lint for ManuallyDrop.
redundant_closure_call - don't lint when used more than once
Fixes#3354.
changelog: fix redundant_closure_call false positive when closure called more than once
Teach bootstrap install and dist commands about TargetSelection
With this, we can now use a target JSON file to build a
cross-compiler:
```
x.py install --host ../aarch64-apple-darwin.json --target aarch64-apple-darwin
```
r? @Mark-Simulacrum
With this, we can now use a target JSON file to build a
cross-compiler:
```
x.py install --host ../aarch64-apple-darwin.json --target aarch64-apple-darwin
```
This has been put in place to patch over an ICE caused when we encounter
a non-static lifetime in a const generic during borrow checking. This
restriction may be relaxed in the future, but we need more discussion
before then, and in the meantime we should still deal with this ICE.
Fixes issue #60814