mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
only query params_in_repr
if def kind is adt
This commit is contained in:
parent
9e3e517446
commit
e9b2d09ad7
@ -358,7 +358,7 @@ fn find_item_ty_spans(
|
||||
match ty.kind {
|
||||
hir::TyKind::Path(hir::QPath::Resolved(_, path)) => {
|
||||
if let Res::Def(kind, def_id) = path.res
|
||||
&& !matches!(kind, DefKind::TyAlias)
|
||||
&& matches!(kind, DefKind::Enum | DefKind::Struct | DefKind::Union)
|
||||
{
|
||||
let check_params = def_id.as_local().map_or(true, |def_id| {
|
||||
if def_id == needle {
|
||||
|
@ -1,5 +0,0 @@
|
||||
//@ known-bug: rust-lang/rust#128327
|
||||
|
||||
use std::ops::Deref;
|
||||
struct Apple((Apple, <&'static [f64] as Deref>::Target(Banana ? Citron)));
|
||||
fn main(){}
|
@ -1,2 +1,5 @@
|
||||
pub struct W<T>(T);
|
||||
pub type Wrapper<T> = W<T>;
|
||||
pub trait Trait {
|
||||
type T;
|
||||
}
|
||||
|
16
tests/ui/infinite/infinite-assoc.rs
Normal file
16
tests/ui/infinite/infinite-assoc.rs
Normal file
@ -0,0 +1,16 @@
|
||||
//@ aux-build: alias.rs
|
||||
|
||||
// issue#128327
|
||||
|
||||
extern crate alias;
|
||||
|
||||
use alias::Trait;
|
||||
struct S;
|
||||
impl Trait for S {
|
||||
type T = ();
|
||||
}
|
||||
struct A((A, <S as Trait>::T<NOT_EXIST?>));
|
||||
//~^ ERROR: invalid `?` in type
|
||||
//~| ERROR: recursive type `A` has infinite size
|
||||
|
||||
fn main() {}
|
25
tests/ui/infinite/infinite-assoc.stderr
Normal file
25
tests/ui/infinite/infinite-assoc.stderr
Normal file
@ -0,0 +1,25 @@
|
||||
error: invalid `?` in type
|
||||
--> $DIR/infinite-assoc.rs:12:39
|
||||
|
|
||||
LL | struct A((A, <S as Trait>::T<NOT_EXIST?>));
|
||||
| ^ `?` is only allowed on expressions, not types
|
||||
|
|
||||
help: if you meant to express that the type might not contain a value, use the `Option` wrapper type
|
||||
|
|
||||
LL | struct A((A, <S as Trait>::T<Option<NOT_EXIST>>));
|
||||
| +++++++ ~
|
||||
|
||||
error[E0072]: recursive type `A` has infinite size
|
||||
--> $DIR/infinite-assoc.rs:12:1
|
||||
|
|
||||
LL | struct A((A, <S as Trait>::T<NOT_EXIST?>));
|
||||
| ^^^^^^^^ - recursive without indirection
|
||||
|
|
||||
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
|
||||
|
|
||||
LL | struct A((Box<A>, <S as Trait>::T<NOT_EXIST?>));
|
||||
| ++++ +
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0072`.
|
Loading…
Reference in New Issue
Block a user