Skip to content

Rollup of 4 pull requests #128428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
@@ -775,10 +775,10 @@ impl<'ll> CodegenCx<'ll, '_> {
ifn!("llvm.debugtrap", fn() -> void);
ifn!("llvm.frameaddress", fn(t_i32) -> ptr);

ifn!("llvm.powi.f16", fn(t_f16, t_i32) -> t_f16);
ifn!("llvm.powi.f32", fn(t_f32, t_i32) -> t_f32);
ifn!("llvm.powi.f64", fn(t_f64, t_i32) -> t_f64);
ifn!("llvm.powi.f128", fn(t_f128, t_i32) -> t_f128);
ifn!("llvm.powi.f16.i32", fn(t_f16, t_i32) -> t_f16);
ifn!("llvm.powi.f32.i32", fn(t_f32, t_i32) -> t_f32);
ifn!("llvm.powi.f64.i32", fn(t_f64, t_i32) -> t_f64);
ifn!("llvm.powi.f128.i32", fn(t_f128, t_i32) -> t_f128);

ifn!("llvm.pow.f16", fn(t_f16, t_f16) -> t_f16);
ifn!("llvm.pow.f32", fn(t_f32, t_f32) -> t_f32);
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
@@ -35,10 +35,10 @@ fn get_simple_intrinsic<'ll>(
sym::sqrtf64 => "llvm.sqrt.f64",
sym::sqrtf128 => "llvm.sqrt.f128",

sym::powif16 => "llvm.powi.f16",
sym::powif32 => "llvm.powi.f32",
sym::powif64 => "llvm.powi.f64",
sym::powif128 => "llvm.powi.f128",
sym::powif16 => "llvm.powi.f16.i32",
sym::powif32 => "llvm.powi.f32.i32",
sym::powif64 => "llvm.powi.f64.i32",
sym::powif128 => "llvm.powi.f128.i32",

sym::sinf16 => "llvm.sin.f16",
sym::sinf32 => "llvm.sin.f32",
8 changes: 7 additions & 1 deletion compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
@@ -544,7 +544,13 @@ fn resolver_for_lowering_raw<'tcx>(
let arenas = Resolver::arenas();
let _ = tcx.registered_tools(()); // Uses `crate_for_resolver`.
let (krate, pre_configured_attrs) = tcx.crate_for_resolver(()).steal();
let mut resolver = Resolver::new(tcx, &pre_configured_attrs, krate.spans.inner_span, &arenas);
let mut resolver = Resolver::new(
tcx,
&pre_configured_attrs,
krate.spans.inner_span,
krate.spans.inject_use_span,
&arenas,
);
let krate = configure_and_expand(krate, &pre_configured_attrs, &mut resolver);

// Make sure we don't mutate the cstore from here on.
546 changes: 179 additions & 367 deletions compiler/rustc_passes/src/check_attr.rs

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -2026,14 +2026,17 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
Applicability::MaybeIncorrect,
)),
)
} else if ident.name == kw::Underscore {
(format!("`_` is not a valid crate or module name"), None)
} else if self.tcx.sess.is_rust_2015() {
(
format!("you might be missing crate `{ident}`"),
Some((
vec![],
format!(
"consider adding `extern crate {ident}` to use the `{ident}` crate"
),
vec![(
self.current_crate_outer_attr_insert_span,
format!("extern crate {ident};\n"),
)],
format!("consider importing the `{ident}` crate"),
Applicability::MaybeIncorrect,
)),
)
6 changes: 6 additions & 0 deletions compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1180,6 +1180,10 @@ pub struct Resolver<'a, 'tcx> {
/// Simplified analogue of module `resolutions` but in trait impls, excluding glob delegations.
/// Needed because glob delegations exclude explicitly defined names.
impl_binding_keys: FxHashMap<LocalDefId, FxHashSet<BindingKey>>,

/// This is the `Span` where an `extern crate foo;` suggestion would be inserted, if `foo`
/// could be a crate that wasn't imported. For diagnostics use only.
current_crate_outer_attr_insert_span: Span,
}

/// Nothing really interesting here; it just provides memory for the rest of the crate.
@@ -1342,6 +1346,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
attrs: &[ast::Attribute],
crate_span: Span,
current_crate_outer_attr_insert_span: Span,
arenas: &'a ResolverArenas<'a>,
) -> Resolver<'a, 'tcx> {
let root_def_id = CRATE_DEF_ID.to_def_id();
@@ -1525,6 +1530,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
glob_delegation_invoc_ids: Default::default(),
impl_unexpanded_invocations: Default::default(),
impl_binding_keys: Default::default(),
current_crate_outer_attr_insert_span,
};

let root_parent_scope = ParentScope::module(graph_root, &resolver);
289 changes: 289 additions & 0 deletions library/core/src/intrinsics.rs

Large diffs are not rendered by default.

176 changes: 176 additions & 0 deletions library/core/src/num/f128.rs
Original file line number Diff line number Diff line change
@@ -686,6 +686,182 @@ impl f128 {
self * RADS_PER_DEG
}

/// Returns the maximum of the two numbers, ignoring NaN.
///
/// If one of the arguments is NaN, then the other argument is returned.
/// This follows the IEEE 754-2008 semantics for maxNum, except for handling of signaling NaNs;
/// this function handles all NaNs the same way and avoids maxNum's problems with associativity.
/// This also matches the behavior of libm’s fmax.
///
/// ```
/// #![feature(f128)]
/// # // Using aarch64 because `reliable_f128_math` is needed
/// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
///
/// let x = 1.0f128;
/// let y = 2.0f128;
///
/// assert_eq!(x.max(y), y);
/// # }
/// ```
#[inline]
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "this returns the result of the comparison, without modifying either input"]
pub fn max(self, other: f128) -> f128 {
intrinsics::maxnumf128(self, other)
}

/// Returns the minimum of the two numbers, ignoring NaN.
///
/// If one of the arguments is NaN, then the other argument is returned.
/// This follows the IEEE 754-2008 semantics for minNum, except for handling of signaling NaNs;
/// this function handles all NaNs the same way and avoids minNum's problems with associativity.
/// This also matches the behavior of libm’s fmin.
///
/// ```
/// #![feature(f128)]
/// # // Using aarch64 because `reliable_f128_math` is needed
/// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
///
/// let x = 1.0f128;
/// let y = 2.0f128;
///
/// assert_eq!(x.min(y), x);
/// # }
/// ```
#[inline]
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "this returns the result of the comparison, without modifying either input"]
pub fn min(self, other: f128) -> f128 {
intrinsics::minnumf128(self, other)
}

/// Returns the maximum of the two numbers, propagating NaN.
///
/// This returns NaN when *either* argument is NaN, as opposed to
/// [`f128::max`] which only returns NaN when *both* arguments are NaN.
///
/// ```
/// #![feature(f128)]
/// #![feature(float_minimum_maximum)]
/// # // Using aarch64 because `reliable_f128_math` is needed
/// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
///
/// let x = 1.0f128;
/// let y = 2.0f128;
///
/// assert_eq!(x.maximum(y), y);
/// assert!(x.maximum(f128::NAN).is_nan());
/// # }
/// ```
///
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the greater
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
/// Note that this follows the semantics specified in IEEE 754-2019.
///
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
/// operand is conserved; see [explanation of NaN as a special value](f128) for more info.
#[inline]
#[unstable(feature = "f128", issue = "116909")]
// #[unstable(feature = "float_minimum_maximum", issue = "91079")]
#[must_use = "this returns the result of the comparison, without modifying either input"]
pub fn maximum(self, other: f128) -> f128 {
if self > other {
self
} else if other > self {
other
} else if self == other {
if self.is_sign_positive() && other.is_sign_negative() { self } else { other }
} else {
self + other
}
}

/// Returns the minimum of the two numbers, propagating NaN.
///
/// This returns NaN when *either* argument is NaN, as opposed to
/// [`f128::min`] which only returns NaN when *both* arguments are NaN.
///
/// ```
/// #![feature(f128)]
/// #![feature(float_minimum_maximum)]
/// # // Using aarch64 because `reliable_f128_math` is needed
/// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
///
/// let x = 1.0f128;
/// let y = 2.0f128;
///
/// assert_eq!(x.minimum(y), x);
/// assert!(x.minimum(f128::NAN).is_nan());
/// # }
/// ```
///
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the lesser
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
/// Note that this follows the semantics specified in IEEE 754-2019.
///
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
/// operand is conserved; see [explanation of NaN as a special value](f128) for more info.
#[inline]
#[unstable(feature = "f128", issue = "116909")]
// #[unstable(feature = "float_minimum_maximum", issue = "91079")]
#[must_use = "this returns the result of the comparison, without modifying either input"]
pub fn minimum(self, other: f128) -> f128 {
if self < other {
self
} else if other < self {
other
} else if self == other {
if self.is_sign_negative() && other.is_sign_positive() { self } else { other }
} else {
// At least one input is NaN. Use `+` to perform NaN propagation and quieting.
self + other
}
}

/// Calculates the middle point of `self` and `rhs`.
///
/// This returns NaN when *either* argument is NaN or if a combination of
/// +inf and -inf is provided as arguments.
///
/// # Examples
///
/// ```
/// #![feature(f128)]
/// #![feature(num_midpoint)]
/// # // Using aarch64 because `reliable_f128_math` is needed
/// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
///
/// assert_eq!(1f128.midpoint(4.0), 2.5);
/// assert_eq!((-5.5f128).midpoint(8.0), 1.25);
/// # }
/// ```
#[inline]
#[unstable(feature = "f128", issue = "116909")]
// #[unstable(feature = "num_midpoint", issue = "110840")]
pub fn midpoint(self, other: f128) -> f128 {
const LO: f128 = f128::MIN_POSITIVE * 2.;
const HI: f128 = f128::MAX / 2.;

let (a, b) = (self, other);
let abs_a = a.abs_private();
let abs_b = b.abs_private();

if abs_a <= HI && abs_b <= HI {
// Overflow is impossible
(a + b) / 2.
} else if abs_a < LO {
// Not safe to halve `a` (would underflow)
a + (b / 2.)
} else if abs_b < LO {
// Not safe to halve `b` (would underflow)
(a / 2.) + b
} else {
// Safe to halve `a` and `b`
(a / 2.) + (b / 2.)
}
}

/// Rounds toward zero and converts to any primitive integer type,
/// assuming that the value is finite and fits in that type.
///
171 changes: 171 additions & 0 deletions library/core/src/num/f16.rs
Original file line number Diff line number Diff line change
@@ -720,6 +720,177 @@ impl f16 {
self * RADS_PER_DEG
}

/// Returns the maximum of the two numbers, ignoring NaN.
///
/// If one of the arguments is NaN, then the other argument is returned.
/// This follows the IEEE 754-2008 semantics for maxNum, except for handling of signaling NaNs;
/// this function handles all NaNs the same way and avoids maxNum's problems with associativity.
/// This also matches the behavior of libm’s fmax.
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
///
/// let x = 1.0f16;
/// let y = 2.0f16;
///
/// assert_eq!(x.max(y), y);
/// # }
/// ```
#[inline]
#[unstable(feature = "f16", issue = "116909")]
#[must_use = "this returns the result of the comparison, without modifying either input"]
pub fn max(self, other: f16) -> f16 {
intrinsics::maxnumf16(self, other)
}

/// Returns the minimum of the two numbers, ignoring NaN.
///
/// If one of the arguments is NaN, then the other argument is returned.
/// This follows the IEEE 754-2008 semantics for minNum, except for handling of signaling NaNs;
/// this function handles all NaNs the same way and avoids minNum's problems with associativity.
/// This also matches the behavior of libm’s fmin.
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
///
/// let x = 1.0f16;
/// let y = 2.0f16;
///
/// assert_eq!(x.min(y), x);
/// # }
/// ```
#[inline]
#[unstable(feature = "f16", issue = "116909")]
#[must_use = "this returns the result of the comparison, without modifying either input"]
pub fn min(self, other: f16) -> f16 {
intrinsics::minnumf16(self, other)
}

/// Returns the maximum of the two numbers, propagating NaN.
///
/// This returns NaN when *either* argument is NaN, as opposed to
/// [`f16::max`] which only returns NaN when *both* arguments are NaN.
///
/// ```
/// #![feature(f16)]
/// #![feature(float_minimum_maximum)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
///
/// let x = 1.0f16;
/// let y = 2.0f16;
///
/// assert_eq!(x.maximum(y), y);
/// assert!(x.maximum(f16::NAN).is_nan());
/// # }
/// ```
///
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the greater
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
/// Note that this follows the semantics specified in IEEE 754-2019.
///
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
/// operand is conserved; see [explanation of NaN as a special value](f16) for more info.
#[inline]
#[unstable(feature = "f16", issue = "116909")]
// #[unstable(feature = "float_minimum_maximum", issue = "91079")]
#[must_use = "this returns the result of the comparison, without modifying either input"]
pub fn maximum(self, other: f16) -> f16 {
if self > other {
self
} else if other > self {
other
} else if self == other {
if self.is_sign_positive() && other.is_sign_negative() { self } else { other }
} else {
self + other
}
}

/// Returns the minimum of the two numbers, propagating NaN.
///
/// This returns NaN when *either* argument is NaN, as opposed to
/// [`f16::min`] which only returns NaN when *both* arguments are NaN.
///
/// ```
/// #![feature(f16)]
/// #![feature(float_minimum_maximum)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
///
/// let x = 1.0f16;
/// let y = 2.0f16;
///
/// assert_eq!(x.minimum(y), x);
/// assert!(x.minimum(f16::NAN).is_nan());
/// # }
/// ```
///
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the lesser
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
/// Note that this follows the semantics specified in IEEE 754-2019.
///
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
/// operand is conserved; see [explanation of NaN as a special value](f16) for more info.
#[inline]
#[unstable(feature = "f16", issue = "116909")]
// #[unstable(feature = "float_minimum_maximum", issue = "91079")]
#[must_use = "this returns the result of the comparison, without modifying either input"]
pub fn minimum(self, other: f16) -> f16 {
if self < other {
self
} else if other < self {
other
} else if self == other {
if self.is_sign_negative() && other.is_sign_positive() { self } else { other }
} else {
// At least one input is NaN. Use `+` to perform NaN propagation and quieting.
self + other
}
}

/// Calculates the middle point of `self` and `rhs`.
///
/// This returns NaN when *either* argument is NaN or if a combination of
/// +inf and -inf is provided as arguments.
///
/// # Examples
///
/// ```
/// #![feature(f16)]
/// #![feature(num_midpoint)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
///
/// assert_eq!(1f16.midpoint(4.0), 2.5);
/// assert_eq!((-5.5f16).midpoint(8.0), 1.25);
/// # }
/// ```
#[inline]
#[unstable(feature = "f16", issue = "116909")]
// #[unstable(feature = "num_midpoint", issue = "110840")]
pub fn midpoint(self, other: f16) -> f16 {
const LO: f16 = f16::MIN_POSITIVE * 2.;
const HI: f16 = f16::MAX / 2.;

let (a, b) = (self, other);
let abs_a = a.abs_private();
let abs_b = b.abs_private();

if abs_a <= HI && abs_b <= HI {
// Overflow is impossible
(a + b) / 2.
} else if abs_a < LO {
// Not safe to halve `a` (would underflow)
a + (b / 2.)
} else if abs_b < LO {
// Not safe to halve `b` (would underflow)
(a / 2.) + b
} else {
// Safe to halve `a` and `b`
(a / 2.) + (b / 2.)
}
}

/// Rounds toward zero and converts to any primitive integer type,
/// assuming that the value is finite and fits in that type.
///
6 changes: 3 additions & 3 deletions library/core/src/num/f32.rs
Original file line number Diff line number Diff line change
@@ -1070,13 +1070,13 @@ impl f32 {
// Overflow is impossible
(a + b) / 2.
} else if abs_a < LO {
// Not safe to halve a
// Not safe to halve `a` (would underflow)
a + (b / 2.)
} else if abs_b < LO {
// Not safe to halve b
// Not safe to halve `b` (would underflow)
(a / 2.) + b
} else {
// Not safe to halve a and b
// Safe to halve `a` and `b`
(a / 2.) + (b / 2.)
}
}
6 changes: 3 additions & 3 deletions library/core/src/num/f64.rs
Original file line number Diff line number Diff line change
@@ -1064,13 +1064,13 @@ impl f64 {
// Overflow is impossible
(a + b) / 2.
} else if abs_a < LO {
// Not safe to halve a
// Not safe to halve `a` (would underflow)
a + (b / 2.)
} else if abs_b < LO {
// Not safe to halve b
// Not safe to halve `b` (would underflow)
(a / 2.) + b
} else {
// Not safe to halve a and b
// Safe to halve `a` and `b`
(a / 2.) + (b / 2.)
}
}
3 changes: 3 additions & 0 deletions library/core/src/primitive_docs.rs
Original file line number Diff line number Diff line change
@@ -1244,6 +1244,9 @@ mod prim_f64 {}
/// actually implement it. For x86-64 and AArch64, ISA support is not even specified,
/// so it will always be a software implementation significantly slower than `f64`.
///
/// _Note: `f128` support is incomplete. Many platforms will not be able to link math functions. On
/// x86 in particular, these functions do link but their results are always incorrect._
///
/// *[See also the `std::f128::consts` module](crate::f128::consts).*
///
/// [wikipedia]: https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format
37 changes: 37 additions & 0 deletions library/std/build.rs
Original file line number Diff line number Diff line change
@@ -85,6 +85,11 @@ fn main() {
println!("cargo:rustc-check-cfg=cfg(reliable_f16)");
println!("cargo:rustc-check-cfg=cfg(reliable_f128)");

// This is a step beyond only having the types and basic functions available. Math functions
// aren't consistently available or correct.
println!("cargo:rustc-check-cfg=cfg(reliable_f16_math)");
println!("cargo:rustc-check-cfg=cfg(reliable_f128_math)");

let has_reliable_f16 = match (target_arch.as_str(), target_os.as_str()) {
// Selection failure until recent LLVM <https://github.com/llvm/llvm-project/issues/93894>
// FIXME(llvm19): can probably be removed at the version bump
@@ -128,10 +133,42 @@ fn main() {
_ => false,
};

// These are currently empty, but will fill up as some platforms move from completely
// unreliable to reliable basics but unreliable math.

// LLVM is currenlty adding missing routines, <https://github.com/llvm/llvm-project/issues/93566>
let has_reliable_f16_math = has_reliable_f16
&& match (target_arch.as_str(), target_os.as_str()) {
// Currently nothing special. Hooray!
// This will change as platforms gain better better support for standard ops but math
// lags behind.
_ => true,
};

let has_reliable_f128_math = has_reliable_f128
&& match (target_arch.as_str(), target_os.as_str()) {
// LLVM lowers `fp128` math to `long double` symbols even on platforms where
// `long double` is not IEEE binary128. See
// <https://github.com/llvm/llvm-project/issues/44744>.
//
// This rules out anything that doesn't have `long double` = `binary128`; <= 32 bits
// (ld is `f64`), anything other than Linux (Windows and MacOS use `f64`), and `x86`
// (ld is 80-bit extended precision).
("x86_64", _) => false,
(_, "linux") if target_pointer_width == 64 => true,
_ => false,
};

if has_reliable_f16 {
println!("cargo:rustc-cfg=reliable_f16");
}
if has_reliable_f128 {
println!("cargo:rustc-cfg=reliable_f128");
}
if has_reliable_f16_math {
println!("cargo:rustc-cfg=reliable_f16_math");
}
if has_reliable_f128_math {
println!("cargo:rustc-cfg=reliable_f128_math");
}
}
1,300 changes: 1,290 additions & 10 deletions library/std/src/f128.rs

Large diffs are not rendered by default.

478 changes: 443 additions & 35 deletions library/std/src/f128/tests.rs

Large diffs are not rendered by default.

1,296 changes: 1,287 additions & 9 deletions library/std/src/f16.rs

Large diffs are not rendered by default.

472 changes: 433 additions & 39 deletions library/std/src/f16/tests.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion library/std/src/macros.rs
Original file line number Diff line number Diff line change
@@ -382,7 +382,7 @@ macro_rules! assert_approx_eq {
let diff = (*a - *b).abs();
assert!(
diff < $lim,
"{a:?} is not approximately equal to {b:?} (threshold {lim:?}, actual {diff:?})",
"{a:?} is not approximately equal to {b:?} (threshold {lim:?}, difference {diff:?})",
lim = $lim
);
}};
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ use crate::io::{Read, Write};
use crate::pipe::pipe;

#[test]
#[cfg(all(windows, unix, not(miri)))]
fn pipe_creation_clone_and_rw() {
let (rx, tx) = pipe().unwrap();

14 changes: 5 additions & 9 deletions library/std/src/sys/anonymous_pipe/mod.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
#![forbid(unsafe_op_in_unsafe_fn)]

cfg_if::cfg_if! {
if #[cfg(unix)] {
mod unix;
pub(crate) use unix::{AnonPipe, pipe};

#[cfg(all(test, not(miri)))]
mod tests;
pub use unix::{AnonPipe, pipe};
} else if #[cfg(windows)] {
mod windows;
pub(crate) use windows::{AnonPipe, pipe};

#[cfg(all(test, not(miri)))]
mod tests;
pub use windows::{AnonPipe, pipe};
} else {
mod unsupported;
pub(crate) use unsupported::{AnonPipe, pipe};
pub use unsupported::{AnonPipe, pipe};
}
}
8 changes: 4 additions & 4 deletions library/std/src/sys/anonymous_pipe/unix.rs
Original file line number Diff line number Diff line change
@@ -6,10 +6,10 @@ use crate::sys::fd::FileDesc;
use crate::sys::pipe::anon_pipe;
use crate::sys_common::{FromInner, IntoInner};

pub(crate) type AnonPipe = FileDesc;
pub type AnonPipe = FileDesc;

