From ffae5deaa77dcb9ca5e18adcd12d465a90b4c089 Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Mon, 17 Jul 2017 22:29:09 +0200 Subject: [PATCH 01/12] configure: allow distros to disable debuginfo-only-std --- configure | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index e08bcc028272e..e3ad7ce85f8cc 100755 --- a/configure +++ b/configure @@ -560,8 +560,8 @@ case "$CFG_RELEASE_CHANNEL" in *-pc-windows-gnu) ;; *) - CFG_ENABLE_DEBUGINFO_LINES=1 - CFG_ENABLE_DEBUGINFO_ONLY_STD=1 + enable_if_not_disabled debuginfo-lines + enable_if_not_disabled debuginfo-only-std ;; esac @@ -572,8 +572,8 @@ case "$CFG_RELEASE_CHANNEL" in *-pc-windows-gnu) ;; *) - CFG_ENABLE_DEBUGINFO_LINES=1 - CFG_ENABLE_DEBUGINFO_ONLY_STD=1 + enable_if_not_disabled debuginfo-lines + enable_if_not_disabled debuginfo-only-std ;; esac ;; From daa276ebb76c966b0d51768c426eb0ebcebe48ec Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 18 Jul 2017 19:01:51 -0600 Subject: [PATCH 02/12] Update liblibc --- src/liblibc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/liblibc b/src/liblibc index 2015cf17a6a2a..ec1e5ab1ef8ba 160000 --- a/src/liblibc +++ b/src/liblibc @@ -1 +1 @@ -Subproject commit 2015cf17a6a2a2280e93d9c57214ba92dbbaf42f +Subproject commit ec1e5ab1ef8baca57f8776bbebd9343572a87082 From fa91eeb99fbfa80fac9ea58670d6b86fa84949f1 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Thu, 20 Jul 2017 15:32:06 +0200 Subject: [PATCH 03/12] Remove unused DefTable::retrace_path(). --- src/librustc/hir/def_id.rs | 4 ++ src/librustc/hir/map/definitions.rs | 85 +++++++--------------------- src/librustc/hir/map/mod.rs | 6 +- src/librustc/middle/cstore.rs | 14 +---- src/librustc/ty/context.rs | 19 +------ src/librustc_metadata/cstore_impl.rs | 12 +--- 6 files changed, 27 insertions(+), 113 deletions(-) diff --git a/src/librustc/hir/def_id.rs b/src/librustc/hir/def_id.rs index 95a27f065999c..7f76e1bf770bf 100644 --- a/src/librustc/hir/def_id.rs +++ b/src/librustc/hir/def_id.rs @@ -136,6 +136,10 @@ impl DefIndex { pub fn as_array_index(&self) -> usize { (self.0 & !DEF_INDEX_HI_START.0) as usize } + + pub fn from_array_index(i: usize, address_space: DefIndexAddressSpace) -> DefIndex { + DefIndex::new(address_space.start() + i) + } } /// The start of the "high" range of DefIndexes. diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index d89e86ee66a66..91bce64243e3f 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -18,7 +18,7 @@ use hir; use hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE, DefIndexAddressSpace, CRATE_DEF_INDEX}; use ich::Fingerprint; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::indexed_vec::IndexVec; use rustc_data_structures::stable_hasher::StableHasher; use serialize::{Encodable, Decodable, Encoder, Decoder}; @@ -36,7 +36,6 @@ use util::nodemap::NodeMap; /// There is one DefPathTable for each crate. pub struct DefPathTable { index_to_key: [Vec; 2], - key_to_index: FxHashMap, def_path_hashes: [Vec; 2], } @@ -47,7 +46,6 @@ impl Clone for DefPathTable { DefPathTable { index_to_key: [self.index_to_key[0].clone(), self.index_to_key[1].clone()], - key_to_index: self.key_to_index.clone(), def_path_hashes: [self.def_path_hashes[0].clone(), self.def_path_hashes[1].clone()], } @@ -65,10 +63,9 @@ impl DefPathTable { let index_to_key = &mut self.index_to_key[address_space.index()]; let index = DefIndex::new(index_to_key.len() + address_space.start()); debug!("DefPathTable::insert() - {:?} <-> {:?}", key, index); - index_to_key.push(key.clone()); + index_to_key.push(key); index }; - self.key_to_index.insert(key, index); self.def_path_hashes[address_space.index()].push(def_path_hash); debug_assert!(self.def_path_hashes[address_space.index()].len() == self.index_to_key[address_space.index()].len()); @@ -87,47 +84,6 @@ impl DefPathTable { [index.as_array_index()] } - #[inline(always)] - pub fn def_index_for_def_key(&self, key: &DefKey) -> Option { - self.key_to_index.get(key).cloned() - } - - #[inline(always)] - pub fn contains_key(&self, key: &DefKey) -> bool { - self.key_to_index.contains_key(key) - } - - pub fn retrace_path(&self, - path_data: &[DisambiguatedDefPathData]) - -> Option { - let root_key = DefKey { - parent: None, - disambiguated_data: DisambiguatedDefPathData { - data: DefPathData::CrateRoot, - disambiguator: 0, - }, - }; - - let root_index = self.key_to_index - .get(&root_key) - .expect("no root key?") - .clone(); - - debug!("retrace_path: root_index={:?}", root_index); - - let mut index = root_index; - for data in path_data { - let key = DefKey { parent: Some(index), disambiguated_data: data.clone() }; - debug!("retrace_path: key={:?}", key); - match self.key_to_index.get(&key) { - Some(&i) => index = i, - None => return None, - } - } - - Some(index) - } - pub fn add_def_path_hashes_to(&self, cnum: CrateNum, out: &mut FxHashMap) { @@ -149,7 +105,7 @@ impl DefPathTable { } pub fn size(&self) -> usize { - self.key_to_index.len() + self.index_to_key.iter().map(|v| v.len()).sum() } } @@ -179,19 +135,8 @@ impl Decodable for DefPathTable { let index_to_key = [index_to_key_lo, index_to_key_hi]; let def_path_hashes = [def_path_hashes_lo, def_path_hashes_hi]; - let mut key_to_index = FxHashMap(); - - for space in &[DefIndexAddressSpace::Low, DefIndexAddressSpace::High] { - key_to_index.extend(index_to_key[space.index()] - .iter() - .enumerate() - .map(|(index, key)| (key.clone(), - DefIndex::new(index + space.start())))) - } - Ok(DefPathTable { index_to_key, - key_to_index, def_path_hashes, }) } @@ -208,6 +153,7 @@ pub struct Definitions { pub(super) node_to_hir_id: IndexVec, macro_def_scopes: FxHashMap, expansions: FxHashMap, + keys_created: FxHashSet, } // Unfortunately we have to provide a manual impl of Clone because of the @@ -224,6 +170,7 @@ impl Clone for Definitions { node_to_hir_id: self.node_to_hir_id.clone(), macro_def_scopes: self.macro_def_scopes.clone(), expansions: self.expansions.clone(), + keys_created: self.keys_created.clone(), } } } @@ -448,7 +395,6 @@ impl Definitions { Definitions { table: DefPathTable { index_to_key: [vec![], vec![]], - key_to_index: FxHashMap(), def_path_hashes: [vec![], vec![]], }, node_to_def_index: NodeMap(), @@ -456,6 +402,7 @@ impl Definitions { node_to_hir_id: IndexVec::new(), macro_def_scopes: FxHashMap(), expansions: FxHashMap(), + keys_created: FxHashSet(), } } @@ -478,10 +425,6 @@ impl Definitions { self.table.def_path_hash(index) } - pub fn def_index_for_def_key(&self, key: DefKey) -> Option { - self.table.def_index_for_def_key(&key) - } - /// Returns the path from the crate root to `index`. The root /// nodes are not included in the path (i.e., this will be an /// empty vector for the crate root). For an inlined item, this @@ -583,9 +526,10 @@ impl Definitions { } }; - while self.table.contains_key(&key) { + while self.keys_created.contains(&key) { key.disambiguated_data.disambiguator += 1; } + self.keys_created.insert(key.clone()); let parent_hash = self.table.def_path_hash(parent); let def_path_hash = key.compute_stable_hash(parent_hash); @@ -710,6 +654,8 @@ macro_rules! define_global_metadata_kind { $($variant),* } + const GLOBAL_MD_ADDRESS_SPACE: DefIndexAddressSpace = DefIndexAddressSpace::High; + impl GlobalMetaDataKind { fn allocate_def_indices(definitions: &mut Definitions) { $({ @@ -718,7 +664,7 @@ macro_rules! define_global_metadata_kind { CRATE_DEF_INDEX, ast::DUMMY_NODE_ID, DefPathData::GlobalMetaData(instance.name()), - DefIndexAddressSpace::High, + GLOBAL_MD_ADDRESS_SPACE, Mark::root() ); @@ -736,7 +682,14 @@ macro_rules! define_global_metadata_kind { } }; - def_path_table.key_to_index[&def_key] + // These DefKeys are all right after the root, + // so a linear search is fine. + let index = def_path_table.index_to_key[GLOBAL_MD_ADDRESS_SPACE.index()] + .iter() + .position(|k| *k == def_key) + .unwrap(); + + DefIndex::from_array_index(index, GLOBAL_MD_ADDRESS_SPACE) } fn name(&self) -> Symbol { diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 2044d32ff9b85..3fdd9c34f46d9 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -17,7 +17,7 @@ pub use self::definitions::{Definitions, DefKey, DefPath, DefPathData, use dep_graph::{DepGraph, DepNode, DepKind}; -use hir::def_id::{CRATE_DEF_INDEX, DefId, DefIndex, DefIndexAddressSpace}; +use hir::def_id::{CRATE_DEF_INDEX, DefId, DefIndexAddressSpace}; use syntax::abi::Abi; use syntax::ast::{self, Name, NodeId, CRATE_NODE_ID}; @@ -377,10 +377,6 @@ impl<'hir> Map<'hir> { self.definitions.def_path(def_id.index) } - pub fn def_index_for_def_key(&self, def_key: DefKey) -> Option { - self.definitions.def_index_for_def_key(def_key) - } - pub fn local_def_id(&self, node: NodeId) -> DefId { self.opt_local_def_id(node).unwrap_or_else(|| { bug!("local_def_id: no entry for `{}`, which has a map of `{:?}`", diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 960d616cd4ca2..48bddf2f71759 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -25,8 +25,7 @@ use hir::def; use hir::def_id::{CrateNum, DefId, DefIndex}; use hir::map as hir_map; -use hir::map::definitions::{Definitions, DefKey, DisambiguatedDefPathData, - DefPathTable}; +use hir::map::definitions::{Definitions, DefKey, DefPathTable}; use hir::svh::Svh; use ich; use middle::lang_items; @@ -269,10 +268,6 @@ pub trait CrateStore { fn is_no_builtins(&self, cnum: CrateNum) -> bool; // resolve - fn retrace_path(&self, - cnum: CrateNum, - path_data: &[DisambiguatedDefPathData]) - -> Option; fn def_key(&self, def: DefId) -> DefKey; fn def_path(&self, def: DefId) -> hir_map::DefPath; fn def_path_hash(&self, def: DefId) -> hir_map::DefPathHash; @@ -392,13 +387,6 @@ impl CrateStore for DummyCrateStore { fn is_no_builtins(&self, cnum: CrateNum) -> bool { bug!("is_no_builtins") } // resolve - fn retrace_path(&self, - cnum: CrateNum, - path_data: &[DisambiguatedDefPathData]) - -> Option { - None - } - fn def_key(&self, def: DefId) -> DefKey { bug!("def_key") } fn def_path(&self, def: DefId) -> hir_map::DefPath { bug!("relative_def_path") diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index c234f43e38779..45ddd4c0ff179 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -18,7 +18,7 @@ use hir::TraitMap; use hir::def::{Def, ExportMap}; use hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use hir::map as hir_map; -use hir::map::{DisambiguatedDefPathData, DefPathHash}; +use hir::map::DefPathHash; use middle::free_region::FreeRegionMap; use middle::lang_items; use middle::resolve_lifetime; @@ -570,23 +570,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - pub fn retrace_path(self, - krate: CrateNum, - path_data: &[DisambiguatedDefPathData]) - -> Option { - debug!("retrace_path(path={:?}, krate={:?})", path_data, self.crate_name(krate)); - - if krate == LOCAL_CRATE { - self.hir - .definitions() - .def_path_table() - .retrace_path(path_data) - .map(|def_index| DefId { krate: krate, index: def_index }) - } else { - self.sess.cstore.retrace_path(krate, path_data) - } - } - pub fn alloc_generics(self, generics: ty::Generics) -> &'gcx ty::Generics { self.global_arenas.generics.alloc(generics) } diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 4bdfdd51f659a..5b0612ddab606 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -22,7 +22,7 @@ use rustc::session::Session; use rustc::ty::{self, TyCtxt}; use rustc::ty::maps::Providers; use rustc::hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE}; -use rustc::hir::map::{DefKey, DefPath, DisambiguatedDefPathData, DefPathHash}; +use rustc::hir::map::{DefKey, DefPath, DefPathHash}; use rustc::hir::map::blocks::FnLikeNode; use rustc::hir::map::definitions::{DefPathTable, GlobalMetaDataKind}; use rustc::util::nodemap::{NodeSet, DefIdMap}; @@ -307,16 +307,6 @@ impl CrateStore for cstore::CStore { self.get_crate_data(cnum).is_no_builtins(&self.dep_graph) } - fn retrace_path(&self, - cnum: CrateNum, - path: &[DisambiguatedDefPathData]) - -> Option { - let cdata = self.get_crate_data(cnum); - cdata.def_path_table - .retrace_path(&path) - .map(|index| DefId { krate: cnum, index: index }) - } - /// Returns the `DefKey` for a given `DefId`. This indicates the /// parent `DefId` as well as some idea of what kind of data the /// `DefId` refers to. From 72e8009185b537083015f43a8e0fd34509ab1938 Mon Sep 17 00:00:00 2001 From: Evan Cameron Date: Thu, 20 Jul 2017 13:59:44 -0400 Subject: [PATCH 04/12] Remove mut where possible --- src/libstd/io/buffered.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 1b832453523fb..d765dd227be69 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -37,7 +37,7 @@ use memchr; /// use std::fs::File; /// /// # fn foo() -> std::io::Result<()> { -/// let mut f = File::open("log.txt")?; +/// let f = File::open("log.txt")?; /// let mut reader = BufReader::new(f); /// /// let mut line = String::new(); @@ -64,8 +64,8 @@ impl BufReader { /// use std::fs::File; /// /// # fn foo() -> std::io::Result<()> { - /// let mut f = File::open("log.txt")?; - /// let mut reader = BufReader::new(f); + /// let f = File::open("log.txt")?; + /// let reader = BufReader::new(f); /// # Ok(()) /// # } /// ``` @@ -85,8 +85,8 @@ impl BufReader { /// use std::fs::File; /// /// # fn foo() -> std::io::Result<()> { - /// let mut f = File::open("log.txt")?; - /// let mut reader = BufReader::with_capacity(10, f); + /// let f = File::open("log.txt")?; + /// let reader = BufReader::with_capacity(10, f); /// # Ok(()) /// # } /// ``` @@ -116,8 +116,8 @@ impl BufReader { /// use std::fs::File; /// /// # fn foo() -> std::io::Result<()> { - /// let mut f1 = File::open("log.txt")?; - /// let mut reader = BufReader::new(f1); + /// let f1 = File::open("log.txt")?; + /// let reader = BufReader::new(f1); /// /// let f2 = reader.get_ref(); /// # Ok(()) @@ -137,7 +137,7 @@ impl BufReader { /// use std::fs::File; /// /// # fn foo() -> std::io::Result<()> { - /// let mut f1 = File::open("log.txt")?; + /// let f1 = File::open("log.txt")?; /// let mut reader = BufReader::new(f1); /// /// let f2 = reader.get_mut(); @@ -158,8 +158,8 @@ impl BufReader { /// use std::fs::File; /// /// # fn foo() -> std::io::Result<()> { - /// let mut f1 = File::open("log.txt")?; - /// let mut reader = BufReader::new(f1); + /// let f1 = File::open("log.txt")?; + /// let reader = BufReader::new(f1); /// /// let f2 = reader.into_inner(); /// # Ok(()) From 9a510553ee7657ac0dfcbad81e0b1df4953005e4 Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Thu, 20 Jul 2017 22:00:16 +0200 Subject: [PATCH 05/12] Clarify that sort_unstable is deterministic --- src/liballoc/slice.rs | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index f4c2b9d054b4f..ec7a2b6d0e8d9 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -1252,12 +1252,13 @@ impl [T] { /// /// # Current implementation /// - /// The current algorithm is based on Orson Peters' [pattern-defeating quicksort][pdqsort], - /// which is a quicksort variant designed to be very fast on certain kinds of patterns, - /// sometimes achieving linear time. It is randomized but deterministic, and falls back to - /// heapsort on degenerate inputs. + /// The current algorithm is based on [pattern-defeating quicksort][pdqsort] by Orson Peters, + /// which combines the fast average case of randomized quicksort with the fast worst case of + /// heapsort, while achieving linear time on slices with certain patterns. It uses some + /// randomization to avoid degenerate cases, but with a fixed seed to always provide + /// deterministic behavior. /// - /// It is generally faster than stable sorting, except in a few special cases, e.g. when the + /// It is typically faster than stable sorting, except in a few special cases, e.g. when the /// slice consists of several concatenated sorted sequences. /// /// # Examples @@ -1286,12 +1287,13 @@ impl [T] { /// /// # Current implementation /// - /// The current algorithm is based on Orson Peters' [pattern-defeating quicksort][pdqsort], - /// which is a quicksort variant designed to be very fast on certain kinds of patterns, - /// sometimes achieving linear time. It is randomized but deterministic, and falls back to - /// heapsort on degenerate inputs. + /// The current algorithm is based on [pattern-defeating quicksort][pdqsort] by Orson Peters, + /// which combines the fast average case of randomized quicksort with the fast worst case of + /// heapsort, while achieving linear time on slices with certain patterns. It uses some + /// randomization to avoid degenerate cases, but with a fixed seed to always provide + /// deterministic behavior. /// - /// It is generally faster than stable sorting, except in a few special cases, e.g. when the + /// It is typically faster than stable sorting, except in a few special cases, e.g. when the /// slice consists of several concatenated sorted sequences. /// /// # Examples @@ -1323,12 +1325,13 @@ impl [T] { /// /// # Current implementation /// - /// The current algorithm is based on Orson Peters' [pattern-defeating quicksort][pdqsort], - /// which is a quicksort variant designed to be very fast on certain kinds of patterns, - /// sometimes achieving linear time. It is randomized but deterministic, and falls back to - /// heapsort on degenerate inputs. + /// The current algorithm is based on [pattern-defeating quicksort][pdqsort] by Orson Peters, + /// which combines the fast average case of randomized quicksort with the fast worst case of + /// heapsort, while achieving linear time on slices with certain patterns. It uses some + /// randomization to avoid degenerate cases, but with a fixed seed to always provide + /// deterministic behavior. /// - /// It is generally faster than stable sorting, except in a few special cases, e.g. when the + /// It is typically faster than stable sorting, except in a few special cases, e.g. when the /// slice consists of several concatenated sorted sequences. /// /// # Examples From 9d0946acd0fe0498456ff7a0da208b546d9683b7 Mon Sep 17 00:00:00 2001 From: Joe Ranweiler Date: Thu, 20 Jul 2017 15:05:10 -0700 Subject: [PATCH 06/12] Tell `tidy` about `compiler_builtins_lib` feature After the work in #42899, it no longer auto-discovers it. --- src/tools/tidy/src/features.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 4c94ade98d965..301f0d1d80b79 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -219,6 +219,18 @@ pub fn collect_lang_features(base_src_path: &Path) -> Features { pub fn collect_lib_features(base_src_path: &Path) -> Features { let mut lib_features = Features::new(); + + // This library feature is defined in the `compiler_builtins` crate, which + // has been moved out-of-tree. Now it can no longer be auto-discovered by + // `tidy`, because we need to filter out its (submodule) directory. Manually + // add it to the set of known library features so we can still generate docs. + lib_features.insert("compiler_builtins_lib".to_owned(), Feature { + level: Status::Unstable, + since: "".to_owned(), + has_gate_test: false, + tracking_issue: None, + }); + map_lib_features(base_src_path, &mut |res, _, _| { match res { From e74f6114052524bbc2498b43713a8bf1114d14f8 Mon Sep 17 00:00:00 2001 From: Joe Ranweiler Date: Wed, 19 Jul 2017 12:56:05 -0700 Subject: [PATCH 07/12] Document use of `compiler_builtins` with `no_std` binaries The docs for the `compiler_builtins_lib` library feature were removed in #42899. But, though the `compiler_builtins` library has been migrated out-of-tree, the feature remains, and is needed to use the stand-alone crate. We reintroduce the docs for the feature, and add a reference to them when describing how to create a `no_std` executable. --- .../src/language-features/lang-items.md | 8 +++++ .../library-features/compiler-builtins-lib.md | 35 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/doc/unstable-book/src/library-features/compiler-builtins-lib.md diff --git a/src/doc/unstable-book/src/language-features/lang-items.md b/src/doc/unstable-book/src/language-features/lang-items.md index a2368ee5f4ac5..ecbc860e25c03 100644 --- a/src/doc/unstable-book/src/language-features/lang-items.md +++ b/src/doc/unstable-book/src/language-features/lang-items.md @@ -194,6 +194,14 @@ pub extern fn rust_begin_panic(_msg: core::fmt::Arguments, } ``` +In many cases, you may need to manually link to the `compiler_builtins` crate +when building a `no_std` binary. You may observe this via linker error messages +such as "```undefined reference to `__rust_probestack'```". Using this crate +also requires enabling the library feature `compiler_builtins_lib`. You can read +more about this [here][compiler-builtins-lib]. + +[compiler-builtins-lib]: library-features/compiler-builtins-lib.html + ## More about the language items The compiler currently makes a few assumptions about symbols which are diff --git a/src/doc/unstable-book/src/library-features/compiler-builtins-lib.md b/src/doc/unstable-book/src/library-features/compiler-builtins-lib.md new file mode 100644 index 0000000000000..6c71c3f2ce191 --- /dev/null +++ b/src/doc/unstable-book/src/library-features/compiler-builtins-lib.md @@ -0,0 +1,35 @@ +# `compiler_builtins_lib` + +The tracking issue for this feature is: None. + +------------------------ + +This feature is required to link to the `compiler_builtins` crate which contains +"compiler intrinsics". Compiler intrinsics are software implementations of basic +operations like multiplication of `u64`s. These intrinsics are only required on +platforms where these operations don't directly map to a hardware instruction. + +You should never need to explicitly link to the `compiler_builtins` crate when +building "std" programs as `compiler_builtins` is already in the dependency +graph of `std`. But you may need it when building `no_std` **binary** crates. If +you get a *linker* error like: + +``` text +$PWD/src/main.rs:11: undefined reference to `__aeabi_lmul' +$PWD/src/main.rs:11: undefined reference to `__aeabi_uldivmod' +``` + +That means that you need to link to this crate. + +When you link to this crate, make sure it only appears once in your crate +dependency graph. Also, it doesn't matter where in the dependency graph you +place the `compiler_builtins` crate. + + + +``` rust,ignore +#![feature(compiler_builtins_lib)] +#![no_std] + +extern crate compiler_builtins; +``` From 3cefd2b1d527b7f932b5c106b7722f26e09fb978 Mon Sep 17 00:00:00 2001 From: Petr Zemek Date: Fri, 21 Jul 2017 08:44:53 +0200 Subject: [PATCH 08/12] Add a missing verb to the description of std::process::ExitStatus::success(). "Signal termination not considered" -> "Signal termination is not considered" The first line of the description was rewrapped so it fits into 80 characters. --- src/libstd/process.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 7adfcc44ad008..31809e382398f 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -799,8 +799,8 @@ impl From for Stdio { pub struct ExitStatus(imp::ExitStatus); impl ExitStatus { - /// Was termination successful? Signal termination not considered a success, - /// and success is defined as a zero exit status. + /// Was termination successful? Signal termination is not considered a + /// success, and success is defined as a zero exit status. /// /// # Examples /// From 5c6ccdc37c88ce77306646703a1ada166e998c40 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 21 Jul 2017 18:08:40 -0700 Subject: [PATCH 09/12] Correct the spelling of "homogeneous" --- src/librustc/diagnostics.rs | 2 +- src/librustc_trans/abi.rs | 16 ++++++++-------- src/librustc_trans/cabi_aarch64.rs | 8 ++++---- src/librustc_trans/cabi_asmjs.rs | 2 +- src/librustc_trans/cabi_powerpc64.rs | 8 ++++---- src/librustc_trans/cabi_sparc64.rs | 8 ++++---- src/librustc_trans/cabi_x86.rs | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index cef1be5cee232..b52224eb5d767 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -1708,7 +1708,7 @@ not apply to structs. representation of enums isn't strictly defined in Rust, and this attribute won't work on enums. -`#[repr(simd)]` will give a struct consisting of a homogenous series of machine +`#[repr(simd)]` will give a struct consisting of a homogeneous series of machine types (i.e. `u8`, `i32`, etc) a representation that permits vectorization via SIMD. This doesn't make much sense for enums since they don't consist of a single list of data. diff --git a/src/librustc_trans/abi.rs b/src/librustc_trans/abi.rs index 120f201a9c8b7..144b484d7e819 100644 --- a/src/librustc_trans/abi.rs +++ b/src/librustc_trans/abi.rs @@ -238,7 +238,7 @@ impl Uniform { pub trait LayoutExt<'tcx> { fn is_aggregate(&self) -> bool; - fn homogenous_aggregate<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> Option; + fn homogeneous_aggregate<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> Option; } impl<'tcx> LayoutExt<'tcx> for TyLayout<'tcx> { @@ -258,7 +258,7 @@ impl<'tcx> LayoutExt<'tcx> for TyLayout<'tcx> { } } - fn homogenous_aggregate<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> Option { + fn homogeneous_aggregate<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> Option { match *self.layout { // The primitives for this algorithm. Layout::Scalar { value, .. } | @@ -291,7 +291,7 @@ impl<'tcx> LayoutExt<'tcx> for TyLayout<'tcx> { Layout::Array { count, .. } => { if count > 0 { - self.field(ccx, 0).homogenous_aggregate(ccx) + self.field(ccx, 0).homogeneous_aggregate(ccx) } else { None } @@ -307,8 +307,8 @@ impl<'tcx> LayoutExt<'tcx> for TyLayout<'tcx> { } let field = self.field(ccx, i); - match (result, field.homogenous_aggregate(ccx)) { - // The field itself must be a homogenous aggregate. + match (result, field.homogeneous_aggregate(ccx)) { + // The field itself must be a homogeneous aggregate. (_, None) => return None, // If this is the first field, record the unit. (None, Some(unit)) => { @@ -344,8 +344,8 @@ impl<'tcx> LayoutExt<'tcx> for TyLayout<'tcx> { for i in 0..self.field_count() { let field = self.field(ccx, i); - match (result, field.homogenous_aggregate(ccx)) { - // The field itself must be a homogenous aggregate. + match (result, field.homogeneous_aggregate(ccx)) { + // The field itself must be a homogeneous aggregate. (_, None) => return None, // If this is the first field, record the unit. (None, Some(unit)) => { @@ -830,7 +830,7 @@ impl<'a, 'tcx> FnType<'tcx> { let size = arg.layout.size(ccx); - if let Some(unit) = arg.layout.homogenous_aggregate(ccx) { + if let Some(unit) = arg.layout.homogeneous_aggregate(ccx) { // Replace newtypes with their inner-most type. if unit.size == size { // Needs a cast as we've unpacked a newtype. diff --git a/src/librustc_trans/cabi_aarch64.rs b/src/librustc_trans/cabi_aarch64.rs index c8c5af714d92a..bf842e6358f87 100644 --- a/src/librustc_trans/cabi_aarch64.rs +++ b/src/librustc_trans/cabi_aarch64.rs @@ -11,9 +11,9 @@ use abi::{FnType, ArgType, LayoutExt, Reg, RegKind, Uniform}; use context::CrateContext; -fn is_homogenous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>) +fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>) -> Option { - arg.layout.homogenous_aggregate(ccx).and_then(|unit| { + arg.layout.homogeneous_aggregate(ccx).and_then(|unit| { let size = arg.layout.size(ccx); // Ensure we have at most four uniquely addressable members. @@ -43,7 +43,7 @@ fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tc ret.extend_integer_width_to(32); return; } - if let Some(uniform) = is_homogenous_aggregate(ccx, ret) { + if let Some(uniform) = is_homogeneous_aggregate(ccx, ret) { ret.cast_to(ccx, uniform); return; } @@ -74,7 +74,7 @@ fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tc arg.extend_integer_width_to(32); return; } - if let Some(uniform) = is_homogenous_aggregate(ccx, arg) { + if let Some(uniform) = is_homogeneous_aggregate(ccx, arg) { arg.cast_to(ccx, uniform); return; } diff --git a/src/librustc_trans/cabi_asmjs.rs b/src/librustc_trans/cabi_asmjs.rs index f05dda8bce21a..6fcd3ed581d27 100644 --- a/src/librustc_trans/cabi_asmjs.rs +++ b/src/librustc_trans/cabi_asmjs.rs @@ -18,7 +18,7 @@ use context::CrateContext; fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tcx>) { if ret.layout.is_aggregate() { - if let Some(unit) = ret.layout.homogenous_aggregate(ccx) { + if let Some(unit) = ret.layout.homogeneous_aggregate(ccx) { let size = ret.layout.size(ccx); if unit.size == size { ret.cast_to(ccx, Uniform { diff --git a/src/librustc_trans/cabi_powerpc64.rs b/src/librustc_trans/cabi_powerpc64.rs index c4f8d0b4b9637..5c695387236fa 100644 --- a/src/librustc_trans/cabi_powerpc64.rs +++ b/src/librustc_trans/cabi_powerpc64.rs @@ -15,9 +15,9 @@ use abi::{FnType, ArgType, LayoutExt, Reg, RegKind, Uniform}; use context::CrateContext; -fn is_homogenous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>) +fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>) -> Option { - arg.layout.homogenous_aggregate(ccx).and_then(|unit| { + arg.layout.homogeneous_aggregate(ccx).and_then(|unit| { let size = arg.layout.size(ccx); // Ensure we have at most eight uniquely addressable members. @@ -53,7 +53,7 @@ fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tc ret.make_indirect(ccx); } - if let Some(uniform) = is_homogenous_aggregate(ccx, ret) { + if let Some(uniform) = is_homogeneous_aggregate(ccx, ret) { ret.cast_to(ccx, uniform); return; } @@ -86,7 +86,7 @@ fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tc return; } - if let Some(uniform) = is_homogenous_aggregate(ccx, arg) { + if let Some(uniform) = is_homogeneous_aggregate(ccx, arg) { arg.cast_to(ccx, uniform); return; } diff --git a/src/librustc_trans/cabi_sparc64.rs b/src/librustc_trans/cabi_sparc64.rs index b75fa97f948ec..8383007550e1e 100644 --- a/src/librustc_trans/cabi_sparc64.rs +++ b/src/librustc_trans/cabi_sparc64.rs @@ -13,9 +13,9 @@ use abi::{FnType, ArgType, LayoutExt, Reg, RegKind, Uniform}; use context::CrateContext; -fn is_homogenous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>) +fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>) -> Option { - arg.layout.homogenous_aggregate(ccx).and_then(|unit| { + arg.layout.homogeneous_aggregate(ccx).and_then(|unit| { let size = arg.layout.size(ccx); // Ensure we have at most eight uniquely addressable members. @@ -46,7 +46,7 @@ fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tc return; } - if let Some(uniform) = is_homogenous_aggregate(ccx, ret) { + if let Some(uniform) = is_homogeneous_aggregate(ccx, ret) { ret.cast_to(ccx, uniform); return; } @@ -80,7 +80,7 @@ fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tc return; } - if let Some(uniform) = is_homogenous_aggregate(ccx, arg) { + if let Some(uniform) = is_homogeneous_aggregate(ccx, arg) { arg.cast_to(ccx, uniform); return; } diff --git a/src/librustc_trans/cabi_x86.rs b/src/librustc_trans/cabi_x86.rs index 9f5520dabe334..8b024b8c97fa0 100644 --- a/src/librustc_trans/cabi_x86.rs +++ b/src/librustc_trans/cabi_x86.rs @@ -74,7 +74,7 @@ pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, if arg.is_ignore() || arg.is_indirect() { continue; } // At this point we know this must be a primitive of sorts. - let unit = arg.layout.homogenous_aggregate(ccx).unwrap(); + let unit = arg.layout.homogeneous_aggregate(ccx).unwrap(); let size = arg.layout.size(ccx); assert_eq!(unit.size, size); if unit.kind == RegKind::Float { From 02219642bc5e8a9454ff4d6c6b0ede16a321ab9d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 21 Jul 2017 21:22:26 -0700 Subject: [PATCH 10/12] rustc: Add some build scripts for librustc crates This commit adds some "boilerplate" build scripts to librustc/libsyntax crates to declare dependencies on various environment variables that are configured throughout the build. Cargo recently gained the ability to depend on environment variables in build scripts which can help trigger recompilation of a crate. This should fix weird bugs where after you make a commit or a few days later you'll get weird "not built with the same compiler" errors hopefully. --- src/librustc/build.rs | 15 +++++++++++++++ src/librustc_back/build.rs | 15 +++++++++++++++ src/librustc_driver/build.rs | 17 +++++++++++++++++ src/librustc_incremental/build.rs | 14 ++++++++++++++ src/librustc_metadata/build.rs | 14 ++++++++++++++ src/librustc_trans/build.rs | 16 ++++++++++++++++ src/libsyntax/build.rs | 15 +++++++++++++++ 7 files changed, 106 insertions(+) create mode 100644 src/librustc/build.rs create mode 100644 src/librustc_back/build.rs create mode 100644 src/librustc_driver/build.rs create mode 100644 src/librustc_incremental/build.rs create mode 100644 src/librustc_metadata/build.rs create mode 100644 src/librustc_trans/build.rs create mode 100644 src/libsyntax/build.rs diff --git a/src/librustc/build.rs b/src/librustc/build.rs new file mode 100644 index 0000000000000..4df5f0e64050c --- /dev/null +++ b/src/librustc/build.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-env-changed=CFG_LIBDIR_RELATIVE"); + println!("cargo:rerun-if-env-changed=CFG_COMPILER_HOST_TRIPLE"); +} diff --git a/src/librustc_back/build.rs b/src/librustc_back/build.rs new file mode 100644 index 0000000000000..16f0872b25ac1 --- /dev/null +++ b/src/librustc_back/build.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-env-changed=CFG_DEFAULT_LINKER"); + println!("cargo:rerun-if-env-changed=CFG_DEFAULT_AR"); +} diff --git a/src/librustc_driver/build.rs b/src/librustc_driver/build.rs new file mode 100644 index 0000000000000..9844f3b557a1f --- /dev/null +++ b/src/librustc_driver/build.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-env-changed=CFG_RELEASE"); + println!("cargo:rerun-if-env-changed=CFG_VERSION"); + println!("cargo:rerun-if-env-changed=CFG_VER_DATE"); + println!("cargo:rerun-if-env-changed=CFG_VER_HASH"); +} diff --git a/src/librustc_incremental/build.rs b/src/librustc_incremental/build.rs new file mode 100644 index 0000000000000..f18a3f9b94016 --- /dev/null +++ b/src/librustc_incremental/build.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-env-changed=CFG_VERSION"); +} diff --git a/src/librustc_metadata/build.rs b/src/librustc_metadata/build.rs new file mode 100644 index 0000000000000..f18a3f9b94016 --- /dev/null +++ b/src/librustc_metadata/build.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-env-changed=CFG_VERSION"); +} diff --git a/src/librustc_trans/build.rs b/src/librustc_trans/build.rs new file mode 100644 index 0000000000000..97accbb4b8fe6 --- /dev/null +++ b/src/librustc_trans/build.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-env-changed=CFG_VERSION"); + println!("cargo:rerun-if-env-changed=CFG_PREFIX"); + println!("cargo:rerun-if-env-changed=CFG_LLVM_ROOT"); +} diff --git a/src/libsyntax/build.rs b/src/libsyntax/build.rs new file mode 100644 index 0000000000000..d39340c332690 --- /dev/null +++ b/src/libsyntax/build.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-env-changed=CFG_RELEASE_CHANNEL"); + println!("cargo:rerun-if-env-changed=CFG_DISABLE_UNSTABLE_FEATURES"); +} From 539df8121bf799526bcb36a1613ac3fd3e255a61 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sun, 23 Jul 2017 22:06:16 +0700 Subject: [PATCH 11/12] Fix some doc/comment typos. --- src/libcore/str/mod.rs | 2 +- src/libcore/str/pattern.rs | 6 +++--- src/librustc/traits/specialize/mod.rs | 8 ++++---- src/librustc_data_structures/obligation_forest/mod.rs | 4 ++-- src/librustc_mir/dataflow/move_paths/mod.rs | 2 +- src/librustc_trans/partitioning.rs | 4 ++-- src/libserialize/serialize.rs | 4 ++-- src/libstd/collections/hash/map.rs | 2 +- src/libstd/path.rs | 6 +++--- src/libstd/thread/mod.rs | 8 ++++---- src/libsyntax_pos/lib.rs | 2 +- src/test/parse-fail/default.rs | 2 +- src/test/run-pass/backtrace-debuginfo-aux.rs | 2 +- src/test/run-pass/backtrace-debuginfo.rs | 4 ++-- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 1df69a1b598e4..95b27751a6aaf 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -847,7 +847,7 @@ macro_rules! generate_pattern_iterators { internal: $internal_iterator:ident yielding ($iterty:ty); - // Kind of delgation - either single ended or double ended + // Kind of delegation - either single ended or double ended delegate $($t:tt)* } => { $(#[$forward_iterator_attribute])* diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index 3c9c1d6cab479..c4ff95b1d6a49 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -83,7 +83,7 @@ pub enum SearchStep { /// Note that there might be more than one `Reject` between two `Match`es, /// there is no requirement for them to be combined into one. Reject(usize, usize), - /// Expresses that every byte of the haystack has been visted, ending + /// Expresses that every byte of the haystack has been visited, ending /// the iteration. Done } @@ -101,7 +101,7 @@ pub enum SearchStep { /// the haystack. This enables consumers of this trait to /// slice the haystack without additional runtime checks. pub unsafe trait Searcher<'a> { - /// Getter for the underlaying string to be searched in + /// Getter for the underlying string to be searched in /// /// Will always return the same `&str` fn haystack(&self) -> &'a str; @@ -1153,7 +1153,7 @@ impl TwoWaySearcher { // The maximal suffix is a possible critical factorization (u', v') of `arr`. // // Returns `i` where `i` is the starting index of v', from the back; - // returns immedately when a period of `known_period` is reached. + // returns immediately when a period of `known_period` is reached. // // `order_greater` determines if lexical order is `<` or `>`. Both // orders must be computed -- the ordering with the largest `i` gives diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index 18734e2dbc3f1..46e5510296652 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -88,7 +88,7 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, // vary across impls let target_substs = match target_node { specialization_graph::Node::Impl(target_impl) => { - // no need to translate if we're targetting the impl we started with + // no need to translate if we're targeting the impl we started with if source_impl == target_impl { return source_substs; } @@ -96,7 +96,7 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, fulfill_implication(infcx, param_env, source_trait_ref, target_impl) .unwrap_or_else(|_| { bug!("When translating substitutions for specialization, the expected \ - specializaiton failed to hold") + specialization failed to hold") }) } specialization_graph::Node::Trait(..) => source_trait_ref.substs, @@ -107,7 +107,7 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, } /// Given a selected impl described by `impl_data`, returns the -/// definition and substitions for the method with the name `name` +/// definition and substitutions for the method with the name `name` /// the kind `kind`, and trait method substitutions `substs`, in /// that impl, a less specialized impl, or the trait default, /// whichever applies. @@ -305,7 +305,7 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx // The coherence checking implementation seems to rely on impls being // iterated over (roughly) in definition order, so we are sorting by // negated CrateNum (so remote definitions are visited first) and then - // by a flattend version of the DefIndex. + // by a flattened version of the DefIndex. trait_impls.sort_unstable_by_key(|def_id| { (-(def_id.krate.as_u32() as i64), def_id.index.address_space().index(), diff --git a/src/librustc_data_structures/obligation_forest/mod.rs b/src/librustc_data_structures/obligation_forest/mod.rs index 3515e5c5ede35..6e70944ce642f 100644 --- a/src/librustc_data_structures/obligation_forest/mod.rs +++ b/src/librustc_data_structures/obligation_forest/mod.rs @@ -117,11 +117,11 @@ enum NodeState { /// non-ambiguous result. Pending, - /// This obligation was selected successfuly, but may or + /// This obligation was selected successfully, but may or /// may not have subobligations. Success, - /// This obligation was selected sucessfully, but it has + /// This obligation was selected successfully, but it has /// a pending subobligation. Waiting, diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index d7ed0938e886a..648c376de1cdb 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -259,7 +259,7 @@ impl<'a, 'tcx> MoveDataBuilder<'a, 'tcx> { /// NOTE: lvalues behind references *do not* get a move path, which is /// problematic for borrowck. /// - /// Maybe we should have seperate "borrowck" and "moveck" modes. + /// Maybe we should have separate "borrowck" and "moveck" modes. fn move_path_for(&mut self, lval: &Lvalue<'tcx>) -> Result { diff --git a/src/librustc_trans/partitioning.rs b/src/librustc_trans/partitioning.rs index 7518948323b8b..904cfb2acd741 100644 --- a/src/librustc_trans/partitioning.rs +++ b/src/librustc_trans/partitioning.rs @@ -251,7 +251,7 @@ pub fn partition<'a, 'tcx, I>(scx: &SharedCrateContext<'a, 'tcx>, exported_symbols, trans_items); - debug_dump(tcx, "INITIAL PARTITONING:", initial_partitioning.codegen_units.iter()); + debug_dump(tcx, "INITIAL PARTITIONING:", initial_partitioning.codegen_units.iter()); // If the partitioning should produce a fixed count of codegen units, merge // until that count is reached. @@ -261,7 +261,7 @@ pub fn partition<'a, 'tcx, I>(scx: &SharedCrateContext<'a, 'tcx>, debug_dump(tcx, "POST MERGING:", initial_partitioning.codegen_units.iter()); } - // In the next step, we use the inlining map to determine which addtional + // In the next step, we use the inlining map to determine which additional // translation items have to go into each codegen unit. These additional // translation items can be drop-glue, functions from external crates, and // local functions the definition of which is marked with #[inline]. diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs index c6847249803e3..6d67bbc06cc1b 100644 --- a/src/libserialize/serialize.rs +++ b/src/libserialize/serialize.rs @@ -729,7 +729,7 @@ pub trait SpecializationError { /// `S` is the encoder/decoder state type, /// `T` is the type being encoded/decoded, and /// the arguments are the names of the trait - /// and method that should've been overriden. + /// and method that should've been overridden. fn not_found(trait_name: &'static str, method_name: &'static str) -> Self; } @@ -737,7 +737,7 @@ pub trait SpecializationError { impl SpecializationError for E { default fn not_found(trait_name: &'static str, method_name: &'static str) -> E { - panic!("missing specializaiton: `<{} as {}<{}>>::{}` not overriden", + panic!("missing specialization: `<{} as {}<{}>>::{}` not overridden", unsafe { intrinsics::type_name::() }, trait_name, unsafe { intrinsics::type_name::() }, diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 746e18047f945..12241b3f88187 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -203,7 +203,7 @@ const DISPLACEMENT_THRESHOLD: usize = 128; // so we round that up to 128. // // At a load factor of α, the odds of finding the target bucket after exactly n -// unsuccesful probes[1] are +// unsuccessful probes[1] are // // Pr_α{displacement = n} = // (1 - α) / α * ∑_{k≥1} e^(-kα) * (kα)^(k+n) / (k + n)! * (1 - kα / (k + n + 1)) diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 432605cf3b25b..619d079542142 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -476,7 +476,7 @@ impl<'a> Hash for PrefixComponent<'a> { /// A single component of a path. /// -/// A `Component` roughtly corresponds to a substring between path separators +/// A `Component` roughly corresponds to a substring between path separators /// (`/` or `\`). /// /// This `enum` is created by iterating over [`Components`], which in turn is @@ -571,7 +571,7 @@ impl<'a> AsRef for Component<'a> { } } -/// An interator over the [`Component`]s of a [`Path`]. +/// An iterator over the [`Component`]s of a [`Path`]. /// /// This `struct` is created by the [`components`] method on [`Path`]. /// See its documentation for more. @@ -2019,7 +2019,7 @@ impl Path { /// * Repeated separators are ignored, so `a/b` and `a//b` both have /// `a` and `b` as components. /// - /// * Occurences of `.` are normalized away, except if they are at the + /// * Occurrences of `.` are normalized away, except if they are at the /// beginning of the path. For example, `a/./b`, `a/b/`, `a/b/.` and /// `a/b` all have `a` and `b` as components, but `./a/b` starts with /// an additional [`CurDir`] component. diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 07a3a01ce8666..c35676f2709cc 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -190,7 +190,7 @@ pub use self::local::{LocalKey, LocalKeyState, AccessError}; /// - [`name`]: allows to give a name to the thread which is currently /// only used in `panic` messages. /// - [`stack_size`]: specifies the desired stack size. Note that this can -/// be overriden by the OS. +/// be overridden by the OS. /// /// If the [`stack_size`] field is not specified, the stack size /// will be the `RUST_MIN_STACK` environment variable. If it is @@ -529,7 +529,7 @@ pub fn current() -> Thread { /// Thus the pattern of `yield`ing after a failed poll is rather common when /// implementing low-level shared resources or synchronization primitives. /// -/// However programmers will usualy prefer to use, [`channel`]s, [`Condvar`]s, +/// However programmers will usually prefer to use, [`channel`]s, [`Condvar`]s, /// [`Mutex`]es or [`join`] for their synchronisation routines, as they avoid /// thinking about thread schedulling. /// @@ -770,7 +770,7 @@ pub fn park_timeout_ms(ms: u32) { /// preemption or platform differences that may not cause the maximum /// amount of time waited to be precisely `dur` long. /// -/// See the [park dococumentation][park] for more details. +/// See the [park documentation][park] for more details. /// /// # Platform behavior /// @@ -891,7 +891,7 @@ struct Inner { /// The [`thread::current`] function is available even for threads not spawned /// by the APIs of this module. /// -/// There is usualy no need to create a `Thread` struct yourself, one +/// There is usually no need to create a `Thread` struct yourself, one /// should instead use a function like `spawn` to create new threads, see the /// docs of [`Builder`] and [`spawn`] for more details. /// diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index ad5f3845e2be7..820adc60999a4 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -312,7 +312,7 @@ impl MultiSpan { &self.primary_spans } - /// Replaces all occurances of one Span with another. Used to move Spans in areas that don't + /// Replaces all occurrences of one Span with another. Used to move Spans in areas that don't /// display well (like std macros). Returns true if replacements occurred. pub fn replace(&mut self, before: Span, after: Span) -> bool { let mut replacements_occurred = false; diff --git a/src/test/parse-fail/default.rs b/src/test/parse-fail/default.rs index d18401e67646c..6c3bc45d34aa4 100644 --- a/src/test/parse-fail/default.rs +++ b/src/test/parse-fail/default.rs @@ -10,7 +10,7 @@ // compile-flags: -Z parse-only -// Test successful and unsucessful parsing of the `default` contextual keyword +// Test successful and unsuccessful parsing of the `default` contextual keyword trait Foo { fn foo() -> T; diff --git a/src/test/run-pass/backtrace-debuginfo-aux.rs b/src/test/run-pass/backtrace-debuginfo-aux.rs index 48df600214ad0..1236acf351121 100644 --- a/src/test/run-pass/backtrace-debuginfo-aux.rs +++ b/src/test/run-pass/backtrace-debuginfo-aux.rs @@ -16,7 +16,7 @@ pub fn callback(f: F) where F: FnOnce((&'static str, u32)) { } // LLVM does not yet output the required debug info to support showing inlined -// function calls in backtraces when targetting MSVC, so disable inlining in +// function calls in backtraces when targeting MSVC, so disable inlining in // this case. #[cfg_attr(not(target_env = "msvc"), inline(always))] #[cfg_attr(target_env = "msvc", inline(never))] diff --git a/src/test/run-pass/backtrace-debuginfo.rs b/src/test/run-pass/backtrace-debuginfo.rs index 88fee9ed25b8d..b2ab25c44b82a 100644 --- a/src/test/run-pass/backtrace-debuginfo.rs +++ b/src/test/run-pass/backtrace-debuginfo.rs @@ -10,7 +10,7 @@ // We disable tail merging here because it can't preserve debuginfo and thus // potentially breaks the backtraces. Also, subtle changes can decide whether -// tail merging suceeds, so the test might work today but fail tomorrow due to a +// tail merging succeeds, so the test might work today but fail tomorrow due to a // seemingly completely unrelated change. // Unfortunately, LLVM has no "disable" option for this, so we have to set // "enable" to 0 instead. @@ -88,7 +88,7 @@ fn inner(counter: &mut i32, main_pos: Pos, outer_pos: Pos) { } // LLVM does not yet output the required debug info to support showing inlined -// function calls in backtraces when targetting MSVC, so disable inlining in +// function calls in backtraces when targeting MSVC, so disable inlining in // this case. #[cfg_attr(not(target_env = "msvc"), inline(always))] #[cfg_attr(target_env = "msvc", inline(never))] From 749dcbaa88f66ad0eeb40af6adfe2eab55b14a90 Mon Sep 17 00:00:00 2001 From: "Zack M. Davis" Date: Sun, 23 Jul 2017 17:18:58 -0700 Subject: [PATCH 12/12] rustdoc: add unions to whitelist of sidebar types This resolves #43405. --- src/librustdoc/html/static/main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 788cd80b075ea..84ab88c4fdc08 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -1065,6 +1065,7 @@ block("macro", "Macros"); block("struct", "Structs"); block("enum", "Enums"); + block("union", "Unions"); block("constant", "Constants"); block("static", "Statics"); block("trait", "Traits");