Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c336478

Browse files
committedSep 5, 2020
Auto merge of #75173 - jackh726:chalk-0.21, r=nikomatsakis
Upgrade Chalk to 0.21 Two commits here. First commit actually does the upgrade. Second commit has some changes to make more tests in compare-mode=chalk pass. The `PlaceholdersCollector` and `RegionsSubstitutor` bits are bit a hacky, but only insomuch as `ParamsSubstitutor` is. These won't be needed eventually. r? @nikomatsakis
2 parents 70c5f6e + 0aa2153 commit c336478

File tree

11 files changed

+726
-510
lines changed

11 files changed

+726
-510
lines changed
 

‎Cargo.lock

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,9 @@ dependencies = [
427427

428428
[[package]]
429429
name = "chalk-derive"
430-
version = "0.14.0"
430+
version = "0.21.0"
431431
source = "registry+https://github.com/rust-lang/crates.io-index"
432-
checksum = "d463e01905d607e181de72e8608721d3269f29176c9a14ce037011316ae7131d"
432+
checksum = "c1df0dbb57d74b4acd20f20fa66ab2acd09776b79eaeb9d8f947b2f3e01c40bf"
433433
dependencies = [
434434
"proc-macro2",
435435
"quote",
@@ -439,40 +439,42 @@ dependencies = [
439439

440440
[[package]]
441441
name = "chalk-engine"
442-
version = "0.14.0"
442+
version = "0.21.0"
443443
source = "registry+https://github.com/rust-lang/crates.io-index"
444-
checksum = "efaf428f5398d36284f79690cf988762b7c091249f50a6c11db613a46c057000"
444+
checksum = "fb7c65a13f32f02aba8f1d9a37f206af615f77ac564624b81a4c593c6c1735b9"
445445
dependencies = [
446446
"chalk-derive",
447447
"chalk-ir",
448+
"chalk-solve",
448449
"rustc-hash",
449450
"tracing",
450451
]
451452

452453
[[package]]
453454
name = "chalk-ir"
454-
version = "0.14.0"
455+
version = "0.21.0"
455456
source = "registry+https://github.com/rust-lang/crates.io-index"
456-
checksum = "fd3fdc1e9f68498ffe80f4a23b0b95f1ca6fb21d5a4c9b0c085fab3ca712bdbe"
457+
checksum = "44361a25dbdb1dc428f56ad7a3c21ba9ca12f3225c26a47919ff6fcb10a583d4"
457458
dependencies = [
458459
"chalk-derive",
459460
"lazy_static",
460461
]
461462

462463
[[package]]
463464
name = "chalk-solve"
464-
version = "0.14.0"
465+
version = "0.21.0"
465466
source = "registry+https://github.com/rust-lang/crates.io-index"
466-
checksum = "5b9fd4102807b7ebe8fb034fa0f488c5656e1966d3261b558b81a08d519cdb29"
467+
checksum = "a886da37a0dc457057d86f78f026f7a09c6d8088aa13f4f4127fdb8dc80119a3"
467468
dependencies = [
468469
"chalk-derive",
469-
"chalk-engine",
470470
"chalk-ir",
471471
"ena",
472472
"itertools 0.9.0",
473473
"petgraph",
474474
"rustc-hash",
475475
"tracing",
476+
"tracing-subscriber",
477+
"tracing-tree",
476478
]
477479

478480
[[package]]
@@ -4038,6 +4040,7 @@ dependencies = [
40384040
name = "rustc_traits"
40394041
version = "0.0.0"
40404042
dependencies = [
4043+
"chalk-engine",
40414044
"chalk-ir",
40424045
"chalk-solve",
40434046
"rustc_ast",
@@ -4996,21 +4999,61 @@ dependencies = [
49964999
"lazy_static",
49975000
]
49985001

5002+
[[package]]
5003+
name = "tracing-log"
5004+
version = "0.1.1"
5005+
source = "registry+https://github.com/rust-lang/crates.io-index"
5006+
checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9"
5007+
dependencies = [
5008+
"lazy_static",
5009+
"log",
5010+
"tracing-core",
5011+
]
5012+
5013+
[[package]]
5014+
name = "tracing-serde"
5015+
version = "0.1.1"
5016+
source = "registry+https://github.com/rust-lang/crates.io-index"
5017+
checksum = "b6ccba2f8f16e0ed268fc765d9b7ff22e965e7185d32f8f1ec8294fe17d86e79"
5018+
dependencies = [
5019+
"serde",
5020+
"tracing-core",
5021+
]
5022+
49995023
[[package]]
50005024
name = "tracing-subscriber"
50015025
version = "0.2.11"
50025026
source = "registry+https://github.com/rust-lang/crates.io-index"
50035027
checksum = "abd165311cc4d7a555ad11cc77a37756df836182db0d81aac908c8184c584f40"
50045028
dependencies = [
50055029
"ansi_term 0.12.1",
5030+
"chrono",
50065031
"lazy_static",
50075032
"matchers",
50085033
"parking_lot 0.11.0",
50095034
"regex",
5035+
"serde",
5036+
"serde_json",
50105037
"sharded-slab",
50115038
"smallvec 1.4.2",
50125039
"thread_local",
50135040
"tracing-core",
5041+
"tracing-log",
5042+
"tracing-serde",
5043+
]
5044+
5045+
[[package]]
5046+
name = "tracing-tree"
5047+
version = "0.1.5"
5048+
source = "registry+https://github.com/rust-lang/crates.io-index"
5049+
checksum = "e1a3dc4774db3a6b2d66a4f8d8de670e874ec3ed55615860c994927419b32c5f"
5050+
dependencies = [
5051+
"ansi_term 0.12.1",
5052+
"atty",
5053+
"chrono",
5054+
"termcolor",
5055+
"tracing",
5056+
"tracing-subscriber",
50145057
]
50155058

50165059
[[package]]

‎compiler/rustc_middle/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ rustc_serialize = { path = "../rustc_serialize" }
2727
rustc_ast = { path = "../rustc_ast" }
2828
rustc_span = { path = "../rustc_span" }
2929
byteorder = { version = "1.3" }
30-
chalk-ir = "0.14.0"
30+
chalk-ir = "0.21.0"
3131
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
3232
measureme = "0.7.1"
3333
rustc_session = { path = "../rustc_session" }

‎compiler/rustc_middle/src/traits/chalk.rs

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
7575
type InternedQuantifiedWhereClauses = Vec<chalk_ir::QuantifiedWhereClause<Self>>;
7676
type InternedVariableKinds = Vec<chalk_ir::VariableKind<Self>>;
7777
type InternedCanonicalVarKinds = Vec<chalk_ir::CanonicalVarKind<Self>>;
78+
type InternedConstraints = Vec<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>>;
7879
type DefId = DefId;
7980
type InternedAdtId = &'tcx AdtDef;
8081
type Identifier = ();
@@ -108,8 +109,42 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
108109
application_ty: &chalk_ir::ApplicationTy<Self>,
109110
fmt: &mut fmt::Formatter<'_>,
110111
) -> Option<fmt::Result> {
111-
let chalk_ir::ApplicationTy { name, substitution } = application_ty;
112-
Some(write!(fmt, "{:?}{:?}", name, chalk_ir::debug::Angle(substitution.interned())))
112+
match application_ty.name {
113+
chalk_ir::TypeName::Ref(mutbl) => {
114+
let data = application_ty.substitution.interned();
115+
match (&**data[0].interned(), &**data[1].interned()) {
116+
(
117+
chalk_ir::GenericArgData::Lifetime(lifetime),
118+
chalk_ir::GenericArgData::Ty(ty),
119+
) => Some(match mutbl {
120+
chalk_ir::Mutability::Not => write!(fmt, "(&{:?} {:?})", lifetime, ty),
121+
chalk_ir::Mutability::Mut => write!(fmt, "(&{:?} mut {:?})", lifetime, ty),
122+
}),
123+
_ => unreachable!(),
124+
}
125+
}
126+
chalk_ir::TypeName::Array => {
127+
let data = application_ty.substitution.interned();
128+
match (&**data[0].interned(), &**data[1].interned()) {
129+
(chalk_ir::GenericArgData::Ty(ty), chalk_ir::GenericArgData::Const(len)) => {
130+
Some(write!(fmt, "[{:?}; {:?}]", ty, len))
131+
}
132+
_ => unreachable!(),
133+
}
134+
}
135+
chalk_ir::TypeName::Slice => {
136+
let data = application_ty.substitution.interned();
137+
let ty = match &**data[0].interned() {
138+
chalk_ir::GenericArgData::Ty(t) => t,
139+
_ => unreachable!(),
140+
};
141+
Some(write!(fmt, "[{:?}]", ty))
142+
}
143+
_ => {
144+
let chalk_ir::ApplicationTy { name, substitution } = application_ty;
145+
Some(write!(fmt, "{:?}{:?}", name, chalk_ir::debug::Angle(substitution.interned())))
146+
}
147+
}
113148
}
114149

115150
fn debug_substitution(
@@ -321,6 +356,20 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
321356
) -> &'a [chalk_ir::CanonicalVarKind<Self>] {
322357
canonical_var_kinds
323358
}
359+
360+
fn intern_constraints<E>(
361+
&self,
362+
data: impl IntoIterator<Item = Result<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>, E>>,
363+
) -> Result<Self::InternedConstraints, E> {
364+
data.into_iter().collect::<Result<Vec<_>, _>>()
365+
}
366+
367+
fn constraints_data<'a>(
368+
&self,
369+
constraints: &'a Self::InternedConstraints,
370+
) -> &'a [chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>] {
371+
constraints
372+
}
324373
}
325374