#[inline]
pub(crate) fn pipe() -> io::Result<(AnonPipe, AnonPipe)> {
pub fn pipe() -> io::Result<(AnonPipe, AnonPipe)> {
anon_pipe().map(|(rx, wx)| (rx.into_inner(), wx.into_inner()))
}

@@ -34,7 +34,7 @@ impl From<PipeReader> for OwnedFd {
#[unstable(feature = "anonymous_pipe", issue = "127154")]
impl FromRawFd for PipeReader {
unsafe fn from_raw_fd(raw_fd: RawFd) -> Self {
Self(FileDesc::from_raw_fd(raw_fd))
unsafe { Self(FileDesc::from_raw_fd(raw_fd)) }
}
}
#[unstable(feature = "anonymous_pipe", issue = "127154")]
@@ -71,7 +71,7 @@ impl From<PipeWriter> for OwnedFd {
#[unstable(feature = "anonymous_pipe", issue = "127154")]
impl FromRawFd for PipeWriter {
unsafe fn from_raw_fd(raw_fd: RawFd) -> Self {
Self(FileDesc::from_raw_fd(raw_fd))
unsafe { Self(FileDesc::from_raw_fd(raw_fd)) }
}
}
#[unstable(feature = "anonymous_pipe", issue = "127154")]
2 changes: 1 addition & 1 deletion library/std/src/sys/anonymous_pipe/unsupported.rs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ use crate::process::Stdio;
pub(crate) use crate::sys::pipe::AnonPipe;

#[inline]
pub(crate) fn pipe() -> io::Result<(AnonPipe, AnonPipe)> {
pub fn pipe() -> io::Result<(AnonPipe, AnonPipe)> {
Err(io::Error::UNSUPPORTED_PLATFORM)
}

24 changes: 16 additions & 8 deletions library/std/src/sys/anonymous_pipe/windows.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
use crate::io;
use crate::os::windows::io::{
AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle, OwnedHandle, RawHandle,
};
use crate::pipe::{PipeReader, PipeWriter};
use crate::process::Stdio;
use crate::sys::c;
use crate::sys::handle::Handle;
use crate::sys::pipe::unnamed_anon_pipe;
use crate::sys_common::{FromInner, IntoInner};
use crate::{io, ptr};

pub(crate) type AnonPipe = Handle;
pub type AnonPipe = Handle;

#[inline]
pub(crate) fn pipe() -> io::Result<(AnonPipe, AnonPipe)> {
unnamed_anon_pipe().map(|(rx, wx)| (rx.into_inner(), wx.into_inner()))
pub fn pipe() -> io::Result<(AnonPipe, AnonPipe)> {
let mut read_pipe = c::INVALID_HANDLE_VALUE;
let mut write_pipe = c::INVALID_HANDLE_VALUE;

let ret = unsafe { c::CreatePipe(&mut read_pipe, &mut write_pipe, ptr::null_mut(), 0) };

if ret == 0 {
Err(io::Error::last_os_error())
} else {
unsafe { Ok((Handle::from_raw_handle(read_pipe), Handle::from_raw_handle(write_pipe))) }
}
}

#[unstable(feature = "anonymous_pipe", issue = "127154")]
@@ -31,7 +39,7 @@ impl AsRawHandle for PipeReader {
#[unstable(feature = "anonymous_pipe", issue = "127154")]
impl FromRawHandle for PipeReader {
unsafe fn from_raw_handle(raw_handle: RawHandle) -> Self {
Self(Handle::from_raw_handle(raw_handle))
unsafe { Self(Handle::from_raw_handle(raw_handle)) }
}
}
#[unstable(feature = "anonymous_pipe", issue = "127154")]
@@ -70,7 +78,7 @@ impl AsRawHandle for PipeWriter {
#[unstable(feature = "anonymous_pipe", issue = "127154")]
impl FromRawHandle for PipeWriter {
unsafe fn from_raw_handle(raw_handle: RawHandle) -> Self {
Self(Handle::from_raw_handle(raw_handle))
unsafe { Self(Handle::from_raw_handle(raw_handle)) }
}
}
#[unstable(feature = "anonymous_pipe", issue = "127154")]
15 changes: 15 additions & 0 deletions library/std/src/sys/cmath.rs
Original file line number Diff line number Diff line change
@@ -28,6 +28,21 @@ extern "C" {
pub fn lgamma_r(n: f64, s: &mut i32) -> f64;
pub fn lgammaf_r(n: f32, s: &mut i32) -> f32;

pub fn acosf128(n: f128) -> f128;
pub fn asinf128(n: f128) -> f128;
pub fn atanf128(n: f128) -> f128;
pub fn atan2f128(a: f128, b: f128) -> f128;
pub fn cbrtf128(n: f128) -> f128;
pub fn coshf128(n: f128) -> f128;
pub fn expm1f128(n: f128) -> f128;
pub fn hypotf128(x: f128, y: f128) -> f128;
pub fn log1pf128(n: f128) -> f128;
pub fn sinhf128(n: f128) -> f128;
pub fn tanf128(n: f128) -> f128;
pub fn tanhf128(n: f128) -> f128;
pub fn tgammaf128(n: f128) -> f128;
pub fn lgammaf128_r(n: f128, s: &mut i32) -> f128;

cfg_if::cfg_if! {
if #[cfg(not(all(target_os = "windows", target_env = "msvc", target_arch = "x86")))] {
pub fn acosf(n: f32) -> f32;
1 change: 0 additions & 1 deletion library/std/src/sys/mod.rs
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ mod pal;

mod personality;

#[unstable(feature = "anonymous_pipe", issue = "127154")]
pub mod anonymous_pipe;
pub mod backtrace;
pub mod cmath;
12 changes: 12 additions & 0 deletions library/std/src/sys/pal/mod.rs
Original file line number Diff line number Diff line change
@@ -79,9 +79,16 @@ cfg_if::cfg_if! {
#[cfg(not(test))]
cfg_if::cfg_if! {
if #[cfg(target_os = "android")] {
pub use self::android::log2f16;
pub use self::android::log2f32;
pub use self::android::log2f64;
pub use self::android::log2f128;
} else {
#[inline]
pub fn log2f16(n: f16) -> f16 {
unsafe { crate::intrinsics::log2f16(n) }
}

#[inline]
pub fn log2f32(n: f32) -> f32 {
unsafe { crate::intrinsics::log2f32(n) }
@@ -91,6 +98,11 @@ cfg_if::cfg_if! {
pub fn log2f64(n: f64) -> f64 {
unsafe { crate::intrinsics::log2f64(n) }
}

#[inline]
pub fn log2f128(n: f128) -> f128 {
unsafe { crate::intrinsics::log2f128(n) }
}
}
}

10 changes: 10 additions & 0 deletions library/std/src/sys/pal/unix/android.rs
Original file line number Diff line number Diff line change
@@ -45,6 +45,11 @@ use super::weak::weak;
//
// log_2(x) = ln(x) * log_2(e)

#[cfg(not(test))]
pub fn log2f16(f: f16) -> f16 {
f.ln() * crate::f16::consts::LOG2_E
}

#[cfg(not(test))]
pub fn log2f32(f: f32) -> f32 {
f.ln() * crate::f32::consts::LOG2_E
@@ -55,6 +60,11 @@ pub fn log2f64(f: f64) -> f64 {
f.ln() * crate::f64::consts::LOG2_E
}

#[cfg(not(test))]
pub fn log2f128(f: f128) -> f128 {
f.ln() * crate::f128::consts::LOG2_E
}

// Back in the day [1] the `signal` function was just an inline wrapper
// around `bsd_signal`, but starting in API level android-20 the `signal`
// symbols was introduced [2]. Finally, in android-21 the API `bsd_signal` was
17 changes: 0 additions & 17 deletions library/std/src/sys/pal/windows/pipe.rs
Original file line number Diff line number Diff line change
@@ -36,23 +36,6 @@ pub struct Pipes {
pub theirs: AnonPipe,
}

/// Create true unnamed anonymous pipe.
pub fn unnamed_anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> {
let mut read_pipe = c::INVALID_HANDLE_VALUE;
let mut write_pipe = c::INVALID_HANDLE_VALUE;

let ret = unsafe { c::CreatePipe(&mut read_pipe, &mut write_pipe, ptr::null_mut(), 0) };

if ret == 0 {
Err(io::Error::last_os_error())
} else {
Ok((
AnonPipe::from_inner(unsafe { Handle::from_raw_handle(read_pipe) }),
AnonPipe::from_inner(unsafe { Handle::from_raw_handle(write_pipe) }),
))
}
}

/// Although this looks similar to `anon_pipe` in the Unix module it's actually
/// subtly different. Here we'll return two pipes in the `Pipes` return value,
/// but one is intended for "us" where as the other is intended for "someone
5 changes: 4 additions & 1 deletion tests/rustdoc-ui/ice-unresolved-import-100241.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0432]: unresolved import `inner`
LL | pub use inner::S;
| ^^^^^ you might be missing crate `inner`
|
= help: consider adding `extern crate inner` to use the `inner` crate
help: consider importing the `inner` crate
|
LL + extern crate inner;
|

error: aborting due to 1 previous error

5 changes: 4 additions & 1 deletion tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0433]: failed to resolve: you might be missing crate `unresolved_crate`
LL | use unresolved_crate::module::Name;
| ^^^^^^^^^^^^^^^^ you might be missing crate `unresolved_crate`
|
= help: consider adding `extern crate unresolved_crate` to use the `unresolved_crate` crate
help: consider importing the `unresolved_crate` crate
|
LL + extern crate unresolved_crate;
|

error: aborting due to 1 previous error

5 changes: 4 additions & 1 deletion tests/rustdoc-ui/issues/issue-61732.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0433]: failed to resolve: you might be missing crate `r#mod`
LL | pub(in crate::r#mod) fn main() {}
| ^^^^^ you might be missing crate `r#mod`
|
= help: consider adding `extern crate r#mod` to use the `r#mod` crate
help: consider importing the `r#mod` crate
|
LL + extern crate r#mod;
|

error: aborting due to 1 previous error

10 changes: 8 additions & 2 deletions tests/ui/attributes/field-attributes-vis-unresolved.stderr
Original file line number Diff line number Diff line change
@@ -4,15 +4,21 @@ error[E0433]: failed to resolve: you might be missing crate `nonexistent`
LL | pub(in nonexistent) field: u8
| ^^^^^^^^^^^ you might be missing crate `nonexistent`
|
= help: consider adding `extern crate nonexistent` to use the `nonexistent` crate
help: consider importing the `nonexistent` crate
|
LL + extern crate nonexistent;
|

error[E0433]: failed to resolve: you might be missing crate `nonexistent`
--> $DIR/field-attributes-vis-unresolved.rs:22:12
|
LL | pub(in nonexistent) u8
| ^^^^^^^^^^^ you might be missing crate `nonexistent`
|
= help: consider adding `extern crate nonexistent` to use the `nonexistent` crate
help: consider importing the `nonexistent` crate
|
LL + extern crate nonexistent;
|

error: aborting due to 2 previous errors

5 changes: 4 additions & 1 deletion tests/ui/error-codes/E0432.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0432]: unresolved import `something`
LL | use something::Foo;
| ^^^^^^^^^ you might be missing crate `something`
|
= help: consider adding `extern crate something` to use the `something` crate
help: consider importing the `something` crate
|
LL + extern crate something;
|

error: aborting due to 1 previous error

5 changes: 4 additions & 1 deletion tests/ui/imports/import-from-missing-star-2.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0432]: unresolved import `spam`
LL | use spam::*;
| ^^^^ you might be missing crate `spam`
|
= help: consider adding `extern crate spam` to use the `spam` crate
help: consider importing the `spam` crate
|
LL + extern crate spam;
|

error: aborting due to 1 previous error

10 changes: 8 additions & 2 deletions tests/ui/imports/import-from-missing-star-3.stderr
Original file line number Diff line number Diff line change
@@ -4,15 +4,21 @@ error[E0432]: unresolved import `spam`
LL | use spam::*;
| ^^^^ you might be missing crate `spam`
|
= help: consider adding `extern crate spam` to use the `spam` crate
help: consider importing the `spam` crate
|
LL + extern crate spam;
|

error[E0432]: unresolved import `spam`
--> $DIR/import-from-missing-star-3.rs:27:13
|
LL | use spam::*;
| ^^^^ you might be missing crate `spam`
|
= help: consider adding `extern crate spam` to use the `spam` crate
help: consider importing the `spam` crate
|
LL + extern crate spam;
|

error: aborting due to 2 previous errors

5 changes: 4 additions & 1 deletion tests/ui/imports/import-from-missing-star.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0432]: unresolved import `spam`
LL | use spam::*;
| ^^^^ you might be missing crate `spam`
|
= help: consider adding `extern crate spam` to use the `spam` crate
help: consider importing the `spam` crate
|
LL + extern crate spam;
|

error: aborting due to 1 previous error

5 changes: 4 additions & 1 deletion tests/ui/imports/import3.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0432]: unresolved import `main`
LL | use main::bar;
| ^^^^ you might be missing crate `main`
|
= help: consider adding `extern crate main` to use the `main` crate
help: consider importing the `main` crate
|
LL + extern crate main;
|

error: aborting due to 1 previous error

5 changes: 4 additions & 1 deletion tests/ui/imports/issue-109343.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0432]: unresolved import `unresolved`
LL | pub use unresolved::f;
| ^^^^^^^^^^ you might be missing crate `unresolved`
|
= help: consider adding `extern crate unresolved` to use the `unresolved` crate
help: consider importing the `unresolved` crate
|
LL + extern crate unresolved;
|

error: aborting due to 1 previous error

2 changes: 1 addition & 1 deletion tests/ui/imports/issue-1697.rs
Original file line number Diff line number Diff line change
@@ -3,6 +3,6 @@
use unresolved::*;
//~^ ERROR unresolved import `unresolved` [E0432]
//~| NOTE you might be missing crate `unresolved`
//~| HELP consider adding `extern crate unresolved` to use the `unresolved` crate
//~| HELP consider importing the `unresolved` crate

fn main() {}
5 changes: 4 additions & 1 deletion tests/ui/imports/issue-1697.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0432]: unresolved import `unresolved`
LL | use unresolved::*;
| ^^^^^^^^^^ you might be missing crate `unresolved`
|
= help: consider adding `extern crate unresolved` to use the `unresolved` crate
help: consider importing the `unresolved` crate
|
LL + extern crate unresolved;
|

error: aborting due to 1 previous error

15 changes: 12 additions & 3 deletions tests/ui/imports/issue-33464.stderr
Original file line number Diff line number Diff line change
@@ -4,23 +4,32 @@ error[E0432]: unresolved import `abc`
LL | use abc::one_el;
| ^^^ you might be missing crate `abc`
|
= help: consider adding `extern crate abc` to use the `abc` crate
help: consider importing the `abc` crate
|
LL + extern crate abc;
|

error[E0432]: unresolved import `abc`
--> $DIR/issue-33464.rs:5:5
|
LL | use abc::{a, bbb, cccccc};
| ^^^ you might be missing crate `abc`
|
= help: consider adding `extern crate abc` to use the `abc` crate
help: consider importing the `abc` crate
|
LL + extern crate abc;
|

error[E0432]: unresolved import `a_very_long_name`
--> $DIR/issue-33464.rs:7:5
|
LL | use a_very_long_name::{el, el2};
| ^^^^^^^^^^^^^^^^ you might be missing crate `a_very_long_name`
|
= help: consider adding `extern crate a_very_long_name` to use the `a_very_long_name` crate
help: consider importing the `a_very_long_name` crate
|
LL + extern crate a_very_long_name;
|

error: aborting due to 3 previous errors

5 changes: 4 additions & 1 deletion tests/ui/imports/issue-36881.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0432]: unresolved import `issue_36881_aux`
LL | use issue_36881_aux::Foo;
| ^^^^^^^^^^^^^^^ you might be missing crate `issue_36881_aux`
|
= help: consider adding `extern crate issue_36881_aux` to use the `issue_36881_aux` crate
help: consider importing the `issue_36881_aux` crate
|
LL + extern crate issue_36881_aux;
|

error: aborting due to 1 previous error

5 changes: 4 additions & 1 deletion tests/ui/imports/issue-37887.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0432]: unresolved import `test`
LL | use test::*;
| ^^^^ you might be missing crate `test`
|
= help: consider adding `extern crate test` to use the `test` crate
help: consider importing the `test` crate
|
LL + extern crate test;
|

error[E0658]: use of unstable library feature 'test'
--> $DIR/issue-37887.rs:2:5
5 changes: 4 additions & 1 deletion tests/ui/imports/issue-53269.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0432]: unresolved import `nonexistent_module`
LL | use nonexistent_module::mac;
| ^^^^^^^^^^^^^^^^^^ you might be missing crate `nonexistent_module`
|
= help: consider adding `extern crate nonexistent_module` to use the `nonexistent_module` crate
help: consider importing the `nonexistent_module` crate
|
LL + extern crate nonexistent_module;
|

error[E0659]: `mac` is ambiguous
--> $DIR/issue-53269.rs:8:5
5 changes: 4 additions & 1 deletion tests/ui/imports/issue-55457.stderr
Original file line number Diff line number Diff line change
@@ -13,7 +13,10 @@ error[E0432]: unresolved import `non_existent`
LL | use non_existent::non_existent;
| ^^^^^^^^^^^^ you might be missing crate `non_existent`
|
= help: consider adding `extern crate non_existent` to use the `non_existent` crate
help: consider importing the `non_existent` crate
|
LL + extern crate non_existent;
|

error: aborting due to 2 previous errors

5 changes: 4 additions & 1 deletion tests/ui/imports/issue-81413.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0432]: unresolved import `doesnt_exist`
LL | pub use doesnt_exist::*;
| ^^^^^^^^^^^^ you might be missing crate `doesnt_exist`
|
= help: consider adding `extern crate doesnt_exist` to use the `doesnt_exist` crate
help: consider importing the `doesnt_exist` crate
|
LL + extern crate doesnt_exist;
|

