rustc: doc comments

This commit is contained in:
Alexander Regueiro 2019-02-08 14:53:55 +01:00
parent 0b7af2668a
commit c3e182cf43
343 changed files with 2260 additions and 2241 deletions

View file

@ -174,13 +174,13 @@ pub trait ArgTypeExt<'ll, 'tcx> {
}
impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
/// Get the LLVM type for a place of the original Rust type of
/// Gets the LLVM type for a place of the original Rust type of
/// this argument/return, i.e., the result of `type_of::type_of`.
fn memory_ty(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type {
self.layout.llvm_type(cx)
}
/// Store a direct/indirect value described by this ArgType into a
/// Stores a direct/indirect value described by this ArgType into a
/// place for the original Rust type of this argument/return.
/// Can be used for both storing formal arguments into Rust variables
/// or results of call/invoke instructions into their destinations.

View file

@ -51,7 +51,7 @@ fn is_relevant_child(c: &Child) -> bool {
}
impl<'a> ArchiveBuilder<'a> {
/// Create a new static archive, ready for modifying the archive specified
/// Creates a new static archive, ready for modifying the archive specified
/// by `config`.
pub fn new(config: ArchiveConfig<'a>) -> ArchiveBuilder<'a> {
ArchiveBuilder {

View file

@ -42,7 +42,7 @@ pub use rustc_codegen_utils::link::{find_crate_name, filename_for_input, default
out_filename, check_file_is_writeable};
/// Perform the linkage portion of the compilation phase. This will generate all
/// Performs the linkage portion of the compilation phase. This will generate all
/// of the requested outputs for this compilation session.
pub(crate) fn link_binary(sess: &Session,
codegen_results: &CodegenResults,

View file

@ -791,7 +791,7 @@ impl ThinLTOImports {
self.imports.get(llvm_module_name).map(|v| &v[..]).unwrap_or(&[])
}
/// Load the ThinLTO import map from ThinLTOData.
/// Loads the ThinLTO import map from ThinLTOData.
unsafe fn from_thin_lto_data(data: *const llvm::ThinLTOData) -> ThinLTOImports {
unsafe extern "C" fn imported_module_callback(payload: *mut libc::c_void,
importing_module_name: *const libc::c_char,

View file

@ -112,7 +112,7 @@ pub fn rewrite_imports(path: &Path, import_map: &FxHashMap<String, String>) {
}
}
/// Add or augment the existing `producers` section to encode information about
/// Adds or augment the existing `producers` section to encode information about
/// the Rust compiler used to produce the wasm file.
pub fn add_producer_section(
path: &Path,

View file

@ -7,11 +7,11 @@
//!
//! Hopefully useful general knowledge about codegen:
//!
//! * There's no way to find out the Ty type of a Value. Doing so
//! would be "trying to get the eggs out of an omelette" (credit:
//! pcwalton). You can, instead, find out its llvm::Type by calling val_ty,
//! but one llvm::Type corresponds to many `Ty`s; for instance, tup(int, int,
//! int) and rec(x=int, y=int, z=int) will have the same llvm::Type.
//! * There's no way to find out the `Ty` type of a Value. Doing so
//! would be "trying to get the eggs out of an omelette" (credit:
//! pcwalton). You can, instead, find out its `llvm::Type` by calling `val_ty`,
//! but one `llvm::Type` corresponds to many `Ty`s; for instance, `tup(int, int,
//! int)` and `rec(x=int, y=int, z=int)` will have the same `llvm::Type`.
use super::ModuleLlvm;
use rustc_codegen_ssa::{ModuleCodegen, ModuleKind};

View file

@ -1,6 +1,6 @@
//! Handles codegen of callees as well as other call-related
//! things. Callees are a superset of normal rust values and sometimes
//! have different representations. In particular, top-level fn items
//! things. Callees are a superset of normal rust values and sometimes
//! have different representations. In particular, top-level fn items
//! and methods are represented as just a fn ptr and not a full
//! closure.

View file

@ -75,7 +75,7 @@ pub struct CodegenCx<'ll, 'tcx: 'll> {
pub statics_to_rauw: RefCell<Vec<(&'ll Value, &'ll Value)>>,
/// Statics that will be placed in the llvm.used variable
/// See http://llvm.org/docs/LangRef.html#the-llvm-used-global-variable for details
/// See <http://llvm.org/docs/LangRef.html#the-llvm-used-global-variable> for details
pub used_statics: RefCell<Vec<&'ll Value>>,
pub lltypes: RefCell<FxHashMap<(Ty<'tcx>, Option<VariantIdx>), &'ll Type>>,
@ -807,7 +807,7 @@ impl CodegenCx<'b, 'tcx> {
}
impl<'b, 'tcx> CodegenCx<'b, 'tcx> {
/// Generate a new symbol name with the given prefix. This symbol name must
/// Generates a new symbol name with the given prefix. This symbol name must
/// only be used for definitions with `internal` or `private` linkage.
pub fn generate_local_symbol_name(&self, prefix: &str) -> String {
let idx = self.local_gen_sym_counter.get();

View file

@ -16,7 +16,7 @@ use rustc_data_structures::indexed_vec::{Idx, IndexVec};
use syntax_pos::BytePos;
/// Produce DIScope DIEs for each MIR Scope which has variables defined in it.
/// Produces DIScope DIEs for each MIR Scope which has variables defined in it.
/// If debuginfo is disabled, the returned vector is empty.
pub fn create_mir_scopes(
cx: &CodegenCx<'ll, '_>,

View file

@ -160,7 +160,7 @@
//!
//! This algorithm also provides a stable ID for types that are defined in one
//! crate but instantiated from metadata within another crate. We just have to
//! take care to always map crate and node IDs back to the original crate
//! take care to always map crate and `NodeId`s back to the original crate
//! context.
//!
//! As a side-effect these unique type IDs also help to solve a problem arising
@ -170,7 +170,7 @@
//! with different concrete substitutions for `'a`, and thus there will be N
//! `Ty` instances for the type `Struct<'a>` even though it is not generic
//! otherwise. Unfortunately this means that we cannot use `ty::type_id()` as
//! cheap identifier for type metadata---we have done this in the past, but it
//! cheap identifier for type metadata -- we have done this in the past, but it
//! led to unnecessary metadata duplication in the best case and LLVM
//! assertions in the worst. However, the unique type ID as described above
//! *can* be used as identifier. Since it is comparatively expensive to

View file

@ -102,7 +102,7 @@ impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> {
}
}
/// Create any deferred debug metadata nodes
/// Creates any deferred debug metadata nodes
pub fn finalize(cx: &CodegenCx) {
if cx.dbg_cx.is_none() {
return;

View file

@ -36,7 +36,7 @@ pub fn create_DIArray(
};
}
/// Return syntax_pos::Loc corresponding to the beginning of the span
/// Returns syntax_pos::Loc corresponding to the beginning of the span
pub fn span_start(cx: &CodegenCx, span: Span) -> syntax_pos::Loc {
cx.sess().source_map().lookup_char_pos(span.lo())
}

View file

@ -1337,7 +1337,7 @@ extern "C" {
pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>;
/// Destroys a section iterator.
pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>);
/// Returns true if the section iterator is at the end of the section
/// Returns `true` if the section iterator is at the end of the section
/// list:
pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool;
/// Moves the section iterator to point to the next section.

View file

@ -226,7 +226,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> {
}
}
/// Get the LLVM type corresponding to a Rust type, i.e., `rustc::ty::Ty`.
/// Gets the LLVM type corresponding to a Rust type, i.e., `rustc::ty::Ty`.
/// The pointee type of the pointer in `PlaceRef` is always this type.
/// For sized types, it is also the right LLVM type for an `alloca`
/// containing a value of that type, and most immediates (except `bool`).