mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Handle e2021 precise capturing of unsafe binder
This commit is contained in:
@@ -117,6 +117,10 @@ pub fn to_symbol(&self) -> Symbol {
|
||||
}
|
||||
},
|
||||
|
||||
HirProjectionKind::UnwrapUnsafeBinder => {
|
||||
write!(&mut symbol, "__unwrap").unwrap();
|
||||
}
|
||||
|
||||
// Ignore derefs for now, as they are likely caused by
|
||||
// autoderefs that don't appear in the original code.
|
||||
HirProjectionKind::Deref => {}
|
||||
|
||||
@@ -101,12 +101,12 @@ fn convert_to_hir_projections_and_truncate_for_capture(
|
||||
variant = Some(*idx);
|
||||
continue;
|
||||
}
|
||||
ProjectionElem::UnwrapUnsafeBinder(_) => HirProjectionKind::UnwrapUnsafeBinder,
|
||||
// These do not affect anything, they just make sure we know the right type.
|
||||
ProjectionElem::OpaqueCast(_) | ProjectionElem::Subtype(..) => continue,
|
||||
ProjectionElem::Index(..)
|
||||
| ProjectionElem::ConstantIndex { .. }
|
||||
| ProjectionElem::Subslice { .. }
|
||||
| ProjectionElem::UnwrapUnsafeBinder(_) => {
|
||||
| ProjectionElem::Subslice { .. } => {
|
||||
// We don't capture array-access projections.
|
||||
// We can stop here as arrays are captured completely.
|
||||
break;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//@ revisions: e2015 e2021
|
||||
//@[e2015] edition: 2015
|
||||
//@[e2021] edition: 2021
|
||||
//@ check-pass
|
||||
|
||||
#![feature(unsafe_binders)]
|
||||
|
||||
Reference in New Issue
Block a user