Auto merge of #53662 - kennytm:rollup, r=kennytm
Rollup of 16 pull requests Successful merges: - #53311 (Window Mutex: Document that we properly initialize the SRWLock) - #53503 (Discourage overuse of mem::forget) - #53545 (Fix #50865: ICE on impl-trait returning functions reaching private items) - #53559 (add macro check for lint) - #53562 (Lament the invincibility of the Turbofish) - #53563 (use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into()) - #53592 (docs: minor stylistic changes to str/string docs) - #53594 (Update RELEASES.md to include clippy-preview) - #53600 (Fix a grammatical mistake in "expected generic arguments" errors) - #53614 (update nomicon and book) - #53617 (tidy: Stop requiring a license header) - #53618 (Add missing fmt examples) - #53636 (Prefer `.nth(n)` over `.skip(n).next()`.) - #53644 (Use SmallVec for SmallCStr) - #53664 (Remove unnecessary closure in rustc_mir/build/mod.rs) - #53666 (Added rustc_codegen_llvm to compiler documentation.)
This commit is contained in:
commit
727eabd681
114 changed files with 382 additions and 305 deletions
|
|
@ -39,6 +39,8 @@ Misc
|
|||
will demote `deny` and `forbid` lints to `warn`.
|
||||
- [`rustc` and `rustdoc` will now have the exit code of `1` if compilation
|
||||
fails, and `101` if there is a panic.][52197]
|
||||
- [A preview of clippy has been made available through rustup.][51122]
|
||||
You can install the preview with `rustup component add clippy-preview`
|
||||
|
||||
Compatibility Notes
|
||||
-------------------
|
||||
|
|
@ -64,6 +66,7 @@ Compatibility Notes
|
|||
[51619]: https://github.com/rust-lang/rust/pull/51619/
|
||||
[51656]: https://github.com/rust-lang/rust/pull/51656/
|
||||
[51178]: https://github.com/rust-lang/rust/pull/51178/
|
||||
[51122]: https://github.com/rust-lang/rust/pull/51122
|
||||
[50494]: https://github.com/rust-lang/rust/pull/50494/
|
||||
[cargo/5614]: https://github.com/rust-lang/cargo/pull/5614/
|
||||
[cargo/5723]: https://github.com/rust-lang/cargo/pull/5723/
|
||||
|
|
|
|||
|
|
@ -712,7 +712,7 @@ impl Step for Rustc {
|
|||
|
||||
// Find dependencies for top level crates.
|
||||
let mut compiler_crates = HashSet::new();
|
||||
for root_crate in &["rustc", "rustc_driver"] {
|
||||
for root_crate in &["rustc", "rustc_driver", "rustc_codegen_llvm"] {
|
||||
let interned_root_crate = INTERNER.intern_str(root_crate);
|
||||
find_compiler_crates(builder, &interned_root_crate, &mut compiler_crates);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 88cdde350fd3a90c93f3bac8b4f168f105d28060
|
||||
Subproject commit 16c9dee7666c2b2766fd98d89003e028679d1207
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 790e96b87f4b5817cac310e73a524d25c3d076d8
|
||||
Subproject commit ae42ad7aa4d7907cca941371c9eee8de8c2ee40d
|
||||
|
|
@ -513,7 +513,7 @@ impl str {
|
|||
unsafe { String::from_utf8_unchecked(slice.into_vec()) }
|
||||
}
|
||||
|
||||
/// Create a [`String`] by repeating a string `n` times.
|
||||
/// Creates a new [`String`] by repeating a string `n` times.
|
||||
///
|
||||
/// [`String`]: string/struct.String.html
|
||||
///
|
||||
|
|
|
|||
|
|
@ -752,7 +752,7 @@ impl String {
|
|||
self.vec
|
||||
}
|
||||
|
||||
/// Extracts a string slice containing the entire string.
|
||||
/// Extracts a string slice containing the entire `String`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
@ -1454,8 +1454,8 @@ impl String {
|
|||
self.vec.clear()
|
||||
}
|
||||
|
||||
/// Creates a draining iterator that removes the specified range in the string
|
||||
/// and yields the removed chars.
|
||||
/// Creates a draining iterator that removes the specified range in the `String`
|
||||
/// and yields the removed `chars`.
|
||||
///
|
||||
/// Note: The element range is removed even if the iterator is not
|
||||
/// consumed until the end.
|
||||
|
|
|
|||
|
|
@ -1132,6 +1132,36 @@ impl<'a> Formatter<'a> {
|
|||
///
|
||||
/// This function will correctly account for the flags provided as well as
|
||||
/// the minimum width. It will not take precision into account.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fmt;
|
||||
///
|
||||
/// struct Foo { nb: i32 };
|
||||
///
|
||||
/// impl Foo {
|
||||
/// fn new(nb: i32) -> Foo {
|
||||
/// Foo {
|
||||
/// nb,
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// impl fmt::Display for Foo {
|
||||
/// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
/// // We need to remove "-" from the number output.
|
||||
/// let tmp = self.nb.abs().to_string();
|
||||
///
|
||||
/// formatter.pad_integral(self.nb > 0, "Foo ", &tmp)
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// assert_eq!(&format!("{}", Foo::new(2)), "2");
|
||||
/// assert_eq!(&format!("{}", Foo::new(-1)), "-1");
|
||||
/// assert_eq!(&format!("{:#}", Foo::new(-1)), "-Foo 1");
|
||||
/// assert_eq!(&format!("{:0>#8}", Foo::new(-1)), "00-Foo 1");
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn pad_integral(&mut self,
|
||||
is_nonnegative: bool,
|
||||
|
|
@ -1232,7 +1262,7 @@ impl<'a> Formatter<'a> {
|
|||
// If our string is longer that the precision, then we must have
|
||||
// truncation. However other flags like `fill`, `width` and `align`
|
||||
// must act as always.
|
||||
if let Some((i, _)) = s.char_indices().skip(max).next() {
|
||||
if let Some((i, _)) = s.char_indices().nth(max) {
|
||||
// LLVM here can't prove that `..i` won't panic `&s[..i]`, but
|
||||
// we know that it can't panic. Use `get` + `unwrap_or` to avoid
|
||||
// `unsafe` and otherwise don't emit any panic-related code
|
||||
|
|
@ -1381,12 +1411,48 @@ impl<'a> Formatter<'a> {
|
|||
|
||||
/// Writes some data to the underlying buffer contained within this
|
||||
/// formatter.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fmt;
|
||||
///
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl fmt::Display for Foo {
|
||||
/// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
/// formatter.write_str("Foo")
|
||||
/// // This is equivalent to:
|
||||
/// // write!(formatter, "Foo")
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// assert_eq!(&format!("{}", Foo), "Foo");
|
||||
/// assert_eq!(&format!("{:0>8}", Foo), "Foo");
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn write_str(&mut self, data: &str) -> Result {
|
||||
self.buf.write_str(data)
|
||||
}
|
||||
|
||||
/// Writes some formatted information into this instance.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fmt;
|
||||
///
|
||||
/// struct Foo(i32);
|
||||
///
|
||||
/// impl fmt::Display for Foo {
|
||||
/// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
/// formatter.write_fmt(format_args!("Foo {}", self.0))
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// assert_eq!(&format!("{}", Foo(-1)), "Foo -1");
|
||||
/// assert_eq!(&format!("{:0>8}", Foo(2)), "Foo 2");
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn write_fmt(&mut self, fmt: Arguments) -> Result {
|
||||
write(self.buf, fmt)
|
||||
|
|
|
|||
|
|
@ -29,13 +29,15 @@ use ops::{Deref, DerefMut, CoerceUnsized};
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use intrinsics::transmute;
|
||||
|
||||
/// Leaks a value: takes ownership and "forgets" about the value **without running
|
||||
/// its destructor**.
|
||||
/// Takes ownership and "forgets" about the value **without running its destructor**.
|
||||
///
|
||||
/// Any resources the value manages, such as heap memory or a file handle, will linger
|
||||
/// forever in an unreachable state.
|
||||
/// forever in an unreachable state. However, it does not guarantee that pointers
|
||||
/// to this memory will remain valid.
|
||||
///
|
||||
/// If you want to dispose of a value properly, running its destructor, see
|
||||
/// * If you want to leak memory, see [`Box::leak`][leak].
|
||||
/// * If you want to obtain a raw pointer to the memory, see [`Box::into_raw`][into_raw].
|
||||
/// * If you want to dispose of a value properly, running its destructor, see
|
||||
/// [`mem::drop`][drop].
|
||||
///
|
||||
/// # Safety
|
||||
|
|
@ -59,15 +61,6 @@ pub use intrinsics::transmute;
|
|||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Leak some heap memory by never deallocating it:
|
||||
///
|
||||
/// ```
|
||||
/// use std::mem;
|
||||
///
|
||||
/// let heap_memory = Box::new(3);
|
||||
/// mem::forget(heap_memory);
|
||||
/// ```
|
||||
///
|
||||
/// Leak an I/O object, never closing the file:
|
||||
///
|
||||
/// ```no_run
|
||||
|
|
@ -137,38 +130,13 @@ pub use intrinsics::transmute;
|
|||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// ## Use case 3
|
||||
///
|
||||
/// You are transferring ownership across a [FFI] boundary to code written in
|
||||
/// another language. You need to `forget` the value on the Rust side because Rust
|
||||
/// code is no longer responsible for it.
|
||||
///
|
||||
/// ```no_run
|
||||
/// use std::mem;
|
||||
///
|
||||
/// extern "C" {
|
||||
/// fn my_c_function(x: *const u32);
|
||||
/// }
|
||||
///
|
||||
/// let x: Box<u32> = Box::new(3);
|
||||
///
|
||||
/// // Transfer ownership into C code.
|
||||
/// unsafe {
|
||||
/// my_c_function(&*x);
|
||||
/// }
|
||||
/// mem::forget(x);
|
||||
/// ```
|
||||
///
|
||||
/// In this case, C code must call back into Rust to free the object. Calling C's `free`
|
||||
/// function on a [`Box`][box] is *not* safe! Also, `Box` provides an [`into_raw`][into_raw]
|
||||
/// method which is the preferred way to do this in practice.
|
||||
///
|
||||
/// [drop]: fn.drop.html
|
||||
/// [uninit]: fn.uninitialized.html
|
||||
/// [clone]: ../clone/trait.Clone.html
|
||||
/// [swap]: fn.swap.html
|
||||
/// [FFI]: ../../book/first-edition/ffi.html
|
||||
/// [box]: ../../std/boxed/struct.Box.html
|
||||
/// [leak]: ../../std/boxed/struct.Box.html#method.leak
|
||||
/// [into_raw]: ../../std/boxed/struct.Box.html#method.into_raw
|
||||
/// [ub]: ../../reference/behavior-considered-undefined.html
|
||||
#[inline]
|
||||
|
|
|
|||
|
|
@ -1091,6 +1091,7 @@ impl_stable_hash_for!(enum traits::Reveal {
|
|||
});
|
||||
|
||||
impl_stable_hash_for!(enum ::middle::privacy::AccessLevel {
|
||||
ReachableFromImplTrait,
|
||||
Reachable,
|
||||
Exported,
|
||||
Public
|
||||
|
|
|
|||
|
|
@ -1330,7 +1330,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
s
|
||||
};
|
||||
let var_description = match var_origin {
|
||||
infer::MiscVariable(_) => "".to_string(),
|
||||
infer::MiscVariable(_) => String::new(),
|
||||
infer::PatternRegion(_) => " for pattern".to_string(),
|
||||
infer::AddrOfRegion(_) => " for borrow expression".to_string(),
|
||||
infer::Autoref(_) => " for autoref".to_string(),
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ use syntax::ast::NodeId;
|
|||
// Accessibility levels, sorted in ascending order
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum AccessLevel {
|
||||
// Superset of Reachable used to mark impl Trait items.
|
||||
ReachableFromImplTrait,
|
||||
// Exported items + items participating in various kinds of public interfaces,
|
||||
// but not directly nameable. For example, if function `fn f() -> T {...}` is
|
||||
// public, then type `T` is reachable. Its values can be obtained by other crates
|
||||
|
|
@ -40,7 +42,7 @@ pub struct AccessLevels<Id = NodeId> {
|
|||
|
||||
impl<Id: Hash + Eq> AccessLevels<Id> {
|
||||
pub fn is_reachable(&self, id: Id) -> bool {
|
||||
self.map.contains_key(&id)
|
||||
self.map.get(&id) >= Some(&AccessLevel::Reachable)
|
||||
}
|
||||
pub fn is_exported(&self, id: Id) -> bool {
|
||||
self.map.get(&id) >= Some(&AccessLevel::Exported)
|
||||
|
|
|
|||
|
|
@ -434,6 +434,8 @@ fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) ->
|
|||
// Step 2: Mark all symbols that the symbols on the worklist touch.
|
||||
reachable_context.propagate();
|
||||
|
||||
debug!("Inline reachability shows: {:?}", reachable_context.reachable_symbols);
|
||||
|
||||
// Return the set of reachable symbols.
|
||||
ReachableSet(Lrc::new(reachable_context.reachable_symbols))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2105,7 +2105,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
|||
region
|
||||
} else {
|
||||
// Do not even print 'static
|
||||
"".to_owned()
|
||||
String::new()
|
||||
};
|
||||
write!(fmt, "&{}{}{:?}", region, kind_str, place)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1051,7 +1051,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
|
|||
"perform LLVM link-time optimizations"),
|
||||
target_cpu: Option<String> = (None, parse_opt_string, [TRACKED],
|
||||
"select target processor (rustc --print target-cpus for details)"),
|
||||
target_feature: String = ("".to_string(), parse_string, [TRACKED],
|
||||
target_feature: String = (String::new(), parse_string, [TRACKED],
|
||||
"target specific attributes (rustc --print target-features for details)"),
|
||||
passes: Vec<String> = (Vec::new(), parse_list, [TRACKED],
|
||||
"a list of extra LLVM passes to run (space separated)"),
|
||||
|
|
@ -1085,7 +1085,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
|
|||
"choose the code model to use (rustc --print code-models for details)"),
|
||||
metadata: Vec<String> = (Vec::new(), parse_list, [TRACKED],
|
||||
"metadata to mangle symbol names with"),
|
||||
extra_filename: String = ("".to_string(), parse_string, [UNTRACKED],
|
||||
extra_filename: String = (String::new(), parse_string, [UNTRACKED],
|
||||
"extra data to put in each output filename"),
|
||||
codegen_units: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
|
||||
"divide crate into N units to optimize in parallel"),
|
||||
|
|
@ -1992,7 +1992,7 @@ pub fn build_session_options_and_crate_config(
|
|||
};
|
||||
if cg.target_feature == "help" {
|
||||
prints.push(PrintRequest::TargetFeatures);
|
||||
cg.target_feature = "".to_string();
|
||||
cg.target_feature = String::new();
|
||||
}
|
||||
if cg.relocation_model.as_ref().map_or(false, |s| s == "help") {
|
||||
prints.push(PrintRequest::RelocationModels);
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
if len > 5 {
|
||||
format!("\nand {} others", len - 4)
|
||||
} else {
|
||||
"".to_owned()
|
||||
String::new()
|
||||
}
|
||||
));
|
||||
}
|
||||
|
|
@ -917,7 +917,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
remove_refs);
|
||||
|
||||
err.span_suggestion_short_with_applicability(
|
||||
sp, &format_str, String::from(""), Applicability::MachineApplicable
|
||||
sp, &format_str, String::new(), Applicability::MachineApplicable
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1116,7 +1116,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
.collect::<Vec<String>>()
|
||||
.join(", "))
|
||||
} else {
|
||||
"".to_owned()
|
||||
String::new()
|
||||
},
|
||||
);
|
||||
err.span_suggestion_with_applicability(
|
||||
|
|
|
|||
|
|
@ -120,13 +120,13 @@ impl IntercrateAmbiguityCause {
|
|||
&IntercrateAmbiguityCause::DownstreamCrate { ref trait_desc, ref self_desc } => {
|
||||
let self_desc = if let &Some(ref ty) = self_desc {
|
||||
format!(" for type `{}`", ty)
|
||||
} else { "".to_string() };
|
||||
} else { String::new() };
|
||||
format!("downstream crates may implement trait `{}`{}", trait_desc, self_desc)
|
||||
}
|
||||
&IntercrateAmbiguityCause::UpstreamCrateUpdate { ref trait_desc, ref self_desc } => {
|
||||
let self_desc = if let &Some(ref ty) = self_desc {
|
||||
format!(" for type `{}`", ty)
|
||||
} else { "".to_string() };
|
||||
} else { String::new() };
|
||||
format!("upstream crates may add new impl of trait `{}`{} \
|
||||
in future versions",
|
||||
trait_desc, self_desc)
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ fn print_time_passes_entry_internal(what: &str, dur: Duration) {
|
|||
let mb = n as f64 / 1_000_000.0;
|
||||
format!("; rss: {}MB", mb.round() as usize)
|
||||
}
|
||||
None => "".to_owned(),
|
||||
None => String::new(),
|
||||
};
|
||||
println!("{}time: {}{}\t{}",
|
||||
" ".repeat(indentation),
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ macro_rules! define_categories {
|
|||
(format!("{:.2}",
|
||||
(((hits as f32) / (total as f32)) * 100.0)), total.to_string())
|
||||
} else {
|
||||
("".into(), "".into())
|
||||
(String::new(), String::new())
|
||||
};
|
||||
|
||||
writeln!(
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ impl<'a, 'tcx> UnusedMutCx<'a, 'tcx> {
|
|||
.span_suggestion_short_with_applicability(
|
||||
mut_span,
|
||||
"remove this `mut`",
|
||||
"".to_owned(),
|
||||
String::new(),
|
||||
Applicability::MachineApplicable)
|
||||
.emit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,21 +140,21 @@ impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O
|
|||
let gens_str = if gens.iter().any(|&u| u != 0) {
|
||||
format!(" gen: {}", bits_to_string(gens))
|
||||
} else {
|
||||
"".to_string()
|
||||
String::new()
|
||||
};
|
||||
|
||||
let action_kills = &self.action_kills[start .. end];
|
||||
let action_kills_str = if action_kills.iter().any(|&u| u != 0) {
|
||||
format!(" action_kill: {}", bits_to_string(action_kills))
|
||||
} else {
|
||||
"".to_string()
|
||||
String::new()
|
||||
};
|
||||
|
||||
let scope_kills = &self.scope_kills[start .. end];
|
||||
let scope_kills_str = if scope_kills.iter().any(|&u| u != 0) {
|
||||
format!(" scope_kill: {}", bits_to_string(scope_kills))
|
||||
} else {
|
||||
"".to_string()
|
||||
String::new()
|
||||
};
|
||||
|
||||
ps.synth_comment(
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> {
|
|||
fn dataflow_for(&self, e: EntryOrExit, n: &Node<'a>) -> String {
|
||||
let id = n.1.data.id();
|
||||
debug!("dataflow_for({:?}, id={:?}) {:?}", e, id, self.variants);
|
||||
let mut sets = "".to_string();
|
||||
let mut sets = String::new();
|
||||
let mut seen_one = false;
|
||||
for &variant in &self.variants {
|
||||
if seen_one { sets.push_str(" "); } else { seen_one = true; }
|
||||
|
|
|
|||
|
|
@ -1191,7 +1191,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
|
|||
member_descriptions);
|
||||
vec![
|
||||
MemberDescription {
|
||||
name: "".to_string(),
|
||||
name: String::new(),
|
||||
type_metadata: variant_type_metadata,
|
||||
offset: Size::ZERO,
|
||||
size: self.layout.size,
|
||||
|
|
@ -1220,7 +1220,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
|
|||
variant_type_metadata,
|
||||
member_descriptions);
|
||||
MemberDescription {
|
||||
name: "".to_string(),
|
||||
name: String::new(),
|
||||
type_metadata: variant_type_metadata,
|
||||
offset: Size::ZERO,
|
||||
size: variant.size,
|
||||
|
|
|
|||
|
|
@ -11,69 +11,61 @@
|
|||
use std::ffi;
|
||||
use std::ops::Deref;
|
||||
|
||||
const SIZE: usize = 38;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
const SIZE: usize = 36;
|
||||
|
||||
/// Like SmallVec but for C strings.
|
||||
#[derive(Clone)]
|
||||
pub enum SmallCStr {
|
||||
OnStack {
|
||||
data: [u8; SIZE],
|
||||
len_with_nul: u8,
|
||||
},
|
||||
OnHeap {
|
||||
data: ffi::CString,
|
||||
}
|
||||
pub struct SmallCStr {
|
||||
data: SmallVec<[u8; SIZE]>,
|
||||
}
|
||||
|
||||
impl SmallCStr {
|
||||
#[inline]
|
||||
pub fn new(s: &str) -> SmallCStr {
|
||||
if s.len() < SIZE {
|
||||
let mut data = [0; SIZE];
|
||||
data[.. s.len()].copy_from_slice(s.as_bytes());
|
||||
let len_with_nul = s.len() + 1;
|
||||
|
||||
// Make sure once that this is a valid CStr
|
||||
if let Err(e) = ffi::CStr::from_bytes_with_nul(&data[.. len_with_nul]) {
|
||||
panic!("The string \"{}\" cannot be converted into a CStr: {}", s, e);
|
||||
}
|
||||
|
||||
SmallCStr::OnStack {
|
||||
data,
|
||||
len_with_nul: len_with_nul as u8,
|
||||
}
|
||||
let len = s.len();
|
||||
let len1 = len + 1;
|
||||
let data = if len < SIZE {
|
||||
let mut buf = [0; SIZE];
|
||||
buf[..len].copy_from_slice(s.as_bytes());
|
||||
SmallVec::from_buf_and_len(buf, len1)
|
||||
} else {
|
||||
SmallCStr::OnHeap {
|
||||
data: ffi::CString::new(s).unwrap()
|
||||
}
|
||||
let mut data = Vec::with_capacity(len1);
|
||||
data.extend_from_slice(s.as_bytes());
|
||||
data.push(0);
|
||||
SmallVec::from_vec(data)
|
||||
};
|
||||
if let Err(e) = ffi::CStr::from_bytes_with_nul(&data) {
|
||||
panic!("The string \"{}\" cannot be converted into a CStr: {}", s, e);
|
||||
}
|
||||
SmallCStr { data }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn new_with_nul(s: &str) -> SmallCStr {
|
||||
let b = s.as_bytes();
|
||||
if let Err(e) = ffi::CStr::from_bytes_with_nul(b) {
|
||||
panic!("The string \"{}\" cannot be converted into a CStr: {}", s, e);
|
||||
}
|
||||
SmallCStr { data: SmallVec::from_slice(s.as_bytes()) }
|
||||
}
|
||||
|
||||
|
||||
#[inline]
|
||||
pub fn as_c_str(&self) -> &ffi::CStr {
|
||||
match *self {
|
||||
SmallCStr::OnStack { ref data, len_with_nul } => {
|
||||
unsafe {
|
||||
let slice = &data[.. len_with_nul as usize];
|
||||
ffi::CStr::from_bytes_with_nul_unchecked(slice)
|
||||
}
|
||||
}
|
||||
SmallCStr::OnHeap { ref data } => {
|
||||
data.as_c_str()
|
||||
}
|
||||
unsafe {
|
||||
ffi::CStr::from_bytes_with_nul_unchecked(&self.data[..])
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn len_with_nul(&self) -> usize {
|
||||
match *self {
|
||||
SmallCStr::OnStack { len_with_nul, .. } => {
|
||||
len_with_nul as usize
|
||||
}
|
||||
SmallCStr::OnHeap { ref data } => {
|
||||
data.as_bytes_with_nul().len()
|
||||
}
|
||||
}
|
||||
self.data.len()
|
||||
}
|
||||
|
||||
pub fn spilled(&self) -> bool {
|
||||
self.data.spilled()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +77,6 @@ impl Deref for SmallCStr {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn short() {
|
||||
const TEXT: &str = "abcd";
|
||||
|
|
@ -95,7 +86,7 @@ fn short() {
|
|||
|
||||
assert_eq!(scs.len_with_nul(), TEXT.len() + 1);
|
||||
assert_eq!(scs.as_c_str(), reference.as_c_str());
|
||||
assert!(if let SmallCStr::OnStack { .. } = scs { true } else { false });
|
||||
assert!(!scs.spilled());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -107,7 +98,7 @@ fn empty() {
|
|||
|
||||
assert_eq!(scs.len_with_nul(), TEXT.len() + 1);
|
||||
assert_eq!(scs.as_c_str(), reference.as_c_str());
|
||||
assert!(if let SmallCStr::OnStack { .. } = scs { true } else { false });
|
||||
assert!(!scs.spilled());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -121,7 +112,7 @@ fn long() {
|
|||
|
||||
assert_eq!(scs.len_with_nul(), TEXT.len() + 1);
|
||||
assert_eq!(scs.as_c_str(), reference.as_c_str());
|
||||
assert!(if let SmallCStr::OnHeap { .. } = scs { true } else { false });
|
||||
assert!(scs.spilled());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ pub fn html_of_effect(eff: &Effect) -> (String, String) {
|
|||
fn html_of_duration(_start: &Instant, dur: &Duration) -> (String, String) {
|
||||
use rustc::util::common::duration_to_secs_str;
|
||||
(duration_to_secs_str(dur.clone()),
|
||||
"".to_string()
|
||||
String::new()
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -798,7 +798,7 @@ impl EmitterWriter {
|
|||
// at by "in this macro invocation"
|
||||
format!(" (#{})", i + 1)
|
||||
} else {
|
||||
"".to_string()
|
||||
String::new()
|
||||
})));
|
||||
}
|
||||
// Check to make sure we're not in any <*macros>
|
||||
|
|
@ -813,7 +813,7 @@ impl EmitterWriter {
|
|||
// backtrace is multiple levels deep
|
||||
format!(" (#{})", i + 1)
|
||||
} else {
|
||||
"".to_string()
|
||||
String::new()
|
||||
})));
|
||||
if !always_backtrace {
|
||||
break;
|
||||
|
|
@ -1065,7 +1065,7 @@ impl EmitterWriter {
|
|||
let col = if let Some(first_annotation) = first_line.annotations.first() {
|
||||
format!(":{}", first_annotation.start_col + 1)
|
||||
} else {
|
||||
"".to_string()
|
||||
String::new()
|
||||
};
|
||||
format!("{}:{}{}",
|
||||
annotated_file.file.name,
|
||||
|
|
|
|||
|
|
@ -295,7 +295,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnsafeCode {
|
|||
declare_lint! {
|
||||
pub MISSING_DOCS,
|
||||
Allow,
|
||||
"detects missing documentation for public members"
|
||||
"detects missing documentation for public members",
|
||||
report_in_external_macro: true
|
||||
}
|
||||
|
||||
pub struct MissingDoc {
|
||||
|
|
@ -794,7 +795,7 @@ impl EarlyLintPass for DeprecatedAttr {
|
|||
err.span_suggestion_short_with_applicability(
|
||||
attr.span,
|
||||
"remove this attribute",
|
||||
"".to_owned(),
|
||||
String::new(),
|
||||
Applicability::MachineApplicable
|
||||
);
|
||||
err.emit();
|
||||
|
|
@ -1250,7 +1251,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems {
|
|||
err.span_suggestion_short_with_applicability(
|
||||
no_mangle_attr.span,
|
||||
"remove this attribute",
|
||||
"".to_owned(),
|
||||
String::new(),
|
||||
// Use of `#[no_mangle]` suggests FFI intent; correct
|
||||
// fix may be to monomorphize source by hand
|
||||
Applicability::MaybeIncorrect
|
||||
|
|
|
|||
|
|
@ -1111,7 +1111,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
|||
let trait_ref = tcx.impl_trait_ref(def_id);
|
||||
let parent = if let Some(trait_ref) = trait_ref {
|
||||
let trait_def = tcx.trait_def(trait_ref.def_id);
|
||||
trait_def.ancestors(tcx, def_id).skip(1).next().and_then(|node| {
|
||||
trait_def.ancestors(tcx, def_id).nth(1).and_then(|node| {
|
||||
match node {
|
||||
specialization_graph::Node::Impl(parent) => Some(parent),
|
||||
_ => None,
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
|
|||
err.span_suggestion_short_with_applicability(
|
||||
mut_span,
|
||||
"remove this `mut`",
|
||||
"".to_owned(),
|
||||
String::new(),
|
||||
Applicability::MachineApplicable);
|
||||
|
||||
err.buffer(&mut mbcx.errors_buffer);
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
} else {
|
||||
item_msg = format!("data in a {}", pointer_type);
|
||||
reason = "".to_string();
|
||||
reason = String::new();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
|
|||
Place::Static(box Static { def_id, ty: _ }) => {
|
||||
if let Place::Static(_) = access_place {
|
||||
item_msg = format!("immutable static item `{}`", access_place_desc.unwrap());
|
||||
reason = "".to_string();
|
||||
reason = String::new();
|
||||
} else {
|
||||
item_msg = format!("`{}`", access_place_desc.unwrap());
|
||||
let static_name = &self.tcx.item_name(*def_id);
|
||||
|
|
|
|||
|
|
@ -37,9 +37,6 @@ use util as mir_util;
|
|||
/// Construct the MIR for a given def-id.
|
||||
pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'tcx> {
|
||||
let id = tcx.hir.as_local_node_id(def_id).unwrap();
|
||||
let unsupported = || {
|
||||
span_bug!(tcx.hir.span(id), "can't build MIR for {:?}", def_id);
|
||||
};
|
||||
|
||||
// Figure out what primary body this item has.
|
||||
let body_id = match tcx.hir.get(id) {
|
||||
|
|
@ -50,7 +47,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t
|
|||
|
||||
_ => match tcx.hir.maybe_body_owned_by(id) {
|
||||
Some(body) => body,
|
||||
None => unsupported(),
|
||||
None => span_bug!(tcx.hir.span(id), "can't build MIR for {:?}", def_id),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -474,7 +474,7 @@ pub trait BorrowckErrors<'cx>: Sized + Copy {
|
|||
) -> DiagnosticBuilder<'cx> {
|
||||
let moved_path = moved_path
|
||||
.map(|mp| format!(": `{}`", mp))
|
||||
.unwrap_or("".to_owned());
|
||||
.unwrap_or(String::new());
|
||||
|
||||
let err = struct_span_err!(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ struct EmbargoVisitor<'a, 'tcx: 'a> {
|
|||
}
|
||||
|
||||
struct ReachEverythingInTheInterfaceVisitor<'b, 'a: 'b, 'tcx: 'a> {
|
||||
access_level: Option<AccessLevel>,
|
||||
item_def_id: DefId,
|
||||
ev: &'b mut EmbargoVisitor<'a, 'tcx>,
|
||||
}
|
||||
|
|
@ -132,6 +133,7 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> {
|
|||
fn reach<'b>(&'b mut self, item_id: ast::NodeId)
|
||||
-> ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> {
|
||||
ReachEverythingInTheInterfaceVisitor {
|
||||
access_level: self.prev_level.map(|l| l.min(AccessLevel::Reachable)),
|
||||
item_def_id: self.tcx.hir.local_def_id(item_id),
|
||||
ev: self,
|
||||
}
|
||||
|
|
@ -214,7 +216,15 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
}
|
||||
hir::ItemKind::Existential(..) |
|
||||
// Impl trait return types mark their parent function.
|
||||
// It (and its children) are revisited if the change applies.
|
||||
hir::ItemKind::Existential(ref ty_data) => {
|
||||
if let Some(impl_trait_fn) = ty_data.impl_trait_fn {
|
||||
if let Some(node_id) = self.tcx.hir.as_local_node_id(impl_trait_fn) {
|
||||
self.update(node_id, Some(AccessLevel::ReachableFromImplTrait));
|
||||
}
|
||||
}
|
||||
}
|
||||
hir::ItemKind::Use(..) |
|
||||
hir::ItemKind::Static(..) |
|
||||
hir::ItemKind::Const(..) |
|
||||
|
|
@ -226,6 +236,10 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
|
|||
hir::ItemKind::ExternCrate(..) => {}
|
||||
}
|
||||
|
||||
// Store this node's access level here to propagate the correct
|
||||
// reachability level through interfaces and children.
|
||||
let orig_level = replace(&mut self.prev_level, item_level);
|
||||
|
||||
// Mark all items in interfaces of reachable items as reachable
|
||||
match item.node {
|
||||
// The interface is empty
|
||||
|
|
@ -324,9 +338,6 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
let orig_level = self.prev_level;
|
||||
self.prev_level = item_level;
|
||||
|
||||
intravisit::walk_item(self, item);
|
||||
|
||||
self.prev_level = orig_level;
|
||||
|
|
@ -462,7 +473,7 @@ impl<'b, 'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> {
|
|||
fn check_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>) {
|
||||
if let Some(node_id) = self.ev.tcx.hir.as_local_node_id(trait_ref.def_id) {
|
||||
let item = self.ev.tcx.hir.expect_item(node_id);
|
||||
self.ev.update(item.id, Some(AccessLevel::Reachable));
|
||||
self.ev.update(item.id, self.access_level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -483,7 +494,7 @@ impl<'b, 'a, 'tcx> TypeVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'b
|
|||
|
||||
if let Some(def_id) = ty_def_id {
|
||||
if let Some(node_id) = self.ev.tcx.hir.as_local_node_id(def_id) {
|
||||
self.ev.update(node_id, Some(AccessLevel::Reachable));
|
||||
self.ev.update(node_id, self.access_level);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -994,7 +994,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
|
|||
let lev_suggestion =
|
||||
match find_best_match_for_name(names, &ident.as_str(), None) {
|
||||
Some(name) => format!(". Did you mean to use `{}`?", name),
|
||||
None => "".to_owned(),
|
||||
None => String::new(),
|
||||
};
|
||||
let msg = match module {
|
||||
ModuleOrUniformRoot::Module(module) => {
|
||||
|
|
|
|||
|
|
@ -1050,7 +1050,7 @@ impl<'a> DumpHandler<'a> {
|
|||
.iter()
|
||||
.any(|ct| *ct == CrateType::Executable);
|
||||
let mut out_name = if executable {
|
||||
"".to_owned()
|
||||
String::new()
|
||||
} else {
|
||||
"lib".to_owned()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
target_os: "ios".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "apple".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
target_os: "fuchsia".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: String::new(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: TargetOptions {
|
||||
abi_blacklist: super::arm_base::abi_blacklist(),
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
target_os: "android".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
target_os: "cloudabi".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
target_os: "freebsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
target_os: "hermit".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
target_os: "netbsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ pub fn target() -> Result<Target, String> {
|
|||
target_pointer_width: "64".to_string(),
|
||||
target_c_int_width: "32".to_string(),
|
||||
target_os: "none".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: String::new(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
target_os: "openbsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "android".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "E-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "none".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: String::new(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "ios".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "apple".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "android".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "cloudabi".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "ios".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "apple".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ pub fn target() -> Result<Target, String> {
|
|||
target_pointer_width: "32".to_string(),
|
||||
target_c_int_width: "32".to_string(),
|
||||
target_os: "emscripten".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
data_layout: "e-p:32:32-i64:64-v128:32:128-n32-S128".to_string(),
|
||||
arch: "asmjs".to_string(),
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "ios".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "apple".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "macos".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "apple".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "android".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "cloudabi".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "dragonfly".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "freebsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "haiku".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "netbsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "openbsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -686,7 +686,7 @@ impl Default for TargetOptions {
|
|||
post_link_args: LinkArgs::new(),
|
||||
asm_args: Vec::new(),
|
||||
cpu: "generic".to_string(),
|
||||
features: "".to_string(),
|
||||
features: String::new(),
|
||||
dynamic_linking: false,
|
||||
only_cdylib: false,
|
||||
executables: false,
|
||||
|
|
@ -698,7 +698,7 @@ impl Default for TargetOptions {
|
|||
function_sections: true,
|
||||
dll_prefix: "lib".to_string(),
|
||||
dll_suffix: ".so".to_string(),
|
||||
exe_suffix: "".to_string(),
|
||||
exe_suffix: String::new(),
|
||||
staticlib_prefix: "lib".to_string(),
|
||||
staticlib_suffix: ".a".to_string(),
|
||||
target_family: None,
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16".to_string(),
|
||||
arch: "msp430".to_string(),
|
||||
target_os: "none".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: String::new(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "E-m:e-p:32:32-i64:64-n32".to_string(),
|
||||
arch: "powerpc".to_string(),
|
||||
target_os: "netbsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ pub fn target() -> TargetResult {
|
|||
target_pointer_width: "32".to_string(),
|
||||
target_c_int_width: "32".to_string(),
|
||||
target_os: "none".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
arch: "riscv32".to_string(),
|
||||
linker_flavor: LinkerFlavor::Ld,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "E-m:e-i64:64-n32:64-S128".to_string(),
|
||||
arch: "sparc64".to_string(),
|
||||
target_os: "netbsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ pub fn target() -> TargetResult {
|
|||
// just be confusing.
|
||||
arch: "sparc64".to_string(),
|
||||
target_os: "solaris".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "sun".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "none".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: String::new(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "none".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: String::new(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "none".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: String::new(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "none".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: String::new(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ pub fn target() -> Result<Target, String> {
|
|||
target_pointer_width: "32".to_string(),
|
||||
target_c_int_width: "32".to_string(),
|
||||
target_os: "emscripten".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128".to_string(),
|
||||
arch: "wasm32".to_string(),
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ pub fn target() -> Result<Target, String> {
|
|||
target_pointer_width: "32".to_string(),
|
||||
target_c_int_width: "32".to_string(),
|
||||
target_os: "emscripten".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
data_layout: "e-p:32:32-i64:64-v128:32:128-n32-S128".to_string(),
|
||||
arch: "wasm32".to_string(),
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ pub fn target() -> Result<Target, String> {
|
|||
|
||||
// relatively self-explanatory!
|
||||
exe_suffix: ".wasm".to_string(),
|
||||
dll_prefix: "".to_string(),
|
||||
dll_prefix: String::new(),
|
||||
dll_suffix: ".wasm".to_string(),
|
||||
linker_is_gnu: false,
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ pub fn target() -> Result<Target, String> {
|
|||
// This is basically guaranteed to change in the future, don't rely on
|
||||
// this. Use `not(target_os = "emscripten")` for now.
|
||||
target_os: "unknown".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128".to_string(),
|
||||
arch: "wasm32".to_string(),
|
||||
|
|
|
|||
|
|
@ -77,10 +77,10 @@ pub fn opts() -> TargetOptions {
|
|||
linker: Some("gcc".to_string()),
|
||||
dynamic_linking: true,
|
||||
executables: true,
|
||||
dll_prefix: "".to_string(),
|
||||
dll_prefix: String::new(),
|
||||
dll_suffix: ".dll".to_string(),
|
||||
exe_suffix: ".exe".to_string(),
|
||||
staticlib_prefix: "".to_string(),
|
||||
staticlib_prefix: String::new(),
|
||||
staticlib_suffix: ".lib".to_string(),
|
||||
no_default_libraries: true,
|
||||
target_family: Some("windows".to_string()),
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ pub fn opts() -> TargetOptions {
|
|||
function_sections: true,
|
||||
dynamic_linking: true,
|
||||
executables: true,
|
||||
dll_prefix: "".to_string(),
|
||||
dll_prefix: String::new(),
|
||||
dll_suffix: ".dll".to_string(),
|
||||
exe_suffix: ".exe".to_string(),
|
||||
staticlib_prefix: "".to_string(),
|
||||
staticlib_prefix: String::new(),
|
||||
staticlib_suffix: ".lib".to_string(),
|
||||
target_family: Some("windows".to_string()),
|
||||
is_like_windows: true,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:o-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "macos".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "apple".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:o-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "ios".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "apple".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: TargetOptions {
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "fuchsia".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: String::new(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "android".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "netbsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "rumprun".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "solaris".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "sun".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "bitrig".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "cloudabi".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "dragonfly".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "freebsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "haiku".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "hermit".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "netbsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "openbsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
|
|||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "redox".to_string(),
|
||||
target_env: "".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
|
|||
quantifier,
|
||||
bound,
|
||||
kind,
|
||||
if required != 1 { "s" } else { "" },
|
||||
if bound != 1 { "s" } else { "" },
|
||||
)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1434,7 +1434,7 @@ fn check_specialization_validity<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
hir::ImplItemKind::Type(_) => ty::AssociatedKind::Type
|
||||
};
|
||||
|
||||
let parent = ancestors.defs(tcx, trait_item.ident, kind, trait_def.def_id).skip(1).next()
|
||||
let parent = ancestors.defs(tcx, trait_item.ident, kind, trait_def.def_id).nth(1)
|
||||
.map(|node_item| node_item.map(|parent| parent.defaultness));
|
||||
|
||||
if let Some(parent) = parent {
|
||||
|
|
@ -3471,7 +3471,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
displayable_field_names.sort();
|
||||
|
||||
let truncated_fields_error = if len <= 3 {
|
||||
"".to_string()
|
||||
String::new()
|
||||
} else {
|
||||
format!(" and {} other field{}", (len - 3), if len - 3 == 1 {""} else {"s"})
|
||||
};
|
||||
|
|
@ -4783,7 +4783,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
err.span_suggestion_with_applicability(
|
||||
span_semi,
|
||||
"consider removing this semicolon",
|
||||
"".to_string(),
|
||||
String::new(),
|
||||
Applicability::MachineApplicable);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) {
|
|||
.span_suggestion_short_with_applicability(
|
||||
span,
|
||||
"remove it",
|
||||
"".to_string(),
|
||||
String::new(),
|
||||
Applicability::MachineApplicable)
|
||||
.emit();
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -568,7 +568,7 @@ impl Clean<Item> for doctree::Module {
|
|||
let name = if self.name.is_some() {
|
||||
self.name.expect("No name provided").clean(cx)
|
||||
} else {
|
||||
"".to_string()
|
||||
String::new()
|
||||
};
|
||||
|
||||
// maintain a stack of mod ids, for doc comment path resolution
|
||||
|
|
@ -1760,7 +1760,7 @@ impl<'a, 'tcx> Clean<FnDecl> for (DefId, ty::PolyFnSig<'tcx>) {
|
|||
values: sig.skip_binder().inputs().iter().map(|t| {
|
||||
Argument {
|
||||
type_: t.clean(cx),
|
||||
name: names.next().map_or("".to_string(), |name| name.to_string()),
|
||||
name: names.next().map_or(String::new(), |name| name.to_string()),
|
||||
}
|
||||
}).collect(),
|
||||
},
|
||||
|
|
@ -3596,7 +3596,7 @@ impl Clean<Item> for hir::ForeignItem {
|
|||
ForeignStaticItem(Static {
|
||||
type_: ty.clean(cx),
|
||||
mutability: if mutbl {Mutable} else {Immutable},
|
||||
expr: "".to_string(),
|
||||
expr: String::new(),
|
||||
})
|
||||
}
|
||||
hir::ForeignItemKind::Type => {
|
||||
|
|
@ -3628,7 +3628,7 @@ impl ToSource for syntax_pos::Span {
|
|||
debug!("converting span {:?} to snippet", self.clean(cx));
|
||||
let sn = match cx.sess().source_map().span_to_snippet(*self) {
|
||||
Ok(x) => x.to_string(),
|
||||
Err(_) => "".to_string()
|
||||
Err(_) => String::new()
|
||||
};
|
||||
debug!("got snippet {}", sn);
|
||||
sn
|
||||
|
|
@ -3824,19 +3824,19 @@ impl Clean<Stability> for attr::Stability {
|
|||
feature: self.feature.to_string(),
|
||||
since: match self.level {
|
||||
attr::Stable {ref since} => since.to_string(),
|
||||
_ => "".to_string(),
|
||||
_ => String::new(),
|
||||
},
|
||||
deprecated_since: match self.rustc_depr {
|
||||
Some(attr::RustcDeprecation {ref since, ..}) => since.to_string(),
|
||||
_=> "".to_string(),
|
||||
_=> String::new(),
|
||||
},
|
||||
deprecated_reason: match self.rustc_depr {
|
||||
Some(ref depr) => depr.reason.to_string(),
|
||||
_ => "".to_string(),
|
||||
_ => String::new(),
|
||||
},
|
||||
unstable_reason: match self.level {
|
||||
attr::Unstable { reason: Some(ref reason), .. } => reason.to_string(),
|
||||
_ => "".to_string(),
|
||||
_ => String::new(),
|
||||
},
|
||||
issue: match self.level {
|
||||
attr::Unstable {issue, ..} => Some(issue),
|
||||
|
|
@ -3855,8 +3855,8 @@ impl<'a> Clean<Stability> for &'a attr::Stability {
|
|||
impl Clean<Deprecation> for attr::Deprecation {
|
||||
fn clean(&self, _: &DocContext) -> Deprecation {
|
||||
Deprecation {
|
||||
since: self.since.as_ref().map_or("".to_string(), |s| s.to_string()),
|
||||
note: self.note.as_ref().map_or("".to_string(), |s| s.to_string()),
|
||||
since: self.since.as_ref().map_or(String::new(), |s| s.to_string()),
|
||||
note: self.note.as_ref().map_or(String::new(), |s| s.to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -620,7 +620,7 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, use_absolute: bool) -> fmt:
|
|||
clean::BorrowedRef{ lifetime: ref l, mutability, type_: ref ty} => {
|
||||
let lt = match *l {
|
||||
Some(ref l) => format!("{} ", *l),
|
||||
_ => "".to_string(),
|
||||
_ => String::new(),
|
||||
};
|
||||
let m = MutableSpace(mutability);
|
||||
let amp = if f.alternate() {
|
||||
|
|
|
|||
|
|
@ -156,13 +156,13 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
|
|||
root_path = page.root_path,
|
||||
suffix=page.resource_suffix)
|
||||
} else {
|
||||
"".to_owned()
|
||||
String::new()
|
||||
},
|
||||
content = *t,
|
||||
root_path = page.root_path,
|
||||
css_class = page.css_class,
|
||||
logo = if layout.logo.is_empty() {
|
||||
"".to_string()
|
||||
String::new()
|
||||
} else {
|
||||
format!("<a href='{}{}/index.html'>\
|
||||
<img src='{}' alt='logo' width='100'></a>",
|
||||
|
|
@ -173,7 +173,7 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
|
|||
description = page.description,
|
||||
keywords = page.keywords,
|
||||
favicon = if layout.favicon.is_empty() {
|
||||
"".to_string()
|
||||
String::new()
|
||||
} else {
|
||||
format!(r#"<link rel="shortcut icon" href="{}">"#, layout.favicon)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -504,8 +504,8 @@ pub fn run(mut krate: clean::Crate,
|
|||
local_sources: FxHashMap(),
|
||||
issue_tracker_base_url: None,
|
||||
layout: layout::Layout {
|
||||
logo: "".to_string(),
|
||||
favicon: "".to_string(),
|
||||
logo: String::new(),
|
||||
favicon: String::new(),
|
||||
external_html: external_html.clone(),
|
||||
krate: krate.name.clone(),
|
||||
},
|
||||
|
|
@ -2183,7 +2183,7 @@ fn shorter<'a>(s: Option<&'a str>) -> String {
|
|||
!chr.is_whitespace()
|
||||
})
|
||||
}).collect::<Vec<_>>().join("\n"),
|
||||
None => "".to_string()
|
||||
None => String::new()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2479,7 +2479,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
|
|||
stab_docs = stab_docs,
|
||||
docs = MarkdownSummaryLine(doc_value, &myitem.links()),
|
||||
class = myitem.type_(),
|
||||
stab = myitem.stability_class().unwrap_or("".to_string()),
|
||||
stab = myitem.stability_class().unwrap_or(String::new()),
|
||||
unsafety_flag = unsafety_flag,
|
||||
href = item_path(myitem.type_(), myitem.name.as_ref().unwrap()),
|
||||
title_type = myitem.type_(),
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ pub unsafe fn raw(m: &Mutex) -> c::PSRWLOCK {
|
|||
impl Mutex {
|
||||
pub const fn new() -> Mutex {
|
||||
Mutex {
|
||||
// This works because SRWLOCK_INIT is 0 (wrapped in a struct), so we are also properly
|
||||
// initializing an SRWLOCK here.
|
||||
lock: AtomicUsize::new(0),
|
||||
held: UnsafeCell::new(false),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::Toke
|
|||
Ok(..) => {
|
||||
// Add this input file to the code map to make it available as
|
||||
// dependency information, but don't enter it's contents
|
||||
cx.source_map().new_source_file(file.into(), "".to_string());
|
||||
cx.source_map().new_source_file(file.into(), String::new());
|
||||
|
||||
base::MacEager::expr(cx.expr_lit(sp, ast::LitKind::ByteStr(Lrc::new(bytes))))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<String>, s: String, col:
|
|||
if col < len {
|
||||
(&s[col..len]).to_string()
|
||||
} else {
|
||||
"".to_string()
|
||||
String::new()
|
||||
}
|
||||
}
|
||||
None => s,
|
||||
|
|
|
|||
|
|
@ -684,7 +684,7 @@ impl<'a> Parser<'a> {
|
|||
let mut i = tokens.iter();
|
||||
// This might be a sign we need a connect method on Iterator.
|
||||
let b = i.next()
|
||||
.map_or("".to_string(), |t| t.to_string());
|
||||
.map_or(String::new(), |t| t.to_string());
|
||||
i.enumerate().fold(b, |mut b, (i, a)| {
|
||||
if tokens.len() > 2 && i == tokens.len() - 2 {
|
||||
b.push_str(", or ");
|
||||
|
|
@ -786,7 +786,7 @@ impl<'a> Parser<'a> {
|
|||
} else {
|
||||
err.span_label(self.span, "expected identifier");
|
||||
if self.token == token::Comma && self.look_ahead(1, |t| t.is_ident()) {
|
||||
err.span_suggestion(self.span, "remove this comma", "".into());
|
||||
err.span_suggestion(self.span, "remove this comma", String::new());
|
||||
}
|
||||
}
|
||||
err
|
||||
|
|
@ -2518,7 +2518,7 @@ impl<'a> Parser<'a> {
|
|||
err.span_suggestion_short_with_applicability(
|
||||
self.span,
|
||||
"remove this comma",
|
||||
"".to_owned(),
|
||||
String::new(),
|
||||
Applicability::MachineApplicable
|
||||
);
|
||||
err.note("the base struct must always be the last field");
|
||||
|
|
@ -3485,7 +3485,7 @@ impl<'a> Parser<'a> {
|
|||
e.span_suggestion_short_with_applicability(
|
||||
match_span,
|
||||
"try removing this `match`",
|
||||
"".to_owned(),
|
||||
String::new(),
|
||||
Applicability::MaybeIncorrect // speculative
|
||||
);
|
||||
}
|
||||
|
|
@ -3862,7 +3862,7 @@ impl<'a> Parser<'a> {
|
|||
if self.token == token::CloseDelim(token::Brace) {
|
||||
// If the struct looks otherwise well formed, recover and continue.
|
||||
if let Some(sp) = comma_sp {
|
||||
err.span_suggestion_short(sp, "remove this comma", "".into());
|
||||
err.span_suggestion_short(sp, "remove this comma", String::new());
|
||||
}
|
||||
err.emit();
|
||||
break;
|
||||
|
|
@ -3902,7 +3902,7 @@ impl<'a> Parser<'a> {
|
|||
err.multipart_suggestion(
|
||||
"move the `..` to the end of the field list",
|
||||
vec![
|
||||
(etc_span, "".into()),
|
||||
(etc_span, String::new()),
|
||||
(self.span, format!("{}.. }}", if ate_comma { "" } else { ", " })),
|
||||
],
|
||||
);
|
||||
|
|
@ -6210,7 +6210,7 @@ impl<'a> Parser<'a> {
|
|||
if token_str == ";" {
|
||||
let msg = "consider removing this semicolon";
|
||||
err.span_suggestion_short_with_applicability(
|
||||
self.span, msg, "".to_string(), Applicability::MachineApplicable
|
||||
self.span, msg, String::new(), Applicability::MachineApplicable
|
||||
);
|
||||
if !items.is_empty() { // Issue #51603
|
||||
let previous_item = &items[items.len()-1];
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue