Auto traits in dyn are suggestable
This commit is contained in:
parent
ba64ba8b0d
commit
cfa6a93a36
@ -3,8 +3,8 @@
|
|||||||
use std::ops::ControlFlow;
|
use std::ops::ControlFlow;
|
||||||
|
|
||||||
use crate::ty::{
|
use crate::ty::{
|
||||||
visit::TypeVisitable, AliasTy, Const, ConstKind, DefIdTree, ExistentialPredicate, InferConst,
|
visit::TypeVisitable, AliasTy, Const, ConstKind, DefIdTree, InferConst, InferTy, Opaque,
|
||||||
InferTy, Opaque, PolyTraitPredicate, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor,
|
PolyTraitPredicate, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor,
|
||||||
};
|
};
|
||||||
|
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
@ -469,17 +469,6 @@ impl<'tcx> TypeVisitor<'tcx> for IsSuggestableVisitor<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Dynamic(dty, _, _) => {
|
|
||||||
for pred in *dty {
|
|
||||||
match pred.skip_binder() {
|
|
||||||
ExistentialPredicate::Trait(_) | ExistentialPredicate::Projection(_) => {
|
|
||||||
// Okay
|
|
||||||
}
|
|
||||||
_ => return ControlFlow::Break(()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Param(param) => {
|
Param(param) => {
|
||||||
// FIXME: It would be nice to make this not use string manipulation,
|
// FIXME: It would be nice to make this not use string manipulation,
|
||||||
// but it's pretty hard to do this, since `ty::ParamTy` is missing
|
// but it's pretty hard to do this, since `ty::ParamTy` is missing
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
use std::fmt::Display;
|
||||||
|
|
||||||
|
fn foo(x: &(dyn Display + Send)) {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
foo();
|
||||||
|
//~^ ERROR this function takes 1 argument but 0 arguments were supplied
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
error[E0061]: this function takes 1 argument but 0 arguments were supplied
|
||||||
|
--> $DIR/display-is-suggestable.rs:6:5
|
||||||
|
|
|
||||||
|
LL | foo();
|
||||||
|
| ^^^-- an argument of type `&dyn std::fmt::Display + Send` is missing
|
||||||
|
|
|
||||||
|
note: function defined here
|
||||||
|
--> $DIR/display-is-suggestable.rs:3:4
|
||||||
|
|
|
||||||
|
LL | fn foo(x: &(dyn Display + Send)) {}
|
||||||
|
| ^^^ ------------------------
|
||||||
|
help: provide the argument
|
||||||
|
|
|
||||||
|
LL | foo(/* &dyn std::fmt::Display + Send */);
|
||||||
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0061`.
|
Loading…
x
Reference in New Issue
Block a user