diff --git a/compiler/rustc_infer/src/infer/canonical/query_response.rs b/compiler/rustc_infer/src/infer/canonical/query_response.rs index 074c9252481aa..2ec9b9e0be4a8 100644 --- a/compiler/rustc_infer/src/infer/canonical/query_response.rs +++ b/compiler/rustc_infer/src/infer/canonical/query_response.rs @@ -507,12 +507,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> { // Unify the original value for each variable with the value // taken from `query_response` (after applying `result_subst`). - Ok(self.unify_canonical_vars( - cause, - param_env, - original_values, - substituted_query_response, - )?) + self.unify_canonical_vars(cause, param_env, original_values, substituted_query_response) } /// Converts the region constraints resulting from a query into an diff --git a/compiler/rustc_middle/src/ty/codec.rs b/compiler/rustc_middle/src/ty/codec.rs index 0dad5df48551e..73ad87a9ef219 100644 --- a/compiler/rustc_middle/src/ty/codec.rs +++ b/compiler/rustc_middle/src/ty/codec.rs @@ -253,7 +253,7 @@ impl<'tcx, D: TyDecoder<'tcx>> Decodable for SubstsRef<'tcx> { fn decode(decoder: &mut D) -> Result { let len = decoder.read_usize()?; let tcx = decoder.tcx(); - Ok(tcx.mk_substs((0..len).map(|_| Decodable::decode(decoder)))?) + tcx.mk_substs((0..len).map(|_| Decodable::decode(decoder))) } } @@ -314,7 +314,7 @@ impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::AdtDef { impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::List> { fn decode(decoder: &mut D) -> Result<&'tcx Self, D::Error> { let len = decoder.read_usize()?; - Ok(decoder.tcx().mk_type_list((0..len).map(|_| Decodable::decode(decoder)))?) + decoder.tcx().mk_type_list((0..len).map(|_| Decodable::decode(decoder))) } } @@ -323,9 +323,7 @@ impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> { fn decode(decoder: &mut D) -> Result<&'tcx Self, D::Error> { let len = decoder.read_usize()?; - Ok(decoder - .tcx() - .mk_poly_existential_predicates((0..len).map(|_| Decodable::decode(decoder)))?) + decoder.tcx().mk_poly_existential_predicates((0..len).map(|_| Decodable::decode(decoder))) } } diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 286041a7c548b..64604b6459f27 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -607,7 +607,7 @@ pub trait PrettyPrinter<'tcx>: return Ok(self); } - return Ok(with_no_queries(|| { + return with_no_queries(|| { let def_key = self.tcx().def_key(def_id); if let Some(name) = def_key.disambiguated_data.data.get_opt_name() { p!(write("{}", name)); @@ -649,7 +649,7 @@ pub trait PrettyPrinter<'tcx>: p!(" Sized"); } Ok(self) - })?); + }); } ty::Str => p!("str"), ty::Generator(did, substs, movability) => { diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index 293b3c6b0470a..315e5d63d2bb3 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -154,7 +154,7 @@ pub fn relate_substs>( relation.relate_with_variance(variance, a, b) }); - Ok(tcx.mk_substs(params)?) + tcx.mk_substs(params) } impl<'tcx> Relate<'tcx> for ty::FnSig<'tcx> { @@ -647,7 +647,7 @@ impl<'tcx> Relate<'tcx> for &'tcx ty::List Err(TypeError::ExistentialMismatch(expected_found(relation, a, b))), } }); - Ok(tcx.mk_poly_existential_predicates(v)?) + tcx.mk_poly_existential_predicates(v) } } diff --git a/compiler/rustc_mir/src/interpret/traits.rs b/compiler/rustc_mir/src/interpret/traits.rs index 09ce6bc0fb754..50603bdd45b40 100644 --- a/compiler/rustc_mir/src/interpret/traits.rs +++ b/compiler/rustc_mir/src/interpret/traits.rs @@ -118,7 +118,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { .get_raw(vtable_slot.alloc_id)? .read_ptr_sized(self, vtable_slot)? .check_init()?; - Ok(self.memory.get_fn(fn_ptr)?) + self.memory.get_fn(fn_ptr) } /// Returns the drop fn instance as well as the actual dynamic type. diff --git a/compiler/rustc_mir/src/util/generic_graphviz.rs b/compiler/rustc_mir/src/util/generic_graphviz.rs index fd55a4dfc4c92..fd41e28226632 100644 --- a/compiler/rustc_mir/src/util/generic_graphviz.rs +++ b/compiler/rustc_mir/src/util/generic_graphviz.rs @@ -6,8 +6,8 @@ use std::io::{self, Write}; pub struct GraphvizWriter< 'a, G: graph::DirectedGraph + graph::WithSuccessors + graph::WithStartNode + graph::WithNumNodes, - NodeContentFn: Fn(::Node) -> Vec, - EdgeLabelsFn: Fn(::Node) -> Vec, + NodeContentFn: Fn(::Node) -> Vec, + EdgeLabelsFn: Fn(::Node) -> Vec, > { graph: &'a G, is_subgraph: bool, @@ -20,8 +20,8 @@ pub struct GraphvizWriter< impl< 'a, G: graph::DirectedGraph + graph::WithSuccessors + graph::WithStartNode + graph::WithNumNodes, - NodeContentFn: Fn(::Node) -> Vec, - EdgeLabelsFn: Fn(::Node) -> Vec, + NodeContentFn: Fn(::Node) -> Vec, + EdgeLabelsFn: Fn(::Node) -> Vec, > GraphvizWriter<'a, G, NodeContentFn, EdgeLabelsFn> { pub fn new( diff --git a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs index 010fe4fd524d4..38b7e50d78672 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs @@ -289,7 +289,6 @@ use super::{PatternFoldable, PatternFolder}; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::sync::OnceCell; use rustc_arena::TypedArena; use rustc_hir::def_id::DefId; @@ -300,6 +299,7 @@ use rustc_span::Span; use smallvec::{smallvec, SmallVec}; use std::fmt; use std::iter::{FromIterator, IntoIterator}; +use std::lazy::OnceCell; crate struct MatchCheckCtxt<'a, 'tcx> { crate tcx: TyCtxt<'tcx>, diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index c5dbd3ed08961..5b14795f5457c 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -783,9 +783,11 @@ supported_targets! { ("riscv32imc-unknown-none-elf", riscv32imc_unknown_none_elf), ("riscv32imac-unknown-none-elf", riscv32imac_unknown_none_elf), ("riscv32gc-unknown-linux-gnu", riscv32gc_unknown_linux_gnu), + ("riscv32gc-unknown-linux-musl", riscv32gc_unknown_linux_musl), ("riscv64imac-unknown-none-elf", riscv64imac_unknown_none_elf), ("riscv64gc-unknown-none-elf", riscv64gc_unknown_none_elf), ("riscv64gc-unknown-linux-gnu", riscv64gc_unknown_linux_gnu), + ("riscv64gc-unknown-linux-musl", riscv64gc_unknown_linux_musl), ("aarch64-unknown-none", aarch64_unknown_none), ("aarch64-unknown-none-softfloat", aarch64_unknown_none_softfloat), diff --git a/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_musl.rs new file mode 100644 index 0000000000000..e5fbd09297f65 --- /dev/null +++ b/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_musl.rs @@ -0,0 +1,19 @@ +use crate::spec::{CodeModel, Target, TargetOptions}; + +pub fn target() -> Target { + Target { + llvm_target: "riscv32-unknown-linux-musl".to_string(), + pointer_width: 32, + data_layout: "e-m:e-p:32:32-i64:64-n32-S128".to_string(), + arch: "riscv32".to_string(), + options: TargetOptions { + unsupported_abis: super::riscv_base::unsupported_abis(), + code_model: Some(CodeModel::Medium), + cpu: "generic-rv32".to_string(), + features: "+m,+a,+f,+d,+c".to_string(), + llvm_abiname: "ilp32d".to_string(), + max_atomic_width: Some(32), + ..super::linux_musl_base::opts() + }, + } +} diff --git a/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_musl.rs new file mode 100644 index 0000000000000..0232b15e8c269 --- /dev/null +++ b/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_musl.rs @@ -0,0 +1,19 @@ +use crate::spec::{CodeModel, Target, TargetOptions}; + +pub fn target() -> Target { + Target { + llvm_target: "riscv64-unknown-linux-musl".to_string(), + pointer_width: 64, + data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".to_string(), + arch: "riscv64".to_string(), + options: TargetOptions { + unsupported_abis: super::riscv_base::unsupported_abis(), + code_model: Some(CodeModel::Medium), + cpu: "generic-rv64".to_string(), + features: "+m,+a,+f,+d,+c".to_string(), + llvm_abiname: "lp64d".to_string(), + max_atomic_width: Some(64), + ..super::linux_musl_base::opts() + }, + } +} diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs index 1688539165ab5..68356ce73aacd 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs @@ -43,7 +43,7 @@ where info!("fully_perform({:?})", self); } - scrape_region_constraints(infcx, || Ok((self.closure)(infcx)?)) + scrape_region_constraints(infcx, || (self.closure)(infcx)) } } diff --git a/compiler/rustc_typeck/src/astconv/generics.rs b/compiler/rustc_typeck/src/astconv/generics.rs index 67e37ca8d8e49..0ea0ccaceabd4 100644 --- a/compiler/rustc_typeck/src/astconv/generics.rs +++ b/compiler/rustc_typeck/src/astconv/generics.rs @@ -6,8 +6,9 @@ use crate::astconv::{ use crate::errors::AssocTypeBindingNotAllowed; use crate::structured_errors::{StructuredDiagnostic, WrongNumberOfGenericArgs}; use rustc_ast::ast::ParamKindOrd; -use rustc_errors::{struct_span_err, Applicability, ErrorReported}; +use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorReported}; use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::DefId; use rustc_hir::GenericArg; use rustc_middle::ty::{ @@ -43,23 +44,57 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } } + let add_braces_suggestion = |arg: &GenericArg<'_>, err: &mut DiagnosticBuilder<'_>| { + let suggestions = vec![ + (arg.span().shrink_to_lo(), String::from("{ ")), + (arg.span().shrink_to_hi(), String::from(" }")), + ]; + err.multipart_suggestion( + "if this generic argument was intended as a const parameter, \ + surround it with braces", + suggestions, + Applicability::MaybeIncorrect, + ); + }; + // Specific suggestion set for diagnostics match (arg, ¶m.kind) { ( - GenericArg::Type(hir::Ty { kind: hir::TyKind::Path { .. }, .. }), - GenericParamDefKind::Const { .. }, - ) => { - let suggestions = vec![ - (arg.span().shrink_to_lo(), String::from("{ ")), - (arg.span().shrink_to_hi(), String::from(" }")), - ]; - err.multipart_suggestion( - "if this generic argument was intended as a const parameter, \ - try surrounding it with braces:", - suggestions, - Applicability::MaybeIncorrect, - ); - } + GenericArg::Type(hir::Ty { + kind: hir::TyKind::Path(rustc_hir::QPath::Resolved(_, path)), + .. + }), + GenericParamDefKind::Const, + ) => match path.res { + Res::Err => { + add_braces_suggestion(arg, &mut err); + err.set_primary_message( + "unresolved item provided when a constant was expected", + ) + .emit(); + return; + } + Res::Def(DefKind::TyParam, src_def_id) => { + if let Some(param_local_id) = param.def_id.as_local() { + let param_hir_id = tcx.hir().local_def_id_to_hir_id(param_local_id); + let param_name = tcx.hir().ty_param_name(param_hir_id); + let param_type = tcx.type_of(param.def_id); + if param_type.is_suggestable() { + err.span_suggestion( + tcx.def_span(src_def_id), + "consider changing this type paramater to a `const`-generic", + format!("const {}: {}", param_name, param_type), + Applicability::MaybeIncorrect, + ); + }; + } + } + _ => add_braces_suggestion(arg, &mut err), + }, + ( + GenericArg::Type(hir::Ty { kind: hir::TyKind::Path(_), .. }), + GenericParamDefKind::Const, + ) => add_braces_suggestion(arg, &mut err), ( GenericArg::Type(hir::Ty { kind: hir::TyKind::Array(_, len), .. }), GenericParamDefKind::Const { .. }, diff --git a/compiler/rustc_typeck/src/check/method/suggest.rs b/compiler/rustc_typeck/src/check/method/suggest.rs index faa47230d3a06..16c3dd696abee 100644 --- a/compiler/rustc_typeck/src/check/method/suggest.rs +++ b/compiler/rustc_typeck/src/check/method/suggest.rs @@ -1141,7 +1141,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let trait_def_ids: FxHashSet = param .bounds .iter() - .filter_map(|bound| Some(bound.trait_ref()?.trait_def_id()?)) + .filter_map(|bound| bound.trait_ref()?.trait_def_id()) .collect(); if !candidates.iter().any(|t| trait_def_ids.contains(&t.def_id)) { err.span_suggestions( diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs index 1160011f35287..e736bf19e8f93 100644 --- a/library/std/src/io/stdio.rs +++ b/library/std/src/io/stdio.rs @@ -231,7 +231,7 @@ pub struct Stdin { inner: &'static Mutex>, } -/// A locked reference to the `Stdin` handle. +/// A locked reference to the [`Stdin`] handle. /// /// This handle implements both the [`Read`] and [`BufRead`] traits, and /// is constructed via the [`Stdin::lock`] method. @@ -494,7 +494,7 @@ pub struct Stdout { inner: Pin<&'static ReentrantMutex>>>, } -/// A locked reference to the `Stdout` handle. +/// A locked reference to the [`Stdout`] handle. /// /// This handle implements the [`Write`] trait, and is constructed via /// the [`Stdout::lock`] method. @@ -708,9 +708,9 @@ pub struct Stderr { inner: Pin<&'static ReentrantMutex>>, } -/// A locked reference to the `Stderr` handle. +/// A locked reference to the [`Stderr`] handle. /// -/// This handle implements the `Write` trait and is constructed via +/// This handle implements the [`Write`] trait and is constructed via /// the [`Stderr::lock`] method. /// /// ### Note: Windows Portability Consideration diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs index a32a4a7fe56c2..e730a2557e0bf 100644 --- a/src/bootstrap/bin/main.rs +++ b/src/bootstrap/bin/main.rs @@ -22,7 +22,10 @@ fn main() { let suggest_setup = !config.config.exists() && !matches!(config.cmd, Subcommand::Setup { .. }); if suggest_setup { println!("warning: you have not made a `config.toml`"); - println!("help: consider running `x.py setup` or copying `config.toml.example`"); + println!( + "help: consider running `./x.py setup` or copying `config.toml.example` by running \ + `cp config.toml.example config.toml`" + ); } else if let Some(suggestion) = &changelog_suggestion { println!("{}", suggestion); } @@ -31,7 +34,10 @@ fn main() { if suggest_setup { println!("warning: you have not made a `config.toml`"); - println!("help: consider running `x.py setup` or copying `config.toml.example`"); + println!( + "help: consider running `./x.py setup` or copying `config.toml.example` by running \ + `cp config.toml.example config.toml`" + ); } else if let Some(suggestion) = &changelog_suggestion { println!("{}", suggestion); } diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index eb74041964701..8198dbaa5278c 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -204,7 +204,9 @@ target | std | host | notes `powerpc64-unknown-linux-musl` | ? | | `powerpc64-wrs-vxworks` | ? | | `powerpc64le-unknown-linux-musl` | ? | | +`riscv64gc-unknown-linux-musl` | | | RISC-V Linux (kernel 4.20, musl 1.2.0) `riscv32gc-unknown-linux-gnu` | | | RISC-V Linux (kernel 5.4, glibc 2.33) +`riscv32gc-unknown-linux-musl` | | | RISC-V Linux (kernel 5.4, musl + RISCV32 support patches) `sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux `sparc64-unknown-netbsd` | ✓ | ✓ | NetBSD/sparc64 `sparc64-unknown-openbsd` | ? | | diff --git a/src/test/ui/issues/issue-21726.rs b/src/test/ui/associated-types/issue-21726.rs similarity index 100% rename from src/test/ui/issues/issue-21726.rs rename to src/test/ui/associated-types/issue-21726.rs diff --git a/src/test/ui/issues/issue-22560.rs b/src/test/ui/associated-types/issue-22560.rs similarity index 100% rename from src/test/ui/issues/issue-22560.rs rename to src/test/ui/associated-types/issue-22560.rs diff --git a/src/test/ui/issues/issue-22560.stderr b/src/test/ui/associated-types/issue-22560.stderr similarity index 100% rename from src/test/ui/issues/issue-22560.stderr rename to src/test/ui/associated-types/issue-22560.stderr diff --git a/src/test/ui/issues/issue-23595-2.rs b/src/test/ui/associated-types/issue-23595-2.rs similarity index 100% rename from src/test/ui/issues/issue-23595-2.rs rename to src/test/ui/associated-types/issue-23595-2.rs diff --git a/src/test/ui/issues/issue-23595-2.stderr b/src/test/ui/associated-types/issue-23595-2.stderr similarity index 100% rename from src/test/ui/issues/issue-23595-2.stderr rename to src/test/ui/associated-types/issue-23595-2.stderr diff --git a/src/test/ui/issues/issue-24204.rs b/src/test/ui/associated-types/issue-24204.rs similarity index 100% rename from src/test/ui/issues/issue-24204.rs rename to src/test/ui/associated-types/issue-24204.rs diff --git a/src/test/ui/issues/issue-43784-associated-type.rs b/src/test/ui/associated-types/issue-43784-associated-type.rs similarity index 100% rename from src/test/ui/issues/issue-43784-associated-type.rs rename to src/test/ui/associated-types/issue-43784-associated-type.rs diff --git a/src/test/ui/issues/issue-43784-associated-type.stderr b/src/test/ui/associated-types/issue-43784-associated-type.stderr similarity index 100% rename from src/test/ui/issues/issue-43784-associated-type.stderr rename to src/test/ui/associated-types/issue-43784-associated-type.stderr diff --git a/src/test/ui/project-defer-unification.rs b/src/test/ui/associated-types/project-defer-unification.rs similarity index 100% rename from src/test/ui/project-defer-unification.rs rename to src/test/ui/associated-types/project-defer-unification.rs diff --git a/src/test/ui/issues/issue-77993-2.rs b/src/test/ui/async-await/issue-77993-2.rs similarity index 100% rename from src/test/ui/issues/issue-77993-2.rs rename to src/test/ui/async-await/issue-77993-2.rs diff --git a/src/test/ui/issues/issue-77993-2.stderr b/src/test/ui/async-await/issue-77993-2.stderr similarity index 100% rename from src/test/ui/issues/issue-77993-2.stderr rename to src/test/ui/async-await/issue-77993-2.stderr diff --git a/src/test/ui/repeat_count_const_in_async_fn.rs b/src/test/ui/async-await/repeat_count_const_in_async_fn.rs similarity index 100% rename from src/test/ui/repeat_count_const_in_async_fn.rs rename to src/test/ui/async-await/repeat_count_const_in_async_fn.rs diff --git a/src/test/ui/const-generics/const-param-shadowing.stderr b/src/test/ui/const-generics/const-param-shadowing.stderr index 7447ca3ff3631..17ccd2f3527b0 100644 --- a/src/test/ui/const-generics/const-param-shadowing.stderr +++ b/src/test/ui/const-generics/const-param-shadowing.stderr @@ -4,7 +4,7 @@ error[E0747]: type provided when a constant was expected LL | fn test() -> Foo { | ^ | -help: if this generic argument was intended as a const parameter, try surrounding it with braces: +help: if this generic argument was intended as a const parameter, surround it with braces | LL | fn test() -> Foo<{ N }> { | ^ ^ diff --git a/src/test/ui/const-generics/diagnostics.rs b/src/test/ui/const-generics/diagnostics.rs new file mode 100644 index 0000000000000..1581af5ab2751 --- /dev/null +++ b/src/test/ui/const-generics/diagnostics.rs @@ -0,0 +1,18 @@ +#![crate_type="lib"] +#![feature(min_const_generics)] +#![allow(incomplete_features)] + +struct A; +trait Foo {} +impl Foo for A {} +//~^ ERROR cannot find type +//~| unresolved item provided when a constant + +struct B; +impl Foo for B {} +//~^ ERROR type provided when a constant + +struct C; +impl Foo for C {} +//~^ ERROR cannot find type +//~| unresolved item provided when a constant diff --git a/src/test/ui/const-generics/diagnostics.stderr b/src/test/ui/const-generics/diagnostics.stderr new file mode 100644 index 0000000000000..7d038ff955d6c --- /dev/null +++ b/src/test/ui/const-generics/diagnostics.stderr @@ -0,0 +1,52 @@ +error[E0412]: cannot find type `N` in this scope + --> $DIR/diagnostics.rs:7:16 + | +LL | struct A; + | ---------------------- similarly named struct `A` defined here +LL | trait Foo {} +LL | impl Foo for A {} + | ^ help: a struct with a similar name exists: `A` + +error[E0412]: cannot find type `T` in this scope + --> $DIR/diagnostics.rs:16:32 + | +LL | struct A; + | ---------------------- similarly named struct `A` defined here +... +LL | impl Foo for C {} + | ^ help: a struct with a similar name exists: `A` + +error[E0747]: unresolved item provided when a constant was expected + --> $DIR/diagnostics.rs:7:16 + | +LL | impl Foo for A {} + | ^ + | +help: if this generic argument was intended as a const parameter, surround it with braces + | +LL | impl Foo for A<{ N }> {} + | ^ ^ + +error[E0747]: type provided when a constant was expected + --> $DIR/diagnostics.rs:12:19 + | +LL | impl Foo for B {} + | - ^ + | | + | help: consider changing this type paramater to a `const`-generic: `const N: u8` + +error[E0747]: unresolved item provided when a constant was expected + --> $DIR/diagnostics.rs:16:32 + | +LL | impl Foo for C {} + | ^ + | +help: if this generic argument was intended as a const parameter, surround it with braces + | +LL | impl Foo for C {} + | ^ ^ + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0412, E0747. +For more information about an error, try `rustc --explain E0412`. diff --git a/src/test/ui/const-generics/invalid-enum.rs b/src/test/ui/const-generics/invalid-enum.rs index 4ca10ed8b71a2..32939dcd2861b 100644 --- a/src/test/ui/const-generics/invalid-enum.rs +++ b/src/test/ui/const-generics/invalid-enum.rs @@ -3,14 +3,14 @@ #[derive(PartialEq, Eq)] enum CompileFlag { - A, - B, + A, + B, } pub fn test_1() {} pub fn test_2(x: T) {} pub struct Example{ - x: T, + x: T, } impl Example { @@ -20,15 +20,15 @@ impl Example { pub fn main() { test_1::(); //~^ ERROR: expected type, found variant - //~| ERROR: type provided when a constant was expected + //~| ERROR: unresolved item provided when a constant was expected test_2::<_, CompileFlag::A>(0); //~^ ERROR: expected type, found variant - //~| ERROR: type provided when a constant was expected + //~| ERROR: unresolved item provided when a constant was expected let _: Example = Example { x: 0 }; //~^ ERROR: expected type, found variant - //~| ERROR: type provided when a constant was expected + //~| ERROR: unresolved item provided when a constant was expected let _: Example = Example { x: 0 }; //~^ ERROR: type provided when a constant was expected diff --git a/src/test/ui/const-generics/invalid-enum.stderr b/src/test/ui/const-generics/invalid-enum.stderr index 7822fc072e35c..cfbc61f02543b 100644 --- a/src/test/ui/const-generics/invalid-enum.stderr +++ b/src/test/ui/const-generics/invalid-enum.stderr @@ -25,13 +25,13 @@ LL | let _: Example = Example { x: 0 }; | not a type | help: try using the variant's enum: `CompileFlag` -error[E0747]: type provided when a constant was expected +error[E0747]: unresolved item provided when a constant was expected --> $DIR/invalid-enum.rs:29:18 | LL | let _: Example = Example { x: 0 }; | ^^^^^^^^^^^^^^ | -help: if this generic argument was intended as a const parameter, try surrounding it with braces: +help: if this generic argument was intended as a const parameter, surround it with braces | LL | let _: Example<{ CompileFlag::A }, _> = Example { x: 0 }; | ^ ^ @@ -42,29 +42,29 @@ error[E0747]: type provided when a constant was expected LL | let _: Example = Example { x: 0 }; | ^^^^^^^^^^^^^^^^^^^ | -help: if this generic argument was intended as a const parameter, try surrounding it with braces: +help: if this generic argument was intended as a const parameter, surround it with braces | LL | let _: Example<{ Example::ASSOC_FLAG }, _> = Example { x: 0 }; | ^ ^ -error[E0747]: type provided when a constant was expected +error[E0747]: unresolved item provided when a constant was expected --> $DIR/invalid-enum.rs:21:12 | LL | test_1::(); | ^^^^^^^^^^^^^^ | -help: if this generic argument was intended as a const parameter, try surrounding it with braces: +help: if this generic argument was intended as a const parameter, surround it with braces | LL | test_1::<{ CompileFlag::A }>(); | ^ ^ -error[E0747]: type provided when a constant was expected +error[E0747]: unresolved item provided when a constant was expected --> $DIR/invalid-enum.rs:25:15 | LL | test_2::<_, CompileFlag::A>(0); | ^^^^^^^^^^^^^^ | -help: if this generic argument was intended as a const parameter, try surrounding it with braces: +help: if this generic argument was intended as a const parameter, surround it with braces | LL | test_2::<_, { CompileFlag::A }>(0); | ^ ^ diff --git a/src/test/ui/issues/issue-13837.rs b/src/test/ui/consts/issue-13837.rs similarity index 100% rename from src/test/ui/issues/issue-13837.rs rename to src/test/ui/consts/issue-13837.rs diff --git a/src/test/ui/issues/issue-17718-references.rs b/src/test/ui/consts/issue-17718-references.rs similarity index 100% rename from src/test/ui/issues/issue-17718-references.rs rename to src/test/ui/consts/issue-17718-references.rs diff --git a/src/test/ui/issues/issue-17718-references.stderr b/src/test/ui/consts/issue-17718-references.stderr similarity index 100% rename from src/test/ui/issues/issue-17718-references.stderr rename to src/test/ui/consts/issue-17718-references.stderr diff --git a/src/test/ui/issues/issue-32829.rs b/src/test/ui/consts/issue-32829.rs similarity index 100% rename from src/test/ui/issues/issue-32829.rs rename to src/test/ui/consts/issue-32829.rs diff --git a/src/test/ui/issues/issue-32829.stderr b/src/test/ui/consts/issue-32829.stderr similarity index 100% rename from src/test/ui/issues/issue-32829.stderr rename to src/test/ui/consts/issue-32829.stderr diff --git a/src/test/ui/issues/issue-33537.rs b/src/test/ui/consts/issue-33537.rs similarity index 100% rename from src/test/ui/issues/issue-33537.rs rename to src/test/ui/consts/issue-33537.rs diff --git a/src/test/ui/rvalue-static-promotion.rs b/src/test/ui/consts/rvalue-static-promotion.rs similarity index 100% rename from src/test/ui/rvalue-static-promotion.rs rename to src/test/ui/consts/rvalue-static-promotion.rs diff --git a/src/test/ui/write-to-static-mut-in-static.rs b/src/test/ui/consts/write-to-static-mut-in-static.rs similarity index 100% rename from src/test/ui/write-to-static-mut-in-static.rs rename to src/test/ui/consts/write-to-static-mut-in-static.rs diff --git a/src/test/ui/write-to-static-mut-in-static.stderr b/src/test/ui/consts/write-to-static-mut-in-static.stderr similarity index 100% rename from src/test/ui/write-to-static-mut-in-static.stderr rename to src/test/ui/consts/write-to-static-mut-in-static.stderr diff --git a/src/test/ui/emit-artifact-notifications.nll.stderr b/src/test/ui/emit-artifact-notifications.nll.stderr deleted file mode 100644 index 5547631a4b022..0000000000000 --- a/src/test/ui/emit-artifact-notifications.nll.stderr +++ /dev/null @@ -1 +0,0 @@ -{"artifact":"$TEST_BUILD_DIR/emit-artifact-notifications.nll/libemit_artifact_notifications.rmeta","emit":"metadata"} diff --git a/src/test/ui/emit-artifact-notifications.polonius.stderr b/src/test/ui/emit-artifact-notifications.polonius.stderr deleted file mode 100644 index 47b48b399c25c..0000000000000 --- a/src/test/ui/emit-artifact-notifications.polonius.stderr +++ /dev/null @@ -1 +0,0 @@ -{"artifact":"$TEST_BUILD_DIR/emit-artifact-notifications.polonius/libemit_artifact_notifications.rmeta","emit":"metadata"} diff --git a/src/test/ui/emit-artifact-notifications.stderr b/src/test/ui/emit-artifact-notifications.stderr deleted file mode 100644 index 260d41b8f15cc..0000000000000 --- a/src/test/ui/emit-artifact-notifications.stderr +++ /dev/null @@ -1 +0,0 @@ -{"artifact":"$TEST_BUILD_DIR/emit-artifact-notifications/libemit_artifact_notifications.rmeta","emit":"metadata"} diff --git a/src/test/ui/expr-if-panic.rs b/src/test/ui/expr/if/expr-if-panic-pass.rs similarity index 100% rename from src/test/ui/expr-if-panic.rs rename to src/test/ui/expr/if/expr-if-panic-pass.rs diff --git a/src/test/ui/issues/issue-4201.rs b/src/test/ui/expr/if/issue-4201.rs similarity index 100% rename from src/test/ui/issues/issue-4201.rs rename to src/test/ui/expr/if/issue-4201.rs diff --git a/src/test/ui/issues/issue-4201.stderr b/src/test/ui/expr/if/issue-4201.stderr similarity index 100% rename from src/test/ui/issues/issue-4201.stderr rename to src/test/ui/expr/if/issue-4201.stderr diff --git a/src/test/ui/cleanup-rvalue-during-if-and-while.rs b/src/test/ui/for-loop-while/cleanup-rvalue-during-if-and-while.rs similarity index 100% rename from src/test/ui/cleanup-rvalue-during-if-and-while.rs rename to src/test/ui/for-loop-while/cleanup-rvalue-during-if-and-while.rs diff --git a/src/test/ui/issues/issue-40847.rs b/src/test/ui/hygiene/issue-40847.rs similarity index 100% rename from src/test/ui/issues/issue-40847.rs rename to src/test/ui/hygiene/issue-40847.rs diff --git a/src/test/ui/issues/issue-6157.rs b/src/test/ui/issue-6157.rs similarity index 100% rename from src/test/ui/issues/issue-6157.rs rename to src/test/ui/issue-6157.rs diff --git a/src/test/ui/issues/issue-31924-non-snake-ffi.rs b/src/test/ui/lint/issue-31924-non-snake-ffi.rs similarity index 100% rename from src/test/ui/issues/issue-31924-non-snake-ffi.rs rename to src/test/ui/lint/issue-31924-non-snake-ffi.rs diff --git a/src/test/ui/html-literals.rs b/src/test/ui/macros/html-literals.rs similarity index 100% rename from src/test/ui/html-literals.rs rename to src/test/ui/macros/html-literals.rs diff --git a/src/test/ui/dotdotdot-expr.rs b/src/test/ui/parser/dotdotdot-expr.rs similarity index 100% rename from src/test/ui/dotdotdot-expr.rs rename to src/test/ui/parser/dotdotdot-expr.rs diff --git a/src/test/ui/dotdotdot-expr.stderr b/src/test/ui/parser/dotdotdot-expr.stderr similarity index 100% rename from src/test/ui/dotdotdot-expr.stderr rename to src/test/ui/parser/dotdotdot-expr.stderr diff --git a/src/test/ui/issues/issue-20616-3.rs b/src/test/ui/parser/issue-20616-3.rs similarity index 100% rename from src/test/ui/issues/issue-20616-3.rs rename to src/test/ui/parser/issue-20616-3.rs diff --git a/src/test/ui/issues/issue-20616-3.stderr b/src/test/ui/parser/issue-20616-3.stderr similarity index 100% rename from src/test/ui/issues/issue-20616-3.stderr rename to src/test/ui/parser/issue-20616-3.stderr diff --git a/src/test/ui/issues/issue-44406.rs b/src/test/ui/parser/issue-44406.rs similarity index 100% rename from src/test/ui/issues/issue-44406.rs rename to src/test/ui/parser/issue-44406.rs diff --git a/src/test/ui/issues/issue-44406.stderr b/src/test/ui/parser/issue-44406.stderr similarity index 100% rename from src/test/ui/issues/issue-44406.stderr rename to src/test/ui/parser/issue-44406.stderr diff --git a/src/test/ui/old-suffixes-are-really-forbidden.rs b/src/test/ui/parser/old-suffixes-are-really-forbidden.rs similarity index 100% rename from src/test/ui/old-suffixes-are-really-forbidden.rs rename to src/test/ui/parser/old-suffixes-are-really-forbidden.rs diff --git a/src/test/ui/old-suffixes-are-really-forbidden.stderr b/src/test/ui/parser/old-suffixes-are-really-forbidden.stderr similarity index 100% rename from src/test/ui/old-suffixes-are-really-forbidden.stderr rename to src/test/ui/parser/old-suffixes-are-really-forbidden.stderr diff --git a/src/test/ui/struct-literal-variant-in-if.rs b/src/test/ui/parser/struct-literal-variant-in-if.rs similarity index 100% rename from src/test/ui/struct-literal-variant-in-if.rs rename to src/test/ui/parser/struct-literal-variant-in-if.rs diff --git a/src/test/ui/struct-literal-variant-in-if.stderr b/src/test/ui/parser/struct-literal-variant-in-if.stderr similarity index 100% rename from src/test/ui/struct-literal-variant-in-if.stderr rename to src/test/ui/parser/struct-literal-variant-in-if.stderr diff --git a/src/test/ui/range_inclusive_gate.rs b/src/test/ui/range_inclusive_gate.rs deleted file mode 100644 index e26e31b44a079..0000000000000 --- a/src/test/ui/range_inclusive_gate.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass - -#![allow(unused_comparisons)] -// Test that you only need the syntax gate if you don't mention the structs. -// (Obsoleted since both features are stabilized) - -fn main() { - let mut count = 0; - for i in 0_usize..=10 { - assert!(i >= 0 && i <= 10); - count += i; - } - assert_eq!(count, 55); -} diff --git a/src/test/ui/regions-fn-subtyping-return-static-fail.nll.stderr b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr similarity index 100% rename from src/test/ui/regions-fn-subtyping-return-static-fail.nll.stderr rename to src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr diff --git a/src/test/ui/regions-fn-subtyping-return-static-fail.rs b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.rs similarity index 100% rename from src/test/ui/regions-fn-subtyping-return-static-fail.rs rename to src/test/ui/regions/regions-fn-subtyping-return-static-fail.rs diff --git a/src/test/ui/regions-fn-subtyping-return-static-fail.stderr b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.stderr similarity index 100% rename from src/test/ui/regions-fn-subtyping-return-static-fail.stderr rename to src/test/ui/regions/regions-fn-subtyping-return-static-fail.stderr diff --git a/src/test/ui/rmeta/emit-artifact-notifications.nll.stderr b/src/test/ui/rmeta/emit-artifact-notifications.nll.stderr new file mode 100644 index 0000000000000..ed62f30028491 --- /dev/null +++ b/src/test/ui/rmeta/emit-artifact-notifications.nll.stderr @@ -0,0 +1 @@ +{"artifact":"$TEST_BUILD_DIR/rmeta/emit-artifact-notifications.nll/libemit_artifact_notifications.rmeta","emit":"metadata"} diff --git a/src/test/ui/rmeta/emit-artifact-notifications.polonius.stderr b/src/test/ui/rmeta/emit-artifact-notifications.polonius.stderr new file mode 100644 index 0000000000000..255c7b370f9fd --- /dev/null +++ b/src/test/ui/rmeta/emit-artifact-notifications.polonius.stderr @@ -0,0 +1 @@ +{"artifact":"$TEST_BUILD_DIR/rmeta/emit-artifact-notifications.polonius/libemit_artifact_notifications.rmeta","emit":"metadata"} diff --git a/src/test/ui/emit-artifact-notifications.rs b/src/test/ui/rmeta/emit-artifact-notifications.rs similarity index 100% rename from src/test/ui/emit-artifact-notifications.rs rename to src/test/ui/rmeta/emit-artifact-notifications.rs diff --git a/src/test/ui/rmeta/emit-artifact-notifications.stderr b/src/test/ui/rmeta/emit-artifact-notifications.stderr new file mode 100644 index 0000000000000..b2f0aa7575c06 --- /dev/null +++ b/src/test/ui/rmeta/emit-artifact-notifications.stderr @@ -0,0 +1 @@ +{"artifact":"$TEST_BUILD_DIR/rmeta/emit-artifact-notifications/libemit_artifact_notifications.rmeta","emit":"metadata"} diff --git a/src/test/ui/emit-metadata-obj.rs b/src/test/ui/rmeta/emit-metadata-obj.rs similarity index 100% rename from src/test/ui/emit-metadata-obj.rs rename to src/test/ui/rmeta/emit-metadata-obj.rs diff --git a/src/test/ui/type-sizes.rs b/src/test/ui/structs-enums/type-sizes.rs similarity index 100% rename from src/test/ui/type-sizes.rs rename to src/test/ui/structs-enums/type-sizes.rs diff --git a/src/test/ui/one-tuple.rs b/src/test/ui/tuple/one-tuple.rs similarity index 100% rename from src/test/ui/one-tuple.rs rename to src/test/ui/tuple/one-tuple.rs diff --git a/src/test/ui/type-id-higher-rank.rs b/src/test/ui/unboxed-closures/type-id-higher-rank.rs similarity index 100% rename from src/test/ui/type-id-higher-rank.rs rename to src/test/ui/unboxed-closures/type-id-higher-rank.rs diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 74ed236675208..659d5ae03c9d8 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -7,8 +7,8 @@ use std::path::Path; const ENTRY_LIMIT: usize = 1000; // FIXME: The following limits should be reduced eventually. -const ROOT_ENTRY_LIMIT: usize = 1459; -const ISSUES_ENTRY_LIMIT: usize = 2615; +const ROOT_ENTRY_LIMIT: usize = 1418; +const ISSUES_ENTRY_LIMIT: usize = 2582; fn check_entries(path: &Path, bad: &mut bool) { let dirs = walkdir::WalkDir::new(&path.join("test/ui"))