From e5a1be8597c21c7b547a02231e5cf072dd3a0179 Mon Sep 17 00:00:00 2001 From: marmeladema Date: Sat, 2 May 2020 18:42:36 +0100 Subject: [PATCH 01/13] Use `LocalDefId` in `DumpVisitor::nest_tables` This is a partial fix for #71104 --- src/librustc_save_analysis/dump_visitor.rs | 70 +++++++++++++--------- src/librustc_typeck/check/mod.rs | 7 --- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index ccce72fb0ac24..e2eb39c3e1cbd 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -21,7 +21,7 @@ use rustc_ast::walk_list; use rustc_ast_pretty::pprust::{bounds_to_string, generic_params_to_string, ty_to_string}; use rustc_data_structures::fx::FxHashSet; use rustc_hir::def::{DefKind as HirDefKind, Res}; -use rustc_hir::def_id::DefId; +use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_middle::span_bug; use rustc_middle::ty::{self, DefIdTree, TyCtxt}; use rustc_session::config::Input; @@ -103,12 +103,10 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { self.dumper.analysis() } - fn nest_tables(&mut self, item_id: NodeId, f: F) + fn nest_tables(&mut self, item_def_id: LocalDefId, f: F) where F: FnOnce(&mut Self), { - let item_def_id = self.tcx.hir().local_def_id_from_node_id(item_id); - let tables = if self.tcx.has_typeck_tables(item_def_id) { self.tcx.typeck_tables_of(item_def_id) } else { @@ -271,8 +269,9 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { ) { debug!("process_method: {}:{}", id, ident); - let hir_id = self.tcx.hir().node_id_to_hir_id(id); - self.nest_tables(id, |v| { + let map = &self.tcx.hir(); + let hir_id = map.node_id_to_hir_id(id); + self.nest_tables(map.local_def_id(hir_id), |v| { if let Some(mut method_data) = v.save_ctxt.get_method_data(id, ident, span) { v.process_formals(&sig.decl.inputs, &method_data.qualname); v.process_generic_params(&generics, &method_data.qualname, id); @@ -295,7 +294,8 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { // start walking from the newly-created definition. match sig.header.asyncness { ast::Async::Yes { return_impl_trait_id, .. } => { - v.nest_tables(return_impl_trait_id, |v| v.visit_ty(ret_ty)) + let hir_id = map.node_id_to_hir_id(return_impl_trait_id); + v.nest_tables(map.local_def_id(hir_id), |v| v.visit_ty(ret_ty)) } _ => v.visit_ty(ret_ty), } @@ -363,8 +363,9 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { ty_params: &'l ast::Generics, body: Option<&'l ast::Block>, ) { - let hir_id = self.tcx.hir().node_id_to_hir_id(item.id); - self.nest_tables(item.id, |v| { + let map = &self.tcx.hir(); + let hir_id = map.node_id_to_hir_id(item.id); + self.nest_tables(map.local_def_id(hir_id), |v| { if let Some(fn_data) = v.save_ctxt.get_item_data(item) { down_cast_data!(fn_data, DefData, item.span); v.process_formals(&decl.inputs, &fn_data.qualname); @@ -388,7 +389,8 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { // start walking from the newly-created definition. match header.asyncness { ast::Async::Yes { return_impl_trait_id, .. } => { - v.nest_tables(return_impl_trait_id, |v| v.visit_ty(ret_ty)) + let hir_id = map.node_id_to_hir_id(return_impl_trait_id); + v.nest_tables(map.local_def_id(hir_id), |v| v.visit_ty(ret_ty)) } _ => v.visit_ty(ret_ty), } @@ -406,7 +408,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { expr: Option<&'l ast::Expr>, ) { let hir_id = self.tcx.hir().node_id_to_hir_id(item.id); - self.nest_tables(item.id, |v| { + self.nest_tables(self.tcx.hir().local_def_id(hir_id), |v| { if let Some(var_data) = v.save_ctxt.get_item_data(item) { down_cast_data!(var_data, DefData, item.span); v.dumper.dump_def(&access_from!(v.save_ctxt, item, hir_id), var_data); @@ -426,15 +428,13 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { vis: ast::Visibility, attrs: &'l [Attribute], ) { - let qualname = format!( - "::{}", - self.tcx.def_path_str(self.tcx.hir().local_def_id_from_node_id(id).to_def_id()) - ); + let hir_id = self.tcx.hir().node_id_to_hir_id(id); + let qualname = + format!("::{}", self.tcx.def_path_str(self.tcx.hir().local_def_id(hir_id).to_def_id())); if !self.span.filter_generated(ident.span) { let sig = sig::assoc_const_signature(id, ident.name, typ, expr, &self.save_ctxt); let span = self.span_from_span(ident.span); - let hir_id = self.tcx.hir().node_id_to_hir_id(id); self.dumper.dump_def( &access_from_vis!(self.save_ctxt, vis, hir_id), @@ -456,7 +456,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { } // walk type and init value - self.nest_tables(id, |v| { + self.nest_tables(self.tcx.hir().local_def_id(hir_id), |v| { v.visit_ty(typ); if let Some(expr) = expr { v.visit_expr(expr); @@ -473,10 +473,9 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { ) { debug!("process_struct {:?} {:?}", item, item.span); let name = item.ident.to_string(); - let qualname = format!( - "::{}", - self.tcx.def_path_str(self.tcx.hir().local_def_id_from_node_id(item.id).to_def_id()) - ); + let hir_id = self.tcx.hir().node_id_to_hir_id(item.id); + let qualname = + format!("::{}", self.tcx.def_path_str(self.tcx.hir().local_def_id(hir_id).to_def_id())); let kind = match item.kind { ast::ItemKind::Struct(_, _) => DefKind::Struct, @@ -508,7 +507,6 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { if !self.span.filter_generated(item.ident.span) { let span = self.span_from_span(item.ident.span); - let hir_id = self.tcx.hir().node_id_to_hir_id(item.id); self.dumper.dump_def( &access_from!(self.save_ctxt, item, hir_id), Def { @@ -528,7 +526,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { ); } - self.nest_tables(item.id, |v| { + self.nest_tables(self.tcx.hir().local_def_id(hir_id), |v| { for field in def.fields() { v.process_struct_field_def(field, item.id); v.visit_ty(&field.ty); @@ -668,14 +666,15 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { } let map = &self.tcx.hir(); - self.nest_tables(item.id, |v| { + let hir_id = map.node_id_to_hir_id(item.id); + self.nest_tables(map.local_def_id(hir_id), |v| { v.visit_ty(&typ); if let &Some(ref trait_ref) = trait_ref { v.process_path(trait_ref.ref_id, &trait_ref.path); } v.process_generic_params(generics, "", item.id); for impl_item in impl_items { - v.process_impl_item(impl_item, map.local_def_id_from_node_id(item.id).to_def_id()); + v.process_impl_item(impl_item, map.local_def_id(hir_id).to_def_id()); } }); } @@ -1410,7 +1409,10 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> { } ast::TyKind::Array(ref element, ref length) => { self.visit_ty(element); - self.nest_tables(length.id, |v| v.visit_expr(&length.value)); + let hir_id = self.tcx.hir().node_id_to_hir_id(length.id); + self.nest_tables(self.tcx.hir().local_def_id(hir_id), |v| { + v.visit_expr(&length.value) + }); } ast::TyKind::ImplTrait(id, ref bounds) => { // FIXME: As of writing, the opaque type lowering introduces @@ -1422,7 +1424,13 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> { // bounds... // This will panic if called on return type `impl Trait`, which // we guard against in `process_fn`. - self.nest_tables(id, |v| v.process_bounds(bounds)); + // FIXME(#71104) Should really be using just `node_id_to_hir_id` but + // some `NodeId` do not seem to have a corresponding HirId. + if let Some(hir_id) = self.tcx.hir().opt_node_id_to_hir_id(id) { + self.nest_tables(self.tcx.hir().local_def_id(hir_id), |v| { + v.process_bounds(bounds) + }); + } } _ => visit::walk_ty(self, t), } @@ -1470,7 +1478,8 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> { } // walk the body - self.nest_tables(ex.id, |v| { + let hir_id = self.tcx.hir().node_id_to_hir_id(ex.id); + self.nest_tables(self.tcx.hir().local_def_id(hir_id), |v| { v.process_formals(&decl.inputs, &id); v.visit_expr(body) }); @@ -1487,7 +1496,10 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> { } ast::ExprKind::Repeat(ref element, ref count) => { self.visit_expr(element); - self.nest_tables(count.id, |v| v.visit_expr(&count.value)); + let hir_id = self.tcx.hir().node_id_to_hir_id(count.id); + self.nest_tables(self.tcx.hir().local_def_id(hir_id), |v| { + v.visit_expr(&count.value) + }); } // In particular, we take this branch for call and path expressions, // where we'll index the idents involved just by continuing to walk. diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index adbab3d4cb620..d95eb5f28fe1b 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -831,13 +831,6 @@ fn primary_body_of( } fn has_typeck_tables(tcx: TyCtxt<'_>, def_id: DefId) -> bool { - // FIXME(#71104) some `LocalDefId` do not seem to have a corresponding `HirId`. - if let Some(def_id) = def_id.as_local() { - if tcx.hir().opt_local_def_id_to_hir_id(def_id).is_none() { - return false; - } - } - // Closures' tables come from their outermost function, // as they are part of the same "inference environment". let outer_def_id = tcx.closure_base_def_id(def_id); From b6e4581937dff28f4534e393907124182fb791d0 Mon Sep 17 00:00:00 2001 From: Marko Mijalkovic Date: Sat, 9 May 2020 15:41:49 -0400 Subject: [PATCH 02/13] Add mipsel-sony-psp target --- src/librustc_target/spec/mipsel_sony_psp.rs | 59 ++++ .../spec/mipsel_sony_psp_linker_script.ld | 289 ++++++++++++++++++ src/librustc_target/spec/mod.rs | 2 + 3 files changed, 350 insertions(+) create mode 100644 src/librustc_target/spec/mipsel_sony_psp.rs create mode 100644 src/librustc_target/spec/mipsel_sony_psp_linker_script.ld diff --git a/src/librustc_target/spec/mipsel_sony_psp.rs b/src/librustc_target/spec/mipsel_sony_psp.rs new file mode 100644 index 0000000000000..d5765f01ba34a --- /dev/null +++ b/src/librustc_target/spec/mipsel_sony_psp.rs @@ -0,0 +1,59 @@ +use std::{io, fs, env, path::PathBuf}; +use crate::spec::{LinkerFlavor, LldFlavor, LinkArgs, RelocModel}; +use crate::spec::{Target, TargetOptions, TargetResult}; + +// The PSP has custom linker requirements. +const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld"); + +fn write_script() -> io::Result { + let path = env::temp_dir().join("rustc-mipsel-sony-psp-linkfile.ld"); + fs::write(&path, LINKER_SCRIPT)?; + Ok(path) +} + +pub fn target() -> TargetResult { + let script = write_script().map_err(|e| { + format!("failed to write link script: {}", e) + })?; + + let mut pre_link_args = LinkArgs::new(); + pre_link_args.insert( + LinkerFlavor::Lld(LldFlavor::Ld), + vec![ + "--eh-frame-hdr".to_string(), + "--emit-relocs".to_string(), + "--script".to_string(), + script.display().to_string(), + ], + ); + + Ok(Target { + llvm_target: "mipsel-sony-psp".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(), + arch: "mips".to_string(), + target_os: "psp".to_string(), + target_env: "".to_string(), + target_vendor: "sony".to_string(), + linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), + + options: TargetOptions { + cpu: "mips2".to_string(), + executables: true, + linker: Some("rust-lld".to_owned()), + relocation_model: RelocModel::Static, + + // PSP FPU only supports single precision floats. + features: "+single-float".to_string(), + + // PSP does not support trap-on-condition instructions. + llvm_args: vec![ + "-mno-check-zero-division".to_string(), + ], + pre_link_args, + ..Default::default() + }, + }) +} diff --git a/src/librustc_target/spec/mipsel_sony_psp_linker_script.ld b/src/librustc_target/spec/mipsel_sony_psp_linker_script.ld new file mode 100644 index 0000000000000..9dd38f5ce919c --- /dev/null +++ b/src/librustc_target/spec/mipsel_sony_psp_linker_script.ld @@ -0,0 +1,289 @@ +/* + * Copyright (c) 2005 adresd + * Copyright (c) 2005 Marcus R. Brown + * Copyright (c) 2005 James Forshaw + * Copyright (c) 2005 John Kelley + * Copyright (c) 2005 Jesper Svennevid + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The names of the authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +OUTPUT_ARCH(mips:allegrex) +ENTRY(module_start) +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + PROVIDE (__executable_start = 0x0); . = 0x0; + .interp : { *(.interp) } + .dynamic : { *(.dynamic) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } + .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + /* PSP-specific relocations. */ + .rel.sceStub.text : { *(.rel.sceStub.text) *(SORT(.rel.sceStub.text.*)) } + .rel.lib.ent.top : { *(.rel.lib.ent.top) } + .rel.lib.ent : { *(.rel.lib.ent) } + .rel.lib.ent.btm : { *(.rel.lib.ent.btm) } + .rel.lib.stub.top : { *(.rel.lib.stub.top) } + .rel.lib.stub : { *(.rel.lib.stub) } + .rel.lib.stub.btm : { *(.rel.lib.stub.btm) } + .rel.rodata.sceModuleInfo : { *(.rel.rodata.sceModuleInfo) } + .rel.rodata.sceResident : { *(.rel.rodata.sceResident) } + .rel.rodata.sceNid : { *(.rel.rodata.sceNid) *(SORT(.rel.rodata.sceNid.*)) } + .rel.rodata.sceVstub : { *(.rel.rodata.sceVstub) *(SORT(.rel.rodata.sceVstub.*)) } + .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } + .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } + .rel.data.rel.ro : { *(.rel.data.rel.ro*) } + .rela.data.rel.ro : { *(.rel.data.rel.ro*) } + .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } + .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } + .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } + .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } + .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } + .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } + .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } + .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } + .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } + .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } + .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } + .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } + .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } + .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } + .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + + /* Start the text section at 0x0 for PRX generation */ + . = 0; + + .text : + { + _ftext = . ; + *(.text .stub .text.* .gnu.linkonce.t.*) + KEEP (*(.text.*personality*)) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.mips16.fn.*) *(.mips16.call.*) + } =0 + .init : + { + KEEP (*(.init)) + } =0 + .plt : { *(.plt) } + .fini : + { + KEEP (*(.fini)) + } =0 + /* PSP library stub functions. */ + .sceStub.text : { *(.sceStub.text) *(SORT(.sceStub.text.*)) } + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + /* PSP library entry table and library stub table. */ + .lib.ent.top : { *(.lib.ent.top) } + .lib.ent : { *(.lib.ent) } + .lib.ent.btm : { *(.lib.ent.btm) } + .lib.stub.top : { *(.lib.stub.top) } + .lib.stub : { *(.lib.stub) } + .lib.stub.btm : { *(.lib.stub.btm) } + /* PSP read-only data for module info, NIDs, and Vstubs. The + .rodata.sceModuleInfo section must appear before the .rodata section + otherwise it would get absorbed into .rodata and the PSP bootloader + would be unable to locate the module info structure. */ + .rodata.sceModuleInfo : { *(.rodata.sceModuleInfo) } + .rodata.sceResident : { *(.rodata.sceResident) } + .rodata.sceNid : { KEEP(*(.rodata.sceNid)) KEEP(*(SORT(.rodata.sceNid.*))) } + .rodata.sceVstub : { *(.rodata.sceVstub) *(SORT(.rodata.sceVstub.*)) } + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata1 : { *(.rodata1) } + .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } + .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } + .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } + + /* Exception handling */ + .eh_frame_hdr : + { + KEEP(*(.eh_frame_hdr)) + } + + __eh_frame_hdr_start = SIZEOF(.eh_frame_hdr) > 0 ? ADDR(.eh_frame_hdr) : 0; + __eh_frame_hdr_end = SIZEOF(.eh_frame_hdr) > 0 ? . : 0; + + .eh_frame : + { + __eh_frame_start = .; + KEEP(*(.eh_frame)) + __eh_frame_end = .; + } + + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(256) + (. & (256 - 1)); + + .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } + /* Thread Local Storage sections */ + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } + /* Ensure the __preinit_array_start label is properly aligned. We + could instead move the label definition inside the section, but + the linker would then create the section even if it turns out to + be empty, which isn't pretty. */ + . = ALIGN(32 / 8); + PROVIDE (__preinit_array_start = .); + .preinit_array : { KEEP (*(.preinit_array)) } + PROVIDE (__preinit_array_end = .); + PROVIDE (__init_array_start = .); + .init_array : { KEEP (*(.init_array)) } + PROVIDE (__init_array_end = .); + PROVIDE (__fini_array_start = .); + .fini_array : { KEEP (*(.fini_array)) } + PROVIDE (__fini_array_end = .); + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin*.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + .dtors : + { + KEEP (*crtbegin*.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + .jcr : { KEEP (*(.jcr)) } + .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } + .data : + { + _fdata = . ; + *(.data .data.* .gnu.linkonce.d.*) + KEEP (*(.gnu.linkonce.d.*personality*)) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + . = .; + _gp = ALIGN(16) + 0x7ff0; + .got : { *(.got.plt) *(.got) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : + { + *(.sdata .sdata.* .gnu.linkonce.s.*) + } + .lit8 : { *(.lit8) } + .lit4 : { *(.lit4) } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + _fbss = .; + .sbss : + { + PROVIDE (__sbss_start = .); + PROVIDE (___sbss_start = .); + *(.dynsbss) + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + PROVIDE (__sbss_end = .); + PROVIDE (___sbss_end = .); + } + .bss : + { + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + } + . = ALIGN(32 / 8); + _end = .; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /DISCARD/ : { *(.comment) *(.pdr) } + /DISCARD/ : { *(.note.GNU-stack) } +} diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index 51dce9e144caa..dab1e51e3f872 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -582,6 +582,8 @@ supported_targets! { ("powerpc-wrs-vxworks", powerpc_wrs_vxworks), ("powerpc-wrs-vxworks-spe", powerpc_wrs_vxworks_spe), ("powerpc64-wrs-vxworks", powerpc64_wrs_vxworks), + + ("mipsel-sony-psp", mipsel_sony_psp), } /// Everything `rustc` knows about how to compile for a specific target. From 20a66913233589208934d155491c75157947e03e Mon Sep 17 00:00:00 2001 From: Marko Mijalkovic Date: Sat, 9 May 2020 16:03:40 -0400 Subject: [PATCH 03/13] Update stdarch --- src/stdarch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdarch b/src/stdarch index d10eefc62284c..ec6fccd34c300 160000 --- a/src/stdarch +++ b/src/stdarch @@ -1 +1 @@ -Subproject commit d10eefc62284c40c5a95a2eed19fc1f414a5364d +Subproject commit ec6fccd34c30003a7ebf4e7a9dfe4e31f5b76e1b From 8961b083762d3660ca21110836b547e8b3f19022 Mon Sep 17 00:00:00 2001 From: Marko Mijalkovic Date: Sat, 9 May 2020 16:39:45 -0400 Subject: [PATCH 04/13] Formatting --- src/librustc_target/spec/mipsel_sony_psp.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/librustc_target/spec/mipsel_sony_psp.rs b/src/librustc_target/spec/mipsel_sony_psp.rs index d5765f01ba34a..80c253b86bbd9 100644 --- a/src/librustc_target/spec/mipsel_sony_psp.rs +++ b/src/librustc_target/spec/mipsel_sony_psp.rs @@ -1,6 +1,6 @@ -use std::{io, fs, env, path::PathBuf}; -use crate::spec::{LinkerFlavor, LldFlavor, LinkArgs, RelocModel}; +use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, RelocModel}; use crate::spec::{Target, TargetOptions, TargetResult}; +use std::{env, fs, io, path::PathBuf}; // The PSP has custom linker requirements. const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld"); @@ -12,9 +12,7 @@ fn write_script() -> io::Result { } pub fn target() -> TargetResult { - let script = write_script().map_err(|e| { - format!("failed to write link script: {}", e) - })?; + let script = write_script().map_err(|e| format!("failed to write link script: {}", e))?; let mut pre_link_args = LinkArgs::new(); pre_link_args.insert( @@ -49,9 +47,7 @@ pub fn target() -> TargetResult { features: "+single-float".to_string(), // PSP does not support trap-on-condition instructions. - llvm_args: vec![ - "-mno-check-zero-division".to_string(), - ], + llvm_args: vec!["-mno-check-zero-division".to_string()], pre_link_args, ..Default::default() }, From 7e62240801cc5f7aa70300fb0f92f54370eabea6 Mon Sep 17 00:00:00 2001 From: Marko Mijalkovic Date: Sun, 10 May 2020 16:06:33 -0400 Subject: [PATCH 05/13] Add lld_link_script to TargetOptions --- src/librustc_codegen_ssa/back/link.rs | 31 +++++++++++++++++++++ src/librustc_target/spec/mipsel_sony_psp.rs | 17 ++--------- src/librustc_target/spec/mod.rs | 6 ++++ 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index 7a0e1e2c63887..ab59a1c5f4879 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -1179,6 +1179,34 @@ fn add_pre_link_args( cmd.args(&sess.opts.debugging_opts.pre_link_args); } +/// Add an LLD link script embedded in the target, if applicable. +fn add_lld_link_script( + cmd: &mut dyn Linker, + sess: &Session, + flavor: LinkerFlavor, + tmpdir: &Path, + crate_type: CrateType, +) { + match (flavor, crate_type, &sess.target.target.options.lld_link_script) { + ( + LinkerFlavor::Lld(LldFlavor::Ld), + CrateType::Cdylib | CrateType::Executable, + Some(script), + ) => { + let file_name = ["rustc", &sess.target.target.llvm_target, "linkfile.ld"].join("-"); + + let path = tmpdir.join(file_name); + if let Err(e) = fs::write(&path, script) { + sess.fatal(&format!("failed to write link script to {}: {}", path.display(), e)); + } + + cmd.arg("--script"); + cmd.arg(path); + } + _ => {} + } +} + /// Add arbitrary "user defined" args defined from command line and by `#[link_args]` attributes. /// FIXME: Determine where exactly these args need to be inserted. fn add_user_defined_link_args( @@ -1421,6 +1449,9 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>( // NO-OPT-OUT, OBJECT-FILES-MAYBE, CUSTOMIZATION-POINT add_pre_link_args(cmd, sess, flavor, crate_type); + // NO-OPT-OUT + add_lld_link_script(cmd, sess, flavor, tmpdir, crate_type); + // NO-OPT-OUT, OBJECT-FILES-NO, AUDIT-ORDER if sess.target.target.options.is_like_fuchsia { let prefix = match sess.opts.debugging_opts.sanitizer { diff --git a/src/librustc_target/spec/mipsel_sony_psp.rs b/src/librustc_target/spec/mipsel_sony_psp.rs index 80c253b86bbd9..eb38dee63b68f 100644 --- a/src/librustc_target/spec/mipsel_sony_psp.rs +++ b/src/librustc_target/spec/mipsel_sony_psp.rs @@ -1,28 +1,14 @@ use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, RelocModel}; use crate::spec::{Target, TargetOptions, TargetResult}; -use std::{env, fs, io, path::PathBuf}; // The PSP has custom linker requirements. const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld"); -fn write_script() -> io::Result { - let path = env::temp_dir().join("rustc-mipsel-sony-psp-linkfile.ld"); - fs::write(&path, LINKER_SCRIPT)?; - Ok(path) -} - pub fn target() -> TargetResult { - let script = write_script().map_err(|e| format!("failed to write link script: {}", e))?; - let mut pre_link_args = LinkArgs::new(); pre_link_args.insert( LinkerFlavor::Lld(LldFlavor::Ld), - vec![ - "--eh-frame-hdr".to_string(), - "--emit-relocs".to_string(), - "--script".to_string(), - script.display().to_string(), - ], + vec!["--eh-frame-hdr".to_string(), "--emit-relocs".to_string()], ); Ok(Target { @@ -49,6 +35,7 @@ pub fn target() -> TargetResult { // PSP does not support trap-on-condition instructions. llvm_args: vec!["-mno-check-zero-division".to_string()], pre_link_args, + lld_link_script: Some(LINKER_SCRIPT.to_string()), ..Default::default() }, }) diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index dab1e51e3f872..91dfa1550f626 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -668,6 +668,9 @@ pub struct TargetOptions { /// Linker arguments that are unconditionally passed *after* any /// user-defined libraries. pub post_link_args: LinkArgs, + /// Optional LLD link script applied to `dylib` and `executable` crate + /// types. This is a string containing the script, not a path. + pub lld_link_script: Option, /// Environment variables to be set for the linker invocation. pub link_env: Vec<(String, String)>, @@ -897,6 +900,7 @@ impl Default for TargetOptions { pre_link_args: LinkArgs::new(), pre_link_args_crt: LinkArgs::new(), post_link_args: LinkArgs::new(), + lld_link_script: None, asm_args: Vec::new(), cpu: "generic".to_string(), features: String::new(), @@ -1246,6 +1250,7 @@ impl Target { key!(post_link_objects, list); key!(post_link_objects_crt, list); key!(post_link_args, link_args); + key!(lld_link_script, optional); key!(link_env, env); key!(link_env_remove, list); key!(asm_args, list); @@ -1475,6 +1480,7 @@ impl ToJson for Target { target_option_val!(post_link_objects); target_option_val!(post_link_objects_crt); target_option_val!(link_args - post_link_args); + target_option_val!(lld_link_script); target_option_val!(env - link_env); target_option_val!(link_env_remove); target_option_val!(asm_args); From 7b649c7364f5128da33c34573a158477df030b70 Mon Sep 17 00:00:00 2001 From: Marko Mijalkovic Date: Sun, 10 May 2020 17:39:57 -0400 Subject: [PATCH 06/13] Renamed lld_link_script to link_script and support all GNU-like linkers --- src/librustc_codegen_ssa/back/link.rs | 19 +++++++++---------- src/librustc_target/spec/mipsel_sony_psp.rs | 3 ++- src/librustc_target/spec/mod.rs | 13 +++++++------ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index ab59a1c5f4879..dca9f12df09b3 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -1179,20 +1179,19 @@ fn add_pre_link_args( cmd.args(&sess.opts.debugging_opts.pre_link_args); } -/// Add an LLD link script embedded in the target, if applicable. -fn add_lld_link_script( +/// Add a link script embedded in the target, if applicable. +fn add_link_script( cmd: &mut dyn Linker, sess: &Session, - flavor: LinkerFlavor, tmpdir: &Path, crate_type: CrateType, ) { - match (flavor, crate_type, &sess.target.target.options.lld_link_script) { - ( - LinkerFlavor::Lld(LldFlavor::Ld), - CrateType::Cdylib | CrateType::Executable, - Some(script), - ) => { + match (crate_type, &sess.target.target.options.link_script) { + (CrateType::Cdylib | CrateType::Executable, Some(script)) => { + if !sess.target.target.options.linker_is_gnu { + sess.fatal("can only use link script when linking with GNU-like linker"); + } + let file_name = ["rustc", &sess.target.target.llvm_target, "linkfile.ld"].join("-"); let path = tmpdir.join(file_name); @@ -1450,7 +1449,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>( add_pre_link_args(cmd, sess, flavor, crate_type); // NO-OPT-OUT - add_lld_link_script(cmd, sess, flavor, tmpdir, crate_type); + add_link_script(cmd, sess, tmpdir, crate_type); // NO-OPT-OUT, OBJECT-FILES-NO, AUDIT-ORDER if sess.target.target.options.is_like_fuchsia { diff --git a/src/librustc_target/spec/mipsel_sony_psp.rs b/src/librustc_target/spec/mipsel_sony_psp.rs index eb38dee63b68f..0c74454d0c5fe 100644 --- a/src/librustc_target/spec/mipsel_sony_psp.rs +++ b/src/librustc_target/spec/mipsel_sony_psp.rs @@ -27,6 +27,7 @@ pub fn target() -> TargetResult { cpu: "mips2".to_string(), executables: true, linker: Some("rust-lld".to_owned()), + linker_is_gnu: true, relocation_model: RelocModel::Static, // PSP FPU only supports single precision floats. @@ -35,7 +36,7 @@ pub fn target() -> TargetResult { // PSP does not support trap-on-condition instructions. llvm_args: vec!["-mno-check-zero-division".to_string()], pre_link_args, - lld_link_script: Some(LINKER_SCRIPT.to_string()), + link_script: Some(LINKER_SCRIPT.to_string()), ..Default::default() }, }) diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index 91dfa1550f626..00088a0d0404a 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -668,9 +668,10 @@ pub struct TargetOptions { /// Linker arguments that are unconditionally passed *after* any /// user-defined libraries. pub post_link_args: LinkArgs, - /// Optional LLD link script applied to `dylib` and `executable` crate - /// types. This is a string containing the script, not a path. - pub lld_link_script: Option, + /// Optional link script applied to `dylib` and `executable` crate types. + /// This is a string containing the script, not a path. Can only be applied + /// to linkers where `linker_is_gnu` is true. + pub link_script: Option, /// Environment variables to be set for the linker invocation. pub link_env: Vec<(String, String)>, @@ -900,7 +901,7 @@ impl Default for TargetOptions { pre_link_args: LinkArgs::new(), pre_link_args_crt: LinkArgs::new(), post_link_args: LinkArgs::new(), - lld_link_script: None, + link_script: None, asm_args: Vec::new(), cpu: "generic".to_string(), features: String::new(), @@ -1250,7 +1251,7 @@ impl Target { key!(post_link_objects, list); key!(post_link_objects_crt, list); key!(post_link_args, link_args); - key!(lld_link_script, optional); + key!(link_script, optional); key!(link_env, env); key!(link_env_remove, list); key!(asm_args, list); @@ -1480,7 +1481,7 @@ impl ToJson for Target { target_option_val!(post_link_objects); target_option_val!(post_link_objects_crt); target_option_val!(link_args - post_link_args); - target_option_val!(lld_link_script); + target_option_val!(link_script); target_option_val!(env - link_env); target_option_val!(link_env_remove); target_option_val!(asm_args); From 744449433004fbdc3d0d665551e59ca2880f0552 Mon Sep 17 00:00:00 2001 From: Marko Mijalkovic Date: Sun, 10 May 2020 17:53:04 -0400 Subject: [PATCH 07/13] Run rustfmt --- src/librustc_codegen_ssa/back/link.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index dca9f12df09b3..ca2d1b0488da6 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -1180,12 +1180,7 @@ fn add_pre_link_args( } /// Add a link script embedded in the target, if applicable. -fn add_link_script( - cmd: &mut dyn Linker, - sess: &Session, - tmpdir: &Path, - crate_type: CrateType, -) { +fn add_link_script(cmd: &mut dyn Linker, sess: &Session, tmpdir: &Path, crate_type: CrateType) { match (crate_type, &sess.target.target.options.link_script) { (CrateType::Cdylib | CrateType::Executable, Some(script)) => { if !sess.target.target.options.linker_is_gnu { From 6c415450fd2e33ec7056805b97475d7ea73eb04c Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Tue, 12 May 2020 13:00:10 -0400 Subject: [PATCH 08/13] Provide separate option for std debug asserts --- config.toml.example | 4 ++++ src/bootstrap/builder.rs | 9 ++++++++- src/bootstrap/config.rs | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/config.toml.example b/config.toml.example index e32beb1c61192..f76ccac8953fc 100644 --- a/config.toml.example +++ b/config.toml.example @@ -314,6 +314,10 @@ # library. #debug-assertions = false +# Whether or not debug assertions are enabled for the standard library. +# Overrides the `debug-assertions` option, if defined. +#debug-assertions-std = false + # Debuginfo level for most of Rust code, corresponds to the `-C debuginfo=N` option of `rustc`. # `0` - no debug info # `1` - line tables only diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index b0e06731330a1..731382e4f75b0 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -916,7 +916,14 @@ impl<'a> Builder<'a> { .env("RUSTC", self.out.join("bootstrap/debug/rustc")) .env("RUSTC_REAL", self.rustc(compiler)) .env("RUSTC_STAGE", stage.to_string()) - .env("RUSTC_DEBUG_ASSERTIONS", self.config.rust_debug_assertions.to_string()) + .env( + "RUSTC_DEBUG_ASSERTIONS", + if mode == Mode::Std { + self.config.rust_debug_assertions_std.to_string() + } else { + self.config.rust_debug_assertions.to_string() + }, + ) .env("RUSTC_SYSROOT", &sysroot) .env("RUSTC_LIBDIR", &libdir) .env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc")) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 390630ee51b8d..ef822dd3e5f6f 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -98,6 +98,7 @@ pub struct Config { pub rust_codegen_units: Option, pub rust_codegen_units_std: Option, pub rust_debug_assertions: bool, + pub rust_debug_assertions_std: bool, pub rust_debuginfo_level_rustc: u32, pub rust_debuginfo_level_std: u32, pub rust_debuginfo_level_tools: u32, @@ -315,6 +316,7 @@ struct Rust { codegen_units: Option, codegen_units_std: Option, debug_assertions: Option, + debug_assertions_std: Option, debuginfo_level: Option, debuginfo_level_rustc: Option, debuginfo_level_std: Option, @@ -520,6 +522,7 @@ impl Config { let mut llvm_assertions = None; let mut debug = None; let mut debug_assertions = None; + let mut debug_assertions_std = None; let mut debuginfo_level = None; let mut debuginfo_level_rustc = None; let mut debuginfo_level_std = None; @@ -562,6 +565,7 @@ impl Config { if let Some(ref rust) = toml.rust { debug = rust.debug; debug_assertions = rust.debug_assertions; + debug_assertions_std = rust.debug_assertions_std; debuginfo_level = rust.debuginfo_level; debuginfo_level_rustc = rust.debuginfo_level_rustc; debuginfo_level_std = rust.debuginfo_level_std; @@ -661,6 +665,8 @@ impl Config { let default = debug == Some(true); config.rust_debug_assertions = debug_assertions.unwrap_or(default); + config.rust_debug_assertions_std = + debug_assertions_std.unwrap_or(config.rust_debug_assertions); let with_defaults = |debuginfo_level_specific: Option| { debuginfo_level_specific.or(debuginfo_level).unwrap_or(if debug == Some(true) { From 2b42a2b541e04164428e83a4adfc4c120a482f82 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Wed, 13 May 2020 11:32:43 -0400 Subject: [PATCH 09/13] Forbid stage arguments to check Users generally expect that check builds are fast, and that's only true in stage 0 (stages beyond that need us to build a compiler, which is slow). --- src/bootstrap/flags.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index fb380af0a47e7..646b9e05d99c3 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -503,6 +503,20 @@ Arguments: } }; + if let Subcommand::Check { .. } = &cmd { + if matches.opt_str("stage").is_some() { + println!("{}", "--stage not supported for x.py check, always treated as stage 0"); + process::exit(1); + } + if matches.opt_str("keep-stage").is_some() { + println!( + "{}", + "--keep-stage not supported for x.py check, only one stage available" + ); + process::exit(1); + } + } + Flags { verbose: matches.opt_count("verbose"), stage: matches.opt_str("stage").map(|j| j.parse().expect("`stage` should be a number")), From 617c7cd9fa9751375abbf1a43cfe29ffc19ee92b Mon Sep 17 00:00:00 2001 From: Tymoteusz Jankowski Date: Wed, 13 May 2020 16:54:16 +0200 Subject: [PATCH 10/13] Make intra links work inside trait impl block --- .../passes/collect_intra_doc_links.rs | 66 +++++++++++++++---- src/test/rustdoc/intra-link-trait-impl.rs | 35 ++++++++++ 2 files changed, 90 insertions(+), 11 deletions(-) create mode 100644 src/test/rustdoc/intra-link-trait-impl.rs diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index fbdb538cd874c..a3ef350a0487e 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -12,7 +12,8 @@ use rustc_hir::def_id::DefId; use rustc_middle::ty; use rustc_resolve::ParentScope; use rustc_session::lint; -use rustc_span::symbol::{Ident, Symbol}; +use rustc_span::symbol::Ident; +use rustc_span::symbol::Symbol; use rustc_span::DUMMY_SP; use std::ops::Range; @@ -130,6 +131,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { current_item: &Option, parent_id: Option, extra_fragment: &Option, + item_opt: Option<&Item>, ) -> Result<(Res, Option), ErrorKind> { let cx = self.cx; @@ -230,16 +232,44 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { DefKind::Struct | DefKind::Union | DefKind::Enum | DefKind::TyAlias, did, ) => { - let item = cx - .tcx - .inherent_impls(did) - .iter() - .flat_map(|imp| cx.tcx.associated_items(*imp).in_definition_order()) - .find(|item| item.ident.name == item_name); + // We need item's parent to know if it's + // trait impl or struct/enum/etc impl + let item_parent = item_opt + .and_then(|item| self.cx.as_local_hir_id(item.def_id)) + .and_then(|item_hir| { + let parent_hir = self.cx.tcx.hir().get_parent_item(item_hir); + self.cx.tcx.hir().find(parent_hir) + }); + let item = match item_parent { + Some(hir::Node::Item(hir::Item { + kind: hir::ItemKind::Impl { of_trait: Some(_), self_ty, .. }, + .. + })) => { + // trait impl + cx.tcx + .associated_item_def_ids(self_ty.hir_id.owner) + .iter() + .map(|child| { + let associated_item = cx.tcx.associated_item(*child); + associated_item + }) + .find(|child| child.ident.name == item_name) + } + _ => { + // struct/enum/etc. impl + cx.tcx + .inherent_impls(did) + .iter() + .flat_map(|imp| cx.tcx.associated_items(*imp).in_definition_order()) + .find(|item| item.ident.name == item_name) + } + }; + if let Some(item) = item { let out = match item.kind { ty::AssocKind::Fn if ns == ValueNS => "method", ty::AssocKind::Const if ns == ValueNS => "associatedconstant", + ty::AssocKind::Type if ns == ValueNS => "associatedtype", _ => return self.variant_field(path_str, current_item, module_id), }; if extra_fragment.is_some() { @@ -484,8 +514,14 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> { match kind { Some(ns @ ValueNS) => { - match self.resolve(path_str, ns, ¤t_item, base_node, &extra_fragment) - { + match self.resolve( + path_str, + ns, + ¤t_item, + base_node, + &extra_fragment, + None, + ) { Ok(res) => res, Err(ErrorKind::ResolutionFailure) => { resolution_failure(cx, &item, path_str, &dox, link_range); @@ -501,8 +537,14 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> { } } Some(ns @ TypeNS) => { - match self.resolve(path_str, ns, ¤t_item, base_node, &extra_fragment) - { + match self.resolve( + path_str, + ns, + ¤t_item, + base_node, + &extra_fragment, + None, + ) { Ok(res) => res, Err(ErrorKind::ResolutionFailure) => { resolution_failure(cx, &item, path_str, &dox, link_range); @@ -526,6 +568,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> { ¤t_item, base_node, &extra_fragment, + None, ) { Err(ErrorKind::AnchorFailure(msg)) => { anchor_failure(cx, &item, &ori_link, &dox, link_range, msg); @@ -539,6 +582,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> { ¤t_item, base_node, &extra_fragment, + Some(&item), ) { Err(ErrorKind::AnchorFailure(msg)) => { anchor_failure(cx, &item, &ori_link, &dox, link_range, msg); diff --git a/src/test/rustdoc/intra-link-trait-impl.rs b/src/test/rustdoc/intra-link-trait-impl.rs new file mode 100644 index 0000000000000..fab8406d525e5 --- /dev/null +++ b/src/test/rustdoc/intra-link-trait-impl.rs @@ -0,0 +1,35 @@ +#![crate_name = "foo"] + +// ignore-tidy-linelength + +pub struct MyStruct; + +impl MyTrait for MyStruct { + +// @has foo/struct.MyStruct.html '//a/@href' '../foo/struct.MyStruct.html#associatedtype.AssoType' + + /// [`AssoType`] + /// + /// [`AssoType`]: MyStruct::AssoType + type AssoType = u32; + +// @has foo/struct.MyStruct.html '//a/@href' '../foo/struct.MyStruct.html#associatedconstant.ASSO_CONST' + + /// [`ASSO_CONST`] + /// + /// [`ASSO_CONST`]: MyStruct::ASSO_CONST + const ASSO_CONST: i32 = 10; + +// @has foo/struct.MyStruct.html '//a/@href' '../foo/struct.MyStruct.html#method.trait_fn' + + /// [`trait_fn`] + /// + /// [`trait_fn`]: MyStruct::trait_fn + fn trait_fn() { } +} + +pub trait MyTrait { + type AssoType; + const ASSO_CONST: i32 = 1; + fn trait_fn(); +} From 425723f5b384ba75af4b9a6b4e0186f8bf2e99a3 Mon Sep 17 00:00:00 2001 From: Marko Mijalkovic Date: Thu, 14 May 2020 06:19:36 -0400 Subject: [PATCH 11/13] Rewrite link script from scratch This absolves previous licensing issues. --- .../spec/mipsel_sony_psp_linker_script.ld | 297 ++---------------- 1 file changed, 21 insertions(+), 276 deletions(-) diff --git a/src/librustc_target/spec/mipsel_sony_psp_linker_script.ld b/src/librustc_target/spec/mipsel_sony_psp_linker_script.ld index 9dd38f5ce919c..1bd436d6f94cc 100644 --- a/src/librustc_target/spec/mipsel_sony_psp_linker_script.ld +++ b/src/librustc_target/spec/mipsel_sony_psp_linker_script.ld @@ -1,151 +1,24 @@ -/* - * Copyright (c) 2005 adresd - * Copyright (c) 2005 Marcus R. Brown - * Copyright (c) 2005 James Forshaw - * Copyright (c) 2005 John Kelley - * Copyright (c) 2005 Jesper Svennevid - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The names of the authors may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -OUTPUT_ARCH(mips:allegrex) ENTRY(module_start) SECTIONS { - /* Read-only sections, merged into text segment: */ - PROVIDE (__executable_start = 0x0); . = 0x0; - .interp : { *(.interp) } - .dynamic : { *(.dynamic) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } - .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - /* PSP-specific relocations. */ - .rel.sceStub.text : { *(.rel.sceStub.text) *(SORT(.rel.sceStub.text.*)) } - .rel.lib.ent.top : { *(.rel.lib.ent.top) } - .rel.lib.ent : { *(.rel.lib.ent) } - .rel.lib.ent.btm : { *(.rel.lib.ent.btm) } - .rel.lib.stub.top : { *(.rel.lib.stub.top) } - .rel.lib.stub : { *(.rel.lib.stub) } - .rel.lib.stub.btm : { *(.rel.lib.stub.btm) } - .rel.rodata.sceModuleInfo : { *(.rel.rodata.sceModuleInfo) } - .rel.rodata.sceResident : { *(.rel.rodata.sceResident) } - .rel.rodata.sceNid : { *(.rel.rodata.sceNid) *(SORT(.rel.rodata.sceNid.*)) } - .rel.rodata.sceVstub : { *(.rel.rodata.sceVstub) *(SORT(.rel.rodata.sceVstub.*)) } - .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } - .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } - .rel.data.rel.ro : { *(.rel.data.rel.ro*) } - .rela.data.rel.ro : { *(.rel.data.rel.ro*) } - .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } - .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } - .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } - .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } - .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } - .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } - .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } - .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } - .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } - .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } - .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } - .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } - .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } - .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } - .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - - /* Start the text section at 0x0 for PRX generation */ - . = 0; - - .text : - { - _ftext = . ; - *(.text .stub .text.* .gnu.linkonce.t.*) - KEEP (*(.text.*personality*)) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.mips16.fn.*) *(.mips16.call.*) - } =0 - .init : - { - KEEP (*(.init)) - } =0 - .plt : { *(.plt) } - .fini : - { - KEEP (*(.fini)) - } =0 - /* PSP library stub functions. */ - .sceStub.text : { *(.sceStub.text) *(SORT(.sceStub.text.*)) } - PROVIDE (__etext = .); - PROVIDE (_etext = .); - PROVIDE (etext = .); - /* PSP library entry table and library stub table. */ - .lib.ent.top : { *(.lib.ent.top) } - .lib.ent : { *(.lib.ent) } - .lib.ent.btm : { *(.lib.ent.btm) } - .lib.stub.top : { *(.lib.stub.top) } - .lib.stub : { *(.lib.stub) } - .lib.stub.btm : { *(.lib.stub.btm) } - /* PSP read-only data for module info, NIDs, and Vstubs. The - .rodata.sceModuleInfo section must appear before the .rodata section - otherwise it would get absorbed into .rodata and the PSP bootloader - would be unable to locate the module info structure. */ - .rodata.sceModuleInfo : { *(.rodata.sceModuleInfo) } - .rodata.sceResident : { *(.rodata.sceResident) } - .rodata.sceNid : { KEEP(*(.rodata.sceNid)) KEEP(*(SORT(.rodata.sceNid.*))) } - .rodata.sceVstub : { *(.rodata.sceVstub) *(SORT(.rodata.sceVstub.*)) } - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - .rodata1 : { *(.rodata1) } - .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } - .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } - .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } - - /* Exception handling */ - .eh_frame_hdr : - { - KEEP(*(.eh_frame_hdr)) - } - + /* PRX format requires text to begin at 0 */ + .text 0 : { *(.text .text.*) } + + /* Sort stubs for convenient ordering */ + .sceStub.text : { *(.sceStub.text) *(SORT(.sceStub.text.*)) } + + /* Keep these sections around, even though they may appear unused to the linker */ + .lib.ent.top : { KEEP(*(.lib.ent.top)) } + .lib.ent : { KEEP(*(.lib.ent)) } + .lib.ent.btm : { KEEP(*(.lib.ent.btm)) } + .lib.stub.top : { KEEP(*(.lib.stub.top)) } + .lib.stub : { KEEP(*(.lib.stub)) } + .lib.stub.btm : { KEEP(*(.lib.stub.btm)) } + .eh_frame_hdr : { KEEP(*(.eh_frame_hdr)) } + + /* Add symbols for LLVM's libunwind */ __eh_frame_hdr_start = SIZEOF(.eh_frame_hdr) > 0 ? ADDR(.eh_frame_hdr) : 0; __eh_frame_hdr_end = SIZEOF(.eh_frame_hdr) > 0 ? . : 0; - .eh_frame : { __eh_frame_start = .; @@ -153,137 +26,9 @@ SECTIONS __eh_frame_end = .; } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = ALIGN(256) + (. & (256 - 1)); - - .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } - /* Thread Local Storage sections */ - .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } - .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } - /* Ensure the __preinit_array_start label is properly aligned. We - could instead move the label definition inside the section, but - the linker would then create the section even if it turns out to - be empty, which isn't pretty. */ - . = ALIGN(32 / 8); - PROVIDE (__preinit_array_start = .); - .preinit_array : { KEEP (*(.preinit_array)) } - PROVIDE (__preinit_array_end = .); - PROVIDE (__init_array_start = .); - .init_array : { KEEP (*(.init_array)) } - PROVIDE (__init_array_end = .); - PROVIDE (__fini_array_start = .); - .fini_array : { KEEP (*(.fini_array)) } - PROVIDE (__fini_array_end = .); - .ctors : - { - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin*.o(.ctors)) - /* We don't want to include the .ctor section from - from the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - } - .dtors : - { - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - } - .jcr : { KEEP (*(.jcr)) } - .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } - .data : - { - _fdata = . ; - *(.data .data.* .gnu.linkonce.d.*) - KEEP (*(.gnu.linkonce.d.*personality*)) - SORT(CONSTRUCTORS) - } - .data1 : { *(.data1) } - . = .; - _gp = ALIGN(16) + 0x7ff0; - .got : { *(.got.plt) *(.got) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : - { - *(.sdata .sdata.* .gnu.linkonce.s.*) - } - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - _fbss = .; - .sbss : - { - PROVIDE (__sbss_start = .); - PROVIDE (___sbss_start = .); - *(.dynsbss) - *(.sbss .sbss.* .gnu.linkonce.sb.*) - *(.scommon) - PROVIDE (__sbss_end = .); - PROVIDE (___sbss_end = .); - } - .bss : - { - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. */ - . = ALIGN(32 / 8); - } - . = ALIGN(32 / 8); - _end = .; - PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /DISCARD/ : { *(.comment) *(.pdr) } - /DISCARD/ : { *(.note.GNU-stack) } + /* These are explicitly listed to avoid being merged into .rodata */ + .rodata.sceResident : { *(.rodata.sceResident) } + .rodata.sceModuleInfo : { *(.rodata.sceModuleInfo) } + /* Sort NIDs for convenient ordering */ + .rodata.sceNid : { *(.rodata.sceNid) *(SORT(.rodata.sceNid.*)) } } From c919a6ea09108d3c45bcfb9e95c6289a04606f53 Mon Sep 17 00:00:00 2001 From: JOE1994 Date: Thu, 14 May 2020 16:39:36 -0400 Subject: [PATCH 12/13] Minor fixes to comments * In 'src/librustc_ast_passes/node_count.rs' * typo fix ('rought' -> 'rough') * In 'src/librustc_middle/middle/region.rs', * fixed broken link to 'rustc-dev-guide' * typo fix ('aluded' -> 'alluded') Thank you for reviewing this PR :) --- src/librustc_ast_passes/node_count.rs | 2 +- src/librustc_middle/middle/region.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_ast_passes/node_count.rs b/src/librustc_ast_passes/node_count.rs index 3cf562b927e2e..34db59b1b458d 100644 --- a/src/librustc_ast_passes/node_count.rs +++ b/src/librustc_ast_passes/node_count.rs @@ -1,4 +1,4 @@ -// Simply gives a rought count of the number of nodes in an AST. +// Simply gives a rough count of the number of nodes in an AST. use rustc_ast::ast::*; use rustc_ast::visit::*; diff --git a/src/librustc_middle/middle/region.rs b/src/librustc_middle/middle/region.rs index c3eeea7662ba9..f02d8fe8ad601 100644 --- a/src/librustc_middle/middle/region.rs +++ b/src/librustc_middle/middle/region.rs @@ -4,7 +4,7 @@ //! For more information about how MIR-based region-checking works, //! see the [rustc dev guide]. //! -//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/mir/borrowck.html +//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/borrow_check.html use crate::ich::{NodeIdHashingMode, StableHashingContext}; use crate::ty::{self, DefIdTree, TyCtxt}; @@ -181,7 +181,7 @@ impl Scope { // `blk`; reuse span of `blk` and shift `lo` // forward to end of indexed statement. // - // (This is the special case aluded to in the + // (This is the special case alluded to in the // doc-comment for this method) let stmt_span = blk.stmts[first_statement_index.index()].span; From 00d42bbd2aa6222dc62177ebcecefd76ca977b9b Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 14 May 2020 13:03:33 -0300 Subject: [PATCH 13/13] Add prioritize_on attribute to triagebot --- triagebot.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/triagebot.toml b/triagebot.toml index 56d29994a8df4..2210a8ff8e656 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -36,4 +36,6 @@ label = "ICEBreaker-Cleanup-Crew" [prioritize] label = "I-prioritize" +prioritize_on = ["regression-from-stable-to-stable", "regression-from-stable-to-beta", "regression-from-stable-to-nightly"] +priority_labels = "P-*" zulip_stream = 227806