error: aborting due to 1 previous error

20 changes: 16 additions & 4 deletions tests/ui/imports/tool-mod-child.stderr
Original file line number Diff line number Diff line change
@@ -4,31 +4,43 @@ error[E0433]: failed to resolve: you might be missing crate `clippy`
LL | use clippy::a::b;
| ^^^^^^ you might be missing crate `clippy`
|
= help: consider adding `extern crate clippy` to use the `clippy` crate
help: consider importing the `clippy` crate
|
LL + extern crate clippy;
|

error[E0432]: unresolved import `clippy`
--> $DIR/tool-mod-child.rs:1:5
|
LL | use clippy::a;
| ^^^^^^ you might be missing crate `clippy`
|
= help: consider adding `extern crate clippy` to use the `clippy` crate
help: consider importing the `clippy` crate
|
LL + extern crate clippy;
|

error[E0433]: failed to resolve: you might be missing crate `rustdoc`
--> $DIR/tool-mod-child.rs:5:5
|
LL | use rustdoc::a::b;
| ^^^^^^^ you might be missing crate `rustdoc`
|
= help: consider adding `extern crate rustdoc` to use the `rustdoc` crate
help: consider importing the `rustdoc` crate
|
LL + extern crate rustdoc;
|

error[E0432]: unresolved import `rustdoc`
--> $DIR/tool-mod-child.rs:4:5
|
LL | use rustdoc::a;
| ^^^^^^^ you might be missing crate `rustdoc`
|
= help: consider adding `extern crate rustdoc` to use the `rustdoc` crate
help: consider importing the `rustdoc` crate
|
LL + extern crate rustdoc;
|

error: aborting due to 4 previous errors

20 changes: 16 additions & 4 deletions tests/ui/imports/unresolved-imports-used.stderr
Original file line number Diff line number Diff line change
@@ -16,31 +16,43 @@ error[E0432]: unresolved import `foo`
LL | use foo::bar;
| ^^^ you might be missing crate `foo`
|
= help: consider adding `extern crate foo` to use the `foo` crate
help: consider importing the `foo` crate
|
LL + extern crate foo;
|

error[E0432]: unresolved import `baz`
--> $DIR/unresolved-imports-used.rs:12:5
|
LL | use baz::*;
| ^^^ you might be missing crate `baz`
|
= help: consider adding `extern crate baz` to use the `baz` crate
help: consider importing the `baz` crate
|
LL + extern crate baz;
|

error[E0432]: unresolved import `foo2`
--> $DIR/unresolved-imports-used.rs:14:5
|
LL | use foo2::bar2;
| ^^^^ you might be missing crate `foo2`
|
= help: consider adding `extern crate foo2` to use the `foo2` crate
help: consider importing the `foo2` crate
|
LL + extern crate foo2;
|

error[E0432]: unresolved import `baz2`
--> $DIR/unresolved-imports-used.rs:15:5
|
LL | use baz2::*;
| ^^^^ you might be missing crate `baz2`
|
= help: consider adding `extern crate baz2` to use the `baz2` crate
help: consider importing the `baz2` crate
|
LL + extern crate baz2;
|

error[E0603]: function `quz` is private
--> $DIR/unresolved-imports-used.rs:9:10
Original file line number Diff line number Diff line change
@@ -15,7 +15,10 @@ error[E0432]: unresolved import `r#extern`
LL | use extern::foo;
| ^^^^^^ you might be missing crate `r#extern`
|
= help: consider adding `extern crate r#extern` to use the `r#extern` crate
help: consider importing the `r#extern` crate
|
LL + extern crate r#extern;
|

error: aborting due to 2 previous errors

5 changes: 4 additions & 1 deletion tests/ui/privacy/restricted/test.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0433]: failed to resolve: you might be missing crate `bad`
LL | pub(in bad::path) mod m1 {}
| ^^^ you might be missing crate `bad`
|
= help: consider adding `extern crate bad` to use the `bad` crate
help: consider importing the `bad` crate
|
LL + extern crate bad;
|

