diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py index b1252f386df3..e6d5ef1a23ff 100755 --- a/src/etc/gdb_rust_pretty_printing.py +++ b/src/etc/gdb_rust_pretty_printing.py @@ -9,7 +9,6 @@ # except according to those terms. import gdb -import re import sys import debugger_pretty_printers_common as rustpp diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index ff3587d5d873..5c776292f53d 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -502,7 +502,7 @@ impl String { #[stable(feature = "rust1", since = "1.0.0")] pub fn from_utf8(vec: Vec) -> Result { match str::from_utf8(&vec) { - Ok(..) => Ok(String { vec: vec }), + Ok(..) => Ok(String { vec }), Err(e) => { Err(FromUtf8Error { bytes: vec, diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index ec7d366c3f5c..689cf319bd75 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -207,8 +207,8 @@ use ptr; /// /// # Examples /// -/// Here you can see how using `Cell` allows to use mutable field inside -/// immutable struct (which is also called 'interior mutability'). +/// In this example, you can see that `Cell` enables mutation inside an +/// immutable struct. In other words, it enables "interior mutability". /// /// ``` /// use std::cell::Cell; @@ -225,10 +225,11 @@ use ptr; /// /// let new_value = 100; /// -/// // ERROR, because my_struct is immutable +/// // ERROR: `my_struct` is immutable /// // my_struct.regular_field = new_value; /// -/// // WORKS, although `my_struct` is immutable, field `special_field` is mutable because it is Cell +/// // WORKS: although `my_struct` is immutable, `special_field` is a `Cell`, +/// // which can always be mutated /// my_struct.special_field.set(new_value); /// assert_eq!(my_struct.special_field.get(), new_value); /// ``` diff --git a/src/libpanic_unwind/dwarf/mod.rs b/src/libpanic_unwind/dwarf/mod.rs index 7e0c32fe03d8..3ff250ff6592 100644 --- a/src/libpanic_unwind/dwarf/mod.rs +++ b/src/libpanic_unwind/dwarf/mod.rs @@ -29,7 +29,7 @@ struct Unaligned(T); impl DwarfReader { pub fn new(ptr: *const u8) -> DwarfReader { - DwarfReader { ptr: ptr } + DwarfReader { ptr } } // DWARF streams are packed, so e.g. a u32 would not necessarily be aligned diff --git a/src/libpanic_unwind/seh64_gnu.rs b/src/libpanic_unwind/seh64_gnu.rs index c2074db00385..60e9829ef9ea 100644 --- a/src/libpanic_unwind/seh64_gnu.rs +++ b/src/libpanic_unwind/seh64_gnu.rs @@ -41,7 +41,7 @@ struct PanicData { } pub unsafe fn panic(data: Box) -> u32 { - let panic_ctx = Box::new(PanicData { data: data }); + let panic_ctx = Box::new(PanicData { data }); let params = [Box::into_raw(panic_ctx) as c::ULONG_PTR]; c::RaiseException(RUST_PANIC, c::EXCEPTION_NONCONTINUABLE, diff --git a/src/librustc/infer/resolve.rs b/src/librustc/infer/resolve.rs index 0ef976185726..a0c310ac2761 100644 --- a/src/librustc/infer/resolve.rs +++ b/src/librustc/infer/resolve.rs @@ -26,7 +26,7 @@ pub struct OpportunisticTypeResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> OpportunisticTypeResolver<'a, 'gcx, 'tcx> { pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self { - OpportunisticTypeResolver { infcx: infcx } + OpportunisticTypeResolver { infcx } } } @@ -54,7 +54,7 @@ pub struct OpportunisticTypeAndRegionResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> { pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self { - OpportunisticTypeAndRegionResolver { infcx: infcx } + OpportunisticTypeAndRegionResolver { infcx } } } diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index 970b6e096ffe..39bf59a7a4ec 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -169,7 +169,7 @@ impl<'tcx> TypeVariableTable<'tcx> { // Hack: we only need this so that `types_escaping_snapshot` // can see what has been unified; see the Delegate impl for // more details. - self.values.record(Instantiate { vid: vid }); + self.values.record(Instantiate { vid }); } /// Creates a new type variable. diff --git a/src/librustc/infer/unify_key.rs b/src/librustc/infer/unify_key.rs index cdc92877a5ae..f8001e085c46 100644 --- a/src/librustc/infer/unify_key.rs +++ b/src/librustc/infer/unify_key.rs @@ -43,7 +43,7 @@ impl UnifyValue for RegionVidKey { value2.min_vid }; - Ok(RegionVidKey { min_vid: min_vid }) + Ok(RegionVidKey { min_vid }) } } diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index ec8e7d060587..5d456481896b 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -469,7 +469,7 @@ impl<'a, 'tcx> Index<'tcx> { /// Cross-references the feature names of unstable APIs with enabled /// features and possibly prints errors. pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - let mut checker = Checker { tcx: tcx }; + let mut checker = Checker { tcx }; tcx.hir.krate().visit_all_item_likes(&mut checker.as_deep_visitor()); } diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 36bc2edcf584..c2014a5fdd23 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -2986,7 +2986,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> { use mir::TerminatorKind::*; let kind = match self.kind { - Goto { target } => Goto { target: target }, + Goto { target } => Goto { target }, SwitchInt { ref discr, switch_ty, diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index 473730c54899..4b53235eab4a 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -32,7 +32,7 @@ pub enum PlaceTy<'tcx> { impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> { pub fn from_ty(ty: Ty<'tcx>) -> PlaceTy<'tcx> { - PlaceTy::Ty { ty: ty } + PlaceTy::Ty { ty } } pub fn to_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 762007775840..5306f2c9689b 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -2202,8 +2202,7 @@ pub fn build_session_options_and_crate_config( if !cg.remark.is_empty() && debuginfo == DebugInfo::None { early_warn( error_format, - "-C remark will not show source locations without \ - --debuginfo", + "-C remark requires \"-C debuginfo=n\" to show source locations", ); } diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index a17825a877d8..fe94b62ef19e 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -868,7 +868,7 @@ impl Session { let fuel = self.optimization_fuel_limit.get(); ret = fuel != 0; if fuel == 0 && !self.out_of_fuel.get() { - println!("optimization-fuel-exhausted: {}", msg()); + eprintln!("optimization-fuel-exhausted: {}", msg()); self.out_of_fuel.set(true); } else if fuel > 0 { self.optimization_fuel_limit.set(fuel - 1); diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index e87e425762d5..8239e5ac56e4 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -447,27 +447,51 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { ty::RegionKind::ReLateBound(_, _), ) => {} - (ty::RegionKind::ReLateBound(_, _), _) => { + (ty::RegionKind::ReLateBound(_, _), _) | + (_, ty::RegionKind::ReVar(_)) => { + // One of these is true: // The new predicate has a HRTB in a spot where the old // predicate does not (if they both had a HRTB, the previous - // match arm would have executed). + // match arm would have executed). A HRBT is a 'stricter' + // bound than anything else, so we want to keep the newer + // predicate (with the HRBT) in place of the old predicate. // - // The means we want to remove the older predicate from - // user_computed_preds, since having both it and the new + // OR + // + // The old predicate has a region variable where the new + // predicate has some other kind of region. An region + // variable isn't something we can actually display to a user, + // so we choose ther new predicate (which doesn't have a region + // varaible). + // + // In both cases, we want to remove the old predicate, + // from user_computed_preds, and replace it with the new + // one. Having both the old and the new // predicate in a ParamEnv would confuse SelectionContext + // // We're currently in the predicate passed to 'retain', // so we return 'false' to remove the old predicate from // user_computed_preds return false; } - (_, ty::RegionKind::ReLateBound(_, _)) => { - // This is the opposite situation as the previous arm - the - // old predicate has a HRTB lifetime in a place where the - // new predicate does not. We want to leave the old + (_, ty::RegionKind::ReLateBound(_, _)) | + (ty::RegionKind::ReVar(_), _) => { + // This is the opposite situation as the previous arm. + // One of these is true: + // + // The old predicate has a HRTB lifetime in a place where the + // new predicate does not. + // + // OR + // + // The new predicate has a region variable where the old + // predicate has some other type of region. + // + // We want to leave the old // predicate in user_computed_preds, and skip adding // new_pred to user_computed_params. should_add_new = false - } + }, _ => {} } } diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index aea956461f27..bc091a4e7e08 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -12,8 +12,9 @@ use infer::InferCtxt; use mir::interpret::{GlobalId, ErrorHandled}; use ty::{self, Ty, TypeFoldable, ToPolyTraitRef, ToPredicate}; use ty::error::ExpectedFound; -use rustc_data_structures::obligation_forest::{Error, ForestObligation, ObligationForest}; -use rustc_data_structures::obligation_forest::{ObligationProcessor, ProcessResult}; +use rustc_data_structures::obligation_forest::{DoCompleted, Error, ForestObligation}; +use rustc_data_structures::obligation_forest::{ObligationForest, ObligationProcessor}; +use rustc_data_structures::obligation_forest::{ProcessResult}; use std::marker::PhantomData; use hir::def_id::DefId; @@ -98,7 +99,7 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> { let outcome = self.predicates.process_obligations(&mut FulfillProcessor { selcx, register_region_obligations: self.register_region_obligations - }); + }, DoCompleted::No); debug!("select: outcome={:#?}", outcome); // FIXME: if we kept the original cache key, we could mark projection diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index a388c7eeb7e4..6b5eb4293e02 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -266,7 +266,7 @@ fn project_and_unify_type<'cx, 'gcx, 'tcx>( }, Err(err) => { debug!("project_and_unify_type: equating types encountered error {:?}", err); - Err(MismatchedProjectionTypes { err: err }) + Err(MismatchedProjectionTypes { err }) } } } diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 312cd66dcc75..550c27ca0ab8 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -3526,7 +3526,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { _ => bug!(), }; - Ok(VtableBuiltinData { nested: nested }) + Ok(VtableBuiltinData { nested }) } /////////////////////////////////////////////////////////////////////////// diff --git a/src/librustc/ty/_match.rs b/src/librustc/ty/_match.rs index c9b0e97c9b05..d20b6d361991 100644 --- a/src/librustc/ty/_match.rs +++ b/src/librustc/ty/_match.rs @@ -34,7 +34,7 @@ pub struct Match<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> Match<'a, 'gcx, 'tcx> { pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Match<'a, 'gcx, 'tcx> { - Match { tcx: tcx } + Match { tcx } } } diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index 8c822adf7b02..ffa4380a5d63 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -82,7 +82,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone { } fn has_type_flags(&self, flags: TypeFlags) -> bool { - self.visit_with(&mut HasTypeFlagsVisitor { flags: flags }) + self.visit_with(&mut HasTypeFlagsVisitor { flags }) } fn has_projections(&self) -> bool { self.has_type_flags(TypeFlags::HAS_PROJECTION) diff --git a/src/librustc_codegen_llvm/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs index 8f940e0d22a8..3d96fef7c0d6 100644 --- a/src/librustc_codegen_llvm/back/lto.rs +++ b/src/librustc_codegen_llvm/back/lto.rs @@ -605,6 +605,13 @@ fn run_pass_manager(cgcx: &CodegenContext, } }); + // We always generate bitcode through ThinLTOBuffers, + // which do not support anonymous globals + if config.bitcode_needed() { + let pass = llvm::LLVMRustFindAndCreatePass("name-anon-globals\0".as_ptr() as *const _); + llvm::LLVMRustAddPass(pm, pass.unwrap()); + } + if config.verify_llvm_ir { let pass = llvm::LLVMRustFindAndCreatePass("verify\0".as_ptr() as *const _); llvm::LLVMRustAddPass(pm, pass.unwrap()); diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index d04e80195f05..184be4b9eab3 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -337,6 +337,11 @@ impl ModuleConfig { self.merge_functions = sess.opts.optimize == config::OptLevel::Default || sess.opts.optimize == config::OptLevel::Aggressive; } + + pub fn bitcode_needed(&self) -> bool { + self.emit_bc || self.obj_is_bitcode + || self.emit_bc_compressed || self.embed_bitcode + } } /// Assembler name and command used by codegen when no_integrated_as is enabled @@ -564,8 +569,7 @@ unsafe fn optimize(cgcx: &CodegenContext, // Some options cause LLVM bitcode to be emitted, which uses ThinLTOBuffers, so we need // to make sure we run LLVM's NameAnonGlobals pass when emitting bitcode; otherwise // we'll get errors in LLVM. - let using_thin_buffers = config.emit_bc || config.obj_is_bitcode - || config.emit_bc_compressed || config.embed_bitcode; + let using_thin_buffers = config.bitcode_needed(); let mut have_name_anon_globals_pass = false; if !config.no_prepopulate_passes { llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod); diff --git a/src/librustc_codegen_llvm/llvm/mod.rs b/src/librustc_codegen_llvm/llvm/mod.rs index 4343c8c184ec..fbd5192a63f8 100644 --- a/src/librustc_codegen_llvm/llvm/mod.rs +++ b/src/librustc_codegen_llvm/llvm/mod.rs @@ -190,7 +190,7 @@ impl ObjectFile { pub fn new(llmb: &'static mut MemoryBuffer) -> Option { unsafe { let llof = LLVMCreateObjectFile(llmb)?; - Some(ObjectFile { llof: llof }) + Some(ObjectFile { llof }) } } } diff --git a/src/librustc_codegen_llvm/mir/analyze.rs b/src/librustc_codegen_llvm/mir/analyze.rs index a93c6faaf7ba..2af772bd7ce2 100644 --- a/src/librustc_codegen_llvm/mir/analyze.rs +++ b/src/librustc_codegen_llvm/mir/analyze.rs @@ -346,7 +346,7 @@ pub fn cleanup_kinds<'a, 'tcx>(mir: &mir::Mir<'tcx>) -> IndexVec { - result[succ] = CleanupKind::Internal { funclet: funclet }; + result[succ] = CleanupKind::Internal { funclet }; } CleanupKind::Funclet => { if funclet != succ { diff --git a/src/librustc_codegen_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs index 47bbd67fb5c7..6eaf0c1c08da 100644 --- a/src/librustc_codegen_utils/symbol_names_test.rs +++ b/src/librustc_codegen_utils/symbol_names_test.rs @@ -32,7 +32,7 @@ pub fn report_symbol_names<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { } tcx.dep_graph.with_ignore(|| { - let mut visitor = SymbolNamesTest { tcx: tcx }; + let mut visitor = SymbolNamesTest { tcx }; tcx.hir.krate().visit_all_item_likes(&mut visitor); }) } diff --git a/src/librustc_data_structures/flock.rs b/src/librustc_data_structures/flock.rs index 38ce331051fe..86e48e21626a 100644 --- a/src/librustc_data_structures/flock.rs +++ b/src/librustc_data_structures/flock.rs @@ -214,7 +214,7 @@ cfg_if! { unsafe { libc::close(fd); } Err(err) } else { - Ok(Lock { fd: fd }) + Ok(Lock { fd }) } } } diff --git a/src/librustc_data_structures/obligation_forest/mod.rs b/src/librustc_data_structures/obligation_forest/mod.rs index ccf2a7f81590..c211d888df13 100644 --- a/src/librustc_data_structures/obligation_forest/mod.rs +++ b/src/librustc_data_structures/obligation_forest/mod.rs @@ -162,8 +162,8 @@ enum NodeState { #[derive(Debug)] pub struct Outcome { /// Obligations that were completely evaluated, including all - /// (transitive) subobligations. - pub completed: Vec, + /// (transitive) subobligations. Only computed if requested. + pub completed: Option>, /// Backtrace of obligations that were found to be in error. pub errors: Vec>, @@ -177,6 +177,14 @@ pub struct Outcome { pub stalled: bool, } +/// Should `process_obligations` compute the `Outcome::completed` field of its +/// result? +#[derive(PartialEq)] +pub enum DoCompleted { + No, + Yes, +} + #[derive(Debug, PartialEq, Eq)] pub struct Error { pub error: E, @@ -282,8 +290,8 @@ impl ObligationForest { }); } } - let successful_obligations = self.compress(); - assert!(successful_obligations.is_empty()); + let successful_obligations = self.compress(DoCompleted::Yes); + assert!(successful_obligations.unwrap().is_empty()); errors } @@ -311,7 +319,8 @@ impl ObligationForest { /// be called in a loop until `outcome.stalled` is false. /// /// This CANNOT be unrolled (presently, at least). - pub fn process_obligations

