Auto merge of #151183 - jhpratt:rollup-GxmJbns, r=jhpratt
Rollup of 5 pull requests Successful merges: - rust-lang/rust#150607 (Add amdgpu_dispatch_ptr intrinsic) - rust-lang/rust#150611 (Unify and deduplicate From<T> float tests) - rust-lang/rust#151082 (Silence unused type param error on struct parse error) - rust-lang/rust#151159 (Tidying up `tests/ui/issues` 15 tests [8/N]) - rust-lang/rust#151164 (Stabilise `EULER_GAMMA` and `GOLDEN_RATIO` constants for `f32` and `f64`.) r? @ghost
This commit is contained in:
commit
bcf787a780
55 changed files with 461 additions and 288 deletions
|
|
@ -560,6 +560,12 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
sym::amdgpu_dispatch_ptr => {
|
||||
let val = self.call_intrinsic("llvm.amdgcn.dispatch.ptr", &[], &[]);
|
||||
// Relying on `LLVMBuildPointerCast` to produce an addrspacecast
|
||||
self.pointercast(val, self.type_ptr())
|
||||
}
|
||||
|
||||
_ if name.as_str().starts_with("simd_") => {
|
||||
// Unpack non-power-of-2 #[repr(packed, simd)] arguments.
|
||||
// This gives them the expected layout of a regular #[repr(simd)] vector.
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
| sym::unreachable
|
||||
| sym::cold_path
|
||||
| sym::breakpoint
|
||||
| sym::amdgpu_dispatch_ptr
|
||||
| sym::assert_zero_valid
|
||||
| sym::assert_mem_uninitialized_valid
|
||||
| sym::assert_inhabited
|
||||
|
|
|
|||
|
|
@ -4525,6 +4525,26 @@ impl ItemKind<'_> {
|
|||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn recovered(&self) -> bool {
|
||||
match self {
|
||||
ItemKind::Struct(
|
||||
_,
|
||||
_,
|
||||
VariantData::Struct { recovered: ast::Recovered::Yes(_), .. },
|
||||
) => true,
|
||||
ItemKind::Union(
|
||||
_,
|
||||
_,
|
||||
VariantData::Struct { recovered: ast::Recovered::Yes(_), .. },
|
||||
) => true,
|
||||
ItemKind::Enum(_, _, def) => def.variants.iter().any(|v| match v.data {
|
||||
VariantData::Struct { recovered: ast::Recovered::Yes(_), .. } => true,
|
||||
_ => false,
|
||||
}),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The bodies for items are stored "out of line", in a separate
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hi
|
|||
| sym::add_with_overflow
|
||||
| sym::aggregate_raw_ptr
|
||||
| sym::align_of
|
||||
| sym::amdgpu_dispatch_ptr
|
||||
| sym::assert_inhabited
|
||||
| sym::assert_mem_uninitialized_valid
|
||||
| sym::assert_zero_valid
|
||||
|
|
@ -286,6 +287,7 @@ pub(crate) fn check_intrinsic_type(
|
|||
let (n_tps, n_cts, inputs, output) = match intrinsic_name {
|
||||
sym::autodiff => (4, 0, vec![param(0), param(1), param(2)], param(3)),
|
||||
sym::abort => (0, 0, vec![], tcx.types.never),
|
||||
sym::amdgpu_dispatch_ptr => (0, 0, vec![], Ty::new_imm_ptr(tcx, tcx.types.unit)),
|
||||
sym::unreachable => (0, 0, vec![], tcx.types.never),
|
||||
sym::breakpoint => (0, 0, vec![], tcx.types.unit),
|
||||
sym::size_of | sym::align_of | sym::variant_count => (1, 0, vec![], tcx.types.usize),
|
||||
|
|
|
|||
|
|
@ -2160,7 +2160,12 @@ fn report_bivariance<'tcx>(
|
|||
const_param_help,
|
||||
});
|
||||
diag.code(E0392);
|
||||
diag.emit()
|
||||
if item.kind.recovered() {
|
||||
// Silence potentially redundant error, as the item had a parse error.
|
||||
diag.delay_as_bug()
|
||||
} else {
|
||||
diag.emit()
|
||||
}
|
||||
}
|
||||
|
||||
/// Detects cases where an ADT/LTA is trivially cyclical -- we want to detect this so
|
||||
|
|
|
|||
|
|
@ -458,6 +458,7 @@ symbols! {
|
|||
alu32,
|
||||
always,
|
||||
amdgpu,
|
||||
amdgpu_dispatch_ptr,
|
||||
analysis,
|
||||
and,
|
||||
and_then,
|
||||
|
|
|
|||
|
|
@ -488,7 +488,30 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
let Some(InferSource { span, kind }) = local_visitor.infer_source else {
|
||||
return self.bad_inference_failure_err(failure_span, arg_data, error_code);
|
||||
let silence = if let DefKind::AssocFn = self.tcx.def_kind(body_def_id)
|
||||
&& let parent = self.tcx.parent(body_def_id.into())
|
||||
&& self.tcx.is_automatically_derived(parent)
|
||||
&& let Some(parent) = parent.as_local()
|
||||
&& let hir::Node::Item(item) = self.tcx.hir_node_by_def_id(parent)
|
||||
&& let hir::ItemKind::Impl(imp) = item.kind
|
||||
&& let hir::TyKind::Path(hir::QPath::Resolved(_, path)) = imp.self_ty.kind
|
||||
&& let Res::Def(DefKind::Struct | DefKind::Enum | DefKind::Union, def_id) = path.res
|
||||
&& let Some(def_id) = def_id.as_local()
|
||||
&& let hir::Node::Item(item) = self.tcx.hir_node_by_def_id(def_id)
|
||||
{
|
||||
// We have encountered an inference error within an automatically derived `impl`,
|
||||
// from a `#[derive(..)]` on an item that had a parse error. Because the parse
|
||||
// error might have caused the expanded code to be malformed, we silence the
|
||||
// inference error.
|
||||
item.kind.recovered()
|
||||
} else {
|
||||
false
|
||||
};
|
||||
let mut err = self.bad_inference_failure_err(failure_span, arg_data, error_code);
|
||||
if silence {
|
||||
err.downgrade_to_delayed_bug();
|
||||
}
|
||||
return err;
|
||||
};
|
||||
|
||||
let (source_kind, name, long_ty_path) = kind.ty_localized_msg(self);
|
||||
|
|
|
|||
23
library/core/src/intrinsics/gpu.rs
Normal file
23
library/core/src/intrinsics/gpu.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
//! Intrinsics for GPU targets.
|
||||
//!
|
||||
//! Intrinsics in this module are intended for use on GPU targets.
|
||||
//! They can be target specific but in general GPU targets are similar.
|
||||
|
||||
#![unstable(feature = "gpu_intrinsics", issue = "none")]
|
||||
|
||||
/// Returns a pointer to the HSA kernel dispatch packet.
|
||||
///
|
||||
/// A `gpu-kernel` on amdgpu is always launched through a kernel dispatch packet.
|
||||
/// The dispatch packet contains the workgroup size, launch size and other data.
|
||||
/// The content is defined by the [HSA Platform System Architecture Specification],
|
||||
/// which is implemented e.g. in AMD's [hsa.h].
|
||||
/// The intrinsic returns a unit pointer so that rustc does not need to know the packet struct.
|
||||
/// The pointer is valid for the whole lifetime of the program.
|
||||
///
|
||||
/// [HSA Platform System Architecture Specification]: https://hsafoundation.com/wp-content/uploads/2021/02/HSA-SysArch-1.2.pdf
|
||||
/// [hsa.h]: https://github.com/ROCm/rocm-systems/blob/rocm-7.1.0/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa.h#L2959
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
#[cfg(target_arch = "amdgpu")]
|
||||
#[must_use = "returns a pointer that does nothing unless used"]
|
||||
pub fn amdgpu_dispatch_ptr() -> *const ();
|
||||
|
|
@ -60,6 +60,7 @@ use crate::{mem, ptr};
|
|||
|
||||
mod bounds;
|
||||
pub mod fallback;
|
||||
pub mod gpu;
|
||||
pub mod mir;
|
||||
pub mod simd;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ pub mod consts {
|
|||
|
||||
/// The golden ratio (φ)
|
||||
#[unstable(feature = "f128", issue = "116909")]
|
||||
// Also, #[unstable(feature = "more_float_constants", issue = "146939")]
|
||||
pub const PHI: f128 = 1.61803398874989484820458683436563811772030917980576286213545_f128;
|
||||
pub const GOLDEN_RATIO: f128 =
|
||||
1.61803398874989484820458683436563811772030917980576286213545_f128;
|
||||
|
||||
/// The Euler-Mascheroni constant (γ)
|
||||
#[unstable(feature = "f128", issue = "116909")]
|
||||
// Also, #[unstable(feature = "more_float_constants", issue = "146939")]
|
||||
pub const EGAMMA: f128 = 0.577215664901532860606512090082402431042159335939923598805767_f128;
|
||||
pub const EULER_GAMMA: f128 =
|
||||
0.577215664901532860606512090082402431042159335939923598805767_f128;
|
||||
|
||||
/// π/2
|
||||
#[unstable(feature = "f128", issue = "116909")]
|
||||
|
|
|
|||
|
|
@ -36,13 +36,11 @@ pub mod consts {
|
|||
|
||||
/// The golden ratio (φ)
|
||||
#[unstable(feature = "f16", issue = "116909")]
|
||||
// Also, #[unstable(feature = "more_float_constants", issue = "146939")]
|
||||
pub const PHI: f16 = 1.618033988749894848204586834365638118_f16;
|
||||
pub const GOLDEN_RATIO: f16 = 1.618033988749894848204586834365638118_f16;
|
||||
|
||||
/// The Euler-Mascheroni constant (γ)
|
||||
#[unstable(feature = "f16", issue = "116909")]
|
||||
// Also, #[unstable(feature = "more_float_constants", issue = "146939")]
|
||||
pub const EGAMMA: f16 = 0.577215664901532860606512090082402431_f16;
|
||||
pub const EULER_GAMMA: f16 = 0.577215664901532860606512090082402431_f16;
|
||||
|
||||
/// π/2
|
||||
#[unstable(feature = "f16", issue = "116909")]
|
||||
|
|
|
|||
|
|
@ -292,12 +292,12 @@ pub mod consts {
|
|||
pub const TAU: f32 = 6.28318530717958647692528676655900577_f32;
|
||||
|
||||
/// The golden ratio (φ)
|
||||
#[unstable(feature = "more_float_constants", issue = "146939")]
|
||||
pub const PHI: f32 = 1.618033988749894848204586834365638118_f32;
|
||||
#[stable(feature = "euler_gamma_golden_ratio", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const GOLDEN_RATIO: f32 = 1.618033988749894848204586834365638118_f32;
|
||||
|
||||
/// The Euler-Mascheroni constant (γ)
|
||||
#[unstable(feature = "more_float_constants", issue = "146939")]
|
||||
pub const EGAMMA: f32 = 0.577215664901532860606512090082402431_f32;
|
||||
#[stable(feature = "euler_gamma_golden_ratio", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const EULER_GAMMA: f32 = 0.577215664901532860606512090082402431_f32;
|
||||
|
||||
/// π/2
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
|
|
|||
|
|
@ -292,12 +292,12 @@ pub mod consts {
|
|||
pub const TAU: f64 = 6.28318530717958647692528676655900577_f64;
|
||||
|
||||
/// The golden ratio (φ)
|
||||
#[unstable(feature = "more_float_constants", issue = "146939")]
|
||||
pub const PHI: f64 = 1.618033988749894848204586834365638118_f64;
|
||||
#[stable(feature = "euler_gamma_golden_ratio", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const GOLDEN_RATIO: f64 = 1.618033988749894848204586834365638118_f64;
|
||||
|
||||
/// The Euler-Mascheroni constant (γ)
|
||||
#[unstable(feature = "more_float_constants", issue = "146939")]
|
||||
pub const EGAMMA: f64 = 0.577215664901532860606512090082402431_f64;
|
||||
#[stable(feature = "euler_gamma_golden_ratio", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const EULER_GAMMA: f64 = 0.577215664901532860606512090082402431_f64;
|
||||
|
||||
/// π/2
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
// FIXME(f16_f128): only tested on platforms that have symbols and aren't buggy
|
||||
#![cfg(target_has_reliable_f128)]
|
||||
|
||||
use super::assert_biteq;
|
||||
|
||||
// Note these tolerances make sense around zero, but not for more extreme exponents.
|
||||
|
||||
/// Default tolerances. Works for values that should be near precise but not exact. Roughly
|
||||
/// the precision carried by `100 * 100`.
|
||||
#[allow(unused)]
|
||||
const TOL: f128 = 1e-12;
|
||||
|
||||
/// For operations that are near exact, usually not involving math of different
|
||||
/// signs.
|
||||
#[allow(unused)]
|
||||
const TOL_PRECISE: f128 = 1e-28;
|
||||
|
||||
// FIXME(f16_f128,miri): many of these have to be disabled since miri does not yet support
|
||||
// the intrinsics.
|
||||
|
||||
#[test]
|
||||
fn test_from() {
|
||||
assert_biteq!(f128::from(false), 0.0);
|
||||
assert_biteq!(f128::from(true), 1.0);
|
||||
assert_biteq!(f128::from(u8::MIN), 0.0);
|
||||
assert_biteq!(f128::from(42_u8), 42.0);
|
||||
assert_biteq!(f128::from(u8::MAX), 255.0);
|
||||
assert_biteq!(f128::from(i8::MIN), -128.0);
|
||||
assert_biteq!(f128::from(42_i8), 42.0);
|
||||
assert_biteq!(f128::from(i8::MAX), 127.0);
|
||||
assert_biteq!(f128::from(u16::MIN), 0.0);
|
||||
assert_biteq!(f128::from(42_u16), 42.0);
|
||||
assert_biteq!(f128::from(u16::MAX), 65535.0);
|
||||
assert_biteq!(f128::from(i16::MIN), -32768.0);
|
||||
assert_biteq!(f128::from(42_i16), 42.0);
|
||||
assert_biteq!(f128::from(i16::MAX), 32767.0);
|
||||
assert_biteq!(f128::from(u32::MIN), 0.0);
|
||||
assert_biteq!(f128::from(42_u32), 42.0);
|
||||
assert_biteq!(f128::from(u32::MAX), 4294967295.0);
|
||||
assert_biteq!(f128::from(i32::MIN), -2147483648.0);
|
||||
assert_biteq!(f128::from(42_i32), 42.0);
|
||||
assert_biteq!(f128::from(i32::MAX), 2147483647.0);
|
||||
// FIXME(f16_f128): Uncomment these tests once the From<{u64,i64}> impls are added.
|
||||
// assert_eq!(f128::from(u64::MIN), 0.0);
|
||||
// assert_eq!(f128::from(42_u64), 42.0);
|
||||
// assert_eq!(f128::from(u64::MAX), 18446744073709551615.0);
|
||||
// assert_eq!(f128::from(i64::MIN), -9223372036854775808.0);
|
||||
// assert_eq!(f128::from(42_i64), 42.0);
|
||||
// assert_eq!(f128::from(i64::MAX), 9223372036854775807.0);
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
// FIXME(f16_f128): only tested on platforms that have symbols and aren't buggy
|
||||
#![cfg(target_has_reliable_f16)]
|
||||
|
||||
use super::assert_biteq;
|
||||
|
||||
/// Tolerance for results on the order of 10.0e-2
|
||||
#[allow(unused)]
|
||||
const TOL_N2: f16 = 0.0001;
|
||||
|
||||
/// Tolerance for results on the order of 10.0e+0
|
||||
#[allow(unused)]
|
||||
const TOL_0: f16 = 0.01;
|
||||
|
||||
/// Tolerance for results on the order of 10.0e+2
|
||||
#[allow(unused)]
|
||||
const TOL_P2: f16 = 0.5;
|
||||
|
||||
/// Tolerance for results on the order of 10.0e+4
|
||||
#[allow(unused)]
|
||||
const TOL_P4: f16 = 10.0;
|
||||
|
||||
// FIXME(f16_f128,miri): many of these have to be disabled since miri does not yet support
|
||||
// the intrinsics.
|
||||
|
||||
#[test]
|
||||
fn test_from() {
|
||||
assert_biteq!(f16::from(false), 0.0);
|
||||
assert_biteq!(f16::from(true), 1.0);
|
||||
assert_biteq!(f16::from(u8::MIN), 0.0);
|
||||
assert_biteq!(f16::from(42_u8), 42.0);
|
||||
assert_biteq!(f16::from(u8::MAX), 255.0);
|
||||
assert_biteq!(f16::from(i8::MIN), -128.0);
|
||||
assert_biteq!(f16::from(42_i8), 42.0);
|
||||
assert_biteq!(f16::from(i8::MAX), 127.0);
|
||||
}
|
||||
|
|
@ -375,9 +375,6 @@ macro_rules! float_test {
|
|||
};
|
||||
}
|
||||
|
||||
mod f128;
|
||||
mod f16;
|
||||
|
||||
float_test! {
|
||||
name: num,
|
||||
attrs: {
|
||||
|
|
@ -1582,3 +1579,78 @@ float_test! {
|
|||
assert_biteq!((flt(-3.2)).mul_add(2.4, neg_inf), neg_inf);
|
||||
}
|
||||
}
|
||||
|
||||
float_test! {
|
||||
name: from,
|
||||
attrs: {
|
||||
f16: #[cfg(any(miri, target_has_reliable_f16))],
|
||||
f128: #[cfg(any(miri, target_has_reliable_f128))],
|
||||
},
|
||||
test<Float> {
|
||||
assert_biteq!(Float::from(false), Float::ZERO);
|
||||
assert_biteq!(Float::from(true), Float::ONE);
|
||||
|
||||
assert_biteq!(Float::from(u8::MIN), Float::ZERO);
|
||||
assert_biteq!(Float::from(42_u8), 42.0);
|
||||
assert_biteq!(Float::from(u8::MAX), 255.0);
|
||||
|
||||
assert_biteq!(Float::from(i8::MIN), -128.0);
|
||||
assert_biteq!(Float::from(42_i8), 42.0);
|
||||
assert_biteq!(Float::from(i8::MAX), 127.0);
|
||||
}
|
||||
}
|
||||
|
||||
float_test! {
|
||||
name: from_u16_i16,
|
||||
attrs: {
|
||||
f16: #[cfg(false)],
|
||||
const f16: #[cfg(false)],
|
||||
f128: #[cfg(any(miri, target_has_reliable_f128))],
|
||||
},
|
||||
test<Float> {
|
||||
assert_biteq!(Float::from(u16::MIN), Float::ZERO);
|
||||
assert_biteq!(Float::from(42_u16), 42.0);
|
||||
assert_biteq!(Float::from(u16::MAX), 65535.0);
|
||||
assert_biteq!(Float::from(i16::MIN), -32768.0);
|
||||
assert_biteq!(Float::from(42_i16), 42.0);
|
||||
assert_biteq!(Float::from(i16::MAX), 32767.0);
|
||||
}
|
||||
}
|
||||
|
||||
float_test! {
|
||||
name: from_u32_i32,
|
||||
attrs: {
|
||||
f16: #[cfg(false)],
|
||||
const f16: #[cfg(false)],
|
||||
f32: #[cfg(false)],
|
||||
const f32: #[cfg(false)],
|
||||
f128: #[cfg(any(miri, target_has_reliable_f128))],
|
||||
},
|
||||
test<Float> {
|
||||
assert_biteq!(Float::from(u32::MIN), Float::ZERO);
|
||||
assert_biteq!(Float::from(42_u32), 42.0);
|
||||
assert_biteq!(Float::from(u32::MAX), 4294967295.0);
|
||||
assert_biteq!(Float::from(i32::MIN), -2147483648.0);
|
||||
assert_biteq!(Float::from(42_i32), 42.0);
|
||||
assert_biteq!(Float::from(i32::MAX), 2147483647.0);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME(f16_f128): Uncomment and adapt these tests once the From<{u64,i64}> impls are added.
|
||||
// float_test! {
|
||||
// name: from_u64_i64,
|
||||
// attrs: {
|
||||
// f16: #[cfg(false)],
|
||||
// f32: #[cfg(false)],
|
||||
// f64: #[cfg(false)],
|
||||
// f128: #[cfg(any(miri, target_has_reliable_f128))],
|
||||
// },
|
||||
// test<Float> {
|
||||
// assert_biteq!(Float::from(u64::MIN), Float::ZERO);
|
||||
// assert_biteq!(Float::from(42_u64), 42.0);
|
||||
// assert_biteq!(Float::from(u64::MAX), 18446744073709551615.0);
|
||||
// assert_biteq!(Float::from(i64::MIN), -9223372036854775808.0);
|
||||
// assert_biteq!(Float::from(42_i64), 42.0);
|
||||
// assert_biteq!(Float::from(i64::MAX), 9223372036854775807.0);
|
||||
// }
|
||||
// }
|
||||
|
|
|
|||
27
tests/codegen-llvm/amdgpu-dispatch-ptr.rs
Normal file
27
tests/codegen-llvm/amdgpu-dispatch-ptr.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Tests the amdgpu_dispatch_ptr intrinsic.
|
||||
|
||||
//@ compile-flags: --crate-type=rlib --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900
|
||||
//@ needs-llvm-components: amdgpu
|
||||
//@ add-minicore
|
||||
#![feature(intrinsics, no_core, rustc_attrs)]
|
||||
#![no_core]
|
||||
|
||||
extern crate minicore;
|
||||
|
||||
pub struct DispatchPacket {
|
||||
pub header: u16,
|
||||
pub setup: u16,
|
||||
pub workgroup_size_x: u16, // and more
|
||||
}
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_nounwind]
|
||||
fn amdgpu_dispatch_ptr() -> *const ();
|
||||
|
||||
// CHECK-LABEL: @get_dispatch_data
|
||||
// CHECK: %[[ORIG_PTR:[^ ]+]] = {{(tail )?}}call ptr addrspace(4) @llvm.amdgcn.dispatch.ptr()
|
||||
// CHECK-NEXT: %[[PTR:[^ ]+]] = addrspacecast ptr addrspace(4) %[[ORIG_PTR]] to ptr
|
||||
#[unsafe(no_mangle)]
|
||||
pub fn get_dispatch_data() -> &'static DispatchPacket {
|
||||
unsafe { &*(amdgpu_dispatch_ptr() as *const _) }
|
||||
}
|
||||
6
tests/ui/array-slice-vec/closure-in-array-len.rs
Normal file
6
tests/ui/array-slice-vec/closure-in-array-len.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/50600>
|
||||
struct Foo(
|
||||
fn([u8; |x: u8| {}]), //~ ERROR mismatched types
|
||||
);
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-50600.rs:2:13
|
||||
--> $DIR/closure-in-array-len.rs:3:13
|
||||
|
|
||||
LL | fn([u8; |x: u8| {}]),
|
||||
| ^^^^^^^^^^ expected `usize`, found closure
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found closure `{closure@$DIR/issue-50600.rs:2:13: 2:20}`
|
||||
found closure `{closure@$DIR/closure-in-array-len.rs:3:13: 3:20}`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/51714>
|
||||
fn main() {
|
||||
//~^ NOTE: not the enclosing function body
|
||||
//~| NOTE: not the enclosing function body
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0572]: return statement outside of function body
|
||||
--> $DIR/issue-51714.rs:6:13
|
||||
--> $DIR/return-in-array-len.rs:7:13
|
||||
|
|
||||
LL | / fn main() {
|
||||
... |
|
||||
|
|
@ -10,7 +10,7 @@ LL | | }
|
|||
| |_- ...not the enclosing function body
|
||||
|
||||
error[E0572]: return statement outside of function body
|
||||
--> $DIR/issue-51714.rs:10:10
|
||||
--> $DIR/return-in-array-len.rs:11:10
|
||||
|
|
||||
LL | / fn main() {
|
||||
... |
|
||||
|
|
@ -21,7 +21,7 @@ LL | | }
|
|||
| |_- ...not the enclosing function body
|
||||
|
||||
error[E0572]: return statement outside of function body
|
||||
--> $DIR/issue-51714.rs:14:10
|
||||
--> $DIR/return-in-array-len.rs:15:10
|
||||
|
|
||||
LL | / fn main() {
|
||||
... |
|
||||
|
|
@ -32,7 +32,7 @@ LL | | }
|
|||
| |_- ...not the enclosing function body
|
||||
|
||||
error[E0572]: return statement outside of function body
|
||||
--> $DIR/issue-51714.rs:18:10
|
||||
--> $DIR/return-in-array-len.rs:19:10
|
||||
|
|
||||
LL | / fn main() {
|
||||
... |
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/17503>
|
||||
//@ run-pass
|
||||
fn main() {
|
||||
let s: &[isize] = &[0, 1, 2, 3, 4];
|
||||
10
tests/ui/derives/derive-hygiene-struct-builder.rs
Normal file
10
tests/ui/derives/derive-hygiene-struct-builder.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/42453>
|
||||
//! struct named "builder" conflicted with derive macro internals.
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#[derive(Debug)]
|
||||
struct builder;
|
||||
|
||||
fn main() {}
|
||||
8
tests/ui/dst/unsized-str-mutability.rs
Normal file
8
tests/ui/dst/unsized-str-mutability.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/17361>
|
||||
//! Test that HIR ty lowering doesn't forget about mutability of `&mut str`.
|
||||
//@ run-pass
|
||||
|
||||
fn main() {
|
||||
fn foo<T: ?Sized>(_: &mut T) {}
|
||||
let _f: fn(&mut str) = foo;
|
||||
}
|
||||
|
|
@ -1,25 +1,41 @@
|
|||
struct Foo {
|
||||
t: String
|
||||
t: String,
|
||||
}
|
||||
|
||||
fn cond() -> bool { true }
|
||||
fn cond() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn foo<F>(_: F) where F: FnOnce() {}
|
||||
fn foo<F>(_: F)
|
||||
where
|
||||
F: FnOnce(),
|
||||
{
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let pth = break; //~ ERROR: `break` outside of a loop
|
||||
if cond() { continue } //~ ERROR: `continue` outside of a loop
|
||||
if cond() {
|
||||
continue; //~ ERROR: `continue` outside of a loop
|
||||
}
|
||||
|
||||
while cond() {
|
||||
if cond() { break }
|
||||
if cond() { continue }
|
||||
if cond() {
|
||||
break;
|
||||
}
|
||||
if cond() {
|
||||
continue;
|
||||
}
|
||||
foo(|| {
|
||||
if cond() { break } //~ ERROR: `break` inside of a closure
|
||||
if cond() { continue } //~ ERROR: `continue` inside of a closure
|
||||
if cond() {
|
||||
break; //~ ERROR: `break` inside of a closure
|
||||
}
|
||||
if cond() {
|
||||
continue; //~ ERROR: `continue` inside of a closure
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let rs: Foo = Foo{t: pth};
|
||||
let rs: Foo = Foo { t: pth };
|
||||
|
||||
let unconstrained = break; //~ ERROR: `break` outside of a loop
|
||||
|
||||
|
|
@ -32,4 +48,10 @@ fn main() {
|
|||
//~| ERROR `break` inside of a closure
|
||||
};
|
||||
}
|
||||
|
||||
// Make sure that a continue span actually contains the keyword. (#28105)
|
||||
continue //~ ERROR `continue` outside of a loop
|
||||
;
|
||||
break //~ ERROR `break` outside of a loop
|
||||
;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0767]: use of unreachable label `'lab`
|
||||
--> $DIR/break-outside-loop.rs:30:19
|
||||
--> $DIR/break-outside-loop.rs:46:19
|
||||
|
|
||||
LL | 'lab: loop {
|
||||
| ---- unreachable label defined here
|
||||
|
|
@ -10,49 +10,62 @@ LL | break 'lab;
|
|||
= note: labels are unreachable through functions, closures, async blocks and modules
|
||||
|
||||
error[E0268]: `break` outside of a loop or labeled block
|
||||
--> $DIR/break-outside-loop.rs:10:15
|
||||
--> $DIR/break-outside-loop.rs:16:15
|
||||
|
|
||||
LL | let pth = break;
|
||||
| ^^^^^ cannot `break` outside of a loop or labeled block
|
||||
|
||||
error[E0268]: `continue` outside of a loop
|
||||
--> $DIR/break-outside-loop.rs:11:17
|
||||
--> $DIR/break-outside-loop.rs:18:9
|
||||
|
|
||||
LL | if cond() { continue }
|
||||
| ^^^^^^^^ cannot `continue` outside of a loop
|
||||
LL | continue;
|
||||
| ^^^^^^^^ cannot `continue` outside of a loop
|
||||
|
||||
error[E0267]: `break` inside of a closure
|
||||
--> $DIR/break-outside-loop.rs:17:25
|
||||
--> $DIR/break-outside-loop.rs:30:17
|
||||
|
|
||||
LL | foo(|| {
|
||||
| -- enclosing closure
|
||||
LL | if cond() { break }
|
||||
| ^^^^^ cannot `break` inside of a closure
|
||||
LL | if cond() {
|
||||
LL | break;
|
||||
| ^^^^^ cannot `break` inside of a closure
|
||||
|
||||
error[E0267]: `continue` inside of a closure
|
||||
--> $DIR/break-outside-loop.rs:18:25
|
||||
--> $DIR/break-outside-loop.rs:33:17
|
||||
|
|
||||
LL | foo(|| {
|
||||
| -- enclosing closure
|
||||
LL | if cond() { break }
|
||||
LL | if cond() { continue }
|
||||
| ^^^^^^^^ cannot `continue` inside of a closure
|
||||
...
|
||||
LL | continue;
|
||||
| ^^^^^^^^ cannot `continue` inside of a closure
|
||||
|
||||
error[E0268]: `break` outside of a loop or labeled block
|
||||
--> $DIR/break-outside-loop.rs:24:25
|
||||
--> $DIR/break-outside-loop.rs:40:25
|
||||
|
|
||||
LL | let unconstrained = break;
|
||||
| ^^^^^ cannot `break` outside of a loop or labeled block
|
||||
|
||||
error[E0267]: `break` inside of a closure
|
||||
--> $DIR/break-outside-loop.rs:30:13
|
||||
--> $DIR/break-outside-loop.rs:46:13
|
||||
|
|
||||
LL | || {
|
||||
| -- enclosing closure
|
||||
LL | break 'lab;
|
||||
| ^^^^^^^^^^ cannot `break` inside of a closure
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
error[E0268]: `continue` outside of a loop
|
||||
--> $DIR/break-outside-loop.rs:53:5
|
||||
|
|
||||
LL | continue
|
||||
| ^^^^^^^^ cannot `continue` outside of a loop
|
||||
|
||||
error[E0268]: `break` outside of a loop or labeled block
|
||||
--> $DIR/break-outside-loop.rs:55:5
|
||||
|
|
||||
LL | break
|
||||
| ^^^^^ cannot `break` outside of a loop or labeled block
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0267, E0268, E0767.
|
||||
For more information about an error, try `rustc --explain E0267`.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/22706>
|
||||
fn is_copy<T: ::std::marker<i32>::Copy>() {}
|
||||
//~^ ERROR type arguments are not allowed on module `marker` [E0109]
|
||||
fn main() {}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0109]: type arguments are not allowed on module `marker`
|
||||
--> $DIR/issue-22706.rs:1:29
|
||||
--> $DIR/type-args-on-module-in-bound.rs:2:29
|
||||
|
|
||||
LL | fn is_copy<T: ::std::marker<i32>::Copy>() {}
|
||||
| ------ ^^^ type argument not allowed
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
//@ aux-build:issue-16725.rs
|
||||
|
||||
extern crate issue_16725 as foo;
|
||||
|
||||
fn main() {
|
||||
unsafe { foo::bar(); }
|
||||
//~^ ERROR: function `bar` is private
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
//@ run-pass
|
||||
// Test that HIR ty lowering doesn't forget about mutability of `&mut str`.
|
||||
|
||||
|
||||
fn main() {
|
||||
fn foo<T: ?Sized>(_: &mut T) {}
|
||||
let _f: fn(&mut str) = foo;
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
use std::{fs, net};
|
||||
|
||||
fn assert_both<T: Send + Sync>() {}
|
||||
fn assert_send<T: Send>() {}
|
||||
|
||||
fn main() {
|
||||
assert_both::<fs::File>();
|
||||
assert_both::<fs::Metadata>();
|
||||
assert_both::<fs::ReadDir>();
|
||||
assert_both::<fs::DirEntry>();
|
||||
assert_both::<fs::OpenOptions>();
|
||||
assert_both::<fs::Permissions>();
|
||||
|
||||
assert_both::<net::TcpStream>();
|
||||
assert_both::<net::TcpListener>();
|
||||
assert_both::<net::UdpSocket>();
|
||||
assert_both::<net::SocketAddr>();
|
||||
assert_both::<net::SocketAddrV4>();
|
||||
assert_both::<net::SocketAddrV6>();
|
||||
assert_both::<net::Ipv4Addr>();
|
||||
assert_both::<net::Ipv6Addr>();
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
// Make sure that a continue span actually contains the keyword.
|
||||
|
||||
fn main() {
|
||||
continue //~ ERROR `continue` outside of a loop
|
||||
;
|
||||
break //~ ERROR `break` outside of a loop
|
||||
;
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
error[E0268]: `continue` outside of a loop
|
||||
--> $DIR/issue-28105.rs:4:5
|
||||
|
|
||||
LL | continue
|
||||
| ^^^^^^^^ cannot `continue` outside of a loop
|
||||
|
||||
error[E0268]: `break` outside of a loop or labeled block
|
||||
--> $DIR/issue-28105.rs:6:5
|
||||
|
|
||||
LL | break
|
||||
| ^^^^^ cannot `break` outside of a loop or labeled block
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0268`.
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
enum Bird {
|
||||
pub Duck,
|
||||
//~^ ERROR visibility qualifiers are not permitted here
|
||||
Goose,
|
||||
pub(crate) Dove
|
||||
//~^ ERROR visibility qualifiers are not permitted here
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
let y = Bird::Goose;
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/issue-28433.rs:2:5
|
||||
|
|
||||
LL | pub Duck,
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
||||
= note: enum variants and their fields always share the visibility of the enum they are in
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/issue-28433.rs:5:5
|
||||
|
|
||||
LL | pub(crate) Dove
|
||||
| ^^^^^^^^^^ help: remove the qualifier
|
||||
|
|
||||
= note: enum variants and their fields always share the visibility of the enum they are in
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0449`.
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#[derive(Debug)]
|
||||
struct builder;
|
||||
|
||||
fn main() {
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
//@ check-pass
|
||||
#![allow(unused)]
|
||||
|
||||
macro_rules! column {
|
||||
($i:ident) => {
|
||||
$i
|
||||
};
|
||||
}
|
||||
|
||||
fn foo() -> ! {
|
||||
panic!();
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
struct Foo (
|
||||
fn([u8; |x: u8| {}]), //~ ERROR mismatched types
|
||||
);
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
// Make sure that label for continue and break is spanned correctly
|
||||
//! regression test for <https://github.com/rust-lang/rust/issues/28109>
|
||||
//! Make sure that label for continue and break is spanned correctly.
|
||||
|
||||
fn main() {
|
||||
loop {
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
error[E0426]: use of undeclared label `'b`
|
||||
--> $DIR/issue-28109.rs:6:9
|
||||
--> $DIR/undeclared-label-span.rs:7:9
|
||||
|
|
||||
LL | 'b
|
||||
| ^^ undeclared label `'b`
|
||||
|
||||
error[E0426]: use of undeclared label `'c`
|
||||
--> $DIR/issue-28109.rs:9:9
|
||||
--> $DIR/undeclared-label-span.rs:10:9
|
||||
|
|
||||
LL | 'c
|
||||
| ^^ undeclared label `'c`
|
||||
17
tests/ui/macros/column-macro-collision.rs
Normal file
17
tests/ui/macros/column-macro-collision.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/43057>
|
||||
//! user-defined `column!` macro must not shadow
|
||||
//! the built-in `column!()` used internally by `panic!()`.
|
||||
//@ check-pass
|
||||
#![allow(unused)]
|
||||
|
||||
macro_rules! column {
|
||||
($i:ident) => {
|
||||
$i
|
||||
};
|
||||
}
|
||||
|
||||
fn foo() -> ! {
|
||||
panic!();
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/27008>
|
||||
|
||||
struct S;
|
||||
|
||||
fn main() {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-27008.rs:4:17
|
||||
--> $DIR/array-repeat-unit-struct.rs:6:17
|
||||
|
|
||||
LL | let b = [0; S];
|
||||
| ^ expected `usize`, found `S`
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/24819>
|
||||
//@ dont-require-annotations: NOTE
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
|
@ -9,5 +10,4 @@ fn main() {
|
|||
//~| NOTE expected `&mut HashSet<u32>`, found `&mut Vec<_>`
|
||||
}
|
||||
|
||||
fn foo(h: &mut HashSet<u32>) {
|
||||
}
|
||||
fn foo(h: &mut HashSet<u32>) {}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-24819.rs:7:9
|
||||
--> $DIR/vec-hashset-type-mismatch.rs:8:9
|
||||
|
|
||||
LL | foo(&mut v);
|
||||
| --- ^^^^^^ expected `&mut HashSet<u32>`, found `&mut Vec<_>`
|
||||
|
|
@ -9,9 +9,9 @@ LL | foo(&mut v);
|
|||
= note: expected mutable reference `&mut HashSet<u32>`
|
||||
found mutable reference `&mut Vec<_>`
|
||||
note: function defined here
|
||||
--> $DIR/issue-24819.rs:12:4
|
||||
--> $DIR/vec-hashset-type-mismatch.rs:13:4
|
||||
|
|
||||
LL | fn foo(h: &mut HashSet<u32>) {
|
||||
LL | fn foo(h: &mut HashSet<u32>) {}
|
||||
| ^^^ --------------------
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
|
@ -25,6 +25,14 @@ pub extern "C" { //~ ERROR visibility qualifiers are not permitted here
|
|||
pub static St: u8;
|
||||
}
|
||||
|
||||
enum Bird {
|
||||
pub Duck,
|
||||
//~^ ERROR visibility qualifiers are not permitted here
|
||||
pub(crate) Dove,
|
||||
//~^ ERROR visibility qualifiers are not permitted here
|
||||
Goose,
|
||||
}
|
||||
|
||||
const MAIN: u8 = {
|
||||
pub trait Tr {
|
||||
fn f();
|
||||
|
|
@ -79,4 +87,11 @@ fn main() {
|
|||
pub fn f();
|
||||
pub static St: u8;
|
||||
}
|
||||
enum Bird {
|
||||
pub Duck,
|
||||
//~^ ERROR visibility qualifiers are not permitted here
|
||||
pub(crate) Dove,
|
||||
//~^ ERROR visibility qualifiers are not permitted here
|
||||
Goose,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,23 @@ LL | pub extern "C" {
|
|||
= note: place qualifiers on individual foreign items instead
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:39:5
|
||||
--> $DIR/privacy-sanity.rs:29:5
|
||||
|
|
||||
LL | pub Duck,
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
||||
= note: enum variants and their fields always share the visibility of the enum they are in
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:31:5
|
||||
|
|
||||
LL | pub(crate) Dove,
|
||||
| ^^^^^^^^^^ help: remove the qualifier
|
||||
|
|
||||
= note: enum variants and their fields always share the visibility of the enum they are in
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:47:5
|
||||
|
|
||||
LL | pub impl Tr for S {
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
@ -55,7 +71,7 @@ LL | pub impl Tr for S {
|
|||
= note: trait items always share the visibility of their trait
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:40:9
|
||||
--> $DIR/privacy-sanity.rs:48:9
|
||||
|
|
||||
LL | pub fn f() {}
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
@ -63,7 +79,7 @@ LL | pub fn f() {}
|
|||
= note: trait items always share the visibility of their trait
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:41:9
|
||||
--> $DIR/privacy-sanity.rs:49:9
|
||||
|
|
||||
LL | pub const C: u8 = 0;
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
@ -71,7 +87,7 @@ LL | pub const C: u8 = 0;
|
|||
= note: trait items always share the visibility of their trait
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:42:9
|
||||
--> $DIR/privacy-sanity.rs:50:9
|
||||
|
|
||||
LL | pub type T = u8;
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
@ -79,7 +95,7 @@ LL | pub type T = u8;
|
|||
= note: trait items always share the visibility of their trait
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:44:5
|
||||
--> $DIR/privacy-sanity.rs:52:5
|
||||
|
|
||||
LL | pub impl S {
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
@ -87,7 +103,7 @@ LL | pub impl S {
|
|||
= note: place qualifiers on individual impl items instead
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:49:5
|
||||
--> $DIR/privacy-sanity.rs:57:5
|
||||
|
|
||||
LL | pub extern "C" {
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
@ -95,7 +111,7 @@ LL | pub extern "C" {
|
|||
= note: place qualifiers on individual foreign items instead
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:68:5
|
||||
--> $DIR/privacy-sanity.rs:76:5
|
||||
|
|
||||
LL | pub impl Tr for S {
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
@ -103,7 +119,7 @@ LL | pub impl Tr for S {
|
|||
= note: trait items always share the visibility of their trait
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:69:9
|
||||
--> $DIR/privacy-sanity.rs:77:9
|
||||
|
|
||||
LL | pub fn f() {}
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
@ -111,7 +127,7 @@ LL | pub fn f() {}
|
|||
= note: trait items always share the visibility of their trait
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:70:9
|
||||
--> $DIR/privacy-sanity.rs:78:9
|
||||
|
|
||||
LL | pub const C: u8 = 0;
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
@ -119,7 +135,7 @@ LL | pub const C: u8 = 0;
|
|||
= note: trait items always share the visibility of their trait
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:71:9
|
||||
--> $DIR/privacy-sanity.rs:79:9
|
||||
|
|
||||
LL | pub type T = u8;
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
@ -127,7 +143,7 @@ LL | pub type T = u8;
|
|||
= note: trait items always share the visibility of their trait
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:73:5
|
||||
--> $DIR/privacy-sanity.rs:81:5
|
||||
|
|
||||
LL | pub impl S {
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
@ -135,13 +151,29 @@ LL | pub impl S {
|
|||
= note: place qualifiers on individual impl items instead
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:78:5
|
||||
--> $DIR/privacy-sanity.rs:86:5
|
||||
|
|
||||
LL | pub extern "C" {
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
||||
= note: place qualifiers on individual foreign items instead
|
||||
|
||||
error: aborting due to 18 previous errors
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:91:9
|
||||
|
|
||||
LL | pub Duck,
|
||||
| ^^^ help: remove the qualifier
|
||||
|
|
||||
= note: enum variants and their fields always share the visibility of the enum they are in
|
||||
|
||||
error[E0449]: visibility qualifiers are not permitted here
|
||||
--> $DIR/privacy-sanity.rs:93:9
|
||||
|
|
||||
LL | pub(crate) Dove,
|
||||
| ^^^^^^^^^^ help: remove the qualifier
|
||||
|
|
||||
= note: enum variants and their fields always share the visibility of the enum they are in
|
||||
|
||||
error: aborting due to 22 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0449`.
|
||||
|
|
|
|||
11
tests/ui/privacy/private-extern-fn-visibility.rs
Normal file
11
tests/ui/privacy/private-extern-fn-visibility.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/16725>
|
||||
//@ aux-build:private-extern-fn.rs
|
||||
|
||||
extern crate private_extern_fn as foo;
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
foo::bar();
|
||||
//~^ ERROR: function `bar` is private
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
error[E0603]: function `bar` is private
|
||||
--> $DIR/issue-16725.rs:6:19
|
||||
--> $DIR/private-extern-fn-visibility.rs:8:14
|
||||
|
|
||||
LL | unsafe { foo::bar(); }
|
||||
| ^^^ private function
|
||||
LL | foo::bar();
|
||||
| ^^^ private function
|
||||
|
|
||||
note: the function `bar` is defined here
|
||||
--> $DIR/auxiliary/issue-16725.rs:2:5
|
||||
--> $DIR/auxiliary/private-extern-fn.rs:2:5
|
||||
|
|
||||
LL | fn bar();
|
||||
| ^^^^^^^^^
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/22894>
|
||||
//@ build-pass
|
||||
#[allow(dead_code)]
|
||||
static X: &'static str = &*"";
|
||||
14
tests/ui/structs/parse-error-with-type-param.fixed
Normal file
14
tests/ui/structs/parse-error-with-type-param.fixed
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
//@ run-rustfix
|
||||
// #141403
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Clone)]
|
||||
struct B<T> {
|
||||
a: A<(T, u32)>, // <- note, comma is missing here
|
||||
/// asdf
|
||||
//~^ ERROR found a documentation comment that doesn't document anything
|
||||
b: u32,
|
||||
}
|
||||
#[derive(Clone)]
|
||||
struct A<T>(T);
|
||||
fn main() {}
|
||||
14
tests/ui/structs/parse-error-with-type-param.rs
Normal file
14
tests/ui/structs/parse-error-with-type-param.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
//@ run-rustfix
|
||||
// #141403
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Clone)]
|
||||
struct B<T> {
|
||||
a: A<(T, u32)> // <- note, comma is missing here
|
||||
/// asdf
|
||||
//~^ ERROR found a documentation comment that doesn't document anything
|
||||
b: u32,
|
||||
}
|
||||
#[derive(Clone)]
|
||||
struct A<T>(T);
|
||||
fn main() {}
|
||||
18
tests/ui/structs/parse-error-with-type-param.stderr
Normal file
18
tests/ui/structs/parse-error-with-type-param.stderr
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
error[E0585]: found a documentation comment that doesn't document anything
|
||||
--> $DIR/parse-error-with-type-param.rs:8:5
|
||||
|
|
||||
LL | struct B<T> {
|
||||
| - while parsing this struct
|
||||
LL | a: A<(T, u32)> // <- note, comma is missing here
|
||||
LL | /// asdf
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= help: doc comments must come before what they document, if a comment was intended use `//`
|
||||
help: missing comma here
|
||||
|
|
||||
LL | a: A<(T, u32)>, // <- note, comma is missing here
|
||||
| +
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0585`.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
//@ run-pass
|
||||
|
||||
use std::sync;
|
||||
use std::{fs, net, sync};
|
||||
|
||||
fn assert_both<T: Sync + Send>() {}
|
||||
|
||||
|
|
@ -12,4 +12,20 @@ fn main() {
|
|||
assert_both::<sync::Arc<()>>();
|
||||
assert_both::<sync::Weak<()>>();
|
||||
assert_both::<sync::Once>();
|
||||
|
||||
assert_both::<fs::File>();
|
||||
assert_both::<fs::Metadata>();
|
||||
assert_both::<fs::ReadDir>();
|
||||
assert_both::<fs::DirEntry>();
|
||||
assert_both::<fs::OpenOptions>();
|
||||
assert_both::<fs::Permissions>();
|
||||
|
||||
assert_both::<net::TcpStream>();
|
||||
assert_both::<net::TcpListener>();
|
||||
assert_both::<net::UdpSocket>();
|
||||
assert_both::<net::SocketAddr>();
|
||||
assert_both::<net::SocketAddrV4>();
|
||||
assert_both::<net::SocketAddrV6>();
|
||||
assert_both::<net::Ipv4Addr>();
|
||||
assert_both::<net::Ipv6Addr>();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue