diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index c07ba88ae204d..3f4911c4ecfcf 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -33,7 +33,6 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_span::source_map::{respan, Spanned}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{Span, DUMMY_SP}; -use std::cmp::Ordering; use std::convert::TryFrom; use std::fmt; use std::mem; @@ -324,46 +323,17 @@ pub type GenericBounds = Vec; /// Specifies the enforced ordering for generic parameters. In the future, /// if we wanted to relax this order, we could override `PartialEq` and /// `PartialOrd`, to allow the kinds to be unordered. -#[derive(Hash, Clone, Copy)] +#[derive(Hash, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub enum ParamKindOrd { Lifetime, - Type, - Const, - // `Infer` is not actually constructed directly from the AST, but is implicitly constructed - // during HIR lowering, and `ParamKindOrd` will implicitly order inferred variables last. - Infer, -} - -impl Ord for ParamKindOrd { - fn cmp(&self, other: &Self) -> Ordering { - use ParamKindOrd::*; - let to_int = |v| match v { - Lifetime => 0, - Infer | Type | Const => 1, - }; - - to_int(*self).cmp(&to_int(*other)) - } -} -impl PartialOrd for ParamKindOrd { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} -impl PartialEq for ParamKindOrd { - fn eq(&self, other: &Self) -> bool { - self.cmp(other) == Ordering::Equal - } + TypeOrConst, } -impl Eq for ParamKindOrd {} impl fmt::Display for ParamKindOrd { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { ParamKindOrd::Lifetime => "lifetime".fmt(f), - ParamKindOrd::Type => "type".fmt(f), - ParamKindOrd::Const { .. } => "const".fmt(f), - ParamKindOrd::Infer => "infer".fmt(f), + ParamKindOrd::TypeOrConst => "type and const".fmt(f), } } } diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 6c754f38d144b..6a0a1b0836013 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -839,10 +839,10 @@ fn validate_generic_param_order( let (kind, bounds, span) = (¶m.kind, ¶m.bounds, ident.span); let (ord_kind, ident) = match ¶m.kind { GenericParamKind::Lifetime => (ParamKindOrd::Lifetime, ident.to_string()), - GenericParamKind::Type { default: _ } => (ParamKindOrd::Type, ident.to_string()), + GenericParamKind::Type { default: _ } => (ParamKindOrd::TypeOrConst, ident.to_string()), GenericParamKind::Const { ref ty, kw_span: _, default: _ } => { let ty = pprust::ty_to_string(ty); - (ParamKindOrd::Const, format!("const {}: {}", ident, ty)) + (ParamKindOrd::TypeOrConst, format!("const {}: {}", ident, ty)) } }; param_idents.push((kind, ord_kind, bounds, idx, ident)); diff --git a/compiler/rustc_codegen_llvm/src/common.rs b/compiler/rustc_codegen_llvm/src/common.rs index 488ea72c3b779..acee9134fb96e 100644 --- a/compiler/rustc_codegen_llvm/src/common.rs +++ b/compiler/rustc_codegen_llvm/src/common.rs @@ -215,7 +215,11 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { } fn const_to_opt_uint(&self, v: &'ll Value) -> Option { - try_as_const_integral(v).map(|v| unsafe { llvm::LLVMConstIntGetZExtValue(v) }) + try_as_const_integral(v).and_then(|v| unsafe { + let mut i = 0u64; + let success = llvm::LLVMRustConstIntGetZExtValue(v, &mut i); + success.then_some(i) + }) } fn const_to_opt_u128(&self, v: &'ll Value, sign_ext: bool) -> Option { diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 172684414fc55..ce27dc5a5d1ea 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -1096,7 +1096,7 @@ extern "C" { pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value; pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value; pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value; - pub fn LLVMConstIntGetZExtValue(ConstantVal: &ConstantInt) -> c_ulonglong; + pub fn LLVMRustConstIntGetZExtValue(ConstantVal: &ConstantInt, Value: &mut u64) -> bool; pub fn LLVMRustConstInt128Get( ConstantVal: &ConstantInt, SExt: bool, diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs index 26b9fbf442846..574746e340b7b 100644 --- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs +++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs @@ -87,7 +87,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let size = bx.const_usize(dest.layout.size.bytes()); // Use llvm.memset.p0i8.* to initialize all zero arrays - if bx.cx().const_to_opt_uint(v) == Some(0) { + if bx.cx().const_to_opt_u128(v, false) == Some(0) { let fill = bx.cx().const_u8(0); bx.memset(start, fill, size, dest.align, MemFlags::empty()); return bx; diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index a57fdc3bfb125..c0f93b7c3382a 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -300,9 +300,9 @@ impl GenericArg<'_> { pub fn to_ord(&self) -> ast::ParamKindOrd { match self { GenericArg::Lifetime(_) => ast::ParamKindOrd::Lifetime, - GenericArg::Type(_) => ast::ParamKindOrd::Type, - GenericArg::Const(_) => ast::ParamKindOrd::Const, - GenericArg::Infer(_) => ast::ParamKindOrd::Infer, + GenericArg::Type(_) | GenericArg::Const(_) | GenericArg::Infer(_) => { + ast::ParamKindOrd::TypeOrConst + } } } @@ -2401,6 +2401,14 @@ impl<'hir> Ty<'hir> { _ => None, } } + + pub fn peel_refs(&self) -> &Self { + let mut final_ty = self; + while let TyKind::Rptr(_, MutTy { ty, .. }) = &final_ty.kind { + final_ty = &ty; + } + final_ty + } } /// Not represented directly in the AST; referred to by name through a `ty_path`. diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 931ce78721cb8..6ee3c7d68213e 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -1618,6 +1618,14 @@ extern "C" LLVMValueRef LLVMRustConstInBoundsGEP2(LLVMTypeRef Ty, return wrap(ConstantExpr::getInBoundsGetElementPtr(unwrap(Ty), Val, IdxList)); } +extern "C" bool LLVMRustConstIntGetZExtValue(LLVMValueRef CV, uint64_t *value) { + auto C = unwrap(CV); + if (C->getBitWidth() > 64) + return false; + *value = C->getZExtValue(); + return true; +} + // Returns true if both high and low were successfully set. Fails in case constant wasn’t any of // the common sizes (1, 8, 16, 32, 64, 128 bits) extern "C" bool LLVMRustConstInt128Get(LLVMValueRef CV, bool sext, uint64_t *high, uint64_t *low) diff --git a/compiler/rustc_middle/src/ty/generics.rs b/compiler/rustc_middle/src/ty/generics.rs index 8631ee91fa456..0c8bdde9c8bce 100644 --- a/compiler/rustc_middle/src/ty/generics.rs +++ b/compiler/rustc_middle/src/ty/generics.rs @@ -27,8 +27,9 @@ impl GenericParamDefKind { pub fn to_ord(&self) -> ast::ParamKindOrd { match self { GenericParamDefKind::Lifetime => ast::ParamKindOrd::Lifetime, - GenericParamDefKind::Type { .. } => ast::ParamKindOrd::Type, - GenericParamDefKind::Const { .. } => ast::ParamKindOrd::Const, + GenericParamDefKind::Type { .. } | GenericParamDefKind::Const { .. } => { + ast::ParamKindOrd::TypeOrConst + } } } diff --git a/compiler/rustc_typeck/src/check/expr.rs b/compiler/rustc_typeck/src/check/expr.rs index 0e6a8ef8265b2..2139200136413 100644 --- a/compiler/rustc_typeck/src/check/expr.rs +++ b/compiler/rustc_typeck/src/check/expr.rs @@ -1305,31 +1305,30 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } fn suggest_array_len(&self, expr: &'tcx hir::Expr<'tcx>, array_len: u64) { - if let Some(parent_hir_id) = self.tcx.hir().find_parent_node(expr.hir_id) { - let ty = match self.tcx.hir().find(parent_hir_id) { - Some( - hir::Node::Local(hir::Local { ty: Some(ty), .. }) - | hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(ty, _), .. }), - ) => Some(ty), - _ => None, - }; - if let Some(ty) = ty - && let hir::TyKind::Array(_, length) = ty.kind - && let hir::ArrayLen::Body(hir::AnonConst { hir_id, .. }) = length - && let Some(span) = self.tcx.hir().opt_span(hir_id) - { - match self.tcx.sess.diagnostic().steal_diagnostic(span, StashKey::UnderscoreForArrayLengths) { - Some(mut err) => { - err.span_suggestion( - span, - "consider specifying the array length", - array_len, - Applicability::MaybeIncorrect, - ); - err.emit(); - } - None => () + let parent_node = self.tcx.hir().parent_iter(expr.hir_id).find(|(_, node)| { + !matches!(node, hir::Node::Expr(hir::Expr { kind: hir::ExprKind::AddrOf(..), .. })) + }); + let Some((_, + hir::Node::Local(hir::Local { ty: Some(ty), .. }) + | hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(ty, _), .. })) + ) = parent_node else { + return + }; + if let hir::TyKind::Array(_, length) = ty.peel_refs().kind + && let hir::ArrayLen::Body(hir::AnonConst { hir_id, .. }) = length + && let Some(span) = self.tcx.hir().opt_span(hir_id) + { + match self.tcx.sess.diagnostic().steal_diagnostic(span, StashKey::UnderscoreForArrayLengths) { + Some(mut err) => { + err.span_suggestion( + span, + "consider specifying the array length", + array_len, + Applicability::MaybeIncorrect, + ); + err.emit(); } + None => () } } } diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index a26e26cb38996..70e259b46bf20 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -65,8 +65,8 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option< let ty = item_ctxt.ast_ty_to_ty(hir_ty); // Iterate through the generics of the projection to find the one that corresponds to - // the def_id that this query was called with. We filter to only const args here as a - // precaution for if it's ever allowed to elide lifetimes in GAT's. It currently isn't + // the def_id that this query was called with. We filter to only type and const args here + // as a precaution for if it's ever allowed to elide lifetimes in GAT's. It currently isn't // but it can't hurt to be safe ^^ if let ty::Projection(projection) = ty.kind() { let generics = tcx.generics_of(projection.item_def_id); diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index 9d3e9abf55779..905212eb372b1 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -1819,7 +1819,7 @@ impl<'a> Formatter<'a> { /// write!(formatter, /// "Foo({}{})", /// if self.0 < 0 { '-' } else { '+' }, - /// self.0) + /// self.0.abs()) /// } else { /// write!(formatter, "Foo({})", self.0) /// } @@ -1827,6 +1827,7 @@ impl<'a> Formatter<'a> { /// } /// /// assert_eq!(&format!("{:+}", Foo(23)), "Foo(+23)"); + /// assert_eq!(&format!("{:+}", Foo(-23)), "Foo(-23)"); /// assert_eq!(&format!("{}", Foo(23)), "Foo(23)"); /// ``` #[must_use] diff --git a/library/std/src/sys/windows/path.rs b/library/std/src/sys/windows/path.rs index a0f822070992f..beeca1917a9af 100644 --- a/library/std/src/sys/windows/path.rs +++ b/library/std/src/sys/windows/path.rs @@ -198,14 +198,7 @@ fn parse_next_component(path: &OsStr, verbatim: bool) -> (&OsStr, &OsStr) { match path.bytes().iter().position(|&x| separator(x)) { Some(separator_start) => { - let mut separator_end = separator_start + 1; - - // a series of multiple separator characters is treated as a single separator, - // except in verbatim paths - while !verbatim && separator_end < path.len() && separator(path.bytes()[separator_end]) - { - separator_end += 1; - } + let separator_end = separator_start + 1; let component = &path.bytes()[..separator_start]; diff --git a/library/std/src/sys/windows/path/tests.rs b/library/std/src/sys/windows/path/tests.rs index a71175069052f..623c6236166da 100644 --- a/library/std/src/sys/windows/path/tests.rs +++ b/library/std/src/sys/windows/path/tests.rs @@ -31,16 +31,6 @@ fn test_parse_next_component() { parse_next_component(OsStr::new(r"servershare"), false), (OsStr::new(r"servershare"), OsStr::new("")) ); - - assert_eq!( - parse_next_component(OsStr::new(r"server/\//\/\\\\/////\/share"), false), - (OsStr::new(r"server"), OsStr::new(r"share")) - ); - - assert_eq!( - parse_next_component(OsStr::new(r"server\\\\\\\\\\\\\\share"), true), - (OsStr::new(r"server"), OsStr::new(r"\\\\\\\\\\\\\share")) - ); } #[test] @@ -126,3 +116,22 @@ fn test_windows_prefix_components() { assert_eq!(drive.as_os_str(), OsStr::new("C:")); assert_eq!(components.as_path(), Path::new("")); } + +/// See #101358. +/// +/// Note that the exact behaviour here may change in the future. +/// In which case this test will need to adjusted. +#[test] +fn broken_unc_path() { + use crate::path::Component; + + let mut components = Path::new(r"\\foo\\bar\\").components(); + assert_eq!(components.next(), Some(Component::RootDir)); + assert_eq!(components.next(), Some(Component::Normal("foo".as_ref()))); + assert_eq!(components.next(), Some(Component::Normal("bar".as_ref()))); + + let mut components = Path::new("//foo//bar//").components(); + assert_eq!(components.next(), Some(Component::RootDir)); + assert_eq!(components.next(), Some(Component::Normal("foo".as_ref()))); + assert_eq!(components.next(), Some(Component::Normal("bar".as_ref()))); +} diff --git a/src/test/ui/array-slice-vec/suggest-array-length.fixed b/src/test/ui/array-slice-vec/suggest-array-length.fixed index bae3ab74af676..867c18a7d5e6b 100644 --- a/src/test/ui/array-slice-vec/suggest-array-length.fixed +++ b/src/test/ui/array-slice-vec/suggest-array-length.fixed @@ -5,10 +5,22 @@ fn main() { const Foo: [i32; 3] = [1, 2, 3]; //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment //~| ERROR using `_` for array lengths is unstable + const REF_FOO: &[u8; 1] = &[1]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable let foo: [i32; 3] = [1, 2, 3]; //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment //~| ERROR using `_` for array lengths is unstable let bar: [i32; 3] = [0; 3]; //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment //~| ERROR using `_` for array lengths is unstable + let ref_foo: &[i32; 3] = &[1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let ref_bar: &[i32; 3] = &[0; 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let multiple_ref_foo: &&[i32; 3] = &&[1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable } diff --git a/src/test/ui/array-slice-vec/suggest-array-length.rs b/src/test/ui/array-slice-vec/suggest-array-length.rs index b0867f4e39676..f66b3d4a89991 100644 --- a/src/test/ui/array-slice-vec/suggest-array-length.rs +++ b/src/test/ui/array-slice-vec/suggest-array-length.rs @@ -5,10 +5,22 @@ fn main() { const Foo: [i32; _] = [1, 2, 3]; //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment //~| ERROR using `_` for array lengths is unstable + const REF_FOO: &[u8; _] = &[1]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable let foo: [i32; _] = [1, 2, 3]; //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment //~| ERROR using `_` for array lengths is unstable let bar: [i32; _] = [0; 3]; //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment //~| ERROR using `_` for array lengths is unstable + let ref_foo: &[i32; _] = &[1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let ref_bar: &[i32; _] = &[0; 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable } diff --git a/src/test/ui/array-slice-vec/suggest-array-length.stderr b/src/test/ui/array-slice-vec/suggest-array-length.stderr index 9000f71602850..16c90a04784d0 100644 --- a/src/test/ui/array-slice-vec/suggest-array-length.stderr +++ b/src/test/ui/array-slice-vec/suggest-array-length.stderr @@ -1,21 +1,45 @@ error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/suggest-array-length.rs:8:20 + --> $DIR/suggest-array-length.rs:11:20 | LL | let foo: [i32; _] = [1, 2, 3]; | ^ `_` not allowed here error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/suggest-array-length.rs:11:20 + --> $DIR/suggest-array-length.rs:14:20 | LL | let bar: [i32; _] = [0; 3]; | ^ `_` not allowed here +error: in expressions, `_` can only be used on the left-hand side of an assignment + --> $DIR/suggest-array-length.rs:17:25 + | +LL | let ref_foo: &[i32; _] = &[1, 2, 3]; + | ^ `_` not allowed here + +error: in expressions, `_` can only be used on the left-hand side of an assignment + --> $DIR/suggest-array-length.rs:20:25 + | +LL | let ref_bar: &[i32; _] = &[0; 3]; + | ^ `_` not allowed here + +error: in expressions, `_` can only be used on the left-hand side of an assignment + --> $DIR/suggest-array-length.rs:23:35 + | +LL | let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; + | ^ `_` not allowed here + error: in expressions, `_` can only be used on the left-hand side of an assignment --> $DIR/suggest-array-length.rs:5:22 | LL | const Foo: [i32; _] = [1, 2, 3]; | ^ `_` not allowed here +error: in expressions, `_` can only be used on the left-hand side of an assignment + --> $DIR/suggest-array-length.rs:8:26 + | +LL | const REF_FOO: &[u8; _] = &[1]; + | ^ `_` not allowed here + error[E0658]: using `_` for array lengths is unstable --> $DIR/suggest-array-length.rs:5:22 | @@ -26,7 +50,16 @@ LL | const Foo: [i32; _] = [1, 2, 3]; = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:8:20 + --> $DIR/suggest-array-length.rs:8:26 + | +LL | const REF_FOO: &[u8; _] = &[1]; + | ^ help: consider specifying the array length: `1` + | + = note: see issue #85077 for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + +error[E0658]: using `_` for array lengths is unstable + --> $DIR/suggest-array-length.rs:11:20 | LL | let foo: [i32; _] = [1, 2, 3]; | ^ help: consider specifying the array length: `3` @@ -35,7 +68,7 @@ LL | let foo: [i32; _] = [1, 2, 3]; = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:11:20 + --> $DIR/suggest-array-length.rs:14:20 | LL | let bar: [i32; _] = [0; 3]; | ^ help: consider specifying the array length: `3` @@ -43,6 +76,33 @@ LL | let bar: [i32; _] = [0; 3]; = note: see issue #85077 for more information = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable -error: aborting due to 6 previous errors +error[E0658]: using `_` for array lengths is unstable + --> $DIR/suggest-array-length.rs:17:25 + | +LL | let ref_foo: &[i32; _] = &[1, 2, 3]; + | ^ help: consider specifying the array length: `3` + | + = note: see issue #85077 for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + +error[E0658]: using `_` for array lengths is unstable + --> $DIR/suggest-array-length.rs:20:25 + | +LL | let ref_bar: &[i32; _] = &[0; 3]; + | ^ help: consider specifying the array length: `3` + | + = note: see issue #85077 for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + +error[E0658]: using `_` for array lengths is unstable + --> $DIR/suggest-array-length.rs:23:35 + | +LL | let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; + | ^ help: consider specifying the array length: `3` + | + = note: see issue #85077 for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + +error: aborting due to 14 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/codegen/issue-101585-128bit-repeat.rs b/src/test/ui/codegen/issue-101585-128bit-repeat.rs new file mode 100644 index 0000000000000..c6a686597e9c8 --- /dev/null +++ b/src/test/ui/codegen/issue-101585-128bit-repeat.rs @@ -0,0 +1,14 @@ +// Regression test for issue 101585. +// run-pass + +fn main() { + fn min_array_ok() -> [i128; 1] { + [i128::MIN] + } + assert_eq!(min_array_ok(), [-170141183460469231731687303715884105728i128]); + + fn min_array_nok() -> [i128; 1] { + [i128::MIN; 1] + } + assert_eq!(min_array_nok(), [-170141183460469231731687303715884105728i128]); +} diff --git a/src/test/ui/const-generics/argument_order.stderr b/src/test/ui/const-generics/argument_order.stderr index 6b33dffb434e7..99122c6f5e362 100644 --- a/src/test/ui/const-generics/argument_order.stderr +++ b/src/test/ui/const-generics/argument_order.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/argument_order.rs:6:32 | LL | struct AlsoBad { @@ -11,7 +11,7 @@ LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>; | ^^^^^^^ | = note: lifetime arguments must be provided before type arguments - = help: reorder the arguments: lifetimes, then consts: `<'a, 'b, N, T, M, U>` + = help: reorder the arguments: lifetimes, then type and consts: `<'a, 'b, N, T, M, U>` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/const-param-before-other-params.rs b/src/test/ui/const-generics/const-param-before-other-params.rs index da06aca308e18..cb1cebe1f68a1 100644 --- a/src/test/ui/const-generics/const-param-before-other-params.rs +++ b/src/test/ui/const-generics/const-param-before-other-params.rs @@ -1,5 +1,5 @@ fn bar(_: &'a ()) { - //~^ ERROR lifetime parameters must be declared prior to const parameters + //~^ ERROR lifetime parameters must be declared prior to type and const parameters } fn foo(_: &T) {} diff --git a/src/test/ui/const-generics/const-param-before-other-params.stderr b/src/test/ui/const-generics/const-param-before-other-params.stderr index 607d20c4a25f2..2c7a47bbc78cd 100644 --- a/src/test/ui/const-generics/const-param-before-other-params.stderr +++ b/src/test/ui/const-generics/const-param-before-other-params.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/const-param-before-other-params.rs:1:21 | LL | fn bar(_: &'a ()) { diff --git a/src/test/ui/const-generics/defaults/intermixed-lifetime.rs b/src/test/ui/const-generics/defaults/intermixed-lifetime.rs index 578938db4c43e..beaf7fc6001a9 100644 --- a/src/test/ui/const-generics/defaults/intermixed-lifetime.rs +++ b/src/test/ui/const-generics/defaults/intermixed-lifetime.rs @@ -1,9 +1,9 @@ // Checks that lifetimes cannot be interspersed between consts and types. struct Foo(&'a (), T); -//~^ Error lifetime parameters must be declared prior to const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters struct Bar(&'a (), T); -//~^ Error lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn main() {} diff --git a/src/test/ui/const-generics/defaults/intermixed-lifetime.stderr b/src/test/ui/const-generics/defaults/intermixed-lifetime.stderr index e27976deb2b56..5cff61dd9fb91 100644 --- a/src/test/ui/const-generics/defaults/intermixed-lifetime.stderr +++ b/src/test/ui/const-generics/defaults/intermixed-lifetime.stderr @@ -1,10 +1,10 @@ -error: lifetime parameters must be declared prior to const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/intermixed-lifetime.rs:3:28 | LL | struct Foo(&'a (), T); | -----------------^^---------- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T = u32>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/intermixed-lifetime.rs:6:37 | LL | struct Bar(&'a (), T); diff --git a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs index da087ffc3c4af..f928fc9e75b73 100644 --- a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs +++ b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs @@ -1,4 +1,4 @@ struct Foo(&'a u32); -//~^ Error lifetime parameters must be declared prior to const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn main() {} diff --git a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr index 55f5a53538537..ba08b4646d0f4 100644 --- a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr +++ b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/param-order-err-pretty-prints-default.rs:1:33 | LL | struct Foo(&'a u32); diff --git a/src/test/ui/generics/issue-59508-1.rs b/src/test/ui/generics/issue-59508-1.rs index 7e1dd77070441..8e27749e8fc6b 100644 --- a/src/test/ui/generics/issue-59508-1.rs +++ b/src/test/ui/generics/issue-59508-1.rs @@ -8,7 +8,7 @@ struct A; impl A { pub fn do_things() { - //~^ ERROR lifetime parameters must be declared prior to type parameters + //~^ ERROR lifetime parameters must be declared prior to type and const parameters println!("panic"); } } diff --git a/src/test/ui/generics/issue-59508-1.stderr b/src/test/ui/generics/issue-59508-1.stderr index d162365ea4bff..1c510044f806f 100644 --- a/src/test/ui/generics/issue-59508-1.stderr +++ b/src/test/ui/generics/issue-59508-1.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-59508-1.rs:10:25 | LL | pub fn do_things() { diff --git a/src/test/ui/generics/issue-59508.fixed b/src/test/ui/generics/issue-59508.fixed index b5c60a1626f53..de8f47d4cff89 100644 --- a/src/test/ui/generics/issue-59508.fixed +++ b/src/test/ui/generics/issue-59508.fixed @@ -8,7 +8,7 @@ struct A; impl A { pub fn do_things<'a, 'b: 'a, T>() { - //~^ ERROR lifetime parameters must be declared prior to type parameters + //~^ ERROR lifetime parameters must be declared prior to type and const parameters println!("panic"); } } diff --git a/src/test/ui/generics/issue-59508.rs b/src/test/ui/generics/issue-59508.rs index 0b39c5d8f2aec..a4c7d4ff26266 100644 --- a/src/test/ui/generics/issue-59508.rs +++ b/src/test/ui/generics/issue-59508.rs @@ -8,7 +8,7 @@ struct A; impl A { pub fn do_things() { - //~^ ERROR lifetime parameters must be declared prior to type parameters + //~^ ERROR lifetime parameters must be declared prior to type and const parameters println!("panic"); } } diff --git a/src/test/ui/generics/issue-59508.stderr b/src/test/ui/generics/issue-59508.stderr index c52ae4182b86b..fd23b6276f92b 100644 --- a/src/test/ui/generics/issue-59508.stderr +++ b/src/test/ui/generics/issue-59508.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-59508.rs:10:25 | LL | pub fn do_things() { diff --git a/src/test/ui/generics/issue-80512-param-reordering-with-defaults.rs b/src/test/ui/generics/issue-80512-param-reordering-with-defaults.rs index fe3e4fbc7e0b6..0e208818ed459 100644 --- a/src/test/ui/generics/issue-80512-param-reordering-with-defaults.rs +++ b/src/test/ui/generics/issue-80512-param-reordering-with-defaults.rs @@ -1,4 +1,4 @@ #![crate_type = "lib"] struct S(&'a T); -//~^ ERROR lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters diff --git a/src/test/ui/generics/issue-80512-param-reordering-with-defaults.stderr b/src/test/ui/generics/issue-80512-param-reordering-with-defaults.stderr index 119b1a0d2070e..70793a9c92084 100644 --- a/src/test/ui/generics/issue-80512-param-reordering-with-defaults.stderr +++ b/src/test/ui/generics/issue-80512-param-reordering-with-defaults.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-80512-param-reordering-with-defaults.rs:3:18 | LL | struct S(&'a T); diff --git a/src/test/ui/generics/lifetime-before-type-params.rs b/src/test/ui/generics/lifetime-before-type-params.rs index 5a71d6efeda62..d64b1b0b44f65 100644 --- a/src/test/ui/generics/lifetime-before-type-params.rs +++ b/src/test/ui/generics/lifetime-before-type-params.rs @@ -1,11 +1,11 @@ #![allow(unused)] fn first() {} -//~^ ERROR lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn second<'a, T, 'b>() {} -//~^ ERROR lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn third() {} -//~^ ERROR lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn fourth<'a, T, 'b, U, 'c, V>() {} -//~^ ERROR lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn main() {} diff --git a/src/test/ui/generics/lifetime-before-type-params.stderr b/src/test/ui/generics/lifetime-before-type-params.stderr index 62d95e45329f9..84825eb4ceb21 100644 --- a/src/test/ui/generics/lifetime-before-type-params.stderr +++ b/src/test/ui/generics/lifetime-before-type-params.stderr @@ -1,22 +1,22 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:2:13 | LL | fn first() {} | ----^^--^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:4:18 | LL | fn second<'a, T, 'b>() {} | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:6:16 | LL | fn third() {} | -------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T, U>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:8:18 | LL | fn fourth<'a, T, 'b, U, 'c, V>() {} diff --git a/src/test/ui/parser/issues/issue-14303-enum.rs b/src/test/ui/parser/issues/issue-14303-enum.rs deleted file mode 100644 index a6106159805b2..0000000000000 --- a/src/test/ui/parser/issues/issue-14303-enum.rs +++ /dev/null @@ -1,6 +0,0 @@ -enum X<'a, T, 'b> { -//~^ ERROR lifetime parameters must be declared prior to type parameters - A(&'a &'b T) -} - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303-enum.stderr b/src/test/ui/parser/issues/issue-14303-enum.stderr deleted file mode 100644 index 55cef4cabacfe..0000000000000 --- a/src/test/ui/parser/issues/issue-14303-enum.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-enum.rs:1:15 - | -LL | enum X<'a, T, 'b> { - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` - -error: aborting due to previous error - diff --git a/src/test/ui/parser/issues/issue-14303-fn-def.rs b/src/test/ui/parser/issues/issue-14303-fn-def.rs deleted file mode 100644 index 221bd311e7479..0000000000000 --- a/src/test/ui/parser/issues/issue-14303-fn-def.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn foo<'a, T, 'b>(x: &'a T) {} -//~^ ERROR lifetime parameters must be declared prior to type parameters - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303-fn-def.stderr b/src/test/ui/parser/issues/issue-14303-fn-def.stderr deleted file mode 100644 index bacc922969d91..0000000000000 --- a/src/test/ui/parser/issues/issue-14303-fn-def.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-fn-def.rs:1:15 - | -LL | fn foo<'a, T, 'b>(x: &'a T) {} - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` - -error: aborting due to previous error - diff --git a/src/test/ui/parser/issues/issue-14303-impl.rs b/src/test/ui/parser/issues/issue-14303-impl.rs deleted file mode 100644 index 4dc2c66601807..0000000000000 --- a/src/test/ui/parser/issues/issue-14303-impl.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct X(T); - -impl<'a, T, 'b> X {} -//~^ ERROR lifetime parameters must be declared prior to type parameters - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303-impl.stderr b/src/test/ui/parser/issues/issue-14303-impl.stderr deleted file mode 100644 index d6be02f70fd2e..0000000000000 --- a/src/test/ui/parser/issues/issue-14303-impl.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-impl.rs:3:13 - | -LL | impl<'a, T, 'b> X {} - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` - -error: aborting due to previous error - diff --git a/src/test/ui/parser/issues/issue-14303-path.rs b/src/test/ui/parser/issues/issue-14303-path.rs deleted file mode 100644 index 89ef914aba238..0000000000000 --- a/src/test/ui/parser/issues/issue-14303-path.rs +++ /dev/null @@ -1,13 +0,0 @@ -mod foo { - pub struct X<'a, 'b, 'c, T> { - a: &'a str, - b: &'b str, - c: &'c str, - t: T, - } -} - -fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {} -//~^ ERROR type provided when a lifetime was expected - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303-path.stderr b/src/test/ui/parser/issues/issue-14303-path.stderr deleted file mode 100644 index 841e63ecbe9d5..0000000000000 --- a/src/test/ui/parser/issues/issue-14303-path.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0747]: type provided when a lifetime was expected - --> $DIR/issue-14303-path.rs:10:37 - | -LL | fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {} - | ^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0747`. diff --git a/src/test/ui/parser/issues/issue-14303-struct.rs b/src/test/ui/parser/issues/issue-14303-struct.rs deleted file mode 100644 index 0bd10b4d08516..0000000000000 --- a/src/test/ui/parser/issues/issue-14303-struct.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct X<'a, T, 'b> { -//~^ ERROR lifetime parameters must be declared prior to type parameters - x: &'a &'b T -} - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303-struct.stderr b/src/test/ui/parser/issues/issue-14303-struct.stderr deleted file mode 100644 index fa62a39f2416c..0000000000000 --- a/src/test/ui/parser/issues/issue-14303-struct.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-struct.rs:1:17 - | -LL | struct X<'a, T, 'b> { - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` - -error: aborting due to previous error - diff --git a/src/test/ui/parser/issues/issue-14303-trait.rs b/src/test/ui/parser/issues/issue-14303-trait.rs deleted file mode 100644 index f253de92d92de..0000000000000 --- a/src/test/ui/parser/issues/issue-14303-trait.rs +++ /dev/null @@ -1,4 +0,0 @@ -trait Foo<'a, T, 'b> {} -//~^ ERROR lifetime parameters must be declared prior to type parameters - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303-trait.stderr b/src/test/ui/parser/issues/issue-14303-trait.stderr deleted file mode 100644 index 75cd67a9ded82..0000000000000 --- a/src/test/ui/parser/issues/issue-14303-trait.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-trait.rs:1:18 - | -LL | trait Foo<'a, T, 'b> {} - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` - -error: aborting due to previous error - diff --git a/src/test/ui/parser/issues/issue-14303.rs b/src/test/ui/parser/issues/issue-14303.rs new file mode 100644 index 0000000000000..82850d77aa921 --- /dev/null +++ b/src/test/ui/parser/issues/issue-14303.rs @@ -0,0 +1,33 @@ +enum Enum<'a, T, 'b> { +//~^ ERROR lifetime parameters must be declared prior to type and const parameters + A(&'a &'b T) +} + +struct Struct<'a, T, 'b> { +//~^ ERROR lifetime parameters must be declared prior to type and const parameters + x: &'a &'b T +} + +trait Trait<'a, T, 'b> {} +//~^ ERROR lifetime parameters must be declared prior to type and const parameters + +fn foo<'a, T, 'b>(x: &'a T) {} +//~^ ERROR lifetime parameters must be declared prior to type and const parameters + +struct Y(T); +impl<'a, T, 'b> Y {} +//~^ ERROR lifetime parameters must be declared prior to type and const parameters + +mod bar { + pub struct X<'a, 'b, 'c, T> { + a: &'a str, + b: &'b str, + c: &'c str, + t: T, + } +} + +fn bar<'a, 'b, 'c, T>(x: bar::X<'a, T, 'b, 'c>) {} +//~^ ERROR type provided when a lifetime was expected + +fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303.stderr b/src/test/ui/parser/issues/issue-14303.stderr new file mode 100644 index 0000000000000..f121107c0958f --- /dev/null +++ b/src/test/ui/parser/issues/issue-14303.stderr @@ -0,0 +1,39 @@ +error: lifetime parameters must be declared prior to type and const parameters + --> $DIR/issue-14303.rs:1:18 + | +LL | enum Enum<'a, T, 'b> { + | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + +error: lifetime parameters must be declared prior to type and const parameters + --> $DIR/issue-14303.rs:6:22 + | +LL | struct Struct<'a, T, 'b> { + | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + +error: lifetime parameters must be declared prior to type and const parameters + --> $DIR/issue-14303.rs:11:20 + | +LL | trait Trait<'a, T, 'b> {} + | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + +error: lifetime parameters must be declared prior to type and const parameters + --> $DIR/issue-14303.rs:14:15 + | +LL | fn foo<'a, T, 'b>(x: &'a T) {} + | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + +error: lifetime parameters must be declared prior to type and const parameters + --> $DIR/issue-14303.rs:18:13 + | +LL | impl<'a, T, 'b> Y {} + | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + +error[E0747]: type provided when a lifetime was expected + --> $DIR/issue-14303.rs:30:37 + | +LL | fn bar<'a, 'b, 'c, T>(x: bar::X<'a, T, 'b, 'c>) {} + | ^ + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0747`. diff --git a/src/test/ui/suggestions/suggest-move-lifetimes.stderr b/src/test/ui/suggestions/suggest-move-lifetimes.stderr index f52631caed173..b1a49447d4601 100644 --- a/src/test/ui/suggestions/suggest-move-lifetimes.stderr +++ b/src/test/ui/suggestions/suggest-move-lifetimes.stderr @@ -1,22 +1,22 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:1:13 | LL | struct A { | ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:5:13 | LL | struct B { | ----^^---- help: reorder the parameters: lifetimes, then consts and types: `<'a, T, U>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:10:16 | LL | struct C { | -------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T, U>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:15:16 | LL | struct D { diff --git a/src/test/ui/suggestions/suggest-move-types.stderr b/src/test/ui/suggestions/suggest-move-types.stderr index 1a6032db0010a..b222e8142bab5 100644 --- a/src/test/ui/suggestions/suggest-move-types.stderr +++ b/src/test/ui/suggestions/suggest-move-types.stderr @@ -121,7 +121,7 @@ LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime` + = help: reorder the arguments: lifetimes, then type and consts: `<'a, 'b, 'c, T, U, V>` error[E0747]: lifetime provided when a type was expected --> $DIR/suggest-move-types.rs:82:56 @@ -130,7 +130,7 @@ LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime` + = help: reorder the arguments: lifetimes, then type and consts: `<'a, 'b, 'c, T, U, V>` error: aborting due to 12 previous errors