error[E0742]: visibilities can only be restricted to ancestor modules
--> $DIR/test.rs:51:12
10 changes: 8 additions & 2 deletions tests/ui/resolve/editions-crate-root-2015.stderr
Original file line number Diff line number Diff line change
@@ -4,15 +4,21 @@ error[E0433]: failed to resolve: you might be missing crate `nonexistant`
LL | fn global_inner(_: ::nonexistant::Foo) {
| ^^^^^^^^^^^ you might be missing crate `nonexistant`
|
= help: consider adding `extern crate nonexistant` to use the `nonexistant` crate
help: consider importing the `nonexistant` crate
|
LL + extern crate nonexistant;
|

error[E0433]: failed to resolve: you might be missing crate `nonexistant`
--> $DIR/editions-crate-root-2015.rs:7:30
|
LL | fn crate_inner(_: crate::nonexistant::Foo) {
| ^^^^^^^^^^^ you might be missing crate `nonexistant`
|
= help: consider adding `extern crate nonexistant` to use the `nonexistant` crate
help: consider importing the `nonexistant` crate
|
LL + extern crate nonexistant;
|

error[E0412]: cannot find type `nonexistant` in the crate root
--> $DIR/editions-crate-root-2015.rs:11:25
10 changes: 8 additions & 2 deletions tests/ui/resolve/extern-prelude-fail.stderr
Original file line number Diff line number Diff line change
@@ -4,15 +4,21 @@ error[E0432]: unresolved import `extern_prelude`
LL | use extern_prelude::S;
| ^^^^^^^^^^^^^^ you might be missing crate `extern_prelude`
|
= help: consider adding `extern crate extern_prelude` to use the `extern_prelude` crate
help: consider importing the `extern_prelude` crate
|
LL + extern crate extern_prelude;
|

error[E0433]: failed to resolve: you might be missing crate `extern_prelude`
--> $DIR/extern-prelude-fail.rs:8:15
|
LL | let s = ::extern_prelude::S;
| ^^^^^^^^^^^^^^ you might be missing crate `extern_prelude`
|
= help: consider adding `extern crate extern_prelude` to use the `extern_prelude` crate
help: consider importing the `extern_prelude` crate
|
LL + extern crate extern_prelude;
|

error: aborting due to 2 previous errors

5 changes: 4 additions & 1 deletion tests/ui/resolve/issue-82865.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0433]: failed to resolve: you might be missing crate `x`
LL | use x::y::z;
| ^ you might be missing crate `x`
|
= help: consider adding `extern crate x` to use the `x` crate
help: consider importing the `x` crate
|
LL + extern crate x;
|

error[E0599]: no function or associated item named `z` found for struct `Box<_, _>` in the current scope
--> $DIR/issue-82865.rs:8:10
10 changes: 8 additions & 2 deletions tests/ui/resolve/resolve-bad-visibility.stderr
Original file line number Diff line number Diff line change
@@ -22,15 +22,21 @@ error[E0433]: failed to resolve: you might be missing crate `nonexistent`
LL | pub(in nonexistent) struct G;
| ^^^^^^^^^^^ you might be missing crate `nonexistent`
|
= help: consider adding `extern crate nonexistent` to use the `nonexistent` crate
help: consider importing the `nonexistent` crate
|
LL + extern crate nonexistent;
|

error[E0433]: failed to resolve: you might be missing crate `too_soon`
--> $DIR/resolve-bad-visibility.rs:8:8
|
LL | pub(in too_soon) struct H;
| ^^^^^^^^ you might be missing crate `too_soon`
|
= help: consider adding `extern crate too_soon` to use the `too_soon` crate
help: consider importing the `too_soon` crate
|
LL + extern crate too_soon;
|

error: aborting due to 5 previous errors

16 changes: 4 additions & 12 deletions tests/ui/underscore-imports/issue-110164.stderr
Original file line number Diff line number Diff line change
@@ -38,33 +38,25 @@ error[E0432]: unresolved import `_`
--> $DIR/issue-110164.rs:8:5
|
LL | use _::*;
| ^ you might be missing crate `_`
|
= help: consider adding `extern crate _` to use the `_` crate
| ^ `_` is not a valid crate or module name

error[E0432]: unresolved import `_`
--> $DIR/issue-110164.rs:5:5
|
LL | use _::a;
| ^ you might be missing crate `_`
|
= help: consider adding `extern crate _` to use the `_` crate
| ^ `_` is not a valid crate or module name

error[E0432]: unresolved import `_`
--> $DIR/issue-110164.rs:13:9
|
LL | use _::a;
| ^ you might be missing crate `_`
|
= help: consider adding `extern crate _` to use the `_` crate
| ^ `_` is not a valid crate or module name

error[E0432]: unresolved import `_`
--> $DIR/issue-110164.rs:16:9
|
LL | use _::*;
| ^ you might be missing crate `_`
|
= help: consider adding `extern crate _` to use the `_` crate
| ^ `_` is not a valid crate or module name

error: aborting due to 10 previous errors

5 changes: 4 additions & 1 deletion tests/ui/unresolved/unresolved-asterisk-imports.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ error[E0432]: unresolved import `not_existing_crate`
LL | use not_existing_crate::*;
| ^^^^^^^^^^^^^^^^^^ you might be missing crate `not_existing_crate`
|
= help: consider adding `extern crate not_existing_crate` to use the `not_existing_crate` crate
help: consider importing the `not_existing_crate` crate
|
LL + extern crate not_existing_crate;
|

error: aborting due to 1 previous error

3 changes: 2 additions & 1 deletion tests/ui/unresolved/unresolved-import.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use foo::bar;
//~^ ERROR unresolved import `foo` [E0432]
//~| NOTE you might be missing crate `foo`
//~| HELP consider adding `extern crate foo` to use the `foo` crate
//~| HELP consider importing the `foo` crate
//~| SUGGESTION extern crate foo;

use bar::Baz as x;
//~^ ERROR unresolved import `bar::Baz` [E0432]
15 changes: 9 additions & 6 deletions tests/ui/unresolved/unresolved-import.stderr
Original file line number Diff line number Diff line change
@@ -4,10 +4,13 @@ error[E0432]: unresolved import `foo`
LL | use foo::bar;
| ^^^ you might be missing crate `foo`
|
= help: consider adding `extern crate foo` to use the `foo` crate
help: consider importing the `foo` crate
|
LL + extern crate foo;
|

error[E0432]: unresolved import `bar::Baz`
--> $DIR/unresolved-import.rs:6:5
--> $DIR/unresolved-import.rs:7:5
|
LL | use bar::Baz as x;
| ^^^^^---^^^^^
@@ -16,7 +19,7 @@ LL | use bar::Baz as x;
| no `Baz` in `bar`

error[E0432]: unresolved import `food::baz`
--> $DIR/unresolved-import.rs:12:5
--> $DIR/unresolved-import.rs:13:5
|
LL | use food::baz;
| ^^^^^^---
@@ -25,7 +28,7 @@ LL | use food::baz;
| no `baz` in `food`

error[E0432]: unresolved import `food::beens`
--> $DIR/unresolved-import.rs:18:12
--> $DIR/unresolved-import.rs:19:12
|
LL | use food::{beens as Foo};
| -----^^^^^^^
@@ -34,13 +37,13 @@ LL | use food::{beens as Foo};
| help: a similar name exists in the module: `beans`

error[E0432]: unresolved import `MyEnum`
--> $DIR/unresolved-import.rs:43:9
--> $DIR/unresolved-import.rs:44:9
|
LL | use MyEnum::*;
| ^^^^^^ help: a similar path exists: `self::MyEnum`

error[E0432]: unresolved import `Enum`
--> $DIR/unresolved-import.rs:54:9
--> $DIR/unresolved-import.rs:55:9
|
LL | use Enum::*;
| ^^^^ help: a similar path exists: `self::Enum`