(&mut self, processor: &mut P) -> Outcome + pub fn process_obligations

(&mut self, processor: &mut P, do_completed: DoCompleted) + -> Outcome where P: ObligationProcessor { debug!("process_obligations(len={})", self.nodes.len()); @@ -366,7 +375,7 @@ impl ObligationForest { // There's no need to perform marking, cycle processing and compression when nothing // changed. return Outcome { - completed: vec![], + completed: if do_completed == DoCompleted::Yes { Some(vec![]) } else { None }, errors, stalled, }; @@ -376,12 +385,12 @@ impl ObligationForest { self.process_cycles(processor); // Now we have to compress the result - let completed_obligations = self.compress(); + let completed = self.compress(do_completed); debug!("process_obligations: complete"); Outcome { - completed: completed_obligations, + completed, errors, stalled, } @@ -524,7 +533,7 @@ impl ObligationForest { /// Beforehand, all nodes must be marked as `Done` and no cycles /// on these nodes may be present. This is done by e.g. `process_cycles`. #[inline(never)] - fn compress(&mut self) -> Vec { + fn compress(&mut self, do_completed: DoCompleted) -> Option> { let nodes_len = self.nodes.len(); let mut node_rewrites: Vec<_> = self.scratch.take().unwrap(); node_rewrites.extend(0..nodes_len); @@ -573,21 +582,26 @@ impl ObligationForest { if dead_nodes == 0 { node_rewrites.truncate(0); self.scratch = Some(node_rewrites); - return vec![]; + return if do_completed == DoCompleted::Yes { Some(vec![]) } else { None }; } // Pop off all the nodes we killed and extract the success // stories. - let successful = (0..dead_nodes) - .map(|_| self.nodes.pop().unwrap()) - .flat_map(|node| { - match node.state.get() { - NodeState::Error => None, - NodeState::Done => Some(node.obligation), - _ => unreachable!() - } - }) - .collect(); + let successful = if do_completed == DoCompleted::Yes { + Some((0..dead_nodes) + .map(|_| self.nodes.pop().unwrap()) + .flat_map(|node| { + match node.state.get() { + NodeState::Error => None, + NodeState::Done => Some(node.obligation), + _ => unreachable!() + } + }) + .collect()) + } else { + self.nodes.truncate(self.nodes.len() - dead_nodes); + None + }; self.apply_rewrites(&node_rewrites); node_rewrites.truncate(0); diff --git a/src/librustc_data_structures/obligation_forest/test.rs b/src/librustc_data_structures/obligation_forest/test.rs index c27a65e34310..2a418973fbda 100644 --- a/src/librustc_data_structures/obligation_forest/test.rs +++ b/src/librustc_data_structures/obligation_forest/test.rs @@ -10,7 +10,7 @@ #![cfg(test)] -use super::{Error, ObligationForest, ObligationProcessor, Outcome, ProcessResult}; +use super::{Error, DoCompleted, ObligationForest, ObligationProcessor, Outcome, ProcessResult}; use std::fmt; use std::marker::PhantomData; @@ -84,8 +84,8 @@ fn push_pop() { "C" => ProcessResult::Changed(vec![]), _ => unreachable!(), } - }, |_| {})); - assert_eq!(ok, vec!["C"]); + }, |_| {}), DoCompleted::Yes); + assert_eq!(ok.unwrap(), vec!["C"]); assert_eq!(err, vec![Error { error: "B is for broken", @@ -108,8 +108,8 @@ fn push_pop() { "D" => ProcessResult::Changed(vec!["D.1", "D.2"]), _ => unreachable!(), } - }, |_| {})); - assert_eq!(ok, Vec::<&'static str>::new()); + }, |_| {}), DoCompleted::Yes); + assert_eq!(ok.unwrap(), Vec::<&'static str>::new()); assert_eq!(err, Vec::new()); @@ -127,8 +127,8 @@ fn push_pop() { "D.2" => ProcessResult::Changed(vec!["D.2.i"]), _ => unreachable!(), } - }, |_| {})); - assert_eq!(ok, vec!["A.3", "A.1", "A.3.i"]); + }, |_| {}), DoCompleted::Yes); + assert_eq!(ok.unwrap(), vec!["A.3", "A.1", "A.3.i"]); assert_eq!(err, vec![Error { error: "A is for apple", @@ -143,8 +143,8 @@ fn push_pop() { "D.2.i" => ProcessResult::Changed(vec![]), _ => panic!("unexpected obligation {:?}", obligation), } - }, |_| {})); - assert_eq!(ok, vec!["D.2.i", "D.2"]); + }, |_| {}), DoCompleted::Yes); + assert_eq!(ok.unwrap(), vec!["D.2.i", "D.2"]); assert_eq!(err, vec![Error { error: "D is for dumb", @@ -171,8 +171,8 @@ fn success_in_grandchildren() { "A" => ProcessResult::Changed(vec!["A.1", "A.2", "A.3"]), _ => unreachable!(), } - }, |_| {})); - assert!(ok.is_empty()); + }, |_| {}), DoCompleted::Yes); + assert!(ok.unwrap().is_empty()); assert!(err.is_empty()); let Outcome { completed: ok, errors: err, .. } = @@ -183,8 +183,8 @@ fn success_in_grandchildren() { "A.3" => ProcessResult::Changed(vec![]), _ => unreachable!(), } - }, |_| {})); - assert_eq!(ok, vec!["A.3", "A.1"]); + }, |_| {}), DoCompleted::Yes); + assert_eq!(ok.unwrap(), vec!["A.3", "A.1"]); assert!(err.is_empty()); let Outcome { completed: ok, errors: err, .. } = @@ -194,8 +194,8 @@ fn success_in_grandchildren() { "A.2.ii" => ProcessResult::Changed(vec![]), _ => unreachable!(), } - }, |_| {})); - assert_eq!(ok, vec!["A.2.ii"]); + }, |_| {}), DoCompleted::Yes); + assert_eq!(ok.unwrap(), vec!["A.2.ii"]); assert!(err.is_empty()); let Outcome { completed: ok, errors: err, .. } = @@ -204,14 +204,15 @@ fn success_in_grandchildren() { "A.2.i.a" => ProcessResult::Changed(vec![]), _ => unreachable!(), } - }, |_| {})); - assert_eq!(ok, vec!["A.2.i.a", "A.2.i", "A.2", "A"]); + }, |_| {}), DoCompleted::Yes); + assert_eq!(ok.unwrap(), vec!["A.2.i.a", "A.2.i", "A.2", "A"]); assert!(err.is_empty()); let Outcome { completed: ok, errors: err, .. } = - forest.process_obligations(&mut C(|_| unreachable!(), |_| {})); + forest.process_obligations(&mut C(|_| unreachable!(), |_| {}), + DoCompleted::Yes); - assert!(ok.is_empty()); + assert!(ok.unwrap().is_empty()); assert!(err.is_empty()); } @@ -227,8 +228,8 @@ fn to_errors_no_throw() { "A" => ProcessResult::Changed(vec!["A.1", "A.2", "A.3"]), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok.len(), 0); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap().len(), 0); assert_eq!(err.len(), 0); let errors = forest.to_errors(()); assert_eq!(errors[0].backtrace, vec!["A.1", "A"]); @@ -248,8 +249,8 @@ fn diamond() { "A" => ProcessResult::Changed(vec!["A.1", "A.2"]), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok.len(), 0); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap().len(), 0); assert_eq!(err.len(), 0); let Outcome { completed: ok, errors: err, .. } = @@ -259,8 +260,8 @@ fn diamond() { "A.2" => ProcessResult::Changed(vec!["D"]), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok.len(), 0); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap().len(), 0); assert_eq!(err.len(), 0); let mut d_count = 0; @@ -270,9 +271,9 @@ fn diamond() { "D" => { d_count += 1; ProcessResult::Changed(vec![]) }, _ => unreachable!(), } - }, |_|{})); + }, |_|{}), DoCompleted::Yes); assert_eq!(d_count, 1); - assert_eq!(ok, vec!["D", "A.2", "A.1", "A"]); + assert_eq!(ok.unwrap(), vec!["D", "A.2", "A.1", "A"]); assert_eq!(err.len(), 0); let errors = forest.to_errors(()); @@ -285,8 +286,8 @@ fn diamond() { "A'" => ProcessResult::Changed(vec!["A'.1", "A'.2"]), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok.len(), 0); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap().len(), 0); assert_eq!(err.len(), 0); let Outcome { completed: ok, errors: err, .. } = @@ -296,8 +297,8 @@ fn diamond() { "A'.2" => ProcessResult::Changed(vec!["D'"]), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok.len(), 0); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap().len(), 0); assert_eq!(err.len(), 0); let mut d_count = 0; @@ -307,9 +308,9 @@ fn diamond() { "D'" => { d_count += 1; ProcessResult::Error("operation failed") }, _ => unreachable!(), } - }, |_|{})); + }, |_|{}), DoCompleted::Yes); assert_eq!(d_count, 1); - assert_eq!(ok.len(), 0); + assert_eq!(ok.unwrap().len(), 0); assert_eq!(err, vec![super::Error { error: "operation failed", backtrace: vec!["D'", "A'.1", "A'"] @@ -333,8 +334,8 @@ fn done_dependency() { "A: Sized" | "B: Sized" | "C: Sized" => ProcessResult::Changed(vec![]), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok, vec!["C: Sized", "B: Sized", "A: Sized"]); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap(), vec!["C: Sized", "B: Sized", "A: Sized"]); assert_eq!(err.len(), 0); forest.register_obligation("(A,B,C): Sized"); @@ -348,8 +349,8 @@ fn done_dependency() { ]), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok, vec!["(A,B,C): Sized"]); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap(), vec!["(A,B,C): Sized"]); assert_eq!(err.len(), 0); } @@ -371,8 +372,8 @@ fn orphan() { "C2" => ProcessResult::Changed(vec![]), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok, vec!["C2", "C1"]); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap(), vec!["C2", "C1"]); assert_eq!(err.len(), 0); let Outcome { completed: ok, errors: err, .. } = @@ -382,8 +383,8 @@ fn orphan() { "B" => ProcessResult::Changed(vec!["D"]), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok.len(), 0); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap().len(), 0); assert_eq!(err.len(), 0); let Outcome { completed: ok, errors: err, .. } = @@ -393,8 +394,8 @@ fn orphan() { "E" => ProcessResult::Error("E is for error"), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok.len(), 0); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap().len(), 0); assert_eq!(err, vec![super::Error { error: "E is for error", backtrace: vec!["E", "A"] @@ -406,8 +407,8 @@ fn orphan() { "D" => ProcessResult::Error("D is dead"), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok.len(), 0); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap().len(), 0); assert_eq!(err, vec![super::Error { error: "D is dead", backtrace: vec!["D"] @@ -431,8 +432,8 @@ fn simultaneous_register_and_error() { "B" => ProcessResult::Changed(vec!["A"]), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok.len(), 0); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap().len(), 0); assert_eq!(err, vec![super::Error { error: "An error", backtrace: vec!["A"] @@ -449,8 +450,8 @@ fn simultaneous_register_and_error() { "B" => ProcessResult::Changed(vec!["A"]), _ => unreachable!(), } - }, |_|{})); - assert_eq!(ok.len(), 0); + }, |_|{}), DoCompleted::Yes); + assert_eq!(ok.unwrap().len(), 0); assert_eq!(err, vec![super::Error { error: "An error", backtrace: vec!["A"] diff --git a/src/librustc_data_structures/svh.rs b/src/librustc_data_structures/svh.rs index 94f132562b5e..3d17824608cc 100644 --- a/src/librustc_data_structures/svh.rs +++ b/src/librustc_data_structures/svh.rs @@ -31,7 +31,7 @@ impl Svh { /// compute the SVH from some HIR, you want the `calculate_svh` /// function found in `librustc_incremental`. pub fn new(hash: u64) -> Svh { - Svh { hash: hash } + Svh { hash } } pub fn as_u64(&self) -> u64 { diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index e8fdaddaeb89..6c7982242bfa 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -952,7 +952,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls { control.compilation_done.callback = box move |state| { old_callback(state); let sess = state.session; - println!("Fuel used by {}: {}", + eprintln!("Fuel used by {}: {}", sess.print_fuel_crate.as_ref().unwrap(), sess.print_fuel.get()); } diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 0b788a8fd976..4ce87a9675a8 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -795,7 +795,7 @@ impl LintPass for ImproperCTypes { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes { fn check_foreign_item(&mut self, cx: &LateContext, it: &hir::ForeignItem) { - let mut vis = ImproperCTypesVisitor { cx: cx }; + let mut vis = ImproperCTypesVisitor { cx }; let abi = cx.tcx.hir.get_foreign_abi(it.id); if abi != Abi::RustIntrinsic && abi != Abi::PlatformIntrinsic { match it.node { diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index a855c9470788..c9df36c5e236 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -323,7 +323,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { index.record(DefId::local(CRATE_DEF_INDEX), IsolatedEncoder::encode_info_for_mod, FromId(CRATE_NODE_ID, (&krate.module, &krate.attrs, &vis))); - let mut visitor = EncodeVisitor { index: index }; + let mut visitor = EncodeVisitor { index }; krate.visit_all_item_likes(&mut visitor.as_deep_visitor()); for macro_def in &krate.exported_macros { visitor.visit_macro_def(macro_def); diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index b3e627882568..99badd5a03fe 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -453,7 +453,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } let scope = &self.scopes[len - scope_count]; self.cfg.terminate(block, scope.source_info(span), - TerminatorKind::Goto { target: target }); + TerminatorKind::Goto { target }); } /// Creates a path that performs all required cleanup for dropping a generator. @@ -1019,7 +1019,7 @@ fn build_diverge_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, } else { let block = cfg.start_new_cleanup_block(); cfg.push_end_region(tcx, block, source_info(span), scope.region_scope); - cfg.terminate(block, source_info(span), TerminatorKind::Goto { target: target }); + cfg.terminate(block, source_info(span), TerminatorKind::Goto { target }); *cached_block = Some(block); block } diff --git a/src/librustc_mir/dataflow/impls/borrowed_locals.rs b/src/librustc_mir/dataflow/impls/borrowed_locals.rs index 8d186597b142..1e279d8dd970 100644 --- a/src/librustc_mir/dataflow/impls/borrowed_locals.rs +++ b/src/librustc_mir/dataflow/impls/borrowed_locals.rs @@ -28,7 +28,7 @@ pub struct HaveBeenBorrowedLocals<'a, 'tcx: 'a> { impl<'a, 'tcx: 'a> HaveBeenBorrowedLocals<'a, 'tcx> { pub fn new(mir: &'a Mir<'tcx>) -> Self { - HaveBeenBorrowedLocals { mir: mir } + HaveBeenBorrowedLocals { mir } } pub fn mir(&self) -> &Mir<'tcx> { diff --git a/src/librustc_mir/dataflow/impls/storage_liveness.rs b/src/librustc_mir/dataflow/impls/storage_liveness.rs index ab03ace23d7b..c8faa34df8a2 100644 --- a/src/librustc_mir/dataflow/impls/storage_liveness.rs +++ b/src/librustc_mir/dataflow/impls/storage_liveness.rs @@ -21,7 +21,7 @@ pub struct MaybeStorageLive<'a, 'tcx: 'a> { impl<'a, 'tcx: 'a> MaybeStorageLive<'a, 'tcx> { pub fn new(mir: &'a Mir<'tcx>) -> Self { - MaybeStorageLive { mir: mir } + MaybeStorageLive { mir } } pub fn mir(&self) -> &Mir<'tcx> { diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 735ceef229a2..32f8752c31be 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -52,7 +52,7 @@ impl<'a, 'tcx> Visitor<'tcx> for OuterVisitor<'a, 'tcx> { } pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - tcx.hir.krate().visit_all_item_likes(&mut OuterVisitor { tcx: tcx }.as_deep_visitor()); + tcx.hir.krate().visit_all_item_likes(&mut OuterVisitor { tcx }.as_deep_visitor()); tcx.sess.abort_if_errors(); } diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 0e1f8d1d3281..0acb4052fd73 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -571,7 +571,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { }) .collect(); - PatternKind::Leaf { subpatterns: subpatterns } + PatternKind::Leaf { subpatterns } } ty::Error => { // Avoid ICE (#50577) return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) }; @@ -778,13 +778,13 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { subpatterns, } } else { - PatternKind::Leaf { subpatterns: subpatterns } + PatternKind::Leaf { subpatterns } } } Def::Struct(..) | Def::StructCtor(..) | Def::Union(..) | Def::TyAlias(..) | Def::AssociatedTy(..) | Def::SelfTy(..) | Def::SelfCtor(..) => { - PatternKind::Leaf { subpatterns: subpatterns } + PatternKind::Leaf { subpatterns } } _ => { diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index 8c8b3e2ca77c..8fde0c9b8afd 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -10,6 +10,7 @@ use std::fmt::Write; use std::hash::Hash; +use std::ops::RangeInclusive; use syntax_pos::symbol::Symbol; use rustc::ty::layout::{self, Size, Align, TyLayout, LayoutOf}; @@ -122,6 +123,37 @@ fn path_format(path: &Vec) -> String { out } +// Test if a range that wraps at overflow contains `test` +fn wrapping_range_contains(r: &RangeInclusive, test: u128) -> bool { + let (lo, hi) = r.clone().into_inner(); + if lo > hi { + // Wrapped + (..=hi).contains(&test) || (lo..).contains(&test) + } else { + // Normal + r.contains(&test) + } +} + +// Formats such that a sentence like "expected something {}" to mean +// "expected something " makes sense. +fn wrapping_range_format(r: &RangeInclusive, max_hi: u128) -> String { + let (lo, hi) = r.clone().into_inner(); + debug_assert!(hi <= max_hi); + if lo > hi { + format!("less or equal to {}, or greater or equal to {}", hi, lo) + } else { + if lo == 0 { + debug_assert!(hi < max_hi, "should not be printing if the range covers everything"); + format!("less or equal to {}", hi) + } else if hi == max_hi { + format!("greater or equal to {}", lo) + } else { + format!("in the range {:?}", r) + } + } +} + struct ValidityVisitor<'rt, 'a: 'rt, 'mir: 'rt, 'tcx: 'a+'rt+'mir, M: Machine<'a, 'mir, 'tcx>+'rt> { /// The `path` may be pushed to, but the part that is present when a function /// starts must not be changed! `visit_fields` and `visit_array` rely on @@ -428,8 +460,8 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> "a pointer", self.path, format!( - "something that cannot possibly be outside the (wrapping) range {:?}", - layout.valid_range + "something that cannot possibly fail to be {}", + wrapping_range_format(&layout.valid_range, max_hi) ) ); } @@ -440,33 +472,14 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> } }; // Now compare. This is slightly subtle because this is a special "wrap-around" range. - use std::ops::RangeInclusive; - let in_range = |bound: RangeInclusive| bound.contains(&bits); - if lo > hi { - // wrapping around - if in_range(0..=hi) || in_range(lo..=max_hi) { - Ok(()) - } else { - validation_failure!( - bits, - self.path, - format!("something in the range {:?} or {:?}", 0..=hi, lo..=max_hi) - ) - } + if wrapping_range_contains(&layout.valid_range, bits) { + Ok(()) } else { - if in_range(layout.valid_range.clone()) { - Ok(()) - } else { - validation_failure!( - bits, - self.path, - if hi == max_hi { - format!("something greater or equal to {}", lo) - } else { - format!("something in the range {:?}", layout.valid_range) - } - ) - } + validation_failure!( + bits, + self.path, + format!("something {}", wrapping_range_format(&layout.valid_range, max_hi)) + ) } } diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 958d4e353c89..5de289068b25 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -495,7 +495,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { let target = self.patch.new_block(BasicBlockData { statements: vec![assign], terminator: Some(Terminator { - kind: TerminatorKind::Goto { target: target }, + kind: TerminatorKind::Goto { target }, ..*terminator }), is_cleanup: false, diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index c20d40af5015..f643870dec20 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -302,7 +302,7 @@ impl MirPass for SimplifyLocals { let map = make_local_map(&mut mir.local_decls, marker.locals); // Update references to all vars and tmps now - LocalUpdater { map: map }.visit_mir(mir); + LocalUpdater { map }.visit_mir(mir); mir.local_decls.shrink_to_fit(); } } diff --git a/src/librustc_mir/transform/simplify_branches.rs b/src/librustc_mir/transform/simplify_branches.rs index e14941b8aeb9..b24898095435 100644 --- a/src/librustc_mir/transform/simplify_branches.rs +++ b/src/librustc_mir/transform/simplify_branches.rs @@ -57,7 +57,7 @@ impl MirPass for SimplifyBranches { TerminatorKind::Assert { target, cond: Operand::Constant(ref c), expected, .. } if (c.literal.assert_bool(tcx) == Some(true)) == expected => { - TerminatorKind::Goto { target: target } + TerminatorKind::Goto { target } }, TerminatorKind::FalseEdges { real_target, .. } => { TerminatorKind::Goto { target: real_target } diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index 61861da62f75..b878a330ab64 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -672,5 +672,5 @@ pub fn check_crate(session: &Session, krate: &Crate) { is_banned: false, }, krate); - visit::walk_crate(&mut AstValidator { session: session }, krate) + visit::walk_crate(&mut AstValidator { session }, krate) } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 17ca8c275c3c..241db271177b 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -4422,7 +4422,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { // declared as public (due to pruning, we don't explore // outside crate private modules => no need to check this) if !in_module_is_extern || name_binding.vis == ty::Visibility::Public { - candidates.push(ImportSuggestion { path: path }); + candidates.push(ImportSuggestion { path }); } } } @@ -4519,7 +4519,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { span: name_binding.span, segments: path_segments, }; - result = Some((module, ImportSuggestion { path: path })); + result = Some((module, ImportSuggestion { path })); } else { // add the module to the lookup if seen_modules.insert(module.def_id().unwrap()) { diff --git a/src/librustc_save_analysis/json_dumper.rs b/src/librustc_save_analysis/json_dumper.rs index d2354f38e268..ca336ceb381c 100644 --- a/src/librustc_save_analysis/json_dumper.rs +++ b/src/librustc_save_analysis/json_dumper.rs @@ -71,7 +71,7 @@ impl<'b> JsonDumper> { config: Config, ) -> JsonDumper> { JsonDumper { - output: CallbackOutput { callback: callback }, + output: CallbackOutput { callback }, config: config.clone(), result: Analysis::new(config), } diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 54c6c8f7b932..45c5457c9e14 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -595,7 +595,9 @@ fn compare_number_of_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if num_impl_m_type_params != num_trait_m_type_params { let impl_m_node_id = tcx.hir.as_local_node_id(impl_m.def_id).unwrap(); let impl_m_item = tcx.hir.expect_impl_item(impl_m_node_id); - let span = if impl_m_item.generics.params.is_empty() { + let span = if impl_m_item.generics.params.is_empty() + || impl_m_item.generics.span.is_dummy() // impl Trait in argument position (#55374) + { impl_m_span } else { impl_m_item.generics.span diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 527ba276de27..266b9e3c0aba 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -993,7 +993,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { AdtField { ty: field_ty, span: field.span } }) .collect(); - AdtVariant { fields: fields } + AdtVariant { fields } } fn enum_variants(&self, enum_def: &hir::EnumDef) -> Vec> { diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index b155587dddc4..14c6864434fc 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -17,7 +17,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir; pub fn check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - let mut orphan = OrphanChecker { tcx: tcx }; + let mut orphan = OrphanChecker { tcx }; tcx.hir.krate().visit_all_item_likes(&mut orphan); } diff --git a/src/librustc_typeck/coherence/unsafety.rs b/src/librustc_typeck/coherence/unsafety.rs index bdbf93ddec28..0894c1d49e80 100644 --- a/src/librustc_typeck/coherence/unsafety.rs +++ b/src/librustc_typeck/coherence/unsafety.rs @@ -16,7 +16,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::{self, Unsafety}; pub fn check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - let mut unsafety = UnsafetyChecker { tcx: tcx }; + let mut unsafety = UnsafetyChecker { tcx }; tcx.hir.krate().visit_all_item_likes(&mut unsafety); } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 74dea7fe411a..be09cfce8cae 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -64,7 +64,7 @@ struct OnlySelfBounds(bool); // Main entry point pub fn collect_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - let mut visitor = CollectItemTypesVisitor { tcx: tcx }; + let mut visitor = CollectItemTypesVisitor { tcx }; tcx.hir .krate() .visit_all_item_likes(&mut visitor.as_deep_visitor()); diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index edf3ddf7bdbf..74a53f7fca27 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -62,7 +62,7 @@ pub fn impl_wf_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { // We will tag this as part of the WF check -- logically, it is, // but it's one that we must perform earlier than the rest of // WfCheck. - tcx.hir.krate().visit_all_item_likes(&mut ImplWfCheck { tcx: tcx }); + tcx.hir.krate().visit_all_item_likes(&mut ImplWfCheck { tcx }); } struct ImplWfCheck<'a, 'tcx: 'a> { diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 9f68fd56c5e0..c39b71e33ca0 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2966,7 +2966,7 @@ impl<'tcx> Clean for ty::VariantDef { source: cx.tcx.def_span(self.did).clean(cx), visibility: Some(Inherited), def_id: self.did, - inner: VariantItem(Variant { kind: kind }), + inner: VariantItem(Variant { kind }), stability: get_stability(cx, self.did), deprecation: get_deprecation(cx, self.did), } diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index aea4522892cb..8de415e8aed5 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -3418,7 +3418,7 @@ mod test_map { slot.borrow_mut()[k] += 1; }); - Droppable { k: k } + Droppable { k } } } diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 49012a7d3419..f4703dec187b 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -877,7 +877,7 @@ impl OpenOptions { fn _open(&self, path: &Path) -> io::Result { let inner = fs_imp::File::open(path, &self.0)?; - Ok(File { inner: inner }) + Ok(File { inner }) } } diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 371e5b21c13b..12995d086834 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -150,7 +150,7 @@ pub struct Repeat { byte: u8 } /// assert_eq!(buffer, [0b101, 0b101, 0b101]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] -pub fn repeat(byte: u8) -> Repeat { Repeat { byte: byte } } +pub fn repeat(byte: u8) -> Repeat { Repeat { byte } } #[stable(feature = "rust1", since = "1.0.0")] impl Read for Repeat { diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 59cf741487e4..81f98a55c117 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -931,7 +931,7 @@ impl fmt::Debug for Sender { impl SyncSender { fn new(inner: Arc>) -> SyncSender { - SyncSender { inner: inner } + SyncSender { inner } } /// Sends a value on this synchronous channel. diff --git a/src/libstd/sys/cloudabi/time.rs b/src/libstd/sys/cloudabi/time.rs index ee12731619aa..3d66998b9f54 100644 --- a/src/libstd/sys/cloudabi/time.rs +++ b/src/libstd/sys/cloudabi/time.rs @@ -32,7 +32,7 @@ impl Instant { let mut t = mem::uninitialized(); let ret = abi::clock_time_get(abi::clockid::MONOTONIC, 0, &mut t); assert_eq!(ret, abi::errno::SUCCESS); - Instant { t: t } + Instant { t } } } @@ -71,7 +71,7 @@ impl SystemTime { let mut t = mem::uninitialized(); let ret = abi::clock_time_get(abi::clockid::REALTIME, 0, &mut t); assert_eq!(ret, abi::errno::SUCCESS); - SystemTime { t: t } + SystemTime { t } } } diff --git a/src/libstd/sys/redox/fd.rs b/src/libstd/sys/redox/fd.rs index e04e2791b23a..d61103a872f9 100644 --- a/src/libstd/sys/redox/fd.rs +++ b/src/libstd/sys/redox/fd.rs @@ -21,7 +21,7 @@ pub struct FileDesc { impl FileDesc { pub fn new(fd: usize) -> FileDesc { - FileDesc { fd: fd } + FileDesc { fd } } pub fn raw(&self) -> usize { self.fd } diff --git a/src/libstd/sys/redox/fs.rs b/src/libstd/sys/redox/fs.rs index 2e2216186f1e..6059406997df 100644 --- a/src/libstd/sys/redox/fs.rs +++ b/src/libstd/sys/redox/fs.rs @@ -264,7 +264,7 @@ impl File { pub fn file_attr(&self) -> io::Result { let mut stat = syscall::Stat::default(); cvt(syscall::fstat(self.0.raw(), &mut stat))?; - Ok(FileAttr { stat: stat }) + Ok(FileAttr { stat }) } pub fn fsync(&self) -> io::Result<()> { diff --git a/src/libstd/sys/redox/syscall/error.rs b/src/libstd/sys/redox/syscall/error.rs index 1ef79547431f..1e3783705537 100644 --- a/src/libstd/sys/redox/syscall/error.rs +++ b/src/libstd/sys/redox/syscall/error.rs @@ -19,7 +19,7 @@ pub type Result = result::Result; impl Error { pub fn new(errno: i32) -> Error { - Error { errno: errno } + Error { errno } } pub fn mux(result: Result) -> usize { diff --git a/src/libstd/sys/redox/thread.rs b/src/libstd/sys/redox/thread.rs index f4177087d77a..bab91b16e6c0 100644 --- a/src/libstd/sys/redox/thread.rs +++ b/src/libstd/sys/redox/thread.rs @@ -38,7 +38,7 @@ impl Thread { panic!("thread failed to exit"); } else { mem::forget(p); - Ok(Thread { id: id }) + Ok(Thread { id }) } } diff --git a/src/libstd/sys/redox/time.rs b/src/libstd/sys/redox/time.rs index 5c491115c551..aac6d2704e79 100644 --- a/src/libstd/sys/redox/time.rs +++ b/src/libstd/sys/redox/time.rs @@ -187,7 +187,7 @@ impl SystemTime { impl From for SystemTime { fn from(t: syscall::TimeSpec) -> SystemTime { - SystemTime { t: Timespec { t: t } } + SystemTime { t: Timespec { t } } } } diff --git a/src/libstd/sys/unix/fd.rs b/src/libstd/sys/unix/fd.rs index db2ea6b660a7..af33d2636fb1 100644 --- a/src/libstd/sys/unix/fd.rs +++ b/src/libstd/sys/unix/fd.rs @@ -41,7 +41,7 @@ fn max_len() -> usize { impl FileDesc { pub fn new(fd: c_int) -> FileDesc { - FileDesc { fd: fd } + FileDesc { fd } } pub fn raw(&self) -> c_int { self.fd } diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 1d5b0cfa94ad..add06aec11b6 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -317,7 +317,7 @@ impl DirEntry { cvt(unsafe { fstatat64(fd, self.entry.d_name.as_ptr(), &mut stat, libc::AT_SYMLINK_NOFOLLOW) })?; - Ok(FileAttr { stat: stat }) + Ok(FileAttr { stat }) } #[cfg(not(any(target_os = "linux", target_os = "emscripten", target_os = "android")))] @@ -526,7 +526,7 @@ impl File { cvt(unsafe { fstat64(self.0.raw(), &mut stat) })?; - Ok(FileAttr { stat: stat }) + Ok(FileAttr { stat }) } pub fn fsync(&self) -> io::Result<()> { @@ -807,7 +807,7 @@ pub fn stat(p: &Path) -> io::Result { cvt(unsafe { stat64(p.as_ptr(), &mut stat) })?; - Ok(FileAttr { stat: stat }) + Ok(FileAttr { stat }) } pub fn lstat(p: &Path) -> io::Result { @@ -816,7 +816,7 @@ pub fn lstat(p: &Path) -> io::Result { cvt(unsafe { lstat64(p.as_ptr(), &mut stat) })?; - Ok(FileAttr { stat: stat }) + Ok(FileAttr { stat }) } pub fn canonicalize(p: &Path) -> io::Result { diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index 0b1fb726357e..af51f8a8e257 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -217,7 +217,7 @@ mod inner { impl From for SystemTime { fn from(t: libc::timespec) -> SystemTime { - SystemTime { t: Timespec { t: t } } + SystemTime { t: Timespec { t } } } } @@ -332,7 +332,7 @@ mod inner { impl From for SystemTime { fn from(t: libc::timespec) -> SystemTime { - SystemTime { t: Timespec { t: t } } + SystemTime { t: Timespec { t } } } } diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 4974a8de89c7..ff1ee0d26fe5 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -241,7 +241,7 @@ impl<'a> DropGuard<'a> { fn new(lock: &'a Mutex) -> DropGuard<'a> { unsafe { lock.lock(); - DropGuard { lock: lock } + DropGuard { lock } } } } diff --git a/src/libstd/sys/windows/time.rs b/src/libstd/sys/windows/time.rs index 07e64d386a1c..54bcbc76b1a3 100644 --- a/src/libstd/sys/windows/time.rs +++ b/src/libstd/sys/windows/time.rs @@ -170,7 +170,7 @@ impl fmt::Debug for SystemTime { impl From for SystemTime { fn from(t: c::FILETIME) -> SystemTime { - SystemTime { t: t } + SystemTime { t } } } diff --git a/src/libstd/sys_common/poison.rs b/src/libstd/sys_common/poison.rs index 1625efe4a2ae..af93571a6048 100644 --- a/src/libstd/sys_common/poison.rs +++ b/src/libstd/sys_common/poison.rs @@ -174,7 +174,7 @@ impl PoisonError { /// [`RwLock::read`]: ../../std/sync/struct.RwLock.html#method.read #[stable(feature = "sync_poison", since = "1.2.0")] pub fn new(guard: T) -> PoisonError { - PoisonError { guard: guard } + PoisonError { guard } } /// Consumes this error indicating that a lock is poisoned, returning the diff --git a/src/libstd/sys_common/wtf8.rs b/src/libstd/sys_common/wtf8.rs index 8725abe74167..19ce932aa123 100644 --- a/src/libstd/sys_common/wtf8.rs +++ b/src/libstd/sys_common/wtf8.rs @@ -67,7 +67,7 @@ impl CodePoint { /// Only use when `value` is known to be less than or equal to 0x10FFFF. #[inline] pub unsafe fn from_u32_unchecked(value: u32) -> CodePoint { - CodePoint { value: value } + CodePoint { value } } /// Creates a new `CodePoint` if the value is a valid code point. @@ -76,7 +76,7 @@ impl CodePoint { #[inline] pub fn from_u32(value: u32) -> Option { match value { - 0 ..= 0x10FFFF => Some(CodePoint { value: value }), + 0 ..= 0x10FFFF => Some(CodePoint { value }), _ => None } } diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index 5404420988c3..648766594772 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -455,6 +455,11 @@ pub fn find_by_name<'a>(attrs: &'a [Attribute], name: &str) -> Option<&'a Attrib attrs.iter().find(|attr| attr.check_name(name)) } +pub fn filter_by_name<'a>(attrs: &'a [Attribute], name: &'a str) + -> impl Iterator { + attrs.iter().filter(move |attr| attr.check_name(name)) +} + pub fn first_attr_value_str_by_name(attrs: &[Attribute], name: &str) -> Option { attrs.iter() .find(|at| at.check_name(name)) diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index f5d1bd6255e2..e1ba8897a47f 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -126,7 +126,7 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::T } } - Box::new(ExpandResult { p: p }) + Box::new(ExpandResult { p }) } // include_str! : read the given file, insert it as a literal string expr diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index cb15c517c178..55652c481bd3 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1614,7 +1614,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } ast::ItemKind::Struct(..) => { - if let Some(attr) = attr::find_by_name(&i.attrs[..], "repr") { + for attr in attr::filter_by_name(&i.attrs[..], "repr") { for item in attr.meta_item_list().unwrap_or_else(Vec::new) { if item.check_name("simd") { gate_feature_post!(&self, repr_simd, attr.span, diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index bec193548e17..0e6e2f90693c 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -945,7 +945,7 @@ pub fn noop_fold_item_kind(i: ItemKind, folder: &mut T) -> ItemKind { ItemKind::Enum(enum_definition, generics) => { let generics = folder.fold_generics(generics); let variants = enum_definition.variants.move_map(|x| folder.fold_variant(x)); - ItemKind::Enum(ast::EnumDef { variants: variants }, generics) + ItemKind::Enum(ast::EnumDef { variants }, generics) } ItemKind::Struct(struct_def, generics) => { let generics = folder.fold_generics(generics); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 7e29eaae4e85..c8a686da179f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -6929,7 +6929,7 @@ impl<'a> Parser<'a> { _ => () } - Ok(ast::EnumDef { variants: variants }) + Ok(ast::EnumDef { variants }) } /// Parse an "enum" declaration diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs index 39267edaac04..dba3972a3df9 100644 --- a/src/test/debuginfo/vec-slices.rs +++ b/src/test/debuginfo/vec-slices.rs @@ -99,7 +99,7 @@ // lldb-command:print padded_tuple // lldbg-check:[...]$4 = &[(6, 7), (8, 9)] -// lldbr-check:(&[(i32, i16)]) padded_tuple = { data_ptr = *0x555555555030 length = 2 } +// lldbr-check:(&[(i32, i16)]) padded_tuple = { data_ptr = *[...] length = 2 } // lldb-command:print padded_struct // lldbg-check:[...]$5 = &[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }] diff --git a/src/test/run-pass/optimization-fuel-0.rs b/src/test/run-pass/optimization-fuel-0.rs index 3832c040108f..a12dad4489df 100644 --- a/src/test/run-pass/optimization-fuel-0.rs +++ b/src/test/run-pass/optimization-fuel-0.rs @@ -12,7 +12,8 @@ use std::mem::size_of; -// compile-flags: -Z fuel=foo=0 +// (#55495: The --error-format is to sidestep an issue in our test harness) +// compile-flags: --error-format human -Z fuel=foo=0 struct S1(u8, u16, u8); struct S2(u8, u16, u8); diff --git a/src/test/run-pass/optimization-fuel-0.stdout b/src/test/run-pass/optimization-fuel-0.stderr similarity index 100% rename from src/test/run-pass/optimization-fuel-0.stdout rename to src/test/run-pass/optimization-fuel-0.stderr diff --git a/src/test/run-pass/optimization-fuel-1.rs b/src/test/run-pass/optimization-fuel-1.rs index e3529ebfb0d8..1e76aaa48b76 100644 --- a/src/test/run-pass/optimization-fuel-1.rs +++ b/src/test/run-pass/optimization-fuel-1.rs @@ -12,7 +12,8 @@ use std::mem::size_of; -// compile-flags: -Z fuel=foo=1 +// (#55495: The --error-format is to sidestep an issue in our test harness) +// compile-flags: --error-format human -Z fuel=foo=1 struct S1(u8, u16, u8); struct S2(u8, u16, u8); diff --git a/src/test/run-pass/optimization-fuel-1.stdout b/src/test/run-pass/optimization-fuel-1.stderr similarity index 100% rename from src/test/run-pass/optimization-fuel-1.stdout rename to src/test/run-pass/optimization-fuel-1.stderr diff --git a/src/test/rustdoc/issue-54705.rs b/src/test/rustdoc/issue-54705.rs new file mode 100644 index 000000000000..ccc939657a14 --- /dev/null +++ b/src/test/rustdoc/issue-54705.rs @@ -0,0 +1,40 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +pub trait ScopeHandle<'scope> {} + + + +// @has issue_54705/struct.ScopeFutureContents.html +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'scope, S> \ +// Send for ScopeFutureContents<'scope, S> where S: Sync" +// +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'scope, S> \ +// Sync for ScopeFutureContents<'scope, S> where S: Sync" +pub struct ScopeFutureContents<'scope, S> + where S: ScopeHandle<'scope>, +{ + dummy: &'scope S, + this: Box>, +} + +struct ScopeFuture<'scope, S> + where S: ScopeHandle<'scope>, +{ + contents: ScopeFutureContents<'scope, S>, +} + +unsafe impl<'scope, S> Send for ScopeFuture<'scope, S> + where S: ScopeHandle<'scope>, +{} +unsafe impl<'scope, S> Sync for ScopeFuture<'scope, S> + where S: ScopeHandle<'scope>, +{} diff --git a/src/test/ui/consts/const-eval/transmute-const.stderr b/src/test/ui/consts/const-eval/transmute-const.stderr index 91faa4684c39..cf87170a89d8 100644 --- a/src/test/ui/consts/const-eval/transmute-const.stderr +++ b/src/test/ui/consts/const-eval/transmute-const.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/transmute-const.rs:15:1 | LL | static FOO: bool = unsafe { mem::transmute(3u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3, but expected something in the range 0..=1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3, but expected something less or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior diff --git a/src/test/ui/consts/const-eval/ub-enum.rs b/src/test/ui/consts/const-eval/ub-enum.rs index 309627581d05..0aa15c839387 100644 --- a/src/test/ui/consts/const-eval/ub-enum.rs +++ b/src/test/ui/consts/const-eval/ub-enum.rs @@ -17,39 +17,48 @@ enum Enum { } union TransmuteEnum { a: &'static u8, - b: Enum, + out: Enum, } // A pointer is guaranteed non-null -const BAD_ENUM: Enum = unsafe { TransmuteEnum { a: &1 }.b }; +const BAD_ENUM: Enum = unsafe { TransmuteEnum { a: &1 }.out }; //~^ ERROR is undefined behavior -// Invalid enum discriminant +// (Potentially) invalid enum discriminant #[repr(usize)] #[derive(Copy, Clone)] enum Enum2 { A = 2, } +#[repr(transparent)] +#[derive(Copy, Clone)] +struct Wrap(T); union TransmuteEnum2 { - a: usize, - b: Enum2, - c: (), + in1: usize, + in2: &'static u8, + in3: (), + out1: Enum2, + out2: Wrap, // something wrapping the enum so that we test layout first, not enum } -const BAD_ENUM2 : Enum2 = unsafe { TransmuteEnum2 { a: 0 }.b }; +const BAD_ENUM2: Enum2 = unsafe { TransmuteEnum2 { in1: 0 }.out1 }; +//~^ ERROR is undefined behavior +const BAD_ENUM3: Enum2 = unsafe { TransmuteEnum2 { in2: &0 }.out1 }; +//~^ ERROR is undefined behavior +const BAD_ENUM4: Wrap = unsafe { TransmuteEnum2 { in2: &0 }.out2 }; //~^ ERROR is undefined behavior // Undef enum discriminant. In an arry to avoid `Scalar` layout. -const BAD_ENUM3 : [Enum2; 2] = [unsafe { TransmuteEnum2 { c: () }.b }; 2]; +const BAD_ENUM_UNDEF: [Enum2; 2] = [unsafe { TransmuteEnum2 { in3: () }.out1 }; 2]; //~^ ERROR is undefined behavior -// Invalid enum field content (mostly to test printing of apths for enum tuple +// Invalid enum field content (mostly to test printing of paths for enum tuple // variants and tuples). union TransmuteChar { a: u32, b: char, } // Need to create something which does not clash with enum layout optimizations. -const BAD_ENUM_CHAR : Option<(char, char)> = Some(('x', unsafe { TransmuteChar { a: !0 }.b })); +const BAD_ENUM_CHAR: Option<(char, char)> = Some(('x', unsafe { TransmuteChar { a: !0 }.b })); //~^ ERROR is undefined behavior fn main() { diff --git a/src/test/ui/consts/const-eval/ub-enum.stderr b/src/test/ui/consts/const-eval/ub-enum.stderr index 57c41711536d..804c9643d8ae 100644 --- a/src/test/ui/consts/const-eval/ub-enum.stderr +++ b/src/test/ui/consts/const-eval/ub-enum.stderr @@ -1,35 +1,51 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:24:1 | -LL | const BAD_ENUM: Enum = unsafe { TransmuteEnum { a: &1 }.b }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant +LL | const BAD_ENUM: Enum = unsafe { TransmuteEnum { a: &1 }.out }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:38:1 + --> $DIR/ub-enum.rs:43:1 | -LL | const BAD_ENUM2 : Enum2 = unsafe { TransmuteEnum2 { a: 0 }.b }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected a valid enum discriminant +LL | const BAD_ENUM2: Enum2 = unsafe { TransmuteEnum2 { in1: 0 }.out1 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected a valid enum discriminant | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:42:1 + --> $DIR/ub-enum.rs:45:1 | -LL | const BAD_ENUM3 : [Enum2; 2] = [unsafe { TransmuteEnum2 { c: () }.b }; 2]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes +LL | const BAD_ENUM3: Enum2 = unsafe { TransmuteEnum2 { in2: &0 }.out1 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:52:1 + --> $DIR/ub-enum.rs:47:1 | -LL | const BAD_ENUM_CHAR : Option<(char, char)> = Some(('x', unsafe { TransmuteChar { a: !0 }.b })); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 4294967295 at .Some.0.1, but expected something in the range 0..=1114111 +LL | const BAD_ENUM4: Wrap = unsafe { TransmuteEnum2 { in2: &0 }.out2 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected something that cannot possibly fail to be in the range 2..=2 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior -error: aborting due to 4 previous errors +error[E0080]: it is undefined behavior to use this value + --> $DIR/ub-enum.rs:51:1 + | +LL | const BAD_ENUM_UNDEF: [Enum2; 2] = [unsafe { TransmuteEnum2 { in3: () }.out1 }; 2]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior + +error[E0080]: it is undefined behavior to use this value + --> $DIR/ub-enum.rs:61:1 + | +LL | const BAD_ENUM_CHAR: Option<(char, char)> = Some(('x', unsafe { TransmuteChar { a: !0 }.b })); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 4294967295 at .Some.0.1, but expected something less or equal to 1114111 + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/ub-nonnull.rs b/src/test/ui/consts/const-eval/ub-nonnull.rs index 8b83a1747cab..113221959fb9 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.rs +++ b/src/test/ui/consts/const-eval/ub-nonnull.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(const_transmute)] +#![feature(rustc_attrs, const_transmute)] #![allow(const_err)] // make sure we cannot allow away the errors tested here use std::mem; @@ -23,4 +23,18 @@ const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; //~^ ERROR it is undefined behavior to use this value +// Also test other uses of rustc_layout_scalar_valid_range_start + +#[rustc_layout_scalar_valid_range_start(10)] +#[rustc_layout_scalar_valid_range_end(30)] +struct RestrictedRange1(u32); +const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; +//~^ ERROR it is undefined behavior to use this value + +#[rustc_layout_scalar_valid_range_start(30)] +#[rustc_layout_scalar_valid_range_end(10)] +struct RestrictedRange2(u32); +const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) }; +//~^ ERROR it is undefined behavior to use this value + fn main() {} diff --git a/src/test/ui/consts/const-eval/ub-nonnull.stderr b/src/test/ui/consts/const-eval/ub-nonnull.stderr index 7c0ff851d884..c50b0208f15e 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.stderr +++ b/src/test/ui/consts/const-eval/ub-nonnull.stderr @@ -22,6 +22,22 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior -error: aborting due to 3 previous errors +error[E0080]: it is undefined behavior to use this value + --> $DIR/ub-nonnull.rs:31:1 + | +LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 42, but expected something in the range 10..=30 + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior + +error[E0080]: it is undefined behavior to use this value + --> $DIR/ub-nonnull.rs:37:1 + | +LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 20, but expected something less or equal to 10, or greater or equal to 30 + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr b/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr index 9a799b98cfc5..c21690754f62 100644 --- a/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr +++ b/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr @@ -66,7 +66,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub-fat-ptr.rs:117:1 | LL | const G: &Trait = &unsafe { BoolTransmute { val: 3 }.bl }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .., but expected something in the range 0..=1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .., but expected something less or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior @@ -74,7 +74,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub-fat-ptr.rs:121:1 | LL | const H: &[bool] = &[unsafe { BoolTransmute { val: 3 }.bl }]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .[0], but expected something in the range 0..=1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .[0], but expected something less or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior @@ -82,7 +82,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub-fat-ptr.rs:127:1 | LL | const I2: &MySliceBool = &MySlice(unsafe { BoolTransmute { val: 3 }.bl }, [false]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at ..0, but expected something in the range 0..=1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at ..0, but expected something less or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior @@ -90,7 +90,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub-fat-ptr.rs:130:1 | LL | const I3: &MySliceBool = &MySlice(true, [unsafe { BoolTransmute { val: 3 }.bl }]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at ..1[0], but expected something in the range 0..=1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at ..1[0], but expected something less or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior diff --git a/src/test/ui/consts/const-eval/union-ub.stderr b/src/test/ui/consts/const-eval/union-ub.stderr index 2b6f6a47cd92..db78ead370b8 100644 --- a/src/test/ui/consts/const-eval/union-ub.stderr +++ b/src/test/ui/consts/const-eval/union-ub.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub.rs:38:1 | LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 42, but expected something in the range 0..=1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 42, but expected something less or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior diff --git a/src/test/ui/feature-gates/feature-gate-repr-simd.rs b/src/test/ui/feature-gates/feature-gate-repr-simd.rs index 429cec7ec90d..a70f2758abb5 100644 --- a/src/test/ui/feature-gates/feature-gate-repr-simd.rs +++ b/src/test/ui/feature-gates/feature-gate-repr-simd.rs @@ -11,4 +11,8 @@ #[repr(simd)] //~ error: SIMD types are experimental struct Foo(u64, u64); +#[repr(C)] +#[repr(simd)] //~ error: SIMD types are experimental +struct Bar(u64, u64); + fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-repr-simd.stderr b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr index 8174f82060a1..2f98bd24d4f7 100644 --- a/src/test/ui/feature-gates/feature-gate-repr-simd.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr @@ -6,6 +6,14 @@ LL | #[repr(simd)] //~ error: SIMD types are experimental | = help: add #![feature(repr_simd)] to the crate attributes to enable -error: aborting due to previous error +error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) + --> $DIR/feature-gate-repr-simd.rs:15:1 + | +LL | #[repr(simd)] //~ error: SIMD types are experimental + | ^^^^^^^^^^^^^ + | + = help: add #![feature(repr_simd)] to the crate attributes to enable + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-repr_packed.rs b/src/test/ui/feature-gates/feature-gate-repr_packed.rs index 12bb152b4674..65e3be288fdf 100644 --- a/src/test/ui/feature-gates/feature-gate-repr_packed.rs +++ b/src/test/ui/feature-gates/feature-gate-repr_packed.rs @@ -11,4 +11,8 @@ #[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental struct Foo(u64); +#[repr(C)] +#[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental +struct Bar(u64); + fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-repr_packed.stderr b/src/test/ui/feature-gates/feature-gate-repr_packed.stderr index d0faf9d90bd5..ed89a3f6b316 100644 --- a/src/test/ui/feature-gates/feature-gate-repr_packed.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr_packed.stderr @@ -6,6 +6,14 @@ LL | #[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experim | = help: add #![feature(repr_packed)] to the crate attributes to enable -error: aborting due to previous error +error[E0658]: the `#[repr(packed(n))]` attribute is experimental (see issue #33158) + --> $DIR/feature-gate-repr_packed.rs:15:1 + | +LL | #[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental + | ^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(repr_packed)] to the crate attributes to enable + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issue-51947.rs b/src/test/ui/issue-51947.rs new file mode 100644 index 000000000000..7b79807e4d7f --- /dev/null +++ b/src/test/ui/issue-51947.rs @@ -0,0 +1,17 @@ +// compile-pass + +#![crate_type = "lib"] +#![feature(linkage)] + +// MergeFunctions will merge these via an anonymous internal +// backing function, which must be named if ThinLTO buffers are used + +#[linkage = "weak"] +pub fn fn1(a: u32, b: u32, c: u32) -> u32 { + a + b + c +} + +#[linkage = "weak"] +pub fn fn2(a: u32, b: u32, c: u32) -> u32 { + a + b + c +} diff --git a/src/test/ui/issues/auxiliary/issue_11680.rs b/src/test/ui/issues/auxiliary/issue-11680.rs similarity index 100% rename from src/test/ui/issues/auxiliary/issue_11680.rs rename to src/test/ui/issues/auxiliary/issue-11680.rs diff --git a/src/test/ui/issues/auxiliary/issue_16725.rs b/src/test/ui/issues/auxiliary/issue-16725.rs similarity index 100% rename from src/test/ui/issues/auxiliary/issue_16725.rs rename to src/test/ui/issues/auxiliary/issue-16725.rs diff --git a/src/test/ui/issues/auxiliary/issue_17718_const_privacy.rs b/src/test/ui/issues/auxiliary/issue-17718-const-privacy.rs similarity index 100% rename from src/test/ui/issues/auxiliary/issue_17718_const_privacy.rs rename to src/test/ui/issues/auxiliary/issue-17718-const-privacy.rs diff --git a/src/test/ui/issues/auxiliary/issue_1920.rs b/src/test/ui/issues/auxiliary/issue-1920.rs similarity index 100% rename from src/test/ui/issues/auxiliary/issue_1920.rs rename to src/test/ui/issues/auxiliary/issue-1920.rs diff --git a/src/test/ui/issues/auxiliary/issue_21202.rs b/src/test/ui/issues/auxiliary/issue-21202.rs similarity index 100% rename from src/test/ui/issues/auxiliary/issue_21202.rs rename to src/test/ui/issues/auxiliary/issue-21202.rs diff --git a/src/test/ui/issues/auxiliary/issue_30123_aux.rs b/src/test/ui/issues/auxiliary/issue-30123-aux.rs similarity index 100% rename from src/test/ui/issues/auxiliary/issue_30123_aux.rs rename to src/test/ui/issues/auxiliary/issue-30123-aux.rs diff --git a/src/test/ui/issues/auxiliary/issue_41549.rs b/src/test/ui/issues/auxiliary/issue-41549.rs similarity index 100% rename from src/test/ui/issues/auxiliary/issue_41549.rs rename to src/test/ui/issues/auxiliary/issue-41549.rs diff --git a/src/test/ui/issues/auxiliary/issue_5844_aux.rs b/src/test/ui/issues/auxiliary/issue-5844-aux.rs similarity index 100% rename from src/test/ui/issues/auxiliary/issue_5844_aux.rs rename to src/test/ui/issues/auxiliary/issue-5844-aux.rs diff --git a/src/test/ui/issues/auxiliary/lint_stability.rs b/src/test/ui/issues/auxiliary/lint-stability.rs similarity index 100% rename from src/test/ui/issues/auxiliary/lint_stability.rs rename to src/test/ui/issues/auxiliary/lint-stability.rs diff --git a/src/test/ui/issues/auxiliary/private_trait_xc.rs b/src/test/ui/issues/auxiliary/private-trait-xc.rs similarity index 100% rename from src/test/ui/issues/auxiliary/private_trait_xc.rs rename to src/test/ui/issues/auxiliary/private-trait-xc.rs diff --git a/src/test/ui/issues/auxiliary/xcrate_issue_43189_a.rs b/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs similarity index 100% rename from src/test/ui/issues/auxiliary/xcrate_issue_43189_a.rs rename to src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs diff --git a/src/test/ui/issues/auxiliary/xcrate_issue_43189_b.rs b/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs similarity index 100% rename from src/test/ui/issues/auxiliary/xcrate_issue_43189_b.rs rename to src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs diff --git a/src/test/ui/issues/auxiliary/xcrate_issue_46112_rexport_core.rs b/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs similarity index 100% rename from src/test/ui/issues/auxiliary/xcrate_issue_46112_rexport_core.rs rename to src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs diff --git a/src/test/ui/issues/issue-11593.rs b/src/test/ui/issues/issue-11593.rs index 2749438433d1..f962704dc75a 100644 --- a/src/test/ui/issues/issue-11593.rs +++ b/src/test/ui/issues/issue-11593.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:private_trait_xc.rs +// aux-build:private-trait-xc.rs extern crate private_trait_xc; diff --git a/src/test/ui/issues/issue-11680.rs b/src/test/ui/issues/issue-11680.rs index 7dccd7811066..209b63104fa0 100644 --- a/src/test/ui/issues/issue-11680.rs +++ b/src/test/ui/issues/issue-11680.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_11680.rs +// aux-build:issue-11680.rs extern crate issue_11680 as other; diff --git a/src/test/ui/issues/issue-16725.rs b/src/test/ui/issues/issue-16725.rs index cadf602a4cfc..659ffb2c9840 100644 --- a/src/test/ui/issues/issue-16725.rs +++ b/src/test/ui/issues/issue-16725.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_16725.rs +// aux-build:issue-16725.rs extern crate issue_16725 as foo; diff --git a/src/test/ui/issues/issue-17718-const-privacy.rs b/src/test/ui/issues/issue-17718-const-privacy.rs index 523a387956a3..60eb4b7126da 100644 --- a/src/test/ui/issues/issue-17718-const-privacy.rs +++ b/src/test/ui/issues/issue-17718-const-privacy.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_17718_const_privacy.rs +// aux-build:issue-17718-const-privacy.rs extern crate issue_17718_const_privacy as other; diff --git a/src/test/ui/issues/issue-1920-1.rs b/src/test/ui/issues/issue-1920-1.rs index 97dd290a45bc..7ba655805829 100644 --- a/src/test/ui/issues/issue-1920-1.rs +++ b/src/test/ui/issues/issue-1920-1.rs @@ -10,7 +10,7 @@ //! Test that absolute path names are correct when a crate is not linked into the root namespace -// aux-build:issue_1920.rs +// aux-build:issue-1920.rs mod foo { pub extern crate issue_1920; diff --git a/src/test/ui/issues/issue-1920-2.rs b/src/test/ui/issues/issue-1920-2.rs index 2af6e2cc991f..bf4817aaf34d 100644 --- a/src/test/ui/issues/issue-1920-2.rs +++ b/src/test/ui/issues/issue-1920-2.rs @@ -10,7 +10,7 @@ //! Test that when a crate is linked under another name that name is used in global paths -// aux-build:issue_1920.rs +// aux-build:issue-1920.rs extern crate issue_1920 as bar; diff --git a/src/test/ui/issues/issue-1920-3.rs b/src/test/ui/issues/issue-1920-3.rs index fa6efea845fc..a70e958630f2 100644 --- a/src/test/ui/issues/issue-1920-3.rs +++ b/src/test/ui/issues/issue-1920-3.rs @@ -10,7 +10,7 @@ //! Test that when a crate is linked multiple times that the shortest absolute path name is used -// aux-build:issue_1920.rs +// aux-build:issue-1920.rs mod foo { pub extern crate issue_1920; diff --git a/src/test/ui/issues/issue-21202.rs b/src/test/ui/issues/issue-21202.rs index 2bce838c1cfd..fa4b515c81c0 100644 --- a/src/test/ui/issues/issue-21202.rs +++ b/src/test/ui/issues/issue-21202.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_21202.rs +// aux-build:issue-21202.rs extern crate issue_21202 as crate1; diff --git a/src/test/ui/issues/issue-28075.rs b/src/test/ui/issues/issue-28075.rs index 0f6b9d1b5dc4..494b446dd3ff 100644 --- a/src/test/ui/issues/issue-28075.rs +++ b/src/test/ui/issues/issue-28075.rs @@ -10,7 +10,7 @@ // Unstable entities should be caught in import lists -// aux-build:lint_stability.rs +// aux-build:lint-stability.rs #![allow(warnings)] diff --git a/src/test/ui/issues/issue-28388-3.rs b/src/test/ui/issues/issue-28388-3.rs index 12e3457ef9e3..7593bb35add0 100644 --- a/src/test/ui/issues/issue-28388-3.rs +++ b/src/test/ui/issues/issue-28388-3.rs @@ -10,7 +10,7 @@ // Prefix in imports with empty braces should be resolved and checked privacy, stability, etc. -// aux-build:lint_stability.rs +// aux-build:lint-stability.rs extern crate lint_stability; diff --git a/src/test/ui/issues/issue-30123.rs b/src/test/ui/issues/issue-30123.rs index 653097ad69f7..39278cffa122 100644 --- a/src/test/ui/issues/issue-30123.rs +++ b/src/test/ui/issues/issue-30123.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_30123_aux.rs +// aux-build:issue-30123-aux.rs extern crate issue_30123_aux; use issue_30123_aux::*; diff --git a/src/test/ui/issues/issue32829.rs b/src/test/ui/issues/issue-32829-2.rs similarity index 100% rename from src/test/ui/issues/issue32829.rs rename to src/test/ui/issues/issue-32829-2.rs diff --git a/src/test/ui/issues/issue32829.stderr b/src/test/ui/issues/issue-32829-2.stderr similarity index 85% rename from src/test/ui/issues/issue32829.stderr rename to src/test/ui/issues/issue-32829-2.stderr index dad0880dbdfd..6d6b94ca4bc6 100644 --- a/src/test/ui/issues/issue32829.stderr +++ b/src/test/ui/issues/issue-32829-2.stderr @@ -1,5 +1,5 @@ error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue32829.rs:17:9 + --> $DIR/issue-32829-2.rs:17:9 | LL | 5; | ^ @@ -7,13 +7,13 @@ LL | 5; = help: add #![feature(const_let)] to the crate attributes to enable error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue32829.rs:25:9 + --> $DIR/issue-32829-2.rs:25:9 | LL | invalid(); | ^^^^^^^^^ error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue32829.rs:25:9 + --> $DIR/issue-32829-2.rs:25:9 | LL | invalid(); | ^^^^^^^^^ @@ -21,7 +21,7 @@ LL | invalid(); = help: add #![feature(const_let)] to the crate attributes to enable error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue32829.rs:34:9 + --> $DIR/issue-32829-2.rs:34:9 | LL | valid(); | ^^^^^^^ @@ -29,7 +29,7 @@ LL | valid(); = help: add #![feature(const_let)] to the crate attributes to enable error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue32829.rs:42:9 + --> $DIR/issue-32829-2.rs:42:9 | LL | 5; | ^ @@ -37,13 +37,13 @@ LL | 5; = help: add #![feature(const_let)] to the crate attributes to enable error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue32829.rs:50:9 + --> $DIR/issue-32829-2.rs:50:9 | LL | invalid(); | ^^^^^^^^^ error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue32829.rs:50:9 + --> $DIR/issue-32829-2.rs:50:9 | LL | invalid(); | ^^^^^^^^^ @@ -51,7 +51,7 @@ LL | invalid(); = help: add #![feature(const_let)] to the crate attributes to enable error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue32829.rs:59:9 + --> $DIR/issue-32829-2.rs:59:9 | LL | valid(); | ^^^^^^^ @@ -59,7 +59,7 @@ LL | valid(); = help: add #![feature(const_let)] to the crate attributes to enable error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue32829.rs:67:9 + --> $DIR/issue-32829-2.rs:67:9 | LL | 5; | ^ @@ -67,13 +67,13 @@ LL | 5; = help: add #![feature(const_let)] to the crate attributes to enable error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue32829.rs:75:9 + --> $DIR/issue-32829-2.rs:75:9 | LL | invalid(); | ^^^^^^^^^ error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue32829.rs:75:9 + --> $DIR/issue-32829-2.rs:75:9 | LL | invalid(); | ^^^^^^^^^ @@ -81,7 +81,7 @@ LL | invalid(); = help: add #![feature(const_let)] to the crate attributes to enable error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue32829.rs:84:9 + --> $DIR/issue-32829-2.rs:84:9 | LL | valid(); | ^^^^^^^ diff --git a/src/test/ui/issues/issue-38875/auxiliary/issue_38875_b.rs b/src/test/ui/issues/issue-38875/auxiliary/issue-38875-b.rs similarity index 100% rename from src/test/ui/issues/issue-38875/auxiliary/issue_38875_b.rs rename to src/test/ui/issues/issue-38875/auxiliary/issue-38875-b.rs diff --git a/src/test/ui/issues/issue-38875/issue_38875.rs b/src/test/ui/issues/issue-38875/issue-38875.rs similarity index 94% rename from src/test/ui/issues/issue-38875/issue_38875.rs rename to src/test/ui/issues/issue-38875/issue-38875.rs index d9debe34c4d5..74db92cb8280 100644 --- a/src/test/ui/issues/issue-38875/issue_38875.rs +++ b/src/test/ui/issues/issue-38875/issue-38875.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_38875_b.rs +// aux-build:issue-38875-b.rs // compile-pass extern crate issue_38875_b; diff --git a/src/test/ui/issue-40827.rs b/src/test/ui/issues/issue-40827.rs similarity index 100% rename from src/test/ui/issue-40827.rs rename to src/test/ui/issues/issue-40827.rs diff --git a/src/test/ui/issue-40827.stderr b/src/test/ui/issues/issue-40827.stderr similarity index 100% rename from src/test/ui/issue-40827.stderr rename to src/test/ui/issues/issue-40827.stderr diff --git a/src/test/ui/issues/issue-41549.rs b/src/test/ui/issues/issue-41549.rs index 67be194c8ed2..de52fcfe3272 100644 --- a/src/test/ui/issues/issue-41549.rs +++ b/src/test/ui/issues/issue-41549.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_41549.rs +// aux-build:issue-41549.rs extern crate issue_41549; diff --git a/src/test/ui/issues/issue-41652/auxiliary/issue_41652_b.rs b/src/test/ui/issues/issue-41652/auxiliary/issue-41652-b.rs similarity index 100% rename from src/test/ui/issues/issue-41652/auxiliary/issue_41652_b.rs rename to src/test/ui/issues/issue-41652/auxiliary/issue-41652-b.rs diff --git a/src/test/ui/issues/issue-41652/issue_41652.rs b/src/test/ui/issues/issue-41652/issue-41652.rs similarity index 95% rename from src/test/ui/issues/issue-41652/issue_41652.rs rename to src/test/ui/issues/issue-41652/issue-41652.rs index a4e92820e21e..4b42c0475eb6 100644 --- a/src/test/ui/issues/issue-41652/issue_41652.rs +++ b/src/test/ui/issues/issue-41652/issue-41652.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_41652_b.rs +// aux-build:issue-41652-b.rs extern crate issue_41652_b; diff --git a/src/test/ui/issues/issue-41652/issue_41652.stderr b/src/test/ui/issues/issue-41652/issue-41652.stderr similarity index 91% rename from src/test/ui/issues/issue-41652/issue_41652.stderr rename to src/test/ui/issues/issue-41652/issue-41652.stderr index 3f76b25692cf..ed5eb360298b 100644 --- a/src/test/ui/issues/issue-41652/issue_41652.stderr +++ b/src/test/ui/issues/issue-41652/issue-41652.stderr @@ -1,5 +1,5 @@ error[E0689]: can't call method `f` on ambiguous numeric type `{integer}` - --> $DIR/issue_41652.rs:19:11 + --> $DIR/issue-41652.rs:19:11 | LL | 3.f() | ^ diff --git a/src/test/ui/issues/issue-43189.rs b/src/test/ui/issues/issue-43189.rs index 154bee5d1d4f..7018198aff55 100644 --- a/src/test/ui/issues/issue-43189.rs +++ b/src/test/ui/issues/issue-43189.rs @@ -12,8 +12,8 @@ // paths rooted from `std` to be misrendered in the diagnostic output. // ignore-windows -// aux-build:xcrate_issue_43189_a.rs -// aux-build:xcrate_issue_43189_b.rs +// aux-build:xcrate-issue-43189-a.rs +// aux-build:xcrate-issue-43189-b.rs extern crate xcrate_issue_43189_b; fn main() { diff --git a/src/test/ui/issues/issue-45829/auxiliary/issue_45829_a.rs b/src/test/ui/issues/issue-45829/auxiliary/issue-45829-a.rs similarity index 100% rename from src/test/ui/issues/issue-45829/auxiliary/issue_45829_a.rs rename to src/test/ui/issues/issue-45829/auxiliary/issue-45829-a.rs diff --git a/src/test/ui/issues/issue-45829/auxiliary/issue_45829_b.rs b/src/test/ui/issues/issue-45829/auxiliary/issue-45829-b.rs similarity index 100% rename from src/test/ui/issues/issue-45829/auxiliary/issue_45829_b.rs rename to src/test/ui/issues/issue-45829/auxiliary/issue-45829-b.rs diff --git a/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs b/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs index 5230cadf6043..6befee331d5a 100644 --- a/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs +++ b/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_45829_b.rs +// aux-build:issue-45829-b.rs mod foo { pub mod bar {} diff --git a/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs b/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs index 7066ed65c78c..61c7e915fe88 100644 --- a/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs +++ b/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_45829_a.rs -// aux-build:issue_45829_b.rs +// aux-build:issue-45829-a.rs +// aux-build:issue-45829-b.rs extern crate issue_45829_a; extern crate issue_45829_b as issue_45829_a; diff --git a/src/test/ui/issues/issue-45829/rename-extern.rs b/src/test/ui/issues/issue-45829/rename-extern.rs index 7c3d97240057..41e3e8bbe145 100644 --- a/src/test/ui/issues/issue-45829/rename-extern.rs +++ b/src/test/ui/issues/issue-45829/rename-extern.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_45829_a.rs -// aux-build:issue_45829_b.rs +// aux-build:issue-45829-a.rs +// aux-build:issue-45829-b.rs extern crate issue_45829_a; extern crate issue_45829_b as issue_45829_a; diff --git a/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs b/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs index 1cc261ed922e..9a2ec7a52732 100644 --- a/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs +++ b/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_45829_b.rs +// aux-build:issue-45829-b.rs extern crate issue_45829_b; use std as issue_45829_b; diff --git a/src/test/ui/issues/issue-46112.rs b/src/test/ui/issues/issue-46112.rs index 698005b5d306..202c67e584c5 100644 --- a/src/test/ui/issues/issue-46112.rs +++ b/src/test/ui/issues/issue-46112.rs @@ -12,7 +12,7 @@ // paths rooted from `std` to be misrendered in the diagnostic output. // ignore-windows -// aux-build:xcrate_issue_46112_rexport_core.rs +// aux-build:xcrate-issue-46112-rexport-core.rs extern crate xcrate_issue_46112_rexport_core; fn test(r: Result, &'static str>) { } diff --git a/src/test/ui/issue-49556.rs b/src/test/ui/issues/issue-49556.rs similarity index 100% rename from src/test/ui/issue-49556.rs rename to src/test/ui/issues/issue-49556.rs diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.rs similarity index 100% rename from src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.rs rename to src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.rs diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr similarity index 92% rename from src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.stderr rename to src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr index a56cd6e8d2f5..3e255ca6539b 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `deref` found for type `std::option::Option<{integer}>` in the current scope - --> $DIR/option_deref.rs:14:29 + --> $DIR/option-deref.rs:14:29 | LL | let _result = &Some(42).deref(); | ^^^^^ diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.rs similarity index 100% rename from src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.rs rename to src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.rs diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr similarity index 92% rename from src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.stderr rename to src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr index bf75687b21f7..57b5d07afb4a 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `deref_err` found for type `std::result::Result<_, {integer}>` in the current scope - --> $DIR/result_deref_err.rs:14:28 + --> $DIR/result-deref-err.rs:14:28 | LL | let _result = &Err(41).deref_err(); | ^^^^^^^^^ diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.rs similarity index 100% rename from src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.rs rename to src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.rs diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr similarity index 92% rename from src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.stderr rename to src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr index a77333a75681..ee0c439715bd 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `deref_ok` found for type `std::result::Result<{integer}, _>` in the current scope - --> $DIR/result_deref_ok.rs:14:27 + --> $DIR/result-deref-ok.rs:14:27 | LL | let _result = &Ok(42).deref_ok(); | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.rs similarity index 100% rename from src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.rs rename to src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.rs diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr similarity index 92% rename from src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.stderr rename to src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr index d3d7c1993ca5..46fee660f664 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `deref` found for type `std::result::Result<{integer}, _>` in the current scope - --> $DIR/result_deref.rs:14:27 + --> $DIR/result-deref.rs:14:27 | LL | let _result = &Ok(42).deref(); | ^^^^^ diff --git a/src/test/ui/issue-51602.rs b/src/test/ui/issues/issue-51602.rs similarity index 100% rename from src/test/ui/issue-51602.rs rename to src/test/ui/issues/issue-51602.rs diff --git a/src/test/ui/issue-51602.stderr b/src/test/ui/issues/issue-51602.stderr similarity index 100% rename from src/test/ui/issue-51602.stderr rename to src/test/ui/issues/issue-51602.stderr diff --git a/src/test/ui/issue-52717.rs b/src/test/ui/issues/issue-52717.rs similarity index 100% rename from src/test/ui/issue-52717.rs rename to src/test/ui/issues/issue-52717.rs diff --git a/src/test/ui/issue-52717.stderr b/src/test/ui/issues/issue-52717.stderr similarity index 100% rename from src/test/ui/issue-52717.stderr rename to src/test/ui/issues/issue-52717.stderr diff --git a/src/test/ui/issue-52992.rs b/src/test/ui/issues/issue-52992.rs similarity index 100% rename from src/test/ui/issue-52992.rs rename to src/test/ui/issues/issue-52992.rs diff --git a/src/test/ui/issue-53251.rs b/src/test/ui/issues/issue-53251.rs similarity index 100% rename from src/test/ui/issue-53251.rs rename to src/test/ui/issues/issue-53251.rs diff --git a/src/test/ui/issue-53251.stderr b/src/test/ui/issues/issue-53251.stderr similarity index 100% rename from src/test/ui/issue-53251.stderr rename to src/test/ui/issues/issue-53251.stderr diff --git a/src/test/ui/issue-53300.rs b/src/test/ui/issues/issue-53300.rs similarity index 100% rename from src/test/ui/issue-53300.rs rename to src/test/ui/issues/issue-53300.rs diff --git a/src/test/ui/issue-53300.stderr b/src/test/ui/issues/issue-53300.stderr similarity index 100% rename from src/test/ui/issue-53300.stderr rename to src/test/ui/issues/issue-53300.stderr diff --git a/src/test/ui/issue-53419.rs b/src/test/ui/issues/issue-53419.rs similarity index 100% rename from src/test/ui/issue-53419.rs rename to src/test/ui/issues/issue-53419.rs diff --git a/src/test/ui/issue-53565.rs b/src/test/ui/issues/issue-53565.rs similarity index 100% rename from src/test/ui/issue-53565.rs rename to src/test/ui/issues/issue-53565.rs diff --git a/src/test/ui/issue-53565.stderr b/src/test/ui/issues/issue-53565.stderr similarity index 100% rename from src/test/ui/issue-53565.stderr rename to src/test/ui/issues/issue-53565.stderr diff --git a/src/test/ui/issue-53568.rs b/src/test/ui/issues/issue-53568.rs similarity index 100% rename from src/test/ui/issue-53568.rs rename to src/test/ui/issues/issue-53568.rs diff --git a/src/test/ui/issue-53692.rs b/src/test/ui/issues/issue-53692.rs similarity index 100% rename from src/test/ui/issue-53692.rs rename to src/test/ui/issues/issue-53692.rs diff --git a/src/test/ui/issue-53692.stderr b/src/test/ui/issues/issue-53692.stderr similarity index 100% rename from src/test/ui/issue-53692.stderr rename to src/test/ui/issues/issue-53692.stderr diff --git a/src/test/ui/issue-53840.rs b/src/test/ui/issues/issue-53840.rs similarity index 100% rename from src/test/ui/issue-53840.rs rename to src/test/ui/issues/issue-53840.rs diff --git a/src/test/ui/issue-53840.stderr b/src/test/ui/issues/issue-53840.stderr similarity index 100% rename from src/test/ui/issue-53840.stderr rename to src/test/ui/issues/issue-53840.stderr diff --git a/src/test/ui/issue-54302-cases.rs b/src/test/ui/issues/issue-54302-cases.rs similarity index 100% rename from src/test/ui/issue-54302-cases.rs rename to src/test/ui/issues/issue-54302-cases.rs diff --git a/src/test/ui/issue-54302-cases.stderr b/src/test/ui/issues/issue-54302-cases.stderr similarity index 100% rename from src/test/ui/issue-54302-cases.stderr rename to src/test/ui/issues/issue-54302-cases.stderr diff --git a/src/test/ui/issue-54302.rs b/src/test/ui/issues/issue-54302.rs similarity index 100% rename from src/test/ui/issue-54302.rs rename to src/test/ui/issues/issue-54302.rs diff --git a/src/test/ui/issue-54302.stderr b/src/test/ui/issues/issue-54302.stderr similarity index 100% rename from src/test/ui/issue-54302.stderr rename to src/test/ui/issues/issue-54302.stderr diff --git a/src/test/ui/issues/issue-5844.rs b/src/test/ui/issues/issue-5844.rs index 02e5b9b09219..329bfd1dde0f 100644 --- a/src/test/ui/issues/issue-5844.rs +++ b/src/test/ui/issues/issue-5844.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//aux-build:issue_5844_aux.rs +//aux-build:issue-5844-aux.rs extern crate issue_5844_aux; diff --git a/src/test/ui/issues/type-arg-mismatch-due-to-impl-trait.rs b/src/test/ui/issues/type-arg-mismatch-due-to-impl-trait.rs new file mode 100644 index 000000000000..4a71932d1df1 --- /dev/null +++ b/src/test/ui/issues/type-arg-mismatch-due-to-impl-trait.rs @@ -0,0 +1,15 @@ +trait Foo { + type T; + fn foo(&self, t: Self::T); +//~^ NOTE expected 0 type parameters +} + +impl Foo for u32 { + type T = (); + + fn foo(&self, t: impl Clone) {} +//~^ ERROR method `foo` has 1 type parameter but its trait declaration has 0 type parameters +//~| NOTE found 1 type parameter +} + +fn main() {} diff --git a/src/test/ui/issues/type-arg-mismatch-due-to-impl-trait.stderr b/src/test/ui/issues/type-arg-mismatch-due-to-impl-trait.stderr new file mode 100644 index 000000000000..af7fdde9a8ed --- /dev/null +++ b/src/test/ui/issues/type-arg-mismatch-due-to-impl-trait.stderr @@ -0,0 +1,12 @@ +error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters + --> $DIR/type-arg-mismatch-due-to-impl-trait.rs:10:5 + | +LL | fn foo(&self, t: Self::T); + | -------------------------- expected 0 type parameters +... +LL | fn foo(&self, t: impl Clone) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found 1 type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0049`. diff --git a/src/test/ui/print-fuel/print-fuel.rs b/src/test/ui/print-fuel/print-fuel.rs index 96b025128ee9..31123410481c 100644 --- a/src/test/ui/print-fuel/print-fuel.rs +++ b/src/test/ui/print-fuel/print-fuel.rs @@ -11,7 +11,8 @@ #![crate_name="foo"] #![allow(dead_code)] -// compile-flags: -Z print-fuel=foo +// (#55495: The --error-format is to sidestep an issue in our test harness) +// compile-flags: --error-format human -Z print-fuel=foo // compile-pass struct S1(u8, u16, u8); diff --git a/src/test/ui/print-fuel/print-fuel.stdout b/src/test/ui/print-fuel/print-fuel.stderr similarity index 100% rename from src/test/ui/print-fuel/print-fuel.stdout rename to src/test/ui/print-fuel/print-fuel.stderr diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index f81964ccbc23..15fd855d935a 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -48,6 +48,7 @@ static TARGETS: &'static [&'static str] = &[ "aarch64-apple-ios", "aarch64-fuchsia", "aarch64-linux-android", + "aarch64-pc-windows-msvc", "aarch64-unknown-cloudabi", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", diff --git a/src/tools/lldb b/src/tools/lldb index 29bf48582812..fdea743be550 160000 --- a/src/tools/lldb +++ b/src/tools/lldb @@ -1 +1 @@ -Subproject commit 29bf48582812212450f4caf7da1af3f18c52bfef +Subproject commit fdea743be550ed8d7b61b2c908944cdd1290a6ad