Skip to content

Commit

Permalink
Auto merge of #77954 - JohnTitor:rollup-bpoy497, r=JohnTitor
Browse files Browse the repository at this point in the history
Rollup of 9 pull requests

Successful merges:

 - #77570 (Allow ascii whitespace char for doc aliases )
 - #77739 (Remove unused code)
 - #77753 (Check html comments)
 - #77879 (Provide better documentation and help messages for x.py setup)
 - #77902 (Include aarch64-pc-windows-msvc in the dist manifests)
 - #77934 (Document -Z codegen-backend in the unstable book)
 - #77936 (Remove needless alloc_slice)
 - #77946 (Validate references to source scopes)
 - #77951 (Update books)

Failed merges:

r? `@ghost`
  • Loading branch information
bors committed Oct 14, 2020
2 parents e160e5c + 00100a4 commit f42692b
Show file tree
Hide file tree
Showing 66 changed files with 302 additions and 784 deletions.
38 changes: 0 additions & 38 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,6 @@ pub enum GenericArgs {
}

impl GenericArgs {
pub fn is_parenthesized(&self) -> bool {
match *self {
Parenthesized(..) => true,
_ => false,
}
}

pub fn is_angle_bracketed(&self) -> bool {
match *self {
AngleBracketed(..) => true,
Expand Down Expand Up @@ -857,13 +850,6 @@ impl BinOpKind {
}
}

pub fn is_shift(&self) -> bool {
match *self {
BinOpKind::Shl | BinOpKind::Shr => true,
_ => false,
}
}

pub fn is_comparison(&self) -> bool {
use BinOpKind::*;
// Note for developers: please keep this as is;
Expand All @@ -873,11 +859,6 @@ impl BinOpKind {
And | Or | Add | Sub | Mul | Div | Rem | BitXor | BitAnd | BitOr | Shl | Shr => false,
}
}

/// Returns `true` if the binary operator takes its arguments by value
pub fn is_by_value(&self) -> bool {
!self.is_comparison()
}
}

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

impl UnOp {
/// Returns `true` if the unary operator takes its argument by value
pub fn is_by_value(u: UnOp) -> bool {
match u {
UnOp::Neg | UnOp::Not => true,
_ => false,
}
}

pub fn to_string(op: UnOp) -> &'static str {
match op {
UnOp::Deref => "*",
Expand Down Expand Up @@ -1753,13 +1726,6 @@ impl IntTy {
}
}

pub fn val_to_string(&self, val: i128) -> String {
// Cast to a `u128` so we can correctly print `INT128_MIN`. All integral types
// are parsed as `u128`, so we wouldn't want to print an extra negative
// sign.
format!("{}{}", val as u128, self.name_str())
}

pub fn bit_width(&self) -> Option<u64> {
Some(match *self {
IntTy::Isize => return None,
Expand Down Expand Up @@ -1818,10 +1784,6 @@ impl UintTy {
}
}

pub fn val_to_string(&self, val: u128) -> String {
format!("{}{}", val, self.name_str())
}

pub fn bit_width(&self) -> Option<u64> {
Some(match *self {
UintTy::Usize => return None,
Expand Down
9 changes: 0 additions & 9 deletions compiler/rustc_ast/src/attr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@ impl NestedMetaItem {
self.meta_item().is_some()
}

/// Returns `true` if the variant is `Literal`.
pub fn is_literal(&self) -> bool {
self.literal().is_some()
}

/// Returns `true` if `self` is a `MetaItem` and the meta item is a word.
pub fn is_word(&self) -> bool {
self.meta_item().map_or(false, |meta_item| meta_item.is_word())
Expand Down Expand Up @@ -232,10 +227,6 @@ impl MetaItem {
pub fn is_value_str(&self) -> bool {
self.value_str().is_some()
}

pub fn is_meta_item_list(&self) -> bool {
self.meta_item_list().is_some()
}
}

impl AttrItem {
Expand Down
10 changes: 0 additions & 10 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,6 @@ pub enum DelimToken {
NoDelim,
}

impl DelimToken {
pub fn len(self) -> usize {
if self == NoDelim { 0 } else { 1 }
}

pub fn is_empty(self) -> bool {
self == NoDelim
}
}

#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
pub enum LitKind {
Bool, // AST only, must never appear in a `Token`
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_ast/src/tokenstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,6 @@ impl TokenStream {
.collect(),
))
}

pub fn map<F: FnMut(TokenTree) -> TokenTree>(self, mut f: F) -> TokenStream {
TokenStream(Lrc::new(
self.0.iter().map(|(tree, is_joint)| (f(tree.clone()), *is_joint)).collect(),
))
}
}

// 99.5%+ of the time we have 1 or 2 elements in this vector.
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_ast/src/util/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ impl AssocOp {
}
}

pub const PREC_RESET: i8 = -100;
pub const PREC_CLOSURE: i8 = -40;
pub const PREC_JUMP: i8 = -30;
pub const PREC_RANGE: i8 = -10;
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_codegen_llvm/src/llvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ pub fn SetUnnamedAddress(global: &'a Value, unnamed: UnnamedAddr) {
}
}

pub fn set_thread_local(global: &'a Value, is_thread_local: bool) {
unsafe {
LLVMSetThreadLocal(global, is_thread_local as Bool);
}
}
pub fn set_thread_local_mode(global: &'a Value, mode: ThreadLocalMode) {
unsafe {
LLVMSetThreadLocalMode(global, mode);
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1519,8 +1519,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
}
}

pub const CODEGEN_WORKER_ID: usize = usize::MAX;

/// `FatalError` is explicitly not `Send`.
#[must_use]
pub struct WorkerFatalError;
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,6 @@ fn get_argc_argv<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
}
}

pub const CODEGEN_WORKER_ID: usize = usize::MAX;

pub fn codegen_crate<B: ExtraBackendMethods>(
backend: B,
tcx: TyCtxt<'tcx>,
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_data_structures/src/work_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ pub struct WorkQueue<T: Idx> {
}

impl<T: Idx> WorkQueue<T> {
/// Creates a new work queue with all the elements from (0..len).
#[inline]
pub fn with_all(len: usize) -> Self {
WorkQueue { deque: (0..len).map(T::new).collect(), set: BitSet::new_filled(len) }
}

/// Creates a new work queue that starts empty, where elements range from (0..len).
#[inline]
pub fn with_none(len: usize) -> Self {
Expand Down
13 changes: 0 additions & 13 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ impl Diagnostic {
self.level == Level::Cancelled
}

/// Set the sorting span.
pub fn set_sort_span(&mut self, sp: Span) {
self.sort_span = sp;
}

/// Adds a span/label to be included in the resulting snippet.
///
/// This is pushed onto the [`MultiSpan`] that was created when the diagnostic
Expand Down Expand Up @@ -535,14 +530,6 @@ impl Diagnostic {
&self.message
}

/// Used by a lint. Copies over all details *but* the "main
/// message".
pub fn copy_details_not_message(&mut self, from: &Diagnostic) {
self.span = from.span.clone();
self.code = from.code.clone();
self.children.extend(from.children.iter().cloned())
}

/// Convenience function for internal use, clients should use one of the
/// public methods above.
pub fn sub(
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,6 @@ impl Emitter for SilentEmitter {
fn emit_diagnostic(&mut self, _: &Diagnostic) {}
}

/// Maximum number of lines we will print for each error; arbitrary.
pub const MAX_HIGHLIGHT_LINES: usize = 6;
/// Maximum number of lines we will print for a multiline suggestion; arbitrary.
///
/// This should be replaced with a more involved mechanism to output multiline suggestions that
Expand Down
14 changes: 0 additions & 14 deletions compiler/rustc_expand/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,6 @@ impl Annotatable {
}
}

pub fn map_item_or<F, G>(self, mut f: F, mut or: G) -> Annotatable
where
F: FnMut(P<ast::Item>) -> P<ast::Item>,
G: FnMut(Annotatable) -> Annotatable,
{
match self {
Annotatable::Item(i) => Annotatable::Item(f(i)),
_ => or(self),
}
}

pub fn expect_trait_item(self) -> P<ast::AssocItem> {
match self {
Annotatable::TraitItem(i) => i,
Expand Down Expand Up @@ -1052,9 +1041,6 @@ impl<'a> ExtCtxt<'a> {
.chain(components.iter().map(|&s| Ident::with_dummy_span(s)))
.collect()
}
pub fn name_of(&self, st: &str) -> Symbol {
Symbol::intern(st)
}

pub fn check_unused_macros(&mut self) {
self.resolver.check_unused_macros();
Expand Down
97 changes: 0 additions & 97 deletions compiler/rustc_expand/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,24 +139,6 @@ impl<'a> ExtCtxt<'a> {
ast::Lifetime { id: ast::DUMMY_NODE_ID, ident: ident.with_span_pos(span) }
}

pub fn lifetime_def(
&self,
span: Span,
ident: Ident,
attrs: Vec<ast::Attribute>,
bounds: ast::GenericBounds,
) -> ast::GenericParam {
let lifetime = self.lifetime(span, ident);
ast::GenericParam {
ident: lifetime.ident,
id: lifetime.id,
attrs: attrs.into(),
bounds,
kind: ast::GenericParamKind::Lifetime,
is_placeholder: false,
}
}

pub fn stmt_expr(&self, expr: P<ast::Expr>) -> ast::Stmt {
ast::Stmt {
id: ast::DUMMY_NODE_ID,
Expand Down Expand Up @@ -465,24 +447,6 @@ impl<'a> ExtCtxt<'a> {
self.pat_tuple_struct(span, path, vec![pat])
}

pub fn pat_none(&self, span: Span) -> P<ast::Pat> {
let some = self.std_path(&[sym::option, sym::Option, sym::None]);
let path = self.path_global(span, some);
self.pat_path(span, path)
}

pub fn pat_ok(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat> {
let some = self.std_path(&[sym::result, sym::Result, sym::Ok]);
let path = self.path_global(span, some);
self.pat_tuple_struct(span, path, vec![pat])
}

pub fn pat_err(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat> {
let some = self.std_path(&[sym::result, sym::Result, sym::Err]);
let path = self.path_global(span, some);
self.pat_tuple_struct(span, path, vec![pat])
}

pub fn arm(&self, span: Span, pat: P<ast::Pat>, expr: P<ast::Expr>) -> ast::Arm {
ast::Arm {
attrs: vec![],
Expand Down Expand Up @@ -514,26 +478,6 @@ impl<'a> ExtCtxt<'a> {
self.expr(span, ast::ExprKind::If(cond, self.block_expr(then), els))
}

pub fn lambda_fn_decl(
&self,
span: Span,
fn_decl: P<ast::FnDecl>,
body: P<ast::Expr>,
fn_decl_span: Span,
) -> P<ast::Expr> {
self.expr(
span,
ast::ExprKind::Closure(
ast::CaptureBy::Ref,
ast::Async::No,
ast::Movability::Movable,
fn_decl,
body,
fn_decl_span,
),
)
}

pub fn lambda(&self, span: Span, ids: Vec<Ident>, body: P<ast::Expr>) -> P<ast::Expr> {
let fn_decl = self.fn_decl(
ids.iter().map(|id| self.param(span, *id, self.ty(span, ast::TyKind::Infer))).collect(),
Expand Down Expand Up @@ -610,47 +554,6 @@ impl<'a> ExtCtxt<'a> {
})
}

pub fn variant(&self, span: Span, ident: Ident, tys: Vec<P<ast::Ty>>) -> ast::Variant {
let vis_span = span.shrink_to_lo();
let fields: Vec<_> = tys
.into_iter()
.map(|ty| ast::StructField {
span: ty.span,
ty,
ident: None,
vis: ast::Visibility {
span: vis_span,
kind: ast::VisibilityKind::Inherited,
tokens: None,
},
attrs: Vec::new(),
id: ast::DUMMY_NODE_ID,
is_placeholder: false,
})
.collect();

let vdata = if fields.is_empty() {
ast::VariantData::Unit(ast::DUMMY_NODE_ID)
} else {
ast::VariantData::Tuple(fields, ast::DUMMY_NODE_ID)
};

ast::Variant {
attrs: Vec::new(),
data: vdata,
disr_expr: None,
id: ast::DUMMY_NODE_ID,
ident,
vis: ast::Visibility {
span: vis_span,
kind: ast::VisibilityKind::Inherited,
tokens: None,
},
span,
is_placeholder: false,
}
}

pub fn item_static(
&self,
span: Span,
Expand Down
Loading

0 comments on commit f42692b

Please sign in to comment.