diff options
43 files changed, 619 insertions, 333 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index b80a553b418..ad8dbfd506d 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -814,7 +814,7 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere } fn bounds_to_string(&self, bounds: &[ast::GenericBound]) -> String { - Self::to_string(|s| s.print_type_bounds("", bounds)) + Self::to_string(|s| s.print_type_bounds(bounds)) } fn pat_to_string(&self, pat: &ast::Pat) -> String { @@ -991,7 +991,12 @@ impl<'a> State<'a> { Term::Const(c) => self.print_expr_anon_const(c, &[]), } } - ast::AssocConstraintKind::Bound { bounds } => self.print_type_bounds(":", &*bounds), + ast::AssocConstraintKind::Bound { bounds } => { + if !bounds.is_empty() { + self.word_nbsp(":"); + self.print_type_bounds(&bounds); + } + } } } @@ -1045,11 +1050,14 @@ impl<'a> State<'a> { } ast::TyKind::Path(Some(ref qself), ref path) => self.print_qpath(path, qself, false), ast::TyKind::TraitObject(ref bounds, syntax) => { - let prefix = if syntax == ast::TraitObjectSyntax::Dyn { "dyn" } else { "" }; - self.print_type_bounds(prefix, &bounds); + if syntax == ast::TraitObjectSyntax::Dyn { + self.word_nbsp("dyn"); + } + self.print_type_bounds(bounds); } ast::TyKind::ImplTrait(_, ref bounds) => { - self.print_type_bounds("impl", &bounds); + self.word_nbsp("impl"); + self.print_type_bounds(bounds); } ast::TyKind::Array(ref ty, ref length) => { self.word("["); @@ -1549,29 +1557,24 @@ impl<'a> State<'a> { } } - pub fn print_type_bounds(&mut self, prefix: &'static str, bounds: &[ast::GenericBound]) { - if !bounds.is_empty() { - self.word(prefix); - let mut first = true; - for bound in bounds { - if !(first && prefix.is_empty()) { - self.nbsp(); - } - if first { - first = false; - } else { - self.word_space("+"); - } + pub fn print_type_bounds(&mut self, bounds: &[ast::GenericBound]) { + let mut first = true; + for bound in bounds { + if first { + first = false; + } else { + self.nbsp(); + self.word_space("+"); + } - match bound { - GenericBound::Trait(tref, modifier) => { - if modifier == &TraitBoundModifier::Maybe { - self.word("?"); - } - self.print_poly_trait_ref(tref); + match bound { + GenericBound::Trait(tref, modifier) => { + if modifier == &TraitBoundModifier::Maybe { + self.word("?"); } - GenericBound::Outlives(lt) => self.print_lifetime(*lt), + self.print_poly_trait_ref(tref); } + GenericBound::Outlives(lt) => self.print_lifetime(*lt), } } } @@ -1580,22 +1583,14 @@ impl<'a> State<'a> { self.print_name(lifetime.ident.name) } - pub(crate) fn print_lifetime_bounds( - &mut self, - lifetime: ast::Lifetime, - bounds: &ast::GenericBounds, - ) { - self.print_lifetime(lifetime); - if !bounds.is_empty() { - self.word(": "); - for (i, bound) in bounds.iter().enumerate() { - if i != 0 { - self.word(" + "); - } - match bound { - ast::GenericBound::Outlives(lt) => self.print_lifetime(*lt), - _ => panic!(), - } + pub(crate) fn print_lifetime_bounds(&mut self, bounds: &ast::GenericBounds) { + for (i, bound) in bounds.iter().enumerate() { + if i != 0 { + self.word(" + "); + } + match bound { + ast::GenericBound::Outlives(lt) => self.print_lifetime(*lt), + _ => panic!(), } } } @@ -1613,11 +1608,18 @@ impl<'a> State<'a> { match param.kind { ast::GenericParamKind::Lifetime => { let lt = ast::Lifetime { id: param.id, ident: param.ident }; - s.print_lifetime_bounds(lt, ¶m.bounds) + s.print_lifetime(lt); + if !param.bounds.is_empty() { + s.word_nbsp(":"); + s.print_lifetime_bounds(¶m.bounds) + } } ast::GenericParamKind::Type { ref default } => { s.print_ident(param.ident); - s.print_type_bounds(":", ¶m.bounds); + if !param.bounds.is_empty() { + s.word_nbsp(":"); + s.print_type_bounds(¶m.bounds); + } if let Some(ref default) = default { s.space(); s.word_space("="); @@ -1630,7 +1632,10 @@ impl<'a> State<'a> { s.space(); s.word_space(":"); s.print_type(ty); - s.print_type_bounds(":", ¶m.bounds); + if !param.bounds.is_empty() { + s.word_nbsp(":"); + s.print_type_bounds(¶m.bounds); + } if let Some(ref default) = default { s.space(); s.word_space("="); diff --git a/compiler/rustc_ast_pretty/src/pprust/state/item.rs b/compiler/rustc_ast_pretty/src/pprust/state/item.rs index 67b539a7ad4..f1caf22f364 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state/item.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state/item.rs @@ -114,7 +114,10 @@ impl<'a> State<'a> { self.word_space("type"); self.print_ident(ident); self.print_generic_params(&generics.params); - self.print_type_bounds(":", bounds); + if !bounds.is_empty() { + self.word_nbsp(":"); + self.print_type_bounds(bounds); + } self.print_where_clause_parts(where_clauses.0.0, before_predicates); if let Some(ty) = ty { self.space(); @@ -320,7 +323,10 @@ impl<'a> State<'a> { real_bounds.push(b.clone()); } } - self.print_type_bounds(":", &real_bounds); + if !real_bounds.is_empty() { + self.word_nbsp(":"); + self.print_type_bounds(&real_bounds); + } self.print_where_clause(&generics.where_clause); self.word(" "); self.bopen(); @@ -347,7 +353,10 @@ impl<'a> State<'a> { } } self.nbsp(); - self.print_type_bounds("=", &real_bounds); + if !real_bounds.is_empty() { + self.word_nbsp("="); + self.print_type_bounds(&real_bounds); + } self.print_where_clause(&generics.where_clause); self.word(";"); self.end(); // end inner head-block @@ -618,14 +627,23 @@ impl<'a> State<'a> { }) => { self.print_formal_generic_params(bound_generic_params); self.print_type(bounded_ty); - self.print_type_bounds(":", bounds); + self.word(":"); + if !bounds.is_empty() { + self.nbsp(); + self.print_type_bounds(bounds); + } } ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate { lifetime, bounds, .. }) => { - self.print_lifetime_bounds(*lifetime, bounds); + self.print_lifetime(*lifetime); + self.word(":"); + if !bounds.is_empty() { + self.nbsp(); + self.print_lifetime_bounds(bounds); + } } ast::WherePredicate::EqPredicate(ast::WhereEqPredicate { lhs_ty, rhs_ty, .. }) => { self.print_type(lhs_ty); diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs index fefcaa898c1..ba7cc4908b8 100644 --- a/compiler/rustc_error_messages/src/lib.rs +++ b/compiler/rustc_error_messages/src/lib.rs @@ -1,6 +1,5 @@ #![feature(let_chains)] #![feature(once_cell)] -#![feature(path_try_exists)] #![feature(rustc_attrs)] #![feature(type_alias_impl_trait)] diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index ccbb518e72d..cffb67ef013 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -63,6 +63,17 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { (if_then_scope, then_source_info), LintLevel::Inherited, |this| { + let source_info = if this.is_let(cond) { + let variable_scope = this.new_source_scope( + then_expr.span, + LintLevel::Inherited, + None, + ); + this.source_scope = variable_scope; + SourceInfo { span: then_expr.span, scope: variable_scope } + } else { + this.source_info(then_expr.span) + }; let (then_block, else_block) = this.in_if_then_scope(condition_scope, |this| { let then_blk = unpack!(this.then_else_break( @@ -70,8 +81,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[cond], Some(condition_scope), condition_scope, - then_expr.span, + source_info )); + this.expr_into_dest(destination, then_blk, then_expr) }); then_block.and(else_block) @@ -97,7 +109,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ExprKind::Let { expr, ref pat } => { let scope = this.local_scope(); let (true_block, false_block) = this.in_if_then_scope(scope, |this| { - this.lower_let_expr(block, &this.thir[expr], pat, scope, expr_span) + this.lower_let_expr(block, &this.thir[expr], pat, scope, None, expr_span) }); this.cfg.push_assign_constant( @@ -575,4 +587,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { block_and } + + fn is_let(&self, expr: ExprId) -> bool { + match self.thir[expr].kind { + ExprKind::Let { .. } => true, + ExprKind::Scope { value, .. } => self.is_let(value), + _ => false, + } + } } diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index dc1860cb112..1628f1a4b85 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -40,7 +40,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { expr: &Expr<'tcx>, temp_scope_override: Option<region::Scope>, break_scope: region::Scope, - variable_scope_span: Span, + variable_source_info: SourceInfo, ) -> BlockAnd<()> { let this = self; let expr_span = expr.span; @@ -52,7 +52,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[lhs], temp_scope_override, break_scope, - variable_scope_span, + variable_source_info, )); let rhs_then_block = unpack!(this.then_else_break( @@ -60,7 +60,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[rhs], temp_scope_override, break_scope, - variable_scope_span, + variable_source_info, )); rhs_then_block.unit() @@ -73,13 +73,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[value], temp_scope_override, break_scope, - variable_scope_span, + variable_source_info, ) }) } - ExprKind::Let { expr, ref pat } => { - this.lower_let_expr(block, &this.thir[expr], pat, break_scope, variable_scope_span) - } + ExprKind::Let { expr, ref pat } => this.lower_let_expr( + block, + &this.thir[expr], + pat, + break_scope, + Some(variable_source_info.scope), + variable_source_info.span, + ), _ => { let temp_scope = temp_scope_override.unwrap_or_else(|| this.local_scope()); let mutability = Mutability::Mut; @@ -1772,6 +1777,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { expr: &Expr<'tcx>, pat: &Pat<'tcx>, else_target: region::Scope, + source_scope: Option<SourceScope>, span: Span, ) -> BlockAnd<()> { let expr_span = expr.span; @@ -1797,7 +1803,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let otherwise_post_guard_block = otherwise_candidate.pre_binding_block.unwrap(); self.break_for_else(otherwise_post_guard_block, else_target, self.source_info(expr_span)); - self.declare_bindings(None, pat.span.to(span), pat, ArmHasGuard(false), opt_expr_place); + self.declare_bindings( + source_scope, + pat.span.to(span), + pat, + ArmHasGuard(false), + opt_expr_place, + ); + let post_guard_block = self.bind_pattern( self.source_info(pat.span), guard_candidate, @@ -1969,12 +1982,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { Guard::If(e) => { let e = &this.thir[e]; guard_span = e.span; - this.then_else_break(block, e, None, match_scope, arm_span) + this.then_else_break( + block, + e, + None, + match_scope, + this.source_info(arm_span), + ) } Guard::IfLet(ref pat, scrutinee) => { let s = &this.thir[scrutinee]; guard_span = s.span; - this.lower_let_expr(block, s, pat, match_scope, arm_span) + this.lower_let_expr(block, s, pat, match_scope, None, arm_span) } }); diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index acf892cec53..ba325d70422 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -1355,7 +1355,10 @@ impl<'a> Parser<'a> { s.print_mutability(mut_ty.mutbl, false); s.popen(); s.print_type(&mut_ty.ty); - s.print_type_bounds(" +", &bounds); + if !bounds.is_empty() { + s.word(" + "); + s.print_type_bounds(&bounds); + } s.pclose() }); diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 422af667875..fd0c3f36e72 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -39,11 +39,13 @@ use crate::json::{Json, ToJson}; use crate::spec::abi::{lookup as lookup_abi, Abi}; use crate::spec::crt_objects::{CrtObjects, CrtObjectsFallback}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_span::symbol::{sym, Symbol}; use serde_json::Value; use std::borrow::Cow; use std::collections::BTreeMap; use std::convert::TryFrom; +use std::hash::{Hash, Hasher}; use std::iter::FromIterator; use std::ops::{Deref, DerefMut}; use std::path::{Path, PathBuf}; @@ -2183,7 +2185,7 @@ impl Target { TargetTriple::TargetTriple(ref target_triple) => { load_builtin(target_triple).expect("built-in target") } - TargetTriple::TargetPath(..) => { + TargetTriple::TargetJson { .. } => { panic!("built-in targets doens't support target-paths") } } @@ -2248,11 +2250,9 @@ impl Target { Err(format!("Could not find specification for target {:?}", target_triple)) } - TargetTriple::TargetPath(ref target_path) => { - if target_path.is_file() { - return load_file(&target_path); - } - Err(format!("Target path {:?} is not a valid file", target_path)) + TargetTriple::TargetJson { ref contents, .. } => { + let obj = serde_json::from_str(contents).map_err(|e| e.to_string())?; + Target::from_json(obj) } } } @@ -2421,10 +2421,77 @@ impl ToJson for Target { } /// Either a target triple string or a path to a JSON file. -#[derive(PartialEq, Clone, Debug, Hash, Encodable, Decodable)] +#[derive(Clone, Debug)] pub enum TargetTriple { TargetTriple(String), - TargetPath(PathBuf), + TargetJson { + /// Warning: This field may only be used by rustdoc. Using it anywhere else will lead to + /// inconsistencies as it is discarded during serialization. + path_for_rustdoc: PathBuf, + triple: String, + contents: String, + }, +} + +// Use a manual implementation to ignore the path field +impl PartialEq for TargetTriple { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Self::TargetTriple(l0), Self::TargetTriple(r0)) => l0 == r0, + ( + Self::TargetJson { path_for_rustdoc: _, triple: l_triple, contents: l_contents }, + Self::TargetJson { path_for_rustdoc: _, triple: r_triple, contents: r_contents }, + ) => l_triple == r_triple && l_contents == r_contents, + _ => false, + } + } +} + +// Use a manual implementation to ignore the path field +impl Hash for TargetTriple { + fn hash<H: Hasher>(&self, state: &mut H) -> () { + match self { + TargetTriple::TargetTriple(triple) => { + 0u8.hash(state); + triple.hash(state) + } + TargetTriple::TargetJson { path_for_rustdoc: _, triple, contents } => { + 1u8.hash(state); + triple.hash(state); + contents.hash(state) + } + } + } +} + +// Use a manual implementation to prevent encoding the target json file path in the crate metadata +impl<S: Encoder> Encodable<S> for TargetTriple { + fn encode(&self, s: &mut S) { + match self { + TargetTriple::TargetTriple(triple) => s.emit_enum_variant(0, |s| s.emit_str(triple)), + TargetTriple::TargetJson { path_for_rustdoc: _, triple, contents } => s + .emit_enum_variant(1, |s| { + s.emit_str(triple); + s.emit_str(contents) + }), + } + } +} + +impl<D: Decoder> Decodable<D> for TargetTriple { + fn decode(d: &mut D) -> Self { + match d.read_usize() { + 0 => TargetTriple::TargetTriple(d.read_str().to_owned()), + 1 => TargetTriple::TargetJson { + path_for_rustdoc: PathBuf::new(), + triple: d.read_str().to_owned(), + contents: d.read_str().to_owned(), + }, + _ => { + panic!("invalid enum variant tag while decoding `TargetTriple`, expected 0..2"); + } + } + } } impl TargetTriple { @@ -2436,7 +2503,19 @@ impl TargetTriple { /// Creates a target triple from the passed target path. pub fn from_path(path: &Path) -> Result<Self, io::Error> { let canonicalized_path = path.canonicalize()?; - Ok(TargetTriple::TargetPath(canonicalized_path)) + let contents = std::fs::read_to_string(&canonicalized_path).map_err(|err| { + io::Error::new( + io::ErrorKind::InvalidInput, + format!("target path {:?} is not a valid file: {}", canonicalized_path, err), + ) + })?; + let triple = canonicalized_path + .file_stem() + .expect("target path must not be empty") + .to_str() + .expect("target path must be valid unicode") + .to_owned(); + Ok(TargetTriple::TargetJson { path_for_rustdoc: canonicalized_path, triple, contents }) } /// Returns a string triple for this target. @@ -2444,12 +2523,8 @@ impl TargetTriple { /// If this target is a path, the file name (without extension) is returned. pub fn triple(&self) -> &str { match *self { - TargetTriple::TargetTriple(ref triple) => triple, - TargetTriple::TargetPath(ref path) => path - .file_stem() - .expect("target path must not be empty") - .to_str() - .expect("target path must be valid unicode"), + TargetTriple::TargetTriple(ref triple) + | TargetTriple::TargetJson { ref triple, .. } => triple, } } @@ -2459,16 +2534,15 @@ impl TargetTriple { /// by `triple()`. pub fn debug_triple(&self) -> String { use std::collections::hash_map::DefaultHasher; - use std::hash::{Hash, Hasher}; - - let triple = self.triple(); - if let TargetTriple::TargetPath(ref path) = *self { - let mut hasher = DefaultHasher::new(); - path.hash(&mut hasher); - let hash = hasher.finish(); - format!("{}-{}", triple, hash) - } else { - triple.into() + + match self { + TargetTriple::TargetTriple(triple) => triple.to_owned(), + TargetTriple::TargetJson { path_for_rustdoc: _, triple, contents: content } => { + let mut hasher = DefaultHasher::new(); + content.hash(&mut hasher); + let hash = hasher.finish(); + format!("{}-{}", triple, hash) + } } } } diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index e4da6172916..44ff3fd7306 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -1,4 +1,4 @@ -//! This crates defines the trait resolution method. +//! This crate defines the trait resolution method. //! //! - **Traits.** Trait resolution is implemented in the `traits` module. //! diff --git a/compiler/rustc_typeck/src/astconv/mod.rs b/compiler/rustc_typeck/src/astconv/mod.rs index 32bbfd7e332..4641b36aad1 100644 --- a/compiler/rustc_typeck/src/astconv/mod.rs +++ b/compiler/rustc_typeck/src/astconv/mod.rs @@ -2195,8 +2195,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { "{kind} arguments are not allowed on {this_type}", ); err.span_label(last_span, format!("{kind} argument{s} not allowed")); - for (_, span) in types_and_spans { - err.span_label(span, "not allowed on this"); + for (what, span) in types_and_spans { + err.span_label(span, format!("not allowed on {what}")); } extend(&mut err); err.emit(); diff --git a/library/core/src/future/into_future.rs b/library/core/src/future/into_future.rs index d22094130ad..ad9e80e117f 100644 --- a/library/core/src/future/into_future.rs +++ b/library/core/src/future/into_future.rs @@ -2,7 +2,7 @@ use crate::future::Future; /// Conversion into a `Future`. /// -/// By implementing `Intofuture` for a type, you define how it will be +/// By implementing `IntoFuture` for a type, you define how it will be /// converted to a future. /// /// # `.await` desugaring @@ -29,7 +29,7 @@ use crate::future::Future; /// When implementing futures manually there will often be a choice between /// implementing `Future` or `IntoFuture` for a type. Implementing `Future` is a /// good choice in most cases. But implementing `IntoFuture` is most useful when -/// implementing "async builder" types, which allows the type to be modified +/// implementing "async builder" types, which allow their values to be modified /// multiple times before being `.await`ed. /// /// ```rust diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index 71ea3b4ba85..ecd2b75ae44 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -973,6 +973,28 @@ pub const fn replace<T>(dest: &mut T, src: T) -> T { #[cfg_attr(not(test), rustc_diagnostic_item = "mem_drop")] pub fn drop<T>(_x: T) {} +/// Bitwise-copies a value. +/// +/// This function is not magic; it is literally defined as +/// ``` +/// pub fn copy<T: Copy>(x: &T) -> T { *x } +/// ``` +/// +/// It is useful when you want to pass a function pointer to a combinator, rather than defining a new closure. +/// +/// Example: +/// ``` +/// #![feature(mem_copy_fn)] +/// use core::mem::copy; +/// let result_from_ffi_function: Result<(), &i32> = Err(&1); +/// let result_copied: Result<(), i32> = result_from_ffi_function.map_err(copy); +/// ``` +#[inline] +#[unstable(feature = "mem_copy_fn", issue = "98262")] +pub fn copy<T: Copy>(x: &T) -> T { + *x +} + /// Interprets `src` as having type `&U`, and then reads `src` without moving /// the contained value. /// diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 55bd2c59406..f46997b807a 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -2317,10 +2317,14 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder { /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission /// denied on some of the parent directories.) /// +/// Note that while this avoids some pitfalls of the `exists()` method, it still can not +/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios +/// where those bugs are not an issue. +/// /// # Examples /// /// ```no_run -/// #![feature(path_try_exists)] +/// #![feature(fs_try_exists)] /// use std::fs; /// /// assert!(!fs::try_exists("does_not_exist.txt").expect("Can't check existence of file does_not_exist.txt")); @@ -2330,7 +2334,7 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder { /// [`Path::exists`]: crate::path::Path::exists // FIXME: stabilization should modify documentation of `exists()` to recommend this method // instead. -#[unstable(feature = "path_try_exists", issue = "83186")] +#[unstable(feature = "fs_try_exists", issue = "83186")] #[inline] pub fn try_exists<P: AsRef<Path>>(path: P) -> io::Result<bool> { fs_imp::try_exists(path.as_ref()) diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 6bbc8f55ace..5dfeb517a19 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2705,6 +2705,9 @@ impl Path { /// Returns `true` if the path points at an existing entity. /// + /// Warning: this method may be error-prone, consider using [`try_exists()`] instead! + /// It also has a risk of introducing time-of-check to time-of-use (TOCTOU) bugs. + /// /// This function will traverse symbolic links to query information about the /// destination file. /// @@ -2721,7 +2724,9 @@ impl Path { /// # See Also /// /// This is a convenience function that coerces errors to false. If you want to - /// check errors, call [`fs::metadata`]. + /// check errors, call [`Path::try_exists`]. + /// + /// [`try_exists()`]: Self::try_exists #[stable(feature = "path_ext", since = "1.5.0")] #[must_use] #[inline] @@ -2738,20 +2743,20 @@ impl Path { /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission /// denied on some of the parent directories.) /// + /// Note that while this avoids some pitfalls of the `exists()` method, it still can not + /// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios + /// where those bugs are not an issue. + /// /// # Examples /// /// ```no_run - /// #![feature(path_try_exists)] - /// /// use std::path::Path; /// assert!(!Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt")); /// assert!(Path::new("/root/secret_file.txt").try_exists().is_err()); /// ``` /// /// [`exists()`]: Self::exists - // FIXME: stabilization should modify documentation of `exists()` to recommend this method - // instead. - #[unstable(feature = "path_try_exists", issue = "83186")] + #[stable(feature = "path_try_exists", since = "1.63.0")] #[inline] pub fn try_exists(&self) -> io::Result<bool> { fs::try_exists(self) diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 86c58cd79dc..ab72f4a3f50 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -365,8 +365,8 @@ fn run_test( } compiler.arg("--target").arg(match target { TargetTriple::TargetTriple(s) => s, - TargetTriple::TargetPath(path) => { - path.to_str().expect("target path must be valid unicode").to_string() + TargetTriple::TargetJson { path_for_rustdoc, .. } => { + path_for_rustdoc.to_str().expect("target path must be valid unicode").to_string() } }); if let ErrorOutputType::HumanReadable(kind) = rustdoc_options.error_format { diff --git a/src/test/debuginfo/lexical-scope-in-if-let.rs b/src/test/debuginfo/lexical-scope-in-if-let.rs new file mode 100644 index 00000000000..cdc37ce48fb --- /dev/null +++ b/src/test/debuginfo/lexical-scope-in-if-let.rs @@ -0,0 +1,100 @@ +// compile-flags:-g + +// === GDB TESTS ================================================================================== + +// gdb-command:run +// gdb-command:info locals +// gdb-check:a = 123 + +// gdb-command:continue +// gdb-command:info locals +// gdb-check:x = 42 +// gdb-check:a = 123 + +// gdb-command:continue +// gdb-command:info locals +// gdb-check:y = true +// gdb-check:b = 456 +// gdb-check:x = 42 +// gdb-check:a = 123 + +// gdb-command:continue +// gdb-command:info locals +// gdb-check:z = 10 +// gdb-check:c = 789 +// gdb-check:y = true +// gdb-check:b = 456 +// gdb-check:x = 42 +// gdb-check:a = 123 + +// === LLDB TESTS ================================================================================= + +// lldb-command:run +// lldb-command:frame variable +// lldb-check:(int) a = 123 + +// lldb-command:continue +// lldb-command:frame variable +// lldb-check:(int) a = 123 (int) x = 42 + +// lldb-command:continue +// lldb-command:frame variable +// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true + +// lldb-command:continue +// lldb-command:frame variable +// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true (int) c = 789 (int) z = 10 + +// === CDB TESTS ================================================================================== + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]a = 0n123 + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]a = 0n123 +// cdb-check:[...]x = 0n42 + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]y = true +// cdb-check:[...]b = 0n456 +// cdb-check:[...]a = 0n123 +// cdb-check:[...]x = 0n42 + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]z = 0n10 +// cdb-check:[...]c = 0n789 +// cdb-check:[...]y = true +// cdb-check:[...]b = 0n456 +// cdb-check:[...]a = 0n123 +// cdb-check:[...]x = 0n42 + +fn main() { + let a = id(123); + + zzz(); // #break + + if let Some(x) = id(Some(42)) { + zzz(); // #break + + let b = id(456); + + if let Ok(y) = id::<Result<bool, ()>>(Ok(true)) { + zzz(); // #break + + let c = id(789); + + if let (z, 42) = id((10, 42)) { + zzz(); // #break + } + } + } +} + +#[inline(never)] +fn id<T>(value: T) -> T { value } + +fn zzz() { } diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff index 445732f7022..047853696f2 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff @@ -10,26 +10,28 @@ scope 1 { debug x => _1; // in scope 1 at $DIR/discriminant.rs:11:9: 11:10 } + scope 2 { + } bb0: { StorageLive(_1); // scope 0 at $DIR/discriminant.rs:11:9: 11:10 StorageLive(_2); // scope 0 at $DIR/discriminant.rs:11:13: 11:64 - StorageLive(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - Deinit(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - ((_3 as Some).0: bool) = const true; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - discriminant(_3) = 1; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 -- _4 = discriminant(_3); // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + StorageLive(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + Deinit(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 +- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:11:21: 11:31 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb2: { - _2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49 + _2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:11:47: 11:49 goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 } diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff index 445732f7022..047853696f2 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff @@ -10,26 +10,28 @@ scope 1 { debug x => _1; // in scope 1 at $DIR/discriminant.rs:11:9: 11:10 } + scope 2 { + } bb0: { StorageLive(_1); // scope 0 at $DIR/discriminant.rs:11:9: 11:10 StorageLive(_2); // scope 0 at $DIR/discriminant.rs:11:13: 11:64 - StorageLive(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - Deinit(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - ((_3 as Some).0: bool) = const true; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - discriminant(_3) = 1; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 -- _4 = discriminant(_3); // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + StorageLive(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + Deinit(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 +- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:11:21: 11:31 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb2: { - _2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49 + _2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:11:47: 11:49 goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 } diff --git a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff index 1efaba044ec..982dd7a27bc 100644 --- a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff @@ -7,22 +7,24 @@ let mut _2: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:20: 13:30 let mut _3: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 let mut _4: &E; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:12:16: 12:17 + scope 1 { + } bb0: { - _3 = discriminant((*_1)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _3 = discriminant((*_1)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 } bb1: { - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - _4 = move (((*_1) as Some).0: &E); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - _2 = discriminant((*_4)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + StorageLive(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _4 = move (((*_1) as Some).0: &E); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _2 = discriminant((*_4)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + StorageDead(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 } bb2: { - _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:38: 13:39 + _0 = const 1_u32; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:38: 13:39 goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:5: 13:52 } diff --git a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff index f22fbec03d0..15409fa0dd2 100644 --- a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff +++ b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff @@ -27,9 +27,9 @@ let _6: core::num::flt2dec::Sign; // in scope 1 at $DIR/funky_arms.rs:19:9: 19:13 scope 2 { debug sign => _6; // in scope 2 at $DIR/funky_arms.rs:19:9: 19:13 - let _10: usize; // in scope 2 at $DIR/funky_arms.rs:24:17: 24:26 scope 3 { debug precision => _10; // in scope 3 at $DIR/funky_arms.rs:24:17: 24:26 + let _10: usize; // in scope 3 at $DIR/funky_arms.rs:24:17: 24:26 } } } @@ -63,52 +63,52 @@ } bb4: { - StorageLive(_7); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 - StorageLive(_8); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 - _8 = &(*_1); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 - _7 = Formatter::precision(move _8) -> bb5; // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 + StorageLive(_7); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + StorageLive(_8); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + _8 = &(*_1); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + _7 = Formatter::precision(move _8) -> bb5; // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 // mir::Constant // + span: $DIR/funky_arms.rs:24:34: 24:43 // + literal: Const { ty: for<'r> fn(&'r Formatter) -> Option<usize> {Formatter::precision}, val: Value(Scalar(<ZST>)) } } bb5: { - StorageDead(_8); // scope 2 at $DIR/funky_arms.rs:24:44: 24:45 - _9 = discriminant(_7); // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 - switchInt(move _9) -> [1_isize: bb6, otherwise: bb8]; // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 + StorageDead(_8); // scope 3 at $DIR/funky_arms.rs:24:44: 24:45 + _9 = discriminant(_7); // scope 3 at $DIR/funky_arms.rs:24:12: 24:27 + switchInt(move _9) -> [1_isize: bb6, otherwise: bb8]; // scope 3 at $DIR/funky_arms.rs:24:12: 24:27 } bb6: { - StorageLive(_10); // scope 2 at $DIR/funky_arms.rs:24:17: 24:26 - _10 = ((_7 as Some).0: usize); // scope 2 at $DIR/funky_arms.rs:24:17: 24:26 - StorageLive(_11); // scope 2 at $DIR/funky_arms.rs:26:43: 26:46 - _11 = &mut (*_1); // scope 2 at $DIR/funky_arms.rs:26:43: 26:46 - StorageLive(_12); // scope 2 at $DIR/funky_arms.rs:26:48: 26:51 - _12 = _2; // scope 2 at $DIR/funky_arms.rs:26:48: 26:51 - StorageLive(_13); // scope 2 at $DIR/funky_arms.rs:26:53: 26:57 - _13 = _6; // scope 2 at $DIR/funky_arms.rs:26:53: 26:57 - StorageLive(_14); // scope 2 at $DIR/funky_arms.rs:26:59: 26:79 - StorageLive(_15); // scope 2 at $DIR/funky_arms.rs:26:59: 26:75 - StorageLive(_16); // scope 2 at $DIR/funky_arms.rs:26:59: 26:68 - _16 = _10; // scope 2 at $DIR/funky_arms.rs:26:59: 26:68 - _15 = move _16 as u32 (Misc); // scope 2 at $DIR/funky_arms.rs:26:59: 26:75 - StorageDead(_16); // scope 2 at $DIR/funky_arms.rs:26:74: 26:75 - _14 = Add(move _15, const 1_u32); // scope 2 at $DIR/funky_arms.rs:26:59: 26:79 - StorageDead(_15); // scope 2 at $DIR/funky_arms.rs:26:78: 26:79 - StorageLive(_17); // scope 2 at $DIR/funky_arms.rs:26:81: 26:86 - _17 = _3; // scope 2 at $DIR/funky_arms.rs:26:81: 26:86 - _0 = float_to_exponential_common_exact::<T>(move _11, move _12, move _13, move _14, move _17) -> bb7; // scope 2 at $DIR/funky_arms.rs:26:9: 26:87 + StorageLive(_10); // scope 3 at $DIR/funky_arms.rs:24:17: 24:26 + _10 = ((_7 as Some).0: usize); // scope 3 at $DIR/funky_arms.rs:24:17: 24:26 + StorageLive(_11); // scope 3 at $DIR/funky_arms.rs:26:43: 26:46 + _11 = &mut (*_1); // scope 3 at $DIR/funky_arms.rs:26:43: 26:46 + StorageLive(_12); // scope 3 at $DIR/funky_arms.rs:26:48: 26:51 + _12 = _2; // scope 3 at $DIR/funky_arms.rs:26:48: 26:51 + StorageLive(_13); // scope 3 at $DIR/funky_arms.rs:26:53: 26:57 + _13 = _6; // scope 3 at $DIR/funky_arms.rs:26:53: 26:57 + StorageLive(_14); // scope 3 at $DIR/funky_arms.rs:26:59: 26:79 + StorageLive(_15); // scope 3 at $DIR/funky_arms.rs:26:59: 26:75 + StorageLive(_16); // scope 3 at $DIR/funky_arms.rs:26:59: 26:68 + _16 = _10; // scope 3 at $DIR/funky_arms.rs:26:59: 26:68 + _15 = move _16 as u32 (Misc); // scope 3 at $DIR/funky_arms.rs:26:59: 26:75 + StorageDead(_16); // scope 3 at $DIR/funky_arms.rs:26:74: 26:75 + _14 = Add(move _15, const 1_u32); // scope 3 at $DIR/funky_arms.rs:26:59: 26:79 + StorageDead(_15); // scope 3 at $DIR/funky_arms.rs:26:78: 26:79 + StorageLive(_17); // scope 3 at $DIR/funky_arms.rs:26:81: 26:86 + _17 = _3; // scope 3 at $DIR/funky_arms.rs:26:81: 26:86 + _0 = float_to_exponential_common_exact::<T>(move _11, move _12, move _13, move _14, move _17) -> bb7; // scope 3 at $DIR/funky_arms.rs:26:9: 26:87 // mir::Constant // + span: $DIR/funky_arms.rs:26:9: 26:42 // + literal: Const { ty: for<'r, 's, 't0> fn(&'r mut Formatter<'s>, &'t0 T, Sign, u32, bool) -> Result<(), std::fmt::Error> {float_to_exponential_common_exact::<T>}, val: Value(Scalar(<ZST>)) } } bb7: { - StorageDead(_17); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_14); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_13); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_12); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_11); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_17); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_14); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_13); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_12); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_11); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 StorageDead(_10); // scope 2 at $DIR/funky_arms.rs:27:5: 27:6 goto -> bb10; // scope 2 at $DIR/funky_arms.rs:24:5: 29:6 } diff --git a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir index 54930937c91..ce7ca20358e 100644 --- a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir @@ -14,9 +14,9 @@ fn main() -> () { let mut _11: isize; // in scope 0 at $DIR/issue-41888.rs:15:1: 15:2 scope 1 { debug e => _1; // in scope 1 at $DIR/issue-41888.rs:7:9: 7:10 - let _6: K; // in scope 1 at $DIR/issue-41888.rs:10:21: 10:23 scope 2 { debug _k => _6; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + let _6: K; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 } } @@ -51,15 +51,15 @@ fn main() -> () { bb4: { StorageDead(_3); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 - _5 = discriminant(_1); // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 - switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 + _5 = discriminant(_1); // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 + switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 } bb5: { - StorageLive(_6); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _9 = const false; // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _6 = move ((_1 as F).0: K); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _0 = const (); // scope 1 at $DIR/issue-41888.rs:10:29: 13:10 + StorageLive(_6); // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _9 = const false; // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _6 = move ((_1 as F).0: K); // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _0 = const (); // scope 2 at $DIR/issue-41888.rs:10:29: 13:10 StorageDead(_6); // scope 1 at $DIR/issue-41888.rs:13:9: 13:10 goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10 } diff --git a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index 299529ec649..b8023a6a8e6 100644 --- a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -10,11 +10,11 @@ let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:10:33: 10:35 scope 1 { debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:7:9: 7:15 - let _4: u32; // in scope 1 at $DIR/issue-75439.rs:9:27: 9:29 scope 3 { debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 - } - scope 4 { + let _4: u32; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + scope 4 { + } } } scope 2 { @@ -32,19 +32,19 @@ bb1: { StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:7:52: 7:53 - switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb2: { - switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb3: { - switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb4: { - StorageLive(_5); // scope 1 at $DIR/issue-75439.rs:10:14: 10:38 + StorageLive(_5); // scope 3 at $DIR/issue-75439.rs:10:14: 10:38 StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:10:33: 10:35 _6 = _4; // scope 4 at $DIR/issue-75439.rs:10:33: 10:35 _5 = transmute::<u32, [u8; 4]>(move _6) -> bb7; // scope 4 at $DIR/issue-75439.rs:10:23: 10:36 @@ -54,23 +54,23 @@ } bb5: { - StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - goto -> bb4; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + StorageLive(_4); // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + _4 = _2[3 of 4]; // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + goto -> bb4; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb6: { - StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - goto -> bb4; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + StorageLive(_4); // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + _4 = _2[3 of 4]; // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + goto -> bb4; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb7: { StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:10:35: 10:36 - Deinit(_0); // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 - ((_0 as Some).0: [u8; 4]) = move _5; // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 - discriminant(_0) = 1; // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 - StorageDead(_5); // scope 1 at $DIR/issue-75439.rs:10:38: 10:39 + Deinit(_0); // scope 3 at $DIR/issue-75439.rs:10:9: 10:39 + ((_0 as Some).0: [u8; 4]) = move _5; // scope 3 at $DIR/issue-75439.rs:10:9: 10:39 + discriminant(_0) = 1; // scope 3 at $DIR/issue-75439.rs:10:9: 10:39 + StorageDead(_5); // scope 3 at $DIR/issue-75439.rs:10:38: 10:39 StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:11:5: 11:6 goto -> bb9; // scope 1 at $DIR/issue-75439.rs:9:5: 13:6 } diff --git a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff index a8cc61f0526..075fe8d0908 100644 --- a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff @@ -8,44 +8,44 @@ let mut _3: std::option::Option<T>; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 let mut _4: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:22: 4:26 let mut _5: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:13: 4:20 - let _6: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - let mut _7: bool; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 - let mut _8: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 scope 1 { debug a => _6; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 + let _6: u8; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 } bb0: { - StorageLive(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - StorageLive(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - Deinit(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - discriminant(_2) = 0; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - StorageLive(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - Deinit(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - discriminant(_3) = 0; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - Deinit(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - (_1.0: std::option::Option<u8>) = move _2; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - (_1.1: std::option::Option<T>) = move _3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - StorageDead(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 - StorageDead(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 - _5 = discriminant((_1.0: std::option::Option<u8>)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 - switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + StorageLive(_1); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + StorageLive(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + Deinit(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + discriminant(_2) = 0; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + StorageLive(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + Deinit(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + discriminant(_3) = 0; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + Deinit(_1); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + (_1.0: std::option::Option<u8>) = move _2; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + (_1.1: std::option::Option<T>) = move _3; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + StorageDead(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 + StorageDead(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 + _5 = discriminant((_1.0: std::option::Option<u8>)); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 } bb1: { - _4 = discriminant((_1.1: std::option::Option<T>)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 - switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + _4 = discriminant((_1.1: std::option::Option<T>)); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 } bb2: { - StorageLive(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - _6 = (((_1.0: std::option::Option<u8>) as Some).0: u8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 -- StorageLive(_7); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 -- StorageLive(_8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 -- _8 = _6; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 -- _7 = Gt(move _8, const 42_u8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 -- StorageDead(_8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20 -- StorageDead(_7); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:7:9: 7:10 + StorageLive(_6); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 + _6 = (((_1.0: std::option::Option<u8>) as Some).0: u8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 +- StorageLive(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 +- StorageLive(_8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 +- _8 = _6; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 +- _7 = Gt(move _8, const 42_u8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 +- StorageDead(_8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20 +- StorageDead(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:7:9: 7:10 StorageDead(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:5: 8:6 goto -> bb3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:5: 8:6 } diff --git a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff index 08312bde20f..70486f546d7 100644 --- a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff @@ -5,36 +5,36 @@ let mut _0: (); // return place in scope 0 at $DIR/unreachable.rs:8:11: 8:11 let mut _1: std::option::Option<Empty>; // in scope 0 at $DIR/unreachable.rs:9:23: 9:30 let mut _2: isize; // in scope 0 at $DIR/unreachable.rs:9:12: 9:20 - let _3: Empty; // in scope 0 at $DIR/unreachable.rs:9:17: 9:19 - let mut _4: i32; // in scope 0 at $DIR/unreachable.rs:10:13: 10:19 let _5: (); // in scope 0 at $DIR/unreachable.rs:12:9: 16:10 let mut _6: bool; // in scope 0 at $DIR/unreachable.rs:12:12: 12:16 let mut _7: !; // in scope 0 at $DIR/unreachable.rs:18:9: 18:21 scope 1 { debug _x => _3; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 - } - scope 2 { - debug _y => _4; // in scope 2 at $DIR/unreachable.rs:10:13: 10:19 + let _3: Empty; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 + let mut _4: i32; // in scope 1 at $DIR/unreachable.rs:10:13: 10:19 + scope 2 { + debug _y => _4; // in scope 2 at $DIR/unreachable.rs:10:13: 10:19 + } } bb0: { - StorageLive(_1); // scope 0 at $DIR/unreachable.rs:9:23: 9:30 - _1 = empty() -> bb1; // scope 0 at $DIR/unreachable.rs:9:23: 9:30 + StorageLive(_1); // scope 1 at $DIR/unreachable.rs:9:23: 9:30 + _1 = empty() -> bb1; // scope 1 at $DIR/unreachable.rs:9:23: 9:30 // mir::Constant // + span: $DIR/unreachable.rs:9:23: 9:28 // + literal: Const { ty: fn() -> Option<Empty> {empty}, val: Value(Scalar(<ZST>)) } } bb1: { - _2 = discriminant(_1); // scope 0 at $DIR/unreachable.rs:9:12: 9:20 -- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 -+ goto -> bb2; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 + _2 = discriminant(_1); // scope 1 at $DIR/unreachable.rs:9:12: 9:20 +- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable.rs:9:12: 9:20 ++ goto -> bb2; // scope 1 at $DIR/unreachable.rs:9:12: 9:20 } bb2: { -- StorageLive(_3); // scope 0 at $DIR/unreachable.rs:9:17: 9:19 -- _3 = move ((_1 as Some).0: Empty); // scope 0 at $DIR/unreachable.rs:9:17: 9:19 -- StorageLive(_4); // scope 0 at $DIR/unreachable.rs:10:13: 10:19 +- StorageLive(_3); // scope 1 at $DIR/unreachable.rs:9:17: 9:19 +- _3 = move ((_1 as Some).0: Empty); // scope 1 at $DIR/unreachable.rs:9:17: 9:19 +- StorageLive(_4); // scope 1 at $DIR/unreachable.rs:10:13: 10:19 - StorageLive(_5); // scope 2 at $DIR/unreachable.rs:12:9: 16:10 - StorageLive(_6); // scope 2 at $DIR/unreachable.rs:12:12: 12:16 - _6 = const true; // scope 2 at $DIR/unreachable.rs:12:12: 12:16 diff --git a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff index e5867ccfc5c..d9f2681d145 100644 --- a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff @@ -11,56 +11,56 @@ let mut _7: !; // in scope 0 at $DIR/unreachable_diverging.rs:18:9: 18:22 scope 1 { debug x => _1; // in scope 1 at $DIR/unreachable_diverging.rs:13:9: 13:10 - let _4: Empty; // in scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 scope 2 { debug bomb => _4; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + let _4: Empty; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 } } bb0: { StorageLive(_1); // scope 0 at $DIR/unreachable_diverging.rs:13:9: 13:10 _1 = const true; // scope 0 at $DIR/unreachable_diverging.rs:13:13: 13:17 - StorageLive(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:25: 14:32 - _2 = empty() -> bb1; // scope 1 at $DIR/unreachable_diverging.rs:14:25: 14:32 + StorageLive(_2); // scope 2 at $DIR/unreachable_diverging.rs:14:25: 14:32 + _2 = empty() -> bb1; // scope 2 at $DIR/unreachable_diverging.rs:14:25: 14:32 // mir::Constant // + span: $DIR/unreachable_diverging.rs:14:25: 14:30 // + literal: Const { ty: fn() -> Option<Empty> {empty}, val: Value(Scalar(<ZST>)) } } bb1: { - _3 = discriminant(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 -- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 -+ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 + _3 = discriminant(_2); // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 +- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 ++ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 } bb2: { - StorageLive(_4); // scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 - _4 = move ((_2 as Some).0: Empty); // scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 - StorageLive(_5); // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 - StorageLive(_6); // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 - _6 = _1; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 -- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 -+ goto -> bb3; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 + StorageLive(_4); // scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + _4 = move ((_2 as Some).0: Empty); // scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + StorageLive(_5); // scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 + StorageLive(_6); // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 + _6 = _1; // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 +- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 ++ goto -> bb3; // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 } bb3: { -- _5 = loop_forever() -> bb5; // scope 1 at $DIR/unreachable_diverging.rs:16:13: 16:27 -+ _5 = loop_forever() -> bb4; // scope 1 at $DIR/unreachable_diverging.rs:16:13: 16:27 +- _5 = loop_forever() -> bb5; // scope 2 at $DIR/unreachable_diverging.rs:16:13: 16:27 ++ _5 = loop_forever() -> bb4; // scope 2 at $DIR/unreachable_diverging.rs:16:13: 16:27 // mir::Constant // + span: $DIR/unreachable_diverging.rs:16:13: 16:25 // + literal: Const { ty: fn() {loop_forever}, val: Value(Scalar(<ZST>)) } } bb4: { -- _5 = const (); // scope 1 at $DIR/unreachable_diverging.rs:17:10: 17:10 -- goto -> bb5; // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 +- _5 = const (); // scope 2 at $DIR/unreachable_diverging.rs:17:10: 17:10 +- goto -> bb5; // scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 - } - - bb5: { - StorageDead(_6); // scope 1 at $DIR/unreachable_diverging.rs:17:9: 17:10 - StorageDead(_5); // scope 1 at $DIR/unreachable_diverging.rs:17:9: 17:10 - StorageLive(_7); // scope 1 at $DIR/unreachable_diverging.rs:18:9: 18:22 - unreachable; // scope 1 at $DIR/unreachable_diverging.rs:18:15: 18:19 + StorageDead(_6); // scope 2 at $DIR/unreachable_diverging.rs:17:9: 17:10 + StorageDead(_5); // scope 2 at $DIR/unreachable_diverging.rs:17:9: 17:10 + StorageLive(_7); // scope 2 at $DIR/unreachable_diverging.rs:18:9: 18:22 + unreachable; // scope 2 at $DIR/unreachable_diverging.rs:18:15: 18:19 } - bb6: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff index 0529b15522e..f8b41d7b4c5 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff @@ -13,28 +13,30 @@ let mut _8: !; // in scope 0 at $DIR/while_let_loops.rs:7:5: 10:6 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19 - StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - Deinit(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - discriminant(_3) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 -- _4 = discriminant(_3); // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ _4 = const 0_isize; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + Deinit(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_3) = 0; // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 +- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb1: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb2: { - _1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15 - nop; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 - goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 + _1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:8:9: 8:15 + nop; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 + goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 } bb3: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff index 0529b15522e..f8b41d7b4c5 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff @@ -13,28 +13,30 @@ let mut _8: !; // in scope 0 at $DIR/while_let_loops.rs:7:5: 10:6 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19 - StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - Deinit(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - discriminant(_3) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 -- _4 = discriminant(_3); // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ _4 = const 0_isize; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + Deinit(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_3) = 0; // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 +- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb1: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb2: { - _1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15 - nop; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 - goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 + _1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:8:9: 8:15 + nop; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 + goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 } bb3: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir index 3c94fbddc44..5657f9413a1 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir @@ -5,6 +5,8 @@ fn change_loop_body() -> () { let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir index 3c94fbddc44..5657f9413a1 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir @@ -5,6 +5,8 @@ fn change_loop_body() -> () { let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { diff --git a/src/test/pretty/where-clauses.rs b/src/test/pretty/where-clauses.rs index 5614a81b0eb..4183799457b 100644 --- a/src/test/pretty/where-clauses.rs +++ b/src/test/pretty/where-clauses.rs @@ -2,4 +2,7 @@ fn f<'a, 'b, T>(t: T) -> isize where T: 'a, 'a: 'b, T: Eq { 0 } +// This is legal syntax, sometimes generated by macros. `where T: $($bound+)*` +fn zero_bounds<'a, T>() where 'a:, T: {} + fn main() {} diff --git a/src/test/ui/derives/issue-97343.stderr b/src/test/ui/derives/issue-97343.stderr index ac797a8f501..e83bbb5b60d 100644 --- a/src/test/ui/derives/issue-97343.stderr +++ b/src/test/ui/derives/issue-97343.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on type parameter `Irrelevant` LL | #[derive(Debug)] | ----- | | - | not allowed on this + | not allowed on type parameter `Irrelevant` | in this derive macro expansion LL | pub struct Irrelevant<Irrelevant> { | ^^^^^^^^^^ type argument not allowed diff --git a/src/test/ui/error-codes/E0109.stderr b/src/test/ui/error-codes/E0109.stderr index 7858a9e3028..da00fdde6bd 100644 --- a/src/test/ui/error-codes/E0109.stderr +++ b/src/test/ui/error-codes/E0109.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on this type LL | type X = u32<i32>; | --- ^^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `u32` doesn't have generic parameters | diff --git a/src/test/ui/error-codes/E0110.stderr b/src/test/ui/error-codes/E0110.stderr index 68f98b6f17d..5babb5c2961 100644 --- a/src/test/ui/error-codes/E0110.stderr +++ b/src/test/ui/error-codes/E0110.stderr @@ -4,7 +4,7 @@ error[E0109]: lifetime arguments are not allowed on this type LL | type X = u32<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `u32` doesn't have generic parameters | diff --git a/src/test/ui/issues/issue-22706.stderr b/src/test/ui/issues/issue-22706.stderr index 66911f081d7..5366a36b1a6 100644 --- a/src/test/ui/issues/issue-22706.stderr +++ b/src/test/ui/issues/issue-22706.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on module `marker` LL | fn is_copy<T: ::std::marker<i32>::Copy>() {} | ------ ^^^ type argument not allowed | | - | not allowed on this + | not allowed on module `marker` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-57924.stderr b/src/test/ui/issues/issue-57924.stderr index 211b0dde48c..0323a4dfb8a 100644 --- a/src/test/ui/issues/issue-57924.stderr +++ b/src/test/ui/issues/issue-57924.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on self constructor LL | Self::<E>(e) | ---- ^ type argument not allowed | | - | not allowed on this + | not allowed on self constructor error: aborting due to previous error diff --git a/src/test/ui/issues/issue-60989.stderr b/src/test/ui/issues/issue-60989.stderr index 9076f4f9385..e0236567b2f 100644 --- a/src/test/ui/issues/issue-60989.stderr +++ b/src/test/ui/issues/issue-60989.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on local variable LL | c1::<()>; | -- ^^ type argument not allowed | | - | not allowed on this + | not allowed on local variable error[E0109]: type arguments are not allowed on local variable --> $DIR/issue-60989.rs:16:10 @@ -12,7 +12,7 @@ error[E0109]: type arguments are not allowed on local variable LL | c1::<dyn Into<B>>; | -- ^^^^^^^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on local variable error: aborting due to 2 previous errors diff --git a/src/test/ui/mod-subitem-as-enum-variant.stderr b/src/test/ui/mod-subitem-as-enum-variant.stderr index 15da1d155a3..cf61e94bd86 100644 --- a/src/test/ui/mod-subitem-as-enum-variant.stderr +++ b/src/test/ui/mod-subitem-as-enum-variant.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on module `Mod` LL | Mod::<i32>::FakeVariant(0); | --- ^^^ type argument not allowed | | - | not allowed on this + | not allowed on module `Mod` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-path-associated-type.stderr b/src/test/ui/structs/struct-path-associated-type.stderr index 7424ceecbe3..bdce0e1b331 100644 --- a/src/test/ui/structs/struct-path-associated-type.stderr +++ b/src/test/ui/structs/struct-path-associated-type.stderr @@ -10,7 +10,7 @@ error[E0109]: type arguments are not allowed on this type LL | let z = T::A::<u8> {}; | - ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0071]: expected struct, variant or union type, found associated type --> $DIR/struct-path-associated-type.rs:14:13 @@ -30,7 +30,7 @@ error[E0109]: type arguments are not allowed on this type LL | let z = T::A::<u8> {}; | - ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:32:13 diff --git a/src/test/ui/structs/struct-path-self.stderr b/src/test/ui/structs/struct-path-self.stderr index 4bd0fb38985..c2a8623f9b4 100644 --- a/src/test/ui/structs/struct-path-self.stderr +++ b/src/test/ui/structs/struct-path-self.stderr @@ -10,7 +10,7 @@ error[E0109]: type arguments are not allowed on self type LL | let z = Self::<u8> {}; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | help: the `Self` type doesn't accept type parameters | @@ -36,7 +36,7 @@ error[E0109]: type arguments are not allowed on self type LL | let z = Self::<u8> {}; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `S` --> $DIR/struct-path-self.rs:1:8 @@ -58,7 +58,7 @@ error[E0109]: type arguments are not allowed on self type LL | let z = Self::<u8> {}; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `S` --> $DIR/struct-path-self.rs:1:8 diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr index cfc596e1b78..9601bdce4c5 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr +++ b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr @@ -23,7 +23,7 @@ error[E0109]: type arguments are not allowed on this type LL | Self::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on self type --> $DIR/enum-variant-generic-args.rs:17:16 @@ -31,7 +31,7 @@ error[E0109]: type arguments are not allowed on self type LL | Self::<()>::TSVariant(()); | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `Enum<T>` --> $DIR/enum-variant-generic-args.rs:7:6 @@ -71,7 +71,7 @@ error[E0109]: type arguments are not allowed on self type LL | Self::<()>::TSVariant::<()>(()); | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `Enum<T>` --> $DIR/enum-variant-generic-args.rs:7:6 @@ -92,7 +92,7 @@ error[E0109]: type arguments are not allowed on this type LL | Self::<()>::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0308]: mismatched types --> $DIR/enum-variant-generic-args.rs:26:29 @@ -112,7 +112,7 @@ error[E0109]: type arguments are not allowed on this type LL | Self::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters help: you might have meant to specity type parameters on enum `Enum` @@ -139,7 +139,7 @@ error[E0109]: type arguments are not allowed on self type LL | Self::<()>::SVariant { v: () }; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `Enum<T>` --> $DIR/enum-variant-generic-args.rs:7:6 @@ -172,7 +172,7 @@ error[E0109]: type arguments are not allowed on self type LL | Self::<()>::SVariant::<()> { v: () }; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `Enum<T>` --> $DIR/enum-variant-generic-args.rs:7:6 @@ -193,7 +193,7 @@ error[E0109]: type arguments are not allowed on this type LL | Self::<()>::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters help: you might have meant to specity type parameters on enum `Enum` @@ -220,7 +220,7 @@ error[E0109]: type arguments are not allowed on this type LL | Self::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on self type --> $DIR/enum-variant-generic-args.rs:43:16 @@ -228,7 +228,7 @@ error[E0109]: type arguments are not allowed on self type LL | Self::<()>::UVariant; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `Enum<T>` --> $DIR/enum-variant-generic-args.rs:7:6 @@ -249,7 +249,7 @@ error[E0109]: type arguments are not allowed on self type LL | Self::<()>::UVariant::<()>; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `Enum<T>` --> $DIR/enum-variant-generic-args.rs:7:6 @@ -270,7 +270,7 @@ error[E0109]: type arguments are not allowed on this type LL | Self::<()>::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:54:29 @@ -278,7 +278,7 @@ error[E0109]: type arguments are not allowed on this type LL | Enum::<()>::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:57:24 @@ -286,7 +286,7 @@ error[E0109]: type arguments are not allowed on this type LL | Alias::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:59:30 @@ -294,7 +294,7 @@ error[E0109]: type arguments are not allowed on this type LL | Alias::<()>::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:62:29 @@ -302,7 +302,7 @@ error[E0109]: type arguments are not allowed on this type LL | AliasFixed::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:64:5 @@ -338,7 +338,7 @@ error[E0109]: type arguments are not allowed on this type LL | AliasFixed::<()>::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:72:28 @@ -346,7 +346,7 @@ error[E0109]: type arguments are not allowed on this type LL | Enum::<()>::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters @@ -356,7 +356,7 @@ error[E0109]: type arguments are not allowed on this type LL | Alias::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters help: you might have meant to specity type parameters on enum `Enum` @@ -371,7 +371,7 @@ error[E0109]: type arguments are not allowed on this type LL | Alias::<()>::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters help: you might have meant to specity type parameters on enum `Enum` @@ -386,7 +386,7 @@ error[E0109]: type arguments are not allowed on this type LL | AliasFixed::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters help: you might have meant to specity type parameters on enum `Enum` @@ -429,7 +429,7 @@ error[E0109]: type arguments are not allowed on this type LL | AliasFixed::<()>::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters help: you might have meant to specity type parameters on enum `Enum` @@ -444,7 +444,7 @@ error[E0109]: type arguments are not allowed on this type LL | Enum::<()>::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:93:23 @@ -452,7 +452,7 @@ error[E0109]: type arguments are not allowed on this type LL | Alias::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:95:29 @@ -460,7 +460,7 @@ error[E0109]: type arguments are not allowed on this type LL | Alias::<()>::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:98:28 @@ -468,7 +468,7 @@ error[E0109]: type arguments are not allowed on this type LL | AliasFixed::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:100:5 @@ -504,7 +504,7 @@ error[E0109]: type arguments are not allowed on this type LL | AliasFixed::<()>::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error: aborting due to 39 previous errors diff --git a/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr b/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr index 474548a14a9..51b1c8a1068 100644 --- a/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr +++ b/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _ = Alias::None::<u8>; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error: aborting due to previous error diff --git a/src/test/ui/type/issue-91268.stderr b/src/test/ui/type/issue-91268.stderr index 1df5a2cf07b..e426f450b11 100644 --- a/src/test/ui/type/issue-91268.stderr +++ b/src/test/ui/type/issue-91268.stderr @@ -41,7 +41,7 @@ error[E0109]: type arguments are not allowed on this type LL | 0: u8(ţ | -- ^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `u8` doesn't have generic parameters | diff --git a/src/test/ui/typeck/prim-with-args.stderr b/src/test/ui/typeck/prim-with-args.stderr index cdc7e96bfc5..c45fd00bae9 100644 --- a/src/test/ui/typeck/prim-with-args.stderr +++ b/src/test/ui/typeck/prim-with-args.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _x: isize<isize>; | ----- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `isize` doesn't have generic parameters | @@ -18,7 +18,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _x: i8<isize>; | -- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `i8` doesn't have generic parameters | @@ -32,7 +32,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _x: i16<isize>; | --- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `i16` doesn't have generic parameters | @@ -46,7 +46,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _x: i32<isize>; | --- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `i32` doesn't have generic parameters | @@ -60,7 +60,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _x: i64<isize>; | --- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `i64` doesn't have generic parameters | @@ -74,7 +74,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _x: usize<isize>; | ----- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `usize` doesn't have generic parameters | @@ -88,7 +88,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _x: u8<isize>; | -- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `u8` doesn't have generic parameters | @@ -102,7 +102,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _x: u16<isize>; | --- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `u16` doesn't have generic parameters | @@ -116,7 +116,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _x: u32<isize>; | --- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `u32` doesn't have generic parameters | @@ -130,7 +130,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _x: u64<isize>; | --- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `u64` doesn't have generic parameters | @@ -144,7 +144,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _x: char<isize>; | ---- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `char` doesn't have generic parameters | @@ -158,7 +158,7 @@ error[E0109]: lifetime arguments are not allowed on this type LL | let _x: isize<'static>; | ----- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `isize` doesn't have generic parameters | @@ -172,7 +172,7 @@ error[E0109]: lifetime arguments are not allowed on this type LL | let _x: i8<'static>; | -- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `i8` doesn't have generic parameters | @@ -186,7 +186,7 @@ error[E0109]: lifetime arguments are not allowed on this type LL | let _x: i16<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `i16` doesn't have generic parameters | @@ -200,7 +200,7 @@ error[E0109]: lifetime arguments are not allowed on this type LL | let _x: i32<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `i32` doesn't have generic parameters | @@ -214,7 +214,7 @@ error[E0109]: lifetime arguments are not allowed on this type LL | let _x: i64<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `i64` doesn't have generic parameters | @@ -228,7 +228,7 @@ error[E0109]: lifetime arguments are not allowed on this type LL | let _x: usize<'static>; | ----- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `usize` doesn't have generic parameters | @@ -242,7 +242,7 @@ error[E0109]: lifetime arguments are not allowed on this type LL | let _x: u8<'static>; | -- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `u8` doesn't have generic parameters | @@ -256,7 +256,7 @@ error[E0109]: lifetime arguments are not allowed on this type LL | let _x: u16<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `u16` doesn't have generic parameters | @@ -270,7 +270,7 @@ error[E0109]: lifetime arguments are not allowed on this type LL | let _x: u32<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `u32` doesn't have generic parameters | @@ -284,7 +284,7 @@ error[E0109]: lifetime arguments are not allowed on this type LL | let _x: u64<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `u64` doesn't have generic parameters | @@ -298,7 +298,7 @@ error[E0109]: lifetime arguments are not allowed on this type LL | let _x: char<'static>; | ---- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `char` doesn't have generic parameters | diff --git a/src/test/ui/usize-generic-argument-parent.stderr b/src/test/ui/usize-generic-argument-parent.stderr index b3980101104..abe8c09b739 100644 --- a/src/test/ui/usize-generic-argument-parent.stderr +++ b/src/test/ui/usize-generic-argument-parent.stderr @@ -4,7 +4,7 @@ error[E0109]: const arguments are not allowed on this type LL | let x: usize<foo>; | ----- ^^^ const argument not allowed | | - | not allowed on this + | not allowed on this type | help: primitive type `usize` doesn't have generic parameters | |
