diff --git a/src/test/codegen/issue-45222.rs b/src/test/codegen/issue-45222.rs index 7f99ca724cf73..7aadc8a095498 100644 --- a/src/test/codegen/issue-45222.rs +++ b/src/test/codegen/issue-45222.rs @@ -5,7 +5,6 @@ // verify that LLVM recognizes a loop involving 0..=n and will const-fold it. -//------------------------------------------------------------------------------ // Example from original issue #45222 fn foo2(n: u64) -> u64 { @@ -25,7 +24,6 @@ pub fn check_foo2() -> u64 { foo2(100000) } -//------------------------------------------------------------------------------ // Simplified example of #45222 fn triangle_inc(n: u64) -> u64 { @@ -43,7 +41,6 @@ pub fn check_triangle_inc() -> u64 { triangle_inc(100000) } -//------------------------------------------------------------------------------ // Demo in #48012 fn foo3r(n: u64) -> u64 { diff --git a/src/test/incremental/hashes/call_expressions.rs b/src/test/incremental/hashes/call_expressions.rs index d859cbef39f09..50d3657d417f3 100644 --- a/src/test/incremental/hashes/call_expressions.rs +++ b/src/test/incremental/hashes/call_expressions.rs @@ -18,7 +18,7 @@ fn callee1(_x: u32, _y: i64) {} fn callee2(_x: u32, _y: i64) {} -// Change Callee (Function) ---------------------------------------------------- +// Change Callee (Function) #[cfg(cfail1)] pub fn change_callee_function() { callee1(1, 2) @@ -33,7 +33,7 @@ pub fn change_callee_function() { -// Change Argument (Function) -------------------------------------------------- +// Change Argument (Function) #[cfg(cfail1)] pub fn change_argument_function() { callee1(1, 2) @@ -48,7 +48,7 @@ pub fn change_argument_function() { -// Change Callee Indirectly (Function) ----------------------------------------- +// Change Callee Indirectly (Function) mod change_callee_indirectly_function { #[cfg(cfail1)] use super::callee1 as callee; @@ -73,7 +73,7 @@ impl Struct { fn method2(&self, _x: char, _y: bool) {} } -// Change Callee (Method) ------------------------------------------------------ +// Change Callee (Method) #[cfg(cfail1)] pub fn change_callee_method() { let s = Struct; @@ -90,7 +90,7 @@ pub fn change_callee_method() { -// Change Argument (Method) ---------------------------------------------------- +// Change Argument (Method) #[cfg(cfail1)] pub fn change_argument_method() { let s = Struct; @@ -107,7 +107,7 @@ pub fn change_argument_method() { -// Change Callee (Method, UFCS) ------------------------------------------------ +// Change Callee (Method, UFCS) #[cfg(cfail1)] pub fn change_ufcs_callee_method() { let s = Struct; @@ -124,7 +124,7 @@ pub fn change_ufcs_callee_method() { -// Change Argument (Method, UFCS) ---------------------------------------------- +// Change Argument (Method, UFCS) #[cfg(cfail1)] pub fn change_argument_method_ufcs() { let s = Struct; @@ -141,7 +141,7 @@ pub fn change_argument_method_ufcs() { -// Change To UFCS -------------------------------------------------------------- +// Change To UFCS #[cfg(cfail1)] pub fn change_to_ufcs() { let s = Struct; @@ -164,7 +164,7 @@ impl Struct2 { fn method1(&self, _x: char, _y: bool) {} } -// Change UFCS Callee Indirectly ----------------------------------------------- +// Change UFCS Callee Indirectly pub mod change_ufcs_callee_indirectly { #[cfg(cfail1)] use super::Struct as Struct; diff --git a/src/test/incremental/hashes/closure_expressions.rs b/src/test/incremental/hashes/closure_expressions.rs index 24ab6b8e18455..08693560d0b6e 100644 --- a/src/test/incremental/hashes/closure_expressions.rs +++ b/src/test/incremental/hashes/closure_expressions.rs @@ -14,7 +14,7 @@ #![crate_type="rlib"] -// Change closure body --------------------------------------------------------- +// Change closure body #[cfg(cfail1)] pub fn change_closure_body() { let _ = || 1u32; @@ -29,7 +29,7 @@ pub fn change_closure_body() { -// Add parameter --------------------------------------------------------------- +// Add parameter #[cfg(cfail1)] pub fn add_parameter() { let x = 0u32; @@ -46,7 +46,7 @@ pub fn add_parameter() { -// Change parameter pattern ---------------------------------------------------- +// Change parameter pattern #[cfg(cfail1)] pub fn change_parameter_pattern() { let _ = |x: (u32,)| x; @@ -61,7 +61,7 @@ pub fn change_parameter_pattern() { -// Add `move` to closure ------------------------------------------------------- +// Add `move` to closure #[cfg(cfail1)] pub fn add_move() { let _ = || 1; @@ -76,7 +76,7 @@ pub fn add_move() { -// Add type ascription to parameter -------------------------------------------- +// Add type ascription to parameter #[cfg(cfail1)] pub fn add_type_ascription_to_parameter() { let closure = |x| x + 1u32; @@ -93,7 +93,7 @@ pub fn add_type_ascription_to_parameter() { -// Change parameter type ------------------------------------------------------- +// Change parameter type #[cfg(cfail1)] pub fn change_parameter_type() { let closure = |x: u32| (x as u64) + 1; diff --git a/src/test/incremental/hashes/consts.rs b/src/test/incremental/hashes/consts.rs index 8e713a1d99237..3d2eed89636e8 100644 --- a/src/test/incremental/hashes/consts.rs +++ b/src/test/incremental/hashes/consts.rs @@ -14,7 +14,7 @@ #![crate_type="rlib"] -// Change const visibility --------------------------------------------------- +// Change const visibility #[cfg(cfail1)] const CONST_VISIBILITY: u8 = 0; @@ -24,7 +24,7 @@ const CONST_VISIBILITY: u8 = 0; pub const CONST_VISIBILITY: u8 = 0; -// Change type from i32 to u32 ------------------------------------------------ +// Change type from i32 to u32 #[cfg(cfail1)] const CONST_CHANGE_TYPE_1: i32 = 0; @@ -34,7 +34,7 @@ const CONST_CHANGE_TYPE_1: i32 = 0; const CONST_CHANGE_TYPE_1: u32 = 0; -// Change type from Option to Option -------------------------------- +// Change type from Option to Option #[cfg(cfail1)] const CONST_CHANGE_TYPE_2: Option = None; @@ -44,7 +44,7 @@ const CONST_CHANGE_TYPE_2: Option = None; const CONST_CHANGE_TYPE_2: Option = None; -// Change value between simple literals --------------------------------------- +// Change value between simple literals #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] const CONST_CHANGE_VALUE_1: i16 = { @@ -56,7 +56,7 @@ const CONST_CHANGE_VALUE_1: i16 = { }; -// Change value between expressions ------------------------------------------- +// Change value between expressions #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] const CONST_CHANGE_VALUE_2: i16 = { @@ -88,7 +88,7 @@ const CONST_CHANGE_VALUE_4: i16 = { }; -// Change type indirectly ----------------------------------------------------- +// Change type indirectly struct ReferencedType1; struct ReferencedType2; diff --git a/src/test/incremental/hashes/if_expressions.rs b/src/test/incremental/hashes/if_expressions.rs index b84c393573b91..4b73f1371f872 100644 --- a/src/test/incremental/hashes/if_expressions.rs +++ b/src/test/incremental/hashes/if_expressions.rs @@ -14,7 +14,7 @@ #![feature(rustc_attrs)] #![crate_type="rlib"] -// Change condition (if) ------------------------------------------------------- +// Change condition (if) #[cfg(cfail1)] pub fn change_condition(x: bool) -> u32 { if x { @@ -35,7 +35,7 @@ pub fn change_condition(x: bool) -> u32 { return 0 } -// Change then branch (if) ----------------------------------------------------- +// Change then branch (if) #[cfg(cfail1)] pub fn change_then_branch(x: bool) -> u32 { if x { @@ -58,7 +58,7 @@ pub fn change_then_branch(x: bool) -> u32 { -// Change else branch (if) ----------------------------------------------------- +// Change else branch (if) #[cfg(cfail1)] pub fn change_else_branch(x: bool) -> u32 { if x { @@ -81,7 +81,7 @@ pub fn change_else_branch(x: bool) -> u32 { -// Add else branch (if) -------------------------------------------------------- +// Add else branch (if) #[cfg(cfail1)] pub fn add_else_branch(x: bool) -> u32 { let mut ret = 1; @@ -109,7 +109,7 @@ pub fn add_else_branch(x: bool) -> u32 { -// Change condition (if let) --------------------------------------------------- +// Change condition (if let) #[cfg(cfail1)] pub fn change_condition_if_let(x: Option) -> u32 { if let Some(_x) = x { @@ -132,7 +132,7 @@ pub fn change_condition_if_let(x: Option) -> u32 { -// Change then branch (if let) ------------------------------------------------- +// Change then branch (if let) #[cfg(cfail1)] pub fn change_then_branch_if_let(x: Option) -> u32 { if let Some(x) = x { @@ -155,7 +155,7 @@ pub fn change_then_branch_if_let(x: Option) -> u32 { -// Change else branch (if let) ------------------------------------------------- +// Change else branch (if let) #[cfg(cfail1)] pub fn change_else_branch_if_let(x: Option) -> u32 { if let Some(x) = x { @@ -178,7 +178,7 @@ pub fn change_else_branch_if_let(x: Option) -> u32 { -// Add else branch (if let) ---------------------------------------------------- +// Add else branch (if let) #[cfg(cfail1)] pub fn add_else_branch_if_let(x: Option) -> u32 { let mut ret = 1; diff --git a/src/test/incremental/hashes/indexing_expressions.rs b/src/test/incremental/hashes/indexing_expressions.rs index 4d39ed68701dd..08cf19d776028 100644 --- a/src/test/incremental/hashes/indexing_expressions.rs +++ b/src/test/incremental/hashes/indexing_expressions.rs @@ -13,7 +13,7 @@ #![feature(rustc_attrs)] #![crate_type="rlib"] -// Change simple index --------------------------------------------------------- +// Change simple index #[cfg(cfail1)] fn change_simple_index(slice: &[u32]) -> u32 { slice[3] @@ -30,7 +30,7 @@ fn change_simple_index(slice: &[u32]) -> u32 { -// Change lower bound ---------------------------------------------------------- +// Change lower bound #[cfg(cfail1)] fn change_lower_bound(slice: &[u32]) -> &[u32] { &slice[3..5] @@ -47,7 +47,7 @@ fn change_lower_bound(slice: &[u32]) -> &[u32] { -// Change upper bound ---------------------------------------------------------- +// Change upper bound #[cfg(cfail1)] fn change_upper_bound(slice: &[u32]) -> &[u32] { &slice[3..5] @@ -64,7 +64,7 @@ fn change_upper_bound(slice: &[u32]) -> &[u32] { -// Add lower bound ------------------------------------------------------------- +// Add lower bound #[cfg(cfail1)] fn add_lower_bound(slice: &[u32]) -> &[u32] { &slice[..4] @@ -81,7 +81,7 @@ fn add_lower_bound(slice: &[u32]) -> &[u32] { -// Add upper bound ------------------------------------------------------------- +// Add upper bound #[cfg(cfail1)] fn add_upper_bound(slice: &[u32]) -> &[u32] { &slice[3..] @@ -98,7 +98,7 @@ fn add_upper_bound(slice: &[u32]) -> &[u32] { -// Change mutability ----------------------------------------------------------- +// Change mutability #[cfg(cfail1)] fn change_mutability(slice: &mut [u32]) -> u32 { (&mut slice[3..5])[0] @@ -115,7 +115,7 @@ fn change_mutability(slice: &mut [u32]) -> u32 { -// Exclusive to inclusive range ------------------------------------------------ +// Exclusive to inclusive range #[cfg(cfail1)] fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] { &slice[3..7] diff --git a/src/test/incremental/hashes/inline_asm.rs b/src/test/incremental/hashes/inline_asm.rs index deb1c45a52885..c50ee73d71438 100644 --- a/src/test/incremental/hashes/inline_asm.rs +++ b/src/test/incremental/hashes/inline_asm.rs @@ -16,7 +16,7 @@ -// Change template ------------------------------------------------------------- +// Change template #[cfg(cfail1)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_template(a: i32) -> i32 { @@ -51,7 +51,7 @@ pub fn change_template(a: i32) -> i32 { -// Change output ------------------------------------------------------------- +// Change output #[cfg(cfail1)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_output(a: i32) -> i32 { @@ -88,7 +88,7 @@ pub fn change_output(a: i32) -> i32 { -// Change input ------------------------------------------------------------- +// Change input #[cfg(cfail1)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_input(_a: i32, _b: i32) -> i32 { @@ -123,7 +123,7 @@ pub fn change_input(_a: i32, _b: i32) -> i32 { -// Change input constraint ----------------------------------------------------- +// Change input constraint #[cfg(cfail1)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { @@ -158,7 +158,7 @@ pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { -// Change clobber -------------------------------------------------------------- +// Change clobber #[cfg(cfail1)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_clobber(_a: i32) -> i32 { @@ -193,7 +193,7 @@ pub fn change_clobber(_a: i32) -> i32 { -// Change options -------------------------------------------------------------- +// Change options #[cfg(cfail1)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_options(_a: i32) -> i32 { diff --git a/src/test/incremental/hashes/loop_expressions.rs b/src/test/incremental/hashes/loop_expressions.rs index 6222d948c98e9..a2222db4c59ad 100644 --- a/src/test/incremental/hashes/loop_expressions.rs +++ b/src/test/incremental/hashes/loop_expressions.rs @@ -14,7 +14,7 @@ #![crate_type="rlib"] -// Change loop body ------------------------------------------------------------ +// Change loop body #[cfg(cfail1)] pub fn change_loop_body() { let mut _x = 0; @@ -37,7 +37,7 @@ pub fn change_loop_body() { -// Add break ------------------------------------------------------------------- +// Add break #[cfg(cfail1)] pub fn add_break() { let mut _x = 0; @@ -59,7 +59,7 @@ pub fn add_break() { -// Add loop label -------------------------------------------------------------- +// Add loop label #[cfg(cfail1)] pub fn add_loop_label() { let mut _x = 0; @@ -82,7 +82,7 @@ pub fn add_loop_label() { -// Add loop label to break ----------------------------------------------------- +// Add loop label to break #[cfg(cfail1)] pub fn add_loop_label_to_break() { let mut _x = 0; @@ -105,7 +105,7 @@ pub fn add_loop_label_to_break() { -// Change break label ---------------------------------------------------------- +// Change break label #[cfg(cfail1)] pub fn change_break_label() { let mut _x = 0; @@ -132,7 +132,7 @@ pub fn change_break_label() { -// Add loop label to continue -------------------------------------------------- +// Add loop label to continue #[cfg(cfail1)] pub fn add_loop_label_to_continue() { let mut _x = 0; @@ -155,7 +155,7 @@ pub fn add_loop_label_to_continue() { -// Change continue label ---------------------------------------------------------- +// Change continue label #[cfg(cfail1)] pub fn change_continue_label() { let mut _x = 0; @@ -182,7 +182,7 @@ pub fn change_continue_label() { -// Change continue to break ---------------------------------------------------- +// Change continue to break #[cfg(cfail1)] pub fn change_continue_to_break() { let mut _x = 0; diff --git a/src/test/incremental/hashes/panic_exprs.rs b/src/test/incremental/hashes/panic_exprs.rs index b370fcce8efda..70b0a5ab78cd7 100644 --- a/src/test/incremental/hashes/panic_exprs.rs +++ b/src/test/incremental/hashes/panic_exprs.rs @@ -17,7 +17,7 @@ #![crate_type="rlib"] -// Indexing expression --------------------------------------------------------- +// Indexing expression #[rustc_clean(cfg="cfail2", except="HirBody,mir_built,optimized_mir")] #[rustc_clean(cfg="cfail3")] pub fn indexing(slice: &[u8]) -> u8 { @@ -32,7 +32,7 @@ pub fn indexing(slice: &[u8]) -> u8 { } -// Arithmetic overflow plus ---------------------------------------------------- +// Arithmetic overflow plus #[rustc_clean(cfg="cfail2", except="HirBody,mir_built,optimized_mir")] #[rustc_clean(cfg="cfail3")] pub fn arithmetic_overflow_plus(val: i32) -> i32 { @@ -47,7 +47,7 @@ pub fn arithmetic_overflow_plus(val: i32) -> i32 { } -// Arithmetic overflow minus ---------------------------------------------------- +// Arithmetic overflow minus #[rustc_clean(cfg="cfail2", except="HirBody,mir_built,optimized_mir")] #[rustc_clean(cfg="cfail3")] pub fn arithmetic_overflow_minus(val: i32) -> i32 { @@ -62,7 +62,7 @@ pub fn arithmetic_overflow_minus(val: i32) -> i32 { } -// Arithmetic overflow mult ---------------------------------------------------- +// Arithmetic overflow mult #[rustc_clean(cfg="cfail2", except="HirBody,mir_built,optimized_mir")] #[rustc_clean(cfg="cfail3")] pub fn arithmetic_overflow_mult(val: i32) -> i32 { @@ -77,7 +77,7 @@ pub fn arithmetic_overflow_mult(val: i32) -> i32 { } -// Arithmetic overflow negation ------------------------------------------------ +// Arithmetic overflow negation #[rustc_clean(cfg="cfail2", except="HirBody,mir_built,optimized_mir")] #[rustc_clean(cfg="cfail3")] pub fn arithmetic_overflow_negation(val: i32) -> i32 { @@ -92,7 +92,7 @@ pub fn arithmetic_overflow_negation(val: i32) -> i32 { } -// Division by zero ------------------------------------------------------------ +// Division by zero #[rustc_clean(cfg="cfail2", except="HirBody,mir_built,optimized_mir")] #[rustc_clean(cfg="cfail3")] pub fn division_by_zero(val: i32) -> i32 { @@ -106,7 +106,7 @@ pub fn division_by_zero(val: i32) -> i32 { } } -// Division by zero ------------------------------------------------------------ +// Division by zero #[rustc_clean(cfg="cfail2", except="HirBody,mir_built,optimized_mir")] #[rustc_clean(cfg="cfail3")] pub fn mod_by_zero(val: i32) -> i32 { @@ -121,7 +121,7 @@ pub fn mod_by_zero(val: i32) -> i32 { } -// shift left ------------------------------------------------------------------ +// shift left #[rustc_clean(cfg="cfail2", except="HirBody,mir_built,optimized_mir")] #[rustc_clean(cfg="cfail3")] pub fn shift_left(val: i32, shift: usize) -> i32 { @@ -136,7 +136,7 @@ pub fn shift_left(val: i32, shift: usize) -> i32 { } -// shift right ------------------------------------------------------------------ +// shift right #[rustc_clean(cfg="cfail2", except="HirBody,mir_built,optimized_mir")] #[rustc_clean(cfg="cfail3")] pub fn shift_right(val: i32, shift: usize) -> i32 { diff --git a/src/test/incremental/hashes/statics.rs b/src/test/incremental/hashes/statics.rs index 6f74e0fdbc06e..d70ebb08b715a 100644 --- a/src/test/incremental/hashes/statics.rs +++ b/src/test/incremental/hashes/statics.rs @@ -16,7 +16,7 @@ #![crate_type="rlib"] -// Change static visibility --------------------------------------------------- +// Change static visibility #[cfg(cfail1)] static STATIC_VISIBILITY: u8 = 0; @@ -26,7 +26,7 @@ static STATIC_VISIBILITY: u8 = 0; pub static STATIC_VISIBILITY: u8 = 0; -// Change static mutability --------------------------------------------------- +// Change static mutability #[cfg(cfail1)] static STATIC_MUTABILITY: u8 = 0; @@ -36,7 +36,7 @@ static STATIC_MUTABILITY: u8 = 0; static mut STATIC_MUTABILITY: u8 = 0; -// Add linkage attribute ------------------------------------------------------ +// Add linkage attribute #[cfg(cfail1)] static STATIC_LINKAGE: u8 = 0; @@ -47,7 +47,7 @@ static STATIC_LINKAGE: u8 = 0; static STATIC_LINKAGE: u8 = 0; -// Add no_mangle attribute ---------------------------------------------------- +// Add no_mangle attribute #[cfg(cfail1)] static STATIC_NO_MANGLE: u8 = 0; @@ -58,7 +58,7 @@ static STATIC_NO_MANGLE: u8 = 0; static STATIC_NO_MANGLE: u8 = 0; -// Add thread_local attribute ------------------------------------------------- +// Add thread_local attribute #[cfg(cfail1)] static STATIC_THREAD_LOCAL: u8 = 0; @@ -69,7 +69,7 @@ static STATIC_THREAD_LOCAL: u8 = 0; static STATIC_THREAD_LOCAL: u8 = 0; -// Change type from i16 to u64 ------------------------------------------------ +// Change type from i16 to u64 #[cfg(cfail1)] static STATIC_CHANGE_TYPE_1: i16 = 0; @@ -79,7 +79,7 @@ static STATIC_CHANGE_TYPE_1: i16 = 0; static STATIC_CHANGE_TYPE_1: u64 = 0; -// Change type from Option to Option --------------------------------- +// Change type from Option to Option #[cfg(cfail1)] static STATIC_CHANGE_TYPE_2: Option = None; @@ -89,7 +89,7 @@ static STATIC_CHANGE_TYPE_2: Option = None; static STATIC_CHANGE_TYPE_2: Option = None; -// Change value between simple literals --------------------------------------- +// Change value between simple literals #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] static STATIC_CHANGE_VALUE_1: i16 = { @@ -101,7 +101,7 @@ static STATIC_CHANGE_VALUE_1: i16 = { }; -// Change value between expressions ------------------------------------------- +// Change value between expressions #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] static STATIC_CHANGE_VALUE_2: i16 = { @@ -133,7 +133,7 @@ static STATIC_CHANGE_VALUE_4: i16 = { }; -// Change type indirectly ----------------------------------------------------- +// Change type indirectly struct ReferencedType1; struct ReferencedType2; diff --git a/src/test/incremental/hashes/struct_constructors.rs b/src/test/incremental/hashes/struct_constructors.rs index b708b99eabc99..456d5e74751ae 100644 --- a/src/test/incremental/hashes/struct_constructors.rs +++ b/src/test/incremental/hashes/struct_constructors.rs @@ -20,7 +20,7 @@ pub struct RegularStruct { z: i16, } -// Change field value (regular struct) ----------------------------------------- +// Change field value (regular struct) #[cfg(cfail1)] pub fn change_field_value_regular_struct() -> RegularStruct { RegularStruct { @@ -43,7 +43,7 @@ pub fn change_field_value_regular_struct() -> RegularStruct { -// Change field order (regular struct) ----------------------------------------- +// Change field order (regular struct) #[cfg(cfail1)] pub fn change_field_order_regular_struct() -> RegularStruct { RegularStruct { @@ -66,7 +66,7 @@ pub fn change_field_order_regular_struct() -> RegularStruct { -// Add field (regular struct) -------------------------------------------------- +// Add field (regular struct) #[cfg(cfail1)] pub fn add_field_regular_struct() -> RegularStruct { let struct1 = RegularStruct { @@ -100,7 +100,7 @@ pub fn add_field_regular_struct() -> RegularStruct { -// Change field label (regular struct) ----------------------------------------- +// Change field label (regular struct) #[cfg(cfail1)] pub fn change_field_label_regular_struct() -> RegularStruct { let struct1 = RegularStruct { @@ -141,7 +141,7 @@ pub struct RegularStruct2 { z: i8, } -// Change constructor path (regular struct) ------------------------------------ +// Change constructor path (regular struct) #[cfg(cfail1)] pub fn change_constructor_path_regular_struct() { let _ = RegularStruct { @@ -164,7 +164,7 @@ pub fn change_constructor_path_regular_struct() { -// Change constructor path indirectly (regular struct) ------------------------- +// Change constructor path indirectly (regular struct) pub mod change_constructor_path_indirectly_regular_struct { #[cfg(cfail1)] use super::RegularStruct as Struct; @@ -189,7 +189,7 @@ pub mod change_constructor_path_indirectly_regular_struct { pub struct TupleStruct(i32, i64, i16); -// Change field value (tuple struct) ------------------------------------------- +// Change field value (tuple struct) #[cfg(cfail1)] pub fn change_field_value_tuple_struct() -> TupleStruct { TupleStruct(0, 1, 2) @@ -206,7 +206,7 @@ pub fn change_field_value_tuple_struct() -> TupleStruct { pub struct TupleStruct2(u16, u16, u16); -// Change constructor path (tuple struct) -------------------------------------- +// Change constructor path (tuple struct) #[cfg(cfail1)] pub fn change_constructor_path_tuple_struct() { let _ = TupleStruct(0, 1, 2); @@ -221,7 +221,7 @@ pub fn change_constructor_path_tuple_struct() { -// Change constructor path indirectly (tuple struct) --------------------------- +// Change constructor path indirectly (tuple struct) pub mod change_constructor_path_indirectly_tuple_struct { #[cfg(cfail1)] use super::TupleStruct as Struct; diff --git a/src/test/incremental/hashes/trait_defs.rs b/src/test/incremental/hashes/trait_defs.rs index 30b4e306820ed..81ff99533fc91 100644 --- a/src/test/incremental/hashes/trait_defs.rs +++ b/src/test/incremental/hashes/trait_defs.rs @@ -21,7 +21,7 @@ #![feature(intrinsics)] -// Change trait visibility -------------------------------------------------------- +// Change trait visibility #[cfg(cfail1)] trait TraitVisibility { } @@ -32,7 +32,7 @@ pub trait TraitVisibility { } -// Change trait unsafety ---------------------------------------------------------- +// Change trait unsafety #[cfg(cfail1)] trait TraitUnsafety { } @@ -43,7 +43,7 @@ unsafe trait TraitUnsafety { } -// Add method --------------------------------------------------------------------- +// Add method #[cfg(cfail1)] trait TraitAddMethod { } @@ -57,7 +57,7 @@ pub trait TraitAddMethod { -// Change name of method ---------------------------------------------------------- +// Change name of method #[cfg(cfail1)] trait TraitChangeMethodName { fn method(); @@ -72,7 +72,7 @@ trait TraitChangeMethodName { -// Add return type to method ------------------------------------------------------ +// Add return type to method #[cfg(cfail1)] trait TraitAddReturnType { fn method(); @@ -89,7 +89,7 @@ trait TraitAddReturnType { -// Change return type of method --------------------------------------------------- +// Change return type of method #[cfg(cfail1)] trait TraitChangeReturnType { fn method() -> u32; @@ -106,7 +106,7 @@ trait TraitChangeReturnType { -// Add parameter to method -------------------------------------------------------- +// Add parameter to method #[cfg(cfail1)] trait TraitAddParameterToMethod { fn method(); @@ -123,7 +123,7 @@ trait TraitAddParameterToMethod { -// Change name of method parameter ------------------------------------------------ +// Change name of method parameter #[cfg(cfail1)] trait TraitChangeMethodParameterName { fn method(a: u32); @@ -148,7 +148,7 @@ trait TraitChangeMethodParameterName { -// Change type of method parameter (i32 => i64) ----------------------------------- +// Change type of method parameter (i32 => i64) #[cfg(cfail1)] trait TraitChangeMethodParameterType { fn method(a: i32); @@ -165,7 +165,7 @@ trait TraitChangeMethodParameterType { -// Change type of method parameter (&i32 => &mut i32) ----------------------------- +// Change type of method parameter (&i32 => &mut i32) #[cfg(cfail1)] trait TraitChangeMethodParameterTypeRef { fn method(a: &i32); @@ -182,7 +182,7 @@ trait TraitChangeMethodParameterTypeRef { -// Change order of method parameters ---------------------------------------------- +// Change order of method parameters #[cfg(cfail1)] trait TraitChangeMethodParametersOrder { fn method(a: i32, b: i64); @@ -199,7 +199,7 @@ trait TraitChangeMethodParametersOrder { -// Add default implementation to method ------------------------------------------- +// Add default implementation to method #[cfg(cfail1)] trait TraitAddMethodAutoImplementation { fn method(); @@ -216,7 +216,7 @@ trait TraitAddMethodAutoImplementation { -// Change order of methods -------------------------------------------------------- +// Change order of methods #[cfg(cfail1)] trait TraitChangeOrderOfMethods { fn method0(); @@ -233,7 +233,7 @@ trait TraitChangeOrderOfMethods { -// Change mode of self parameter -------------------------------------------------- +// Change mode of self parameter #[cfg(cfail1)] trait TraitChangeModeSelfRefToMut { fn method(&self); @@ -284,7 +284,7 @@ trait TraitChangeModeSelfOwnToRef { -// Add unsafe modifier to method -------------------------------------------------- +// Add unsafe modifier to method #[cfg(cfail1)] trait TraitAddUnsafeModifier { fn method(); @@ -301,7 +301,7 @@ trait TraitAddUnsafeModifier { -// Add extern modifier to method -------------------------------------------------- +// Add extern modifier to method #[cfg(cfail1)] trait TraitAddExternModifier { fn method(); @@ -318,7 +318,7 @@ trait TraitAddExternModifier { -// Change extern "C" to extern "rust-intrinsic" ----------------------------------- +// Change extern "C" to extern "rust-intrinsic" #[cfg(cfail1)] trait TraitChangeExternCToRustIntrinsic { extern "C" fn method(); @@ -335,7 +335,7 @@ trait TraitChangeExternCToRustIntrinsic { -// Add type parameter to method --------------------------------------------------- +// Add type parameter to method #[cfg(cfail1)] trait TraitAddTypeParameterToMethod { fn method(); @@ -352,7 +352,7 @@ trait TraitAddTypeParameterToMethod { -// Add lifetime parameter to method ----------------------------------------------- +// Add lifetime parameter to method #[cfg(cfail1)] trait TraitAddLifetimeParameterToMethod { fn method(); @@ -373,7 +373,7 @@ trait TraitAddLifetimeParameterToMethod { trait ReferencedTrait0 { } trait ReferencedTrait1 { } -// Add trait bound to method type parameter --------------------------------------- +// Add trait bound to method type parameter #[cfg(cfail1)] trait TraitAddTraitBoundToMethodTypeParameter { fn method(); @@ -390,7 +390,7 @@ trait TraitAddTraitBoundToMethodTypeParameter { -// Add builtin bound to method type parameter ------------------------------------- +// Add builtin bound to method type parameter #[cfg(cfail1)] trait TraitAddBuiltinBoundToMethodTypeParameter { fn method(); @@ -407,7 +407,7 @@ trait TraitAddBuiltinBoundToMethodTypeParameter { -// Add lifetime bound to method lifetime parameter ------------------------------------ +// Add lifetime bound to method lifetime parameter #[cfg(cfail1)] trait TraitAddLifetimeBoundToMethodLifetimeParameter { fn method<'a, 'b>(a: &'a u32, b: &'b u32); @@ -424,7 +424,7 @@ trait TraitAddLifetimeBoundToMethodLifetimeParameter { -// Add second trait bound to method type parameter -------------------------------- +// Add second trait bound to method type parameter #[cfg(cfail1)] trait TraitAddSecondTraitBoundToMethodTypeParameter { fn method(); @@ -441,7 +441,7 @@ trait TraitAddSecondTraitBoundToMethodTypeParameter { -// Add second builtin bound to method type parameter ------------------------------ +// Add second builtin bound to method type parameter #[cfg(cfail1)] trait TraitAddSecondBuiltinBoundToMethodTypeParameter { fn method(); @@ -458,7 +458,7 @@ trait TraitAddSecondBuiltinBoundToMethodTypeParameter { -// Add second lifetime bound to method lifetime parameter ----------------------------- +// Add second lifetime bound to method lifetime parameter #[cfg(cfail1)] trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter { fn method<'a, 'b, 'c: 'a>(a: &'a u32, b: &'b u32, c: &'c u32); @@ -475,7 +475,7 @@ trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter { -// Add associated type ------------------------------------------------------------ +// Add associated type #[cfg(cfail1)] trait TraitAddAssociatedType { @@ -495,7 +495,7 @@ trait TraitAddAssociatedType { -// Add trait bound to associated type --------------------------------------------- +// Add trait bound to associated type #[cfg(cfail1)] trait TraitAddTraitBoundToAssociatedType { type Associated; @@ -519,7 +519,7 @@ trait TraitAddTraitBoundToAssociatedType { -// Add lifetime bound to associated type ------------------------------------------ +// Add lifetime bound to associated type #[cfg(cfail1)] trait TraitAddLifetimeBoundToAssociatedType<'a> { type Associated; @@ -540,7 +540,7 @@ trait TraitAddLifetimeBoundToAssociatedType<'a> { -// Add default to associated type ------------------------------------------------- +// Add default to associated type #[cfg(cfail1)] trait TraitAddDefaultToAssociatedType { type Associated; @@ -561,7 +561,7 @@ trait TraitAddDefaultToAssociatedType { -// Add associated constant -------------------------------------------------------- +// Add associated constant #[cfg(cfail1)] trait TraitAddAssociatedConstant { fn method(); @@ -578,7 +578,7 @@ trait TraitAddAssociatedConstant { -// Add initializer to associated constant ----------------------------------------- +// Add initializer to associated constant #[cfg(cfail1)] trait TraitAddInitializerToAssociatedConstant { const Value: u32; @@ -601,7 +601,7 @@ trait TraitAddInitializerToAssociatedConstant { -// Change type of associated constant --------------------------------------------- +// Change type of associated constant #[cfg(cfail1)] trait TraitChangeTypeOfAssociatedConstant { const Value: u32; @@ -624,7 +624,7 @@ trait TraitChangeTypeOfAssociatedConstant { -// Add super trait ---------------------------------------------------------------- +// Add super trait #[cfg(cfail1)] trait TraitAddSuperTrait { } @@ -635,7 +635,7 @@ trait TraitAddSuperTrait : ReferencedTrait0 { } -// Add builtin bound (Send or Copy) ----------------------------------------------- +// Add builtin bound (Send or Copy) #[cfg(cfail1)] trait TraitAddBuiltiBound { } @@ -646,7 +646,7 @@ trait TraitAddBuiltiBound : Send { } -// Add 'static lifetime bound to trait -------------------------------------------- +// Add 'static lifetime bound to trait #[cfg(cfail1)] trait TraitAddStaticLifetimeBound { } @@ -657,7 +657,7 @@ trait TraitAddStaticLifetimeBound : 'static { } -// Add super trait as second bound ------------------------------------------------ +// Add super trait as second bound #[cfg(cfail1)] trait TraitAddTraitAsSecondBound : ReferencedTrait0 { } @@ -676,7 +676,7 @@ trait TraitAddTraitAsSecondBoundFromBuiltin : Send + ReferencedTrait0 { } -// Add builtin bound as second bound ---------------------------------------------- +// Add builtin bound as second bound #[cfg(cfail1)] trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 { } @@ -695,7 +695,7 @@ trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin: Send + Copy { } -// Add 'static bounds as second bound --------------------------------------------- +// Add 'static bounds as second bound #[cfg(cfail1)] trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 { } @@ -714,7 +714,7 @@ trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send + 'static { } -// Add type parameter to trait ---------------------------------------------------- +// Add type parameter to trait #[cfg(cfail1)] trait TraitAddTypeParameterToTrait { } @@ -725,7 +725,7 @@ trait TraitAddTypeParameterToTrait { } -// Add lifetime parameter to trait ------------------------------------------------ +// Add lifetime parameter to trait #[cfg(cfail1)] trait TraitAddLifetimeParameterToTrait { } @@ -736,7 +736,7 @@ trait TraitAddLifetimeParameterToTrait<'a> { } -// Add trait bound to type parameter of trait ------------------------------------- +// Add trait bound to type parameter of trait #[cfg(cfail1)] trait TraitAddTraitBoundToTypeParameterOfTrait { } @@ -747,7 +747,7 @@ trait TraitAddTraitBoundToTypeParameterOfTrait { } -// Add lifetime bound to type parameter of trait ---------------------------------- +// Add lifetime bound to type parameter of trait #[cfg(cfail1)] trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T> { } @@ -758,7 +758,7 @@ trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T: 'a> { } -// Add lifetime bound to lifetime parameter of trait ------------------------------ +// Add lifetime bound to lifetime parameter of trait #[cfg(cfail1)] trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a, 'b> { } @@ -769,7 +769,7 @@ trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b> { } -// Add builtin bound to type parameter of trait ----------------------------------- +// Add builtin bound to type parameter of trait #[cfg(cfail1)] trait TraitAddBuiltinBoundToTypeParameterOfTrait { } @@ -780,7 +780,7 @@ trait TraitAddBuiltinBoundToTypeParameterOfTrait { } -// Add second type parameter to trait --------------------------------------------- +// Add second type parameter to trait #[cfg(cfail1)] trait TraitAddSecondTypeParameterToTrait { } @@ -791,7 +791,7 @@ trait TraitAddSecondTypeParameterToTrait { } -// Add second lifetime parameter to trait ----------------------------------------- +// Add second lifetime parameter to trait #[cfg(cfail1)] trait TraitAddSecondLifetimeParameterToTrait<'a> { } @@ -802,7 +802,7 @@ trait TraitAddSecondLifetimeParameterToTrait<'a, 'b> { } -// Add second trait bound to type parameter of trait ------------------------------ +// Add second trait bound to type parameter of trait #[cfg(cfail1)] trait TraitAddSecondTraitBoundToTypeParameterOfTrait { } @@ -813,7 +813,7 @@ trait TraitAddSecondTraitBoundToTypeParameterOfTrait { } @@ -824,7 +824,7 @@ trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a + 'b> { } -// Add second lifetime bound to lifetime parameter of trait------------------------ +// Add second lifetime bound to lifetime parameter of trait #[cfg(cfail1)] trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b, 'c> { } @@ -835,7 +835,7 @@ trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b + 'c, 'b, 'c> -// Add second builtin bound to type parameter of trait ---------------------------- +// Add second builtin bound to type parameter of trait #[cfg(cfail1)] trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait { } @@ -846,13 +846,12 @@ trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait { } -// -------------------------------------------------------------------------------- struct ReferenceType0 {} struct ReferenceType1 {} -// Add trait bound to type parameter of trait in where clause---------------------- +// Add trait bound to type parameter of trait in where clause #[cfg(cfail1)] trait TraitAddTraitBoundToTypeParameterOfTraitWhere { } @@ -863,7 +862,7 @@ trait TraitAddTraitBoundToTypeParameterOfTraitWhere where T: ReferencedTrait0 -// Add lifetime bound to type parameter of trait in where clause------------------- +// Add lifetime bound to type parameter of trait in where clause #[cfg(cfail1)] trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> { } @@ -874,7 +873,7 @@ trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> where T: 'a { } -// Add lifetime bound to lifetime parameter of trait in where clause--------------- +// Add lifetime bound to lifetime parameter of trait in where clause #[cfg(cfail1)] trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> { } @@ -885,7 +884,7 @@ trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> where 'a: 'b -// Add builtin bound to type parameter of trait in where clause-------------------- +// Add builtin bound to type parameter of trait in where clause #[cfg(cfail1)] trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere { } @@ -896,7 +895,7 @@ trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere where T: Send { } -// Add second trait bound to type parameter of trait in where clause--------------- +// Add second trait bound to type parameter of trait in where clause #[cfg(cfail1)] trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere where T: ReferencedTrait0 { } @@ -908,7 +907,7 @@ trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere -// Add second lifetime bound to type parameter of trait in where clause------------ +// Add second lifetime bound to type parameter of trait in where clause #[cfg(cfail1)] trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a { } @@ -919,7 +918,7 @@ trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: -// Add second lifetime bound to lifetime parameter of trait in where clause-------- +// Add second lifetime bound to lifetime parameter of trait in where clause #[cfg(cfail1)] trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b { } @@ -930,7 +929,7 @@ trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> whe -// Add second builtin bound to type parameter of trait in where clause------------- +// Add second builtin bound to type parameter of trait in where clause #[cfg(cfail1)] trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere where T: Send { } @@ -940,7 +939,7 @@ trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere where T: Send { } trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere where T: Send + Sync { } -// Change return type of method indirectly by modifying a use statement------------ +// Change return type of method indirectly by modifying a use statement mod change_return_type_of_method_indirectly_use { #[cfg(cfail1)] use super::ReferenceType0 as ReturnType; @@ -958,7 +957,7 @@ mod change_return_type_of_method_indirectly_use { -// Change type of method parameter indirectly by modifying a use statement--------- +// Change type of method parameter indirectly by modifying a use statement mod change_method_parameter_type_indirectly_by_use { #[cfg(cfail1)] use super::ReferenceType0 as ArgType; diff --git a/src/test/incremental/hashes/while_let_loops.rs b/src/test/incremental/hashes/while_let_loops.rs index 39b28ec190639..da3c957741fb2 100644 --- a/src/test/incremental/hashes/while_let_loops.rs +++ b/src/test/incremental/hashes/while_let_loops.rs @@ -14,7 +14,7 @@ #![crate_type="rlib"] -// Change loop body ------------------------------------------------------------ +// Change loop body #[cfg(cfail1)] pub fn change_loop_body() { let mut _x = 0; @@ -37,7 +37,7 @@ pub fn change_loop_body() { -// Change loop body ------------------------------------------------------------ +// Change loop body #[cfg(cfail1)] pub fn change_loop_condition() { let mut _x = 0; @@ -60,7 +60,7 @@ pub fn change_loop_condition() { -// Add break ------------------------------------------------------------------- +// Add break #[cfg(cfail1)] pub fn add_break() { let mut _x = 0; @@ -82,7 +82,7 @@ pub fn add_break() { -// Add loop label -------------------------------------------------------------- +// Add loop label #[cfg(cfail1)] pub fn add_loop_label() { let mut _x = 0; @@ -105,7 +105,7 @@ pub fn add_loop_label() { -// Add loop label to break ----------------------------------------------------- +// Add loop label to break #[cfg(cfail1)] pub fn add_loop_label_to_break() { let mut _x = 0; @@ -128,7 +128,7 @@ pub fn add_loop_label_to_break() { -// Change break label ---------------------------------------------------------- +// Change break label #[cfg(cfail1)] pub fn change_break_label() { let mut _x = 0; @@ -155,7 +155,7 @@ pub fn change_break_label() { -// Add loop label to continue -------------------------------------------------- +// Add loop label to continue #[cfg(cfail1)] pub fn add_loop_label_to_continue() { let mut _x = 0; @@ -178,7 +178,7 @@ pub fn add_loop_label_to_continue() { -// Change continue label ---------------------------------------------------------- +// Change continue label #[cfg(cfail1)] pub fn change_continue_label() { let mut _x = 0; @@ -205,7 +205,7 @@ pub fn change_continue_label() { -// Change continue to break ---------------------------------------------------- +// Change continue to break #[cfg(cfail1)] pub fn change_continue_to_break() { let mut _x = 0; diff --git a/src/test/incremental/hashes/while_loops.rs b/src/test/incremental/hashes/while_loops.rs index 0607218546950..3be42e7a4ee7a 100644 --- a/src/test/incremental/hashes/while_loops.rs +++ b/src/test/incremental/hashes/while_loops.rs @@ -14,7 +14,7 @@ #![crate_type="rlib"] -// Change loop body ------------------------------------------------------------ +// Change loop body #[cfg(cfail1)] pub fn change_loop_body() { let mut _x = 0; @@ -37,7 +37,7 @@ pub fn change_loop_body() { -// Change loop body ------------------------------------------------------------ +// Change loop body #[cfg(cfail1)] pub fn change_loop_condition() { let mut _x = 0; @@ -60,7 +60,7 @@ pub fn change_loop_condition() { -// Add break ------------------------------------------------------------------- +// Add break #[cfg(cfail1)] pub fn add_break() { let mut _x = 0; @@ -82,7 +82,7 @@ pub fn add_break() { -// Add loop label -------------------------------------------------------------- +// Add loop label #[cfg(cfail1)] pub fn add_loop_label() { let mut _x = 0; @@ -105,7 +105,7 @@ pub fn add_loop_label() { -// Add loop label to break ----------------------------------------------------- +// Add loop label to break #[cfg(cfail1)] pub fn add_loop_label_to_break() { let mut _x = 0; @@ -128,7 +128,7 @@ pub fn add_loop_label_to_break() { -// Change break label ---------------------------------------------------------- +// Change break label #[cfg(cfail1)] pub fn change_break_label() { let mut _x = 0; @@ -155,7 +155,7 @@ pub fn change_break_label() { -// Add loop label to continue -------------------------------------------------- +// Add loop label to continue #[cfg(cfail1)] pub fn add_loop_label_to_continue() { let mut _x = 0; @@ -178,7 +178,7 @@ pub fn add_loop_label_to_continue() { -// Change continue label ---------------------------------------------------------- +// Change continue label #[cfg(cfail1)] pub fn change_continue_label() { let mut _x = 0; @@ -205,7 +205,7 @@ pub fn change_continue_label() { -// Change continue to break ---------------------------------------------------- +// Change continue to break #[cfg(cfail1)] pub fn change_continue_to_break() { let mut _x = 0; diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs new file mode 100644 index 0000000000000..4281874a0314d --- /dev/null +++ b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs @@ -0,0 +1,16 @@ +const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe +//~^ dereferencing raw pointers in constant functions + +const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x } +//~^ dereferencing raw pointers in constant functions + +const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x } +//~^ dereferencing raw pointers in constant functions + +fn main() {} + +const unsafe fn no_union() { + union Foo { x: (), y: () } + Foo { x: () }.y + //~^ unions in const fn +} diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr similarity index 90% rename from src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr rename to src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr index d3f2ece1f9294..9de0e732f33d2 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr @@ -1,5 +1,5 @@ error[E0658]: dereferencing raw pointers in constant functions is unstable - --> $DIR/min_const_fn_unsafe.rs:50:77 + --> $DIR/min_const_fn_unsafe_bad.rs:1:77 | LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } | ^^^ @@ -8,7 +8,7 @@ LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { = help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable error[E0658]: dereferencing raw pointers in constant functions is unstable - --> $DIR/min_const_fn_unsafe.rs:53:70 + --> $DIR/min_const_fn_unsafe_bad.rs:4:70 | LL | const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x } | ^^ @@ -17,7 +17,7 @@ LL | const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x } = help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable error[E0658]: dereferencing raw pointers in constant functions is unstable - --> $DIR/min_const_fn_unsafe.rs:56:83 + --> $DIR/min_const_fn_unsafe_bad.rs:7:83 | LL | const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x } | ^^^ @@ -26,7 +26,7 @@ LL | const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static u = help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable error[E0658]: unions in const fn are unstable - --> $DIR/min_const_fn_unsafe.rs:63:5 + --> $DIR/min_const_fn_unsafe_bad.rs:14:5 | LL | Foo { x: () }.y | ^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | Foo { x: () }.y = help: add `#![feature(const_fn_union)]` to the crate attributes to enable error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/min_const_fn_unsafe.rs:50:77 + --> $DIR/min_const_fn_unsafe_bad.rs:1:77 | LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } | ^^^ dereference of raw pointer diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_ok.rs similarity index 61% rename from src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs rename to src/test/ui/consts/min_const_fn/min_const_fn_unsafe_ok.rs index 0152561aefcb2..02c7970deca64 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_ok.rs @@ -1,6 +1,4 @@ -//------------------------------------------------------------------------------ -// OK -//------------------------------------------------------------------------------ +// check-pass const unsafe fn ret_i32_no_unsafe() -> i32 { 42 } const unsafe fn ret_null_ptr_no_unsafe() -> *const T { std::ptr::null() } @@ -43,23 +41,4 @@ const unsafe fn call_unsafe_generic_cell_const_unsafe_fn_immediate() ret_null_mut_ptr_no_unsafe::>>() } -//------------------------------------------------------------------------------ -// NOT OK -//------------------------------------------------------------------------------ - -const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe -//~^ dereferencing raw pointers in constant functions - -const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x } -//~^ dereferencing raw pointers in constant functions - -const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x } -//~^ dereferencing raw pointers in constant functions - fn main() {} - -const unsafe fn no_union() { - union Foo { x: (), y: () } - Foo { x: () }.y - //~^ unions in const fn -} diff --git a/src/test/ui/issues/issue-31776.rs b/src/test/ui/issues/issue-31776.rs index c0d2c91e57796..c86623ce2898c 100644 --- a/src/test/ui/issues/issue-31776.rs +++ b/src/test/ui/issues/issue-31776.rs @@ -13,7 +13,7 @@ mod m { } } -// ------------------------------------------------------ +// Scenario 1 pub trait Tr { type A; @@ -28,7 +28,7 @@ fn f() { } } -// ------------------------------------------------------ +// Scenario 2 trait Tr1 { type A; @@ -49,8 +49,6 @@ mod m1 { } } -// ------------------------------------------------------ - fn main() { S.s(); // Privacy error, unless `fn s` is pub let a = S2.pull().field; // Privacy error unless `field: u8` is pub diff --git a/src/test/ui/issues/issue-50415.rs b/src/test/ui/issues/issue-50415.rs index 20c7be772f909..151b9fe442c03 100644 --- a/src/test/ui/issues/issue-50415.rs +++ b/src/test/ui/issues/issue-50415.rs @@ -1,11 +1,9 @@ // run-pass fn main() { - // -------- Simplified test case -------- - + // Simplified test case let _ = || 0..=1; - // -------- Original test case -------- - + // Original test case let full_length = 1024; let range = { // do some stuff, omit here diff --git a/src/test/ui/issues/issue-5067.rs b/src/test/ui/issues/issue-5067.rs index 616fd09907a2b..5857a081596cb 100644 --- a/src/test/ui/issues/issue-5067.rs +++ b/src/test/ui/issues/issue-5067.rs @@ -54,7 +54,7 @@ macro_rules! foo { //~^ ERROR repetition matches empty token tree } -// --- Original Issue --- // +// Original Issue macro_rules! make_vec { (a $e1:expr $($(, a $e2:expr)*)*) => ([$e1 $($(, $e2)*)*]); @@ -65,7 +65,7 @@ fn main() { let _ = make_vec![a 1, a 2, a 3]; } -// --- Minified Issue --- // +// Minified Issue macro_rules! m { ( $()* ) => {}; diff --git a/src/test/ui/macros/restricted-shadowing-modern.rs b/src/test/ui/macros/restricted-shadowing-modern.rs index a8818507d75d2..1151a829eba16 100644 --- a/src/test/ui/macros/restricted-shadowing-modern.rs +++ b/src/test/ui/macros/restricted-shadowing-modern.rs @@ -95,8 +95,6 @@ macro include() { m!() } - // ----------------------------------------------------------- - fn check1() { macro m() {} { diff --git a/src/test/ui/macros/restricted-shadowing-modern.stderr b/src/test/ui/macros/restricted-shadowing-modern.stderr index d147debeb51b8..12075d42b9a7c 100644 --- a/src/test/ui/macros/restricted-shadowing-modern.stderr +++ b/src/test/ui/macros/restricted-shadowing-modern.stderr @@ -1,5 +1,5 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/restricted-shadowing-modern.rs:106:17 + --> $DIR/restricted-shadowing-modern.rs:104:17 | LL | m!(); | ^ ambiguous name @@ -16,7 +16,7 @@ LL | macro m() { Right } LL | include!(); | ----------- in this macro invocation note: `m` could also refer to the macro defined here - --> $DIR/restricted-shadowing-modern.rs:101:9 + --> $DIR/restricted-shadowing-modern.rs:99:9 | LL | macro m() {} | ^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | include!(); | ----------- in this macro invocation error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/restricted-shadowing-modern.rs:149:33 + --> $DIR/restricted-shadowing-modern.rs:147:33 | LL | macro gen_invoc() { m!() } | ^ ambiguous name @@ -42,7 +42,7 @@ LL | macro m() { Right } LL | include!(); | ----------- in this macro invocation note: `m` could also refer to the macro defined here - --> $DIR/restricted-shadowing-modern.rs:145:9 + --> $DIR/restricted-shadowing-modern.rs:143:9 | LL | macro m() {} | ^^^^^^^^^^^^ @@ -51,7 +51,7 @@ LL | include!(); | ----------- in this macro invocation error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/restricted-shadowing-modern.rs:158:13 + --> $DIR/restricted-shadowing-modern.rs:156:13 | LL | m!(); | ^ ambiguous name @@ -68,7 +68,7 @@ LL | macro m() { Right } LL | include!(); | ----------- in this macro invocation note: `m` could also refer to the macro defined here - --> $DIR/restricted-shadowing-modern.rs:155:9 + --> $DIR/restricted-shadowing-modern.rs:153:9 | LL | macro m() {} | ^^^^^^^^^^^^ @@ -77,7 +77,7 @@ LL | include!(); | ----------- in this macro invocation error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/restricted-shadowing-modern.rs:174:13 + --> $DIR/restricted-shadowing-modern.rs:172:13 | LL | m!(); | ^ ambiguous name @@ -103,7 +103,7 @@ LL | include!(); | ----------- in this macro invocation error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/restricted-shadowing-modern.rs:192:17 + --> $DIR/restricted-shadowing-modern.rs:190:17 | LL | m!(); | ^ ambiguous name @@ -129,7 +129,7 @@ LL | include!(); | ----------- in this macro invocation error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/restricted-shadowing-modern.rs:235:33 + --> $DIR/restricted-shadowing-modern.rs:233:33 | LL | macro gen_invoc() { m!() } | ^ ambiguous name diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr index 867eafe2529d8..4944f2649b738 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:43:12 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:39:12 | LL | fn with_assoc<'a,'b>() { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr index f31f25bf00b60..61be0778c99c5 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr @@ -1,16 +1,16 @@ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:43:12 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:39:12 | LL | let _: &'a WithAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the function body at 37:15 - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:37:15 +note: the pointer is valid for the lifetime 'a as defined on the function body at 33:15 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:33:15 | LL | fn with_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 37:18 - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:37:18 +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 33:18 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:33:18 | LL | fn with_assoc<'a,'b>() { | ^^ diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr index 867eafe2529d8..4944f2649b738 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:43:12 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:39:12 | LL | fn with_assoc<'a,'b>() { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs index 97c5559360077..046d010002e6e 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs @@ -8,8 +8,6 @@ #![allow(dead_code)] -/////////////////////////////////////////////////////////////////////////// - pub trait TheTrait { type TheAssocType; } @@ -28,8 +26,6 @@ impl<'b> TheTrait for TheType<'b> { impl<'b> TheSubTrait for TheType<'b> { } -/////////////////////////////////////////////////////////////////////////// - pub struct WithAssoc { m: [T; 0] } diff --git a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs index 1c1230346a56c..bf0c1dc27ce43 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs @@ -34,7 +34,7 @@ pub fn main() { let vs = &vx; let vsm = &mut vec![X(Y)]; - // -------- test for duplicate suggestions -------- + // test for duplicate suggestions let &(X(_t), X(_u)) = &(x.clone(), x.clone()); //~^ ERROR cannot move diff --git a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs index 6e3879a4155b9..f1e043c30f213 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs @@ -22,7 +22,7 @@ fn move_into_fn() { let x = X(Y); - // -------- move into Fn -------- + // move into Fn consume_fn(|| { let X(_t) = x; @@ -89,7 +89,7 @@ fn move_into_fnmut() { let x = X(Y); - // -------- move into FnMut -------- + // move into FnMut consume_fnmut(|| { let X(_t) = x; diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.rs b/src/test/ui/suggestions/dont-suggest-ref/simple.rs index 69b303a66237e..c53ac3d2cd684 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/simple.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.rs @@ -33,7 +33,7 @@ pub fn main() { let vs = &vx; let vsm = &mut vec![X(Y)]; - // -------- move from Either/X place -------- + // move from Either/X place let X(_t) = *s; //~^ ERROR cannot move @@ -163,7 +163,7 @@ pub fn main() { // FIXME: should suggest removing `ref` too } - // -------- move from &Either/&X place -------- + // move from &Either/&X place let &X(_t) = s; //~^ ERROR cannot move @@ -251,7 +251,7 @@ pub fn main() { //~| HELP consider removing the `&mut` //~| SUGGESTION X(_t) - // -------- move from tuple of &Either/&X -------- + // move from tuple of &Either/&X // FIXME: These should have suggestions. @@ -283,7 +283,7 @@ pub fn main() { fn f4((&mut X(_t),): (&mut X,)) { } //~^ ERROR cannot move - // -------- move from &Either/&X value -------- + // move from &Either/&X value let &X(_t) = &x; //~^ ERROR cannot move diff --git a/src/test/ui/traits/traits-conditional-model-fn.rs b/src/test/ui/traits/traits-conditional-model-fn.rs index afdfb96394bd0..ba88670032c95 100644 --- a/src/test/ui/traits/traits-conditional-model-fn.rs +++ b/src/test/ui/traits/traits-conditional-model-fn.rs @@ -6,7 +6,6 @@ // aux-build:go_trait.rs - extern crate go_trait; use go_trait::{Go, GoMut, GoOnce, go, go_mut, go_once};