Fix CI problems
This commit is contained in:
parent
8f5585ac00
commit
1f20966e90
@ -526,21 +526,20 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
|||||||
let hir_map = self.infcx.tcx.hir();
|
let hir_map = self.infcx.tcx.hir();
|
||||||
let my_def = self.body.source.def_id();
|
let my_def = self.body.source.def_id();
|
||||||
let my_hir = hir_map.local_def_id_to_hir_id(my_def.as_local().unwrap());
|
let my_hir = hir_map.local_def_id_to_hir_id(my_def.as_local().unwrap());
|
||||||
let td = if let Some(a) = self.infcx.tcx.impl_of_method(my_def).and_then(|x| {
|
let td = if let Some(a) =
|
||||||
self.infcx.tcx.trait_id_of_impl(x)
|
self.infcx.tcx.impl_of_method(my_def).and_then(|x| self.infcx.tcx.trait_id_of_impl(x))
|
||||||
}) {
|
{
|
||||||
a
|
a
|
||||||
} else {
|
} else {
|
||||||
return (false, None);
|
return (false, None);
|
||||||
};
|
};
|
||||||
(true, td.as_local().and_then(|tld| {
|
(
|
||||||
|
true,
|
||||||
|
td.as_local().and_then(|tld| {
|
||||||
let h = hir_map.local_def_id_to_hir_id(tld);
|
let h = hir_map.local_def_id_to_hir_id(tld);
|
||||||
match hir_map.find(h) {
|
match hir_map.find(h) {
|
||||||
Some(Node::Item(hir::Item {
|
Some(Node::Item(hir::Item {
|
||||||
kind: hir::ItemKind::Trait(
|
kind: hir::ItemKind::Trait(_, _, _, _, items),
|
||||||
_, _, _, _,
|
|
||||||
items
|
|
||||||
),
|
|
||||||
..
|
..
|
||||||
})) => {
|
})) => {
|
||||||
let mut f_in_trait_opt = None;
|
let mut f_in_trait_opt = None;
|
||||||
@ -555,28 +554,25 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
|||||||
f_in_trait_opt = Some(hi);
|
f_in_trait_opt = Some(hi);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
f_in_trait_opt.and_then(|f_in_trait| {
|
f_in_trait_opt.and_then(|f_in_trait| match hir_map.find(f_in_trait) {
|
||||||
match hir_map.find(f_in_trait) {
|
|
||||||
Some(Node::TraitItem(hir::TraitItem {
|
Some(Node::TraitItem(hir::TraitItem {
|
||||||
kind: hir::TraitItemKind::Fn(hir::FnSig {
|
kind:
|
||||||
decl: hir::FnDecl {
|
hir::TraitItemKind::Fn(
|
||||||
inputs,
|
hir::FnSig { decl: hir::FnDecl { inputs, .. }, .. },
|
||||||
..
|
_,
|
||||||
},
|
),
|
||||||
..
|
|
||||||
}, _),
|
|
||||||
..
|
..
|
||||||
})) => {
|
})) => {
|
||||||
let hir::Ty { span, .. } = inputs[local.index() - 1];
|
let hir::Ty { span, .. } = inputs[local.index() - 1];
|
||||||
Some(span)
|
Some(span)
|
||||||
},
|
|
||||||
_ => None,
|
|
||||||
}
|
}
|
||||||
|
_ => None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_ => None
|
_ => None,
|
||||||
}
|
}
|
||||||
}))
|
}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// point to span of upvar making closure call require mutable borrow
|
// point to span of upvar making closure call require mutable borrow
|
||||||
|
@ -4,7 +4,7 @@ struct Test(u32);
|
|||||||
|
|
||||||
unsafe impl GlobalAlloc for Test {
|
unsafe impl GlobalAlloc for Test {
|
||||||
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
|
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
|
||||||
self.0 += 1;
|
self.0 += 1; //~ ERROR cannot assign
|
||||||
0 as *mut u8
|
0 as *mut u8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ struct Test1(i32);
|
|||||||
|
|
||||||
impl Hello for Test1 {
|
impl Hello for Test1 {
|
||||||
fn example(&self, input: &i32) { // should not suggest here
|
fn example(&self, input: &i32) { // should not suggest here
|
||||||
*input = self.0;
|
*input = self.0; //~ ERROR cannot assign
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ struct Test2(i32);
|
|||||||
|
|
||||||
impl Hello for Test2 {
|
impl Hello for Test2 {
|
||||||
fn example(&self, input: &i32) { // should not suggest here
|
fn example(&self, input: &i32) { // should not suggest here
|
||||||
self.0 += *input;
|
self.0 += *input; //~ ERROR cannot assign
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user