326375
impl<'tcx> chalk_ir::interner::HasInterner for RustInterner<'tcx> {

‎compiler/rustc_traits/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ rustc_hir = { path = "../rustc_hir" }
1212
rustc_index = { path = "../rustc_index" }
1313
rustc_ast = { path = "../rustc_ast" }
1414
rustc_span = { path = "../rustc_span" }
15-
chalk-ir = "0.14.0"
16-
chalk-solve = "0.14.0"
15+
chalk-ir = "0.21.0"
16+
chalk-solve = "0.21.0"
17+
chalk-engine = "0.21.0"
1718
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
1819
rustc_infer = { path = "../rustc_infer" }
1920
rustc_trait_selection = { path = "../rustc_trait_selection" }

‎compiler/rustc_traits/src/chalk/db.rs

Lines changed: 171 additions & 172 deletions
Large diffs are not rendered by default.

‎compiler/rustc_traits/src/chalk/lowering.rs

Lines changed: 395 additions & 210 deletions
Large diffs are not rendered by default.

‎compiler/rustc_traits/src/chalk/mod.rs

Lines changed: 39 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ use rustc_middle::infer::canonical::{CanonicalTyVarKind, CanonicalVarKind};
1515
use rustc_middle::traits::ChalkRustInterner;
1616
use rustc_middle::ty::query::Providers;
1717
use rustc_middle::ty::subst::GenericArg;
18-
use rustc_middle::ty::{
19-
self, Bound, BoundVar, ParamTy, Region, RegionKind, Ty, TyCtxt, TypeFoldable,
20-
};
18+
use rustc_middle::ty::{self, BoundVar, ParamTy, TyCtxt, TypeFoldable};
2119

2220
use rustc_infer::infer::canonical::{
2321
Canonical, CanonicalVarValues, Certainty, QueryRegionConstraints, QueryResponse,
2422
};
2523
use rustc_infer::traits::{self, ChalkCanonicalGoal};
2624

2725
use crate::chalk::db::RustIrDatabase as ChalkRustIrDatabase;
28-
use crate::chalk::lowering::{LowerInto, ParamsSubstitutor};
26+
use crate::chalk::lowering::{
27+
LowerInto, ParamsSubstitutor, PlaceholdersCollector, RegionsSubstitutor,
28+
};
2929

3030
use chalk_solve::Solution;
3131

@@ -40,16 +40,35 @@ crate fn evaluate_goal<'tcx>(
4040
let interner = ChalkRustInterner { tcx };
4141

4242
// Chalk doesn't have a notion of `Params`, so instead we use placeholders.
43-
let mut params_substitutor = ParamsSubstitutor::new(tcx);
43+
let mut placeholders_collector = PlaceholdersCollector::new();
44+
obligation.visit_with(&mut placeholders_collector);
45+
46+
let restatic_placeholder = tcx.mk_region(ty::RegionKind::RePlaceholder(ty::Placeholder {
47+
universe: ty::UniverseIndex::ROOT,
48+
name: ty::BoundRegion::BrAnon(placeholders_collector.next_anon_region_placeholder),
49+
}));
50+
let reempty_placeholder = tcx.mk_region(ty::RegionKind::RePlaceholder(ty::Placeholder {
51+
universe: ty::UniverseIndex::ROOT,
52+
name: ty::BoundRegion::BrAnon(placeholders_collector.next_anon_region_placeholder + 1),
53+
}));
54+
55+
let mut params_substitutor =
56+
ParamsSubstitutor::new(tcx, placeholders_collector.next_ty_placeholder);
4457
let obligation = obligation.fold_with(&mut params_substitutor);
58+
// FIXME(chalk): we really should be substituting these back in the solution
4559
let _params: FxHashMap<usize, ParamTy> = params_substitutor.params;
60+
61+
let mut regions_substitutor =
62+
RegionsSubstitutor::new(tcx, restatic_placeholder, reempty_placeholder);
63+
let obligation = obligation.fold_with(&mut regions_substitutor);
64+
4665
let max_universe = obligation.max_universe.index();
4766

48-
let _lowered_goal: chalk_ir::UCanonical<
67+
let lowered_goal: chalk_ir::UCanonical<
4968
chalk_ir::InEnvironment<chalk_ir::Goal<ChalkRustInterner<'tcx>>>,
5069
> = chalk_ir::UCanonical {
5170
canonical: chalk_ir::Canonical {
52-
binders: chalk_ir::CanonicalVarKinds::from(
71+
binders: chalk_ir::CanonicalVarKinds::from_iter(
5372
&interner,
5473
obligation.variables.iter().map(|v| match v.kind {
5574
CanonicalVarKind::PlaceholderTy(_ty) => unimplemented!(),
@@ -81,108 +100,20 @@ crate fn evaluate_goal<'tcx>(
81100
universes: max_universe + 1,
82101
};
83102

84-
let solver_choice = chalk_solve::SolverChoice::SLG { max_size: 32, expected_answers: None };
85-
let mut solver = solver_choice.into_solver::<ChalkRustInterner<'tcx>>();
86-
87-
let db = ChalkRustIrDatabase { tcx, interner };
88-
let solution = solver.solve(&db, &_lowered_goal);
103+
use chalk_solve::Solver;
104+
let mut solver = chalk_engine::solve::SLGSolver::new(32, None);
105+
let db = ChalkRustIrDatabase { interner, restatic_placeholder, reempty_placeholder };
106+
let solution = chalk_solve::logging::with_tracing_logs(|| solver.solve(&db, &lowered_goal));
89107

90108
// Ideally, the code to convert *back* to rustc types would live close to
91109
// the code to convert *from* rustc types. Right now though, we don't
92110
// really need this and so it's really minimal.
93111
// Right now, we also treat a `Unique` solution the same as
94112
// `Ambig(Definite)`. This really isn't right.
95-
let make_solution = |_subst: chalk_ir::Substitution<_>| {
113+
let make_solution = |subst: chalk_ir::Substitution<_>| {
96114
let mut var_values: IndexVec<BoundVar, GenericArg<'tcx>> = IndexVec::new();
97-
_subst.parameters(&interner).iter().for_each(|p| {
98-
// FIXME(chalk): we should move this elsewhere, since this is
99-
// essentially inverse of lowering a `GenericArg`.
100-
let _data = p.data(&interner);
101-
match _data {
102-
chalk_ir::GenericArgData::Ty(_t) => {
103-
use chalk_ir::TyData;
104-
use rustc_ast as ast;
105-
106-
let _data = _t.data(&interner);
107-
let kind = match _data {
108-
TyData::Apply(_application_ty) => match _application_ty.name {
109-
chalk_ir::TypeName::Adt(_struct_id) => unimplemented!(),
110-
chalk_ir::TypeName::Scalar(scalar) => match scalar {
111-
chalk_ir::Scalar::Bool => ty::Bool,
112-
chalk_ir::Scalar::Char => ty::Char,
113-
chalk_ir::Scalar::Int(int_ty) => match int_ty {
114-
chalk_ir::IntTy::Isize => ty::Int(ast::IntTy::Isize),
115-
chalk_ir::IntTy::I8 => ty::Int(ast::IntTy::I8),
116-
chalk_ir::IntTy::I16 => ty::Int(ast::IntTy::I16),
117-
chalk_ir::IntTy::I32 => ty::Int(ast::IntTy::I32),
118-
chalk_ir::IntTy::I64 => ty::Int(ast::IntTy::I64),
119-
chalk_ir::IntTy::I128 => ty::Int(ast::IntTy::I128),
120-
},
121-
chalk_ir::Scalar::Uint(int_ty) => match int_ty {
122-
chalk_ir::UintTy::Usize => ty::Uint(ast::UintTy::Usize),
123-
chalk_ir::UintTy::U8 => ty::Uint(ast::UintTy::U8),
124-
chalk_ir::UintTy::U16 => ty::Uint(ast::UintTy::U16),
125-
chalk_ir::UintTy::U32 => ty::Uint(ast::UintTy::U32),
126-
chalk_ir::UintTy::U64 => ty::Uint(ast::UintTy::U64),
127-
chalk_ir::UintTy::U128 => ty::Uint(ast::UintTy::U128),
128-
},
129-
chalk_ir::Scalar::Float(float_ty) => match float_ty {
130-
chalk_ir::FloatTy::F32 => ty::Float(ast::FloatTy::F32),
131-
chalk_ir::FloatTy::F64 => ty::Float(ast::FloatTy::F64),
132-
},
133-
},
134-
chalk_ir::TypeName::Array => unimplemented!(),
135-
chalk_ir::TypeName::FnDef(_) => unimplemented!(),
136-
chalk_ir::TypeName::Closure(_) => unimplemented!(),
137-
chalk_ir::TypeName::Never => unimplemented!(),
138-
chalk_ir::TypeName::Tuple(_size) => unimplemented!(),
139-
chalk_ir::TypeName::Slice => unimplemented!(),
140-
chalk_ir::TypeName::Raw(_) => unimplemented!(),
141-
chalk_ir::TypeName::Ref(_) => unimplemented!(),
142-
chalk_ir::TypeName::Str => unimplemented!(),
143-
chalk_ir::TypeName::OpaqueType(_ty) => unimplemented!(),
144-
chalk_ir::TypeName::AssociatedType(_assoc_ty) => unimplemented!(),
145-
chalk_ir::TypeName::Error => unimplemented!(),
146-
},
147-
TyData::Placeholder(_placeholder) => {
148-
unimplemented!();
149-
}
150-
TyData::Alias(_alias_ty) => unimplemented!(),
151-
TyData::Function(_quantified_ty) => unimplemented!(),
152-
TyData::BoundVar(_bound) => Bound(
153-
ty::DebruijnIndex::from_usize(_bound.debruijn.depth() as usize),
154-
ty::BoundTy {
155-
var: ty::BoundVar::from_usize(_bound.index),
156-
kind: ty::BoundTyKind::Anon,
157-
},
158-
),
159-
TyData::InferenceVar(_, _) => unimplemented!(),
160-
TyData::Dyn(_) => unimplemented!(),
161-
};
162-
let _ty: Ty<'_> = tcx.mk_ty(kind);
163-
let _arg: GenericArg<'_> = _ty.into();
164-
var_values.push(_arg);
165-
}
166-
chalk_ir::GenericArgData::Lifetime(_l) => {
167-
let _data = _l.data(&interner);
168-
let _lifetime: Region<'_> = match _data {
169-
chalk_ir::LifetimeData::BoundVar(_var) => {
170-
tcx.mk_region(RegionKind::ReLateBound(
171-
rustc_middle::ty::DebruijnIndex::from_usize(
172-
_var.debruijn.depth() as usize
173-
),
174-
rustc_middle::ty::BoundRegion::BrAnon(_var.index as u32),
175-
))
176-
}
177-
chalk_ir::LifetimeData::InferenceVar(_var) => unimplemented!(),
178-
chalk_ir::LifetimeData::Placeholder(_index) => unimplemented!(),
179-
chalk_ir::LifetimeData::Phantom(_, _) => unimplemented!(),
180-
};
181-
let _arg: GenericArg<'_> = _lifetime.into();
182-
var_values.push(_arg);
183-
}
184-
chalk_ir::GenericArgData::Const(_) => unimplemented!(),
185-
}
115+
subst.as_slice(&interner).iter().for_each(|p| {
116+
var_values.push(p.lower_into(&interner));
186117
});
187118
let sol = Canonical {
188119
max_universe: ty::UniverseIndex::from_usize(0),
@@ -194,17 +125,17 @@ crate fn evaluate_goal<'tcx>(
194125
value: (),
195126
},
196127
};
197-
&*tcx.arena.alloc(sol)
128+
tcx.arena.alloc(sol)
198129
};
199130
solution
200131
.map(|s| match s {
201-
Solution::Unique(_subst) => {
132+
Solution::Unique(subst) => {
202133
// FIXME(chalk): handle constraints
203-
make_solution(_subst.value.subst)
134+
make_solution(subst.value.subst)
204135
}
205-
Solution::Ambig(_guidance) => {
206-
match _guidance {
207-
chalk_solve::Guidance::Definite(_subst) => make_solution(_subst.value),
136+
Solution::Ambig(guidance) => {
137+
match guidance {
138+
chalk_solve::Guidance::Definite(subst) => make_solution(subst.value),
208139
chalk_solve::Guidance::Suggested(_) => unimplemented!(),
209140
chalk_solve::Guidance::Unknown => {
210141
// chalk_fulfill doesn't use the var_values here, so

‎src/test/ui/chalkify/type_inference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ fn main() {
2424

2525
// Here we have two solutions so we get back the behavior of the old-style
2626
// trait solver.
27-
only_bar(x); //~ ERROR the trait bound `f64: Bar` is not satisfied
27+
only_bar(x); //~ ERROR the trait bound `{float}: Bar` is not satisfied
2828
}

‎src/test/ui/chalkify/type_inference.stderr

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
error[E0277]: the trait bound `f64: Bar` is not satisfied
1+
error[E0277]: the trait bound `{float}: Bar` is not satisfied
22
--> $DIR/type_inference.rs:27:5
33
|
44
LL | fn only_bar<T: Bar>(_x: T) { }
55
| --- required by this bound in `only_bar`
66
...
77
LL | only_bar(x);
8-
| ^^^^^^^^ the trait `Bar` is not implemented for `f64`
8+
| ^^^^^^^^ the trait `Bar` is not implemented for `{float}`
9+
|
10+
= help: the following implementations were found:
11+
<i32 as Bar>
12+
<u32 as Bar>
913

1014
error: aborting due to previous error
1115

‎src/test/ui/chalkify/type_wf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn main() {
1515
x: 5,
1616
};
1717

18-
let s = S { //~ ERROR the trait bound `f64: Foo` is not satisfied
18+
let s = S { //~ ERROR the trait bound `{float}: Foo` is not satisfied
1919
x: 5.0,
2020
};
2121

‎src/test/ui/chalkify/type_wf.stderr

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
error[E0277]: the trait bound `f64: Foo` is not satisfied
1+
error[E0277]: the trait bound `{float}: Foo` is not satisfied
22
--> $DIR/type_wf.rs:18:13
33
|
44
LL | struct S<T: Foo> {
55
| ---------------- required by `S`
66
...
77
LL | let s = S {
8-
| ^ the trait `Foo` is not implemented for `f64`
8+
| ^ the trait `Foo` is not implemented for `{float}`
9+
|
10+
= help: the following implementations were found:
11+
<Option<T> as Foo>
12+
<i32 as Foo>
913

1014
error: aborting due to previous error
1115

0 commit comments

Comments
 (0)
Please sign in to comment.