Skip to content

Commit f42692b

Browse files
committed
Auto merge of rust-lang#77954 - JohnTitor:rollup-bpoy497, r=JohnTitor
Rollup of 9 pull requests Successful merges: - rust-lang#77570 (Allow ascii whitespace char for doc aliases ) - rust-lang#77739 (Remove unused code) - rust-lang#77753 (Check html comments) - rust-lang#77879 (Provide better documentation and help messages for x.py setup) - rust-lang#77902 (Include aarch64-pc-windows-msvc in the dist manifests) - rust-lang#77934 (Document -Z codegen-backend in the unstable book) - rust-lang#77936 (Remove needless alloc_slice) - rust-lang#77946 (Validate references to source scopes) - rust-lang#77951 (Update books) Failed merges: r? `@ghost`
2 parents e160e5c + 00100a4 commit f42692b

File tree

66 files changed

+302
-784
lines changed

Some content is hidden

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

66 files changed

+302
-784
lines changed

compiler/rustc_ast/src/ast.rs

-38
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,6 @@ pub enum GenericArgs {
167167
}
168168

169169
impl GenericArgs {
170-
pub fn is_parenthesized(&self) -> bool {
171-
match *self {
172-
Parenthesized(..) => true,
173-
_ => false,
174-
}
175-
}
176-
177170
pub fn is_angle_bracketed(&self) -> bool {
178171
match *self {
179172
AngleBracketed(..) => true,
@@ -857,13 +850,6 @@ impl BinOpKind {
857850
}
858851
}
859852

860-
pub fn is_shift(&self) -> bool {
861-
match *self {
862-
BinOpKind::Shl | BinOpKind::Shr => true,
863-
_ => false,
864-
}
865-
}
866-
867853
pub fn is_comparison(&self) -> bool {
868854
use BinOpKind::*;
869855
// Note for developers: please keep this as is;
@@ -873,11 +859,6 @@ impl BinOpKind {
873859
And | Or | Add | Sub | Mul | Div | Rem | BitXor | BitAnd | BitOr | Shl | Shr => false,
874860
}
875861
}
876-
877-
/// Returns `true` if the binary operator takes its arguments by value
878-
pub fn is_by_value(&self) -> bool {
879-
!self.is_comparison()
880-
}
881862
}
882863

883864
pub type BinOp = Spanned<BinOpKind>;
@@ -896,14 +877,6 @@ pub enum UnOp {
896877
}
897878

898879
impl UnOp {
899-
/// Returns `true` if the unary operator takes its argument by value
900-
pub fn is_by_value(u: UnOp) -> bool {
901-
match u {
902-
UnOp::Neg | UnOp::Not => true,
903-
_ => false,
904-
}
905-
}
906-
907880
pub fn to_string(op: UnOp) -> &'static str {
908881
match op {
909882
UnOp::Deref => "*",
@@ -1753,13 +1726,6 @@ impl IntTy {
17531726
}
17541727
}
17551728

1756-
pub fn val_to_string(&self, val: i128) -> String {
1757-
// Cast to a `u128` so we can correctly print `INT128_MIN`. All integral types
1758-
// are parsed as `u128`, so we wouldn't want to print an extra negative
1759-
// sign.
1760-
format!("{}{}", val as u128, self.name_str())
1761-
}
1762-
17631729
pub fn bit_width(&self) -> Option<u64> {
17641730
Some(match *self {
17651731
IntTy::Isize => return None,
@@ -1818,10 +1784,6 @@ impl UintTy {
18181784
}
18191785
}
18201786

1821-
pub fn val_to_string(&self, val: u128) -> String {
1822-
format!("{}{}", val, self.name_str())
1823-
}
1824-
18251787
pub fn bit_width(&self) -> Option<u64> {
18261788
Some(match *self {
18271789
UintTy::Usize => return None,

compiler/rustc_ast/src/attr/mod.rs

-9
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ impl NestedMetaItem {
101101
self.meta_item().is_some()
102102
}
103103

104-
/// Returns `true` if the variant is `Literal`.
105-
pub fn is_literal(&self) -> bool {
106-
self.literal().is_some()
107-
}
108-
109104
/// Returns `true` if `self` is a `MetaItem` and the meta item is a word.
110105
pub fn is_word(&self) -> bool {
111106
self.meta_item().map_or(false, |meta_item| meta_item.is_word())
@@ -232,10 +227,6 @@ impl MetaItem {
232227
pub fn is_value_str(&self) -> bool {
233228
self.value_str().is_some()
234229
}
235-
236-
pub fn is_meta_item_list(&self) -> bool {
237-
self.meta_item_list().is_some()
238-
}
239230
}
240231

241232
impl AttrItem {

compiler/rustc_ast/src/token.rs

-10
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,6 @@ pub enum DelimToken {
5454
NoDelim,
5555
}
5656

57-
impl DelimToken {
58-
pub fn len(self) -> usize {
59-
if self == NoDelim { 0 } else { 1 }
60-
}
61-
62-
pub fn is_empty(self) -> bool {
63-
self == NoDelim
64-
}
65-
}
66-
6757
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
6858
pub enum LitKind {
6959
Bool, // AST only, must never appear in a `Token`

compiler/rustc_ast/src/tokenstream.rs

-6
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,6 @@ impl TokenStream {
295295
.collect(),
296296
))
297297
}
298-
299-
pub fn map<F: FnMut(TokenTree) -> TokenTree>(self, mut f: F) -> TokenStream {
300-
TokenStream(Lrc::new(
301-
self.0.iter().map(|(tree, is_joint)| (f(tree.clone()), *is_joint)).collect(),
302-
))
303-
}
304298
}
305299

306300
// 99.5%+ of the time we have 1 or 2 elements in this vector.

compiler/rustc_ast/src/util/parser.rs

-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ impl AssocOp {
231231
}
232232
}
233233

234-
pub const PREC_RESET: i8 = -100;
235234
pub const PREC_CLOSURE: i8 = -40;
236235
pub const PREC_JUMP: i8 = -30;
237236
pub const PREC_RANGE: i8 = -10;

compiler/rustc_codegen_llvm/src/llvm/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,6 @@ pub fn SetUnnamedAddress(global: &'a Value, unnamed: UnnamedAddr) {
118118
}
119119
}
120120

121-
pub fn set_thread_local(global: &'a Value, is_thread_local: bool) {
122-
unsafe {
123-
LLVMSetThreadLocal(global, is_thread_local as Bool);
124-
}
125-
}
126121
pub fn set_thread_local_mode(global: &'a Value, mode: ThreadLocalMode) {
127122
unsafe {
128123
LLVMSetThreadLocalMode(global, mode);

compiler/rustc_codegen_ssa/src/back/write.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1519,8 +1519,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
15191519
}
15201520
}
15211521

1522-
pub const CODEGEN_WORKER_ID: usize = usize::MAX;
1523-
15241522
/// `FatalError` is explicitly not `Send`.
15251523
#[must_use]
15261524
pub struct WorkerFatalError;

compiler/rustc_codegen_ssa/src/base.rs

-2
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,6 @@ fn get_argc_argv<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
479479
}
480480
}
481481

482-
pub const CODEGEN_WORKER_ID: usize = usize::MAX;
483-
484482
pub fn codegen_crate<B: ExtraBackendMethods>(
485483
backend: B,
486484
tcx: TyCtxt<'tcx>,

compiler/rustc_data_structures/src/work_queue.rs

-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ pub struct WorkQueue<T: Idx> {
1414
}
1515

1616
impl<T: Idx> WorkQueue<T> {
17-
/// Creates a new work queue with all the elements from (0..len).
18-
#[inline]
19-
pub fn with_all(len: usize) -> Self {
20-
WorkQueue { deque: (0..len).map(T::new).collect(), set: BitSet::new_filled(len) }
21-
}
22-
2317
/// Creates a new work queue that starts empty, where elements range from (0..len).
2418
#[inline]
2519
pub fn with_none(len: usize) -> Self {

compiler/rustc_errors/src/diagnostic.rs

-13
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ impl Diagnostic {
121121
self.level == Level::Cancelled
122122
}
123123

124-
/// Set the sorting span.
125-
pub fn set_sort_span(&mut self, sp: Span) {
126-
self.sort_span = sp;
127-
}
128-
129124
/// Adds a span/label to be included in the resulting snippet.
130125
///
131126
/// This is pushed onto the [`MultiSpan`] that was created when the diagnostic
@@ -535,14 +530,6 @@ impl Diagnostic {
535530
&self.message
536531
}
537532

538-
/// Used by a lint. Copies over all details *but* the "main
539-
/// message".
540-
pub fn copy_details_not_message(&mut self, from: &Diagnostic) {
541-
self.span = from.span.clone();
542-
self.code = from.code.clone();
543-
self.children.extend(from.children.iter().cloned())
544-
}
545-
546533
/// Convenience function for internal use, clients should use one of the
547534
/// public methods above.
548535
pub fn sub(

compiler/rustc_errors/src/emitter.rs

-2
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,6 @@ impl Emitter for SilentEmitter {
510510
fn emit_diagnostic(&mut self, _: &Diagnostic) {}
511511
}
512512

513-
/// Maximum number of lines we will print for each error; arbitrary.
514-
pub const MAX_HIGHLIGHT_LINES: usize = 6;
515513
/// Maximum number of lines we will print for a multiline suggestion; arbitrary.
516514
///
517515
/// This should be replaced with a more involved mechanism to output multiline suggestions that

compiler/rustc_expand/src/base.rs

-14
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,6 @@ impl Annotatable {
148148
}
149149
}
150150

151-
pub fn map_item_or<F, G>(self, mut f: F, mut or: G) -> Annotatable
152-
where
153-
F: FnMut(P<ast::Item>) -> P<ast::Item>,
154-
G: FnMut(Annotatable) -> Annotatable,
155-
{
156-
match self {
157-
Annotatable::Item(i) => Annotatable::Item(f(i)),
158-
_ => or(self),
159-
}
160-
}
161-
162151
pub fn expect_trait_item(self) -> P<ast::AssocItem> {
163152
match self {
164153
Annotatable::TraitItem(i) => i,
@@ -1052,9 +1041,6 @@ impl<'a> ExtCtxt<'a> {
10521041
.chain(components.iter().map(|&s| Ident::with_dummy_span(s)))
10531042
.collect()
10541043
}
1055-
pub fn name_of(&self, st: &str) -> Symbol {
1056-
Symbol::intern(st)
1057-
}
10581044

10591045
pub fn check_unused_macros(&mut self) {
10601046
self.resolver.check_unused_macros();

compiler/rustc_expand/src/build.rs

-97
Original file line numberDiff line numberDiff line change
@@ -139,24 +139,6 @@ impl<'a> ExtCtxt<'a> {
139139
ast::Lifetime { id: ast::DUMMY_NODE_ID, ident: ident.with_span_pos(span) }
140140
}
141141

142-
pub fn lifetime_def(
143-
&self,
144-
span: Span,
145-
ident: Ident,
146-
attrs: Vec<ast::Attribute>,
147-
bounds: ast::GenericBounds,
148-
) -> ast::GenericParam {
149-
let lifetime = self.lifetime(span, ident);
150-
ast::GenericParam {
151-
ident: lifetime.ident,
152-
id: lifetime.id,
153-
attrs: attrs.into(),
154-
bounds,
155-
kind: ast::GenericParamKind::Lifetime,
156-
is_placeholder: false,
157-
}
158-
}
159-
160142
pub fn stmt_expr(&self, expr: P<ast::Expr>) -> ast::Stmt {
161143
ast::Stmt {
162144
id: ast::DUMMY_NODE_ID,
@@ -465,24 +447,6 @@ impl<'a> ExtCtxt<'a> {
465447
self.pat_tuple_struct(span, path, vec![pat])
466448
}
467449

468-
pub fn pat_none(&self, span: Span) -> P<ast::Pat> {
469-
let some = self.std_path(&[sym::option, sym::Option, sym::None]);
470-
let path = self.path_global(span, some);
471-
self.pat_path(span, path)
472-
}
473-
474-
pub fn pat_ok(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat> {
475-
let some = self.std_path(&[sym::result, sym::Result, sym::Ok]);
476-
let path = self.path_global(span, some);
477-
self.pat_tuple_struct(span, path, vec![pat])
478-
}
479-
480-
pub fn pat_err(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat> {
481-
let some = self.std_path(&[sym::result, sym::Result, sym::Err]);
482-
let path = self.path_global(span, some);
483-
self.pat_tuple_struct(span, path, vec![pat])
484-
}
485-
486450
pub fn arm(&self, span: Span, pat: P<ast::Pat>, expr: P<ast::Expr>) -> ast::Arm {
487451
ast::Arm {
488452
attrs: vec![],
@@ -514,26 +478,6 @@ impl<'a> ExtCtxt<'a> {
514478
self.expr(span, ast::ExprKind::If(cond, self.block_expr(then), els))
515479
}
516480

517-
pub fn lambda_fn_decl(
518-
&self,
519-
span: Span,
520-
fn_decl: P<ast::FnDecl>,
521-
body: P<ast::Expr>,
522-
fn_decl_span: Span,
523-
) -> P<ast::Expr> {
524-
self.expr(
525-
span,
526-
ast::ExprKind::Closure(
527-
ast::CaptureBy::Ref,
528-
ast::Async::No,
529-
ast::Movability::Movable,
530-
fn_decl,
531-
body,
532-
fn_decl_span,
533-
),
534-
)
535-
}
536-
537481
pub fn lambda(&self, span: Span, ids: Vec<Ident>, body: P<ast::Expr>) -> P<ast::Expr> {
538482
let fn_decl = self.fn_decl(
539483
ids.iter().map(|id| self.param(span, *id, self.ty(span, ast::TyKind::Infer))).collect(),
@@ -610,47 +554,6 @@ impl<'a> ExtCtxt<'a> {
610554
})
611555
}
612556

613-
pub fn variant(&self, span: Span, ident: Ident, tys: Vec<P<ast::Ty>>) -> ast::Variant {
614-
let vis_span = span.shrink_to_lo();
615-
let fields: Vec<_> = tys
616-
.into_iter()
617-
.map(|ty| ast::StructField {
618-
span: ty.span,
619-
ty,
620-
ident: None,
621-
vis: ast::Visibility {
622-
span: vis_span,
623-
kind: ast::VisibilityKind::Inherited,
624-
tokens: None,
625-
},
626-
attrs: Vec::new(),
627-
id: ast::DUMMY_NODE_ID,
628-
is_placeholder: false,
629-
})
630-
.collect();
631-
632-
let vdata = if fields.is_empty() {
633-
ast::VariantData::Unit(ast::DUMMY_NODE_ID)
634-
} else {
635-
ast::VariantData::Tuple(fields, ast::DUMMY_NODE_ID)
636-
};
637-
638-
ast::Variant {
639-
attrs: Vec::new(),
640-
data: vdata,
641-
disr_expr: None,
642-
id: ast::DUMMY_NODE_ID,
643-
ident,
644-
vis: ast::Visibility {
645-
span: vis_span,
646-
kind: ast::VisibilityKind::Inherited,
647-
tokens: None,
648-
},
649-
span,
650-
is_placeholder: false,
651-
}
652-
}
653-
654557
pub fn item_static(
655558
&self,
656559
span: Span,

0 commit comments

Comments
 (0)