When we get around to resolving regions, we really ought to take region
obligations into account. There is one case where they are presently
being ignored. Keep ignoring them there for now but leave a TODO.
We already disallowed them to be in the arg list, such as
Fn(impl Debug), but now we disallow Fn() -> impl Debug.
Also remove the ImplTraitContext argument from the function
lower_parenthesized_parameter_data as it is now unused.
Comment out part of test run-pass/impl-trait/xcrate.rs that now fails.
Uses Symbol::intern and hir.node_to_pretty_string to create a name for
the impl Trait parameter that is just impl and then a ' + ' separated
list of bounds that the user typed.
First some background:
To the compiler, the following two signatures in the trait vs the impl
are the same.
```rust
trait Foo {
fn foo(&self, &impl Debug);
}
impl Foo for () {
fn foo<U: Debug>(&self, x: &U) { ... }
}
```
We do not want to allow this, and so we add a new error and check.
The check just tests that all paramters 'syntheticness' match up. As
during collection, the impl Trait parameters are transformed into
anonymous synthetic generics.
Furthermore, causes a check for unused type parameters to be skipped in
check_bounds_are_used if there is already a TyError. Thus, an unused
input will not trigger `type parameter unused` errors.
Update the one test that checked for this error in the case of
a TyError.
In ast_generics extraction in generics_of and explicit_predicates_of,
also collect inputs if there are any.
Then use a Visitor to extract the necessary information from the
TyImplTraitUniversal types before extending generics and predicates with
the new information.
This is for tracking if an ImplItem is part of a trait impl. Add
a with_trait_impl_ref method to ItemLowerer to appropriately save the
state to allow appropriate nesting of trait and non-trait impls.
Replace hir::TyImplTrait with TyImplTraitUniversal and
TyImplTraitExistential.
Add an ImplTraitContext enum to rustc::hir::lowering to track the kind
and allowedness of an impl Trait.
Significantly alter lowering to thread ImplTraitContext and one other
boolean parameter described below throughought much of lowering.
The other parameter is for tracking if lowering a function is in a trait
impl, as there is not enough information to otherwise know this
information during lowering otherwise.
This change also removes the checks from ast_ty_to_ty for impl trait
allowedness as they are now all taking place in HIR lowering.
Emit better debugging information for a trait object pointer. In
particular, now:
* The fields are explicitly represented in the DWARF;
* DWARF for the vtable itself is emitted; and
* The DWARF for the vtable's type has a DW_AT_containing_type which
points to the concrete type for which the vtable was emitted. This is
a small DWARF extension, that allows debuggers to determine the real
type of the object to which a trait object points.
I'll submit the gdb patch to take advantage of this new debuginfo once
this lands.
The vtable type is not currently complete -- it doesn't include members
for the pointers it contains. This information was not needed for this
feature.
This addresses part 1 of #1563.
This adds a "min-system-llvm-version" directive, so that a test can
indicate that it will either work with rust-llvm or with some minimal
system LLVM. This makes it simpler to write a test that requires an
LLVM patch that landed upstream and was then backported to rust-llvm.