Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7f2863f

Browse files
committedJan 4, 2024
Auto merge of rust-lang#119565 - compiler-errors:rollup-mqab1vy, r=compiler-errors
Rollup of 10 pull requests Successful merges: - rust-lang#118521 (Enable address sanitizer for MSVC targets using INFERASANLIBS linker flag) - rust-lang#119026 (std::net::bind using -1 for openbsd which in turn sets it to somaxconn.) - rust-lang#119195 (Make named_asm_labels lint not trigger on unicode and trigger on format args) - rust-lang#119204 (macro_rules: Less hacky heuristic for using `tt` metavariable spans) - rust-lang#119362 (Make `derive(Trait)` suggestion more accurate) - rust-lang#119397 (Recover parentheses in range patterns) - rust-lang#119414 (bootstrap: Move -Clto= setting from Rustc::run to rustc_cargo) - rust-lang#119417 (Uplift some miscellaneous coroutine-specific machinery into `check_closure`) - rust-lang#119540 (Don't synthesize host effect args inside trait object types) - rust-lang#119555 (Add codegen test for RVO on MaybeUninit) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 090d5ea + 4880f2b commit 7f2863f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+789
-376
lines changed
 

‎compiler/rustc_ast/src/tokenstream.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use rustc_span::{sym, Span, Symbol, DUMMY_SP};
2626
use smallvec::{smallvec, SmallVec};
2727

2828
use std::borrow::Cow;
29-
use std::{cmp, fmt, iter, mem};
29+
use std::{cmp, fmt, iter};
3030

3131
/// When the main Rust parser encounters a syntax-extension invocation, it
3232
/// parses the arguments to the invocation as a token tree. This is a very
@@ -81,14 +81,6 @@ impl TokenTree {
8181
}
8282
}
8383

84-
/// Modify the `TokenTree`'s span in-place.
85-
pub fn set_span(&mut self, span: Span) {
86-
match self {
87-
TokenTree::Token(token, _) => token.span = span,
88-
TokenTree::Delimited(dspan, ..) => *dspan = DelimSpan::from_single(span),
89-
}
90-
}
91-
9284
/// Create a `TokenTree::Token` with alone spacing.
9385
pub fn token_alone(kind: TokenKind, span: Span) -> TokenTree {
9486
TokenTree::Token(Token::new(kind, span), Spacing::Alone)
@@ -461,19 +453,6 @@ impl TokenStream {
461453
t1.next().is_none() && t2.next().is_none()
462454
}
463455

464-
/// Applies the supplied function to each `TokenTree` and its index in `self`, returning a new `TokenStream`
465-
///
466-
/// It is equivalent to `TokenStream::new(self.trees().cloned().enumerate().map(|(i, tt)| f(i, tt)).collect())`.
467-
pub fn map_enumerated_owned(
468-
mut self,
469-
mut f: impl FnMut(usize, TokenTree) -> TokenTree,
470-
) -> TokenStream {
471-
let owned = Lrc::make_mut(&mut self.0); // clone if necessary
472-
// rely on vec's in-place optimizations to avoid another allocation
473-
*owned = mem::take(owned).into_iter().enumerate().map(|(i, tree)| f(i, tree)).collect();
474-
self
475-
}
476-
477456
/// Create a token stream containing a single token with alone spacing. The
478457
/// spacing used for the final token in a constructed stream doesn't matter
479458
/// because it's never used. In practice we arbitrarily use

‎compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,19 +1434,21 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
14341434
let (bounds, lifetime_bound) = self.with_dyn_type_scope(true, |this| {
14351435
let bounds =
14361436
this.arena.alloc_from_iter(bounds.iter().filter_map(|bound| match bound {
1437-
GenericBound::Trait(
1438-
ty,
1439-
TraitBoundModifiers {
1440-
polarity: BoundPolarity::Positive | BoundPolarity::Negative(_),
1441-
constness,
1442-
},
1443-
) => Some(this.lower_poly_trait_ref(ty, itctx, *constness)),
1444-
// We can safely ignore constness here, since AST validation
1445-
// will take care of invalid modifier combinations.
1446-
GenericBound::Trait(
1447-
_,
1448-
TraitBoundModifiers { polarity: BoundPolarity::Maybe(_), .. },
1449-
) => None,
1437+
// We can safely ignore constness here since AST validation
1438+
// takes care of rejecting invalid modifier combinations and
1439+
// const trait bounds in trait object types.
1440+
GenericBound::Trait(ty, modifiers) => match modifiers.polarity {
1441+
BoundPolarity::Positive | BoundPolarity::Negative(_) => {
1442+
Some(this.lower_poly_trait_ref(
1443+
ty,
1444+
itctx,
1445+
// Still, don't pass along the constness here; we don't want to
1446+
// synthesize any host effect args, it'd only cause problems.
1447+
ast::BoundConstness::Never,
1448+
))
1449+
}
1450+
BoundPolarity::Maybe(_) => None,
1451+
},
14501452
GenericBound::Outlives(lifetime) => {
14511453
if lifetime_bound.is_none() {
14521454
lifetime_bound = Some(this.lower_lifetime(lifetime));

0 commit comments

Comments
 (0)
This repository has been archived.