Auto merge of #125829 - petrochenkov:upctxt2, r= · rust-lang/rust@cf4be1f (original) (raw)
`@@ -520,6 +520,7 @@ impl SpanData {
`
520
520
`pub fn with_hi(&self, hi: BytePos) -> Span {
`
521
521
`Span::new(self.lo, hi, self.ctxt, self.parent)
`
522
522
`}
`
``
523
`` +
/// Avoid if possible, Span::map_ctxt
should be preferred.
``
523
524
`#[inline]
`
524
525
`fn with_ctxt(&self, ctxt: SyntaxContext) -> Span {
`
525
526
`Span::new(self.lo, self.hi, ctxt, self.parent)
`
`@@ -576,9 +577,8 @@ impl Span {
`
576
577
`self.data().with_hi(hi)
`
577
578
`}
`
578
579
`#[inline]
`
579
``
`-
pub fn with_ctxt(mut self, ctxt: SyntaxContext) -> Span {
`
580
``
`-
self.update_ctxt(|_| ctxt);
`
581
``
`-
self
`
``
580
`+
pub fn with_ctxt(self, ctxt: SyntaxContext) -> Span {
`
``
581
`+
self.map_ctxt(|_| ctxt)
`
582
582
`}
`
583
583
`#[inline]
`
584
584
`pub fn parent(self) -> Option {
`
`@@ -1059,9 +1059,8 @@ impl Span {
`
1059
1059
`}
`
1060
1060
``
1061
1061
`#[inline]
`
1062
``
`-
pub fn apply_mark(mut self, expn_id: ExpnId, transparency: Transparency) -> Span {
`
1063
``
`-
self.update_ctxt(|ctxt| ctxt.apply_mark(expn_id, transparency));
`
1064
``
`-
self
`
``
1062
`+
pub fn apply_mark(self, expn_id: ExpnId, transparency: Transparency) -> Span {
`
``
1063
`+
self.map_ctxt(|ctxt| ctxt.apply_mark(expn_id, transparency))
`
1065
1064
`}
`
1066
1065
``
1067
1066
`#[inline]
`
`@@ -1109,15 +1108,13 @@ impl Span {
`
1109
1108
`}
`
1110
1109
``
1111
1110
`#[inline]
`
1112
``
`-
pub fn normalize_to_macros_2_0(mut self) -> Span {
`
1113
``
`-
self.update_ctxt(|ctxt| ctxt.normalize_to_macros_2_0());
`
1114
``
`-
self
`
``
1111
`+
pub fn normalize_to_macros_2_0(self) -> Span {
`
``
1112
`+
self.map_ctxt(|ctxt| ctxt.normalize_to_macros_2_0())
`
1115
1113
`}
`
1116
1114
``
1117
1115
`#[inline]
`
1118
``
`-
pub fn normalize_to_macro_rules(mut self) -> Span {
`
1119
``
`-
self.update_ctxt(|ctxt| ctxt.normalize_to_macro_rules());
`
1120
``
`-
self
`
``
1116
`+
pub fn normalize_to_macro_rules(self) -> Span {
`
``
1117
`+
self.map_ctxt(|ctxt| ctxt.normalize_to_macro_rules())
`
1121
1118
`}
`
1122
1119
`}
`
1123
1120
``