diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index be5458523d1ca..26e429034dca6 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -540,7 +540,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // \-------/ // let virtual_drop = Instance { - def: ty::InstanceDef::Virtual(drop_fn.def_id(), 0), + def: ty::InstanceDef::Virtual(drop_fn.def_id(), 0), // idx 0: the drop function args: drop_fn.args, }; debug!("ty = {:?}", ty); @@ -581,7 +581,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // // SO THEN WE CAN USE THE ABOVE CODE. let virtual_drop = Instance { - def: ty::InstanceDef::Virtual(drop_fn.def_id(), 0), + def: ty::InstanceDef::Virtual(drop_fn.def_id(), 0), // idx 0: the drop function args: drop_fn.args, }; debug!("ty = {:?}", ty); diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs index 07425f9a6865c..b474003087ba3 100644 --- a/compiler/rustc_const_eval/src/interpret/terminator.rs +++ b/compiler/rustc_const_eval/src/interpret/terminator.rs @@ -169,10 +169,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } Drop { place, target, unwind, replace: _ } => { - let frame = self.frame(); - let ty = place.ty(&frame.body.local_decls, *self.tcx).ty; - let ty = self.instantiate_from_frame_and_normalize_erasing_regions(frame, ty)?; - let instance = Instance::resolve_drop_in_place(*self.tcx, ty); + let place = self.eval_place(place)?; + let instance = Instance::resolve_drop_in_place(*self.tcx, place.layout.ty); if let ty::InstanceDef::DropGlue(_, None) = instance.def { // This is the branch we enter if and only if the dropped type has no drop glue // whatsoever. This can happen as a result of monomorphizing a drop of a @@ -181,8 +179,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { self.go_to_block(target); return Ok(()); } - let place = self.eval_place(place)?; - trace!("TerminatorKind::drop: {:?}, type {}", place, ty); + trace!("TerminatorKind::drop: {:?}, type {}", place, place.layout.ty); self.drop_in_place(&place, instance, target, unwind)?; } @@ -952,6 +949,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // implementation fail -- a problem shared by rustc. let place = self.force_allocation(place)?; + // We behave a bit different from codegen here. + // Codegen creates an `InstanceDef::Virtual` with index 0 (the slot of the drop method) and + // then dispatches that to the normal call machinery. However, our call machinery currently + // only supports calling `VtblEntry::Method`; it would choke on a `MetadataDropInPlace`. So + // instead we do the virtual call stuff ourselves. It's easier here than in `eval_fn_call` + // since we can just get a place of the underlying type and use `mplace_to_ref`. let place = match place.layout.ty.kind() { ty::Dynamic(data, _, ty::Dyn) => { // Dropping a trait object. Need to find actual drop fn. diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 9c33cc8ed0b9c..dbb88e42a3eb9 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -518,7 +518,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // RFC 2397 gated!( do_not_recommend, Normal, template!(Word), WarnFollowing, - EncodeCrossCrate::No, experimental!(do_not_recommend) + EncodeCrossCrate::Yes, experimental!(do_not_recommend) ), // `#[cfi_encoding = ""]` diff --git a/compiler/rustc_lint/src/context/diagnostics/check_cfg.rs b/compiler/rustc_lint/src/context/diagnostics/check_cfg.rs index e9a6276192e52..3c423b4e2aa6d 100644 --- a/compiler/rustc_lint/src/context/diagnostics/check_cfg.rs +++ b/compiler/rustc_lint/src/context/diagnostics/check_cfg.rs @@ -164,9 +164,9 @@ pub(super) fn unexpected_cfg_name( if is_from_cargo { if !is_feature_cfg { - diag.help(format!("consider using a Cargo feature instead or adding `println!(\"cargo:rustc-check-cfg={inst}\");` to the top of a `build.rs`")); + diag.help(format!("consider using a Cargo feature instead or adding `println!(\"cargo::rustc-check-cfg={inst}\");` to the top of the `build.rs`")); } - diag.note("see for more information about checking conditional configuration"); + diag.note("see for more information about checking conditional configuration"); } else { diag.help(format!("to expect this configuration use `--check-cfg={inst}`")); diag.note("see for more information about checking conditional configuration"); @@ -266,9 +266,9 @@ pub(super) fn unexpected_cfg_value( diag.help("consider defining some features in `Cargo.toml`"); } } else if !is_cfg_a_well_know_name { - diag.help(format!("consider using a Cargo feature instead or adding `println!(\"cargo:rustc-check-cfg={inst}\");` to the top of a `build.rs`")); + diag.help(format!("consider using a Cargo feature instead or adding `println!(\"cargo::rustc-check-cfg={inst}\");` to the top of the `build.rs`")); } - diag.note("see for more information about checking conditional configuration"); + diag.note("see for more information about checking conditional configuration"); } else { if !is_cfg_a_well_know_name { diag.help(format!("to expect this configuration use `--check-cfg={inst}`")); diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs index bae1c6b60115e..773babde0d7b3 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs @@ -888,8 +888,12 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { self.infcx.resolve_vars_if_possible(value) } - pub(super) fn fresh_args_for_item(&self, def_id: DefId) -> ty::GenericArgsRef<'tcx> { - self.infcx.fresh_args_for_item(DUMMY_SP, def_id) + pub(super) fn fresh_args_for_item(&mut self, def_id: DefId) -> ty::GenericArgsRef<'tcx> { + let args = self.infcx.fresh_args_for_item(DUMMY_SP, def_id); + for arg in args { + self.inspect.add_var_value(arg); + } + args } pub(super) fn translate_args( diff --git a/compiler/rustc_trait_selection/src/solve/fulfill.rs b/compiler/rustc_trait_selection/src/solve/fulfill.rs index 796222129f180..fd4b5805f027d 100644 --- a/compiler/rustc_trait_selection/src/solve/fulfill.rs +++ b/compiler/rustc_trait_selection/src/solve/fulfill.rs @@ -11,6 +11,7 @@ use rustc_infer::traits::{ }; use rustc_middle::ty::error::{ExpectedFound, TypeError}; use rustc_middle::ty::{self, TyCtxt}; +use rustc_span::symbol::sym; use super::eval_ctxt::GenerateProofTree; use super::inspect::{ProofTreeInferCtxtExt, ProofTreeVisitor}; @@ -137,7 +138,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> { .collect(); errors.extend(self.obligations.overflowed.drain(..).map(|obligation| FulfillmentError { - obligation: find_best_leaf_obligation(infcx, &obligation), + obligation: find_best_leaf_obligation(infcx, &obligation, true), code: FulfillmentErrorCode::Ambiguity { overflow: Some(true) }, root_obligation: obligation, })); @@ -198,7 +199,7 @@ fn fulfillment_error_for_no_solution<'tcx>( infcx: &InferCtxt<'tcx>, root_obligation: PredicateObligation<'tcx>, ) -> FulfillmentError<'tcx> { - let obligation = find_best_leaf_obligation(infcx, &root_obligation); + let obligation = find_best_leaf_obligation(infcx, &root_obligation, false); let code = match obligation.predicate.kind().skip_binder() { ty::PredicateKind::Clause(ty::ClauseKind::Projection(_)) => { @@ -266,7 +267,7 @@ fn fulfillment_error_for_stalled<'tcx>( }); FulfillmentError { - obligation: find_best_leaf_obligation(infcx, &obligation), + obligation: find_best_leaf_obligation(infcx, &obligation, true), code, root_obligation: obligation, } @@ -275,12 +276,13 @@ fn fulfillment_error_for_stalled<'tcx>( fn find_best_leaf_obligation<'tcx>( infcx: &InferCtxt<'tcx>, obligation: &PredicateObligation<'tcx>, + consider_ambiguities: bool, ) -> PredicateObligation<'tcx> { let obligation = infcx.resolve_vars_if_possible(obligation.clone()); infcx .visit_proof_tree( obligation.clone().into(), - &mut BestObligation { obligation: obligation.clone() }, + &mut BestObligation { obligation: obligation.clone(), consider_ambiguities }, ) .break_value() .unwrap_or(obligation) @@ -288,6 +290,7 @@ fn find_best_leaf_obligation<'tcx>( struct BestObligation<'tcx> { obligation: PredicateObligation<'tcx>, + consider_ambiguities: bool, } impl<'tcx> BestObligation<'tcx> { @@ -320,6 +323,14 @@ impl<'tcx> ProofTreeVisitor<'tcx> for BestObligation<'tcx> { return ControlFlow::Break(self.obligation.clone()); }; + // Don't walk into impls that have `do_not_recommend`. + if let ProbeKind::TraitCandidate { source: CandidateSource::Impl(impl_def_id), result: _ } = + candidate.kind() + && goal.infcx().tcx.has_attr(impl_def_id, sym::do_not_recommend) + { + return ControlFlow::Break(self.obligation.clone()); + } + // FIXME: Could we extract a trait ref from a projection here too? // FIXME: Also, what about considering >1 layer up the stack? May be necessary // for normalizes-to. @@ -355,11 +366,11 @@ impl<'tcx> ProofTreeVisitor<'tcx> for BestObligation<'tcx> { } } - // Skip nested goals that hold. - //FIXME: We should change the max allowed certainty based on if we're - // visiting an ambiguity or error obligation. - if matches!(nested_goal.result(), Ok(Certainty::Yes)) { - continue; + // Skip nested goals that aren't the *reason* for our goal's failure. + match self.consider_ambiguities { + true if matches!(nested_goal.result(), Ok(Certainty::Maybe(_))) => {} + false if matches!(nested_goal.result(), Err(_)) => {} + _ => continue, } self.with_derived_obligation(obligation, |this| nested_goal.visit_with(this))?; diff --git a/config.example.toml b/config.example.toml index 5c1fac7672a9a..3b76952504f28 100644 --- a/config.example.toml +++ b/config.example.toml @@ -254,6 +254,10 @@ # executing the debuginfo test suite. #gdb = "gdb" +# The path to (or name of) the LLDB executable to use. This is only used for +# executing the debuginfo test suite. +#lldb = "lldb" + # The node.js executable to use. Note that this is only used for the emscripten # target when running tests, otherwise this can be omitted. #nodejs = "node" diff --git a/library/std/src/sys/pal/unix/thread_parking.rs b/library/std/src/sys/pal/unix/thread_parking.rs index 66ffc0060574d..1366410b71edc 100644 --- a/library/std/src/sys/pal/unix/thread_parking.rs +++ b/library/std/src/sys/pal/unix/thread_parking.rs @@ -5,7 +5,7 @@ use crate::ffi::{c_int, c_void}; use crate::ptr; use crate::time::Duration; -use libc::{_lwp_self, clockid_t, lwpid_t, time_t, timespec, CLOCK_MONOTONIC}; +use libc::{_lwp_self, c_long, clockid_t, lwpid_t, time_t, timespec, CLOCK_MONOTONIC}; extern "C" { fn ___lwp_park60( @@ -38,7 +38,7 @@ pub fn park_timeout(dur: Duration, hint: usize) { // Saturate so that the operation will definitely time out // (even if it is after the heat death of the universe). tv_sec: dur.as_secs().try_into().ok().unwrap_or(time_t::MAX), - tv_nsec: dur.subsec_nanos().into(), + tv_nsec: dur.subsec_nanos() as c_long, }; // Timeout needs to be mutable since it is modified on NetBSD 9.0 and diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index c7a513d08908a..e9675e204523f 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -33,9 +33,9 @@ path = "src/bin/sccache-plus-cl.rs" test = false [dependencies] -# Most of the time updating these dependencies requires modifications -# to the bootstrap codebase; otherwise, some targets will fail. That's -# why these dependencies are explicitly pinned. +# Most of the time updating these dependencies requires modifications to the +# bootstrap codebase(e.g., https://github.com/rust-lang/rust/issues/124565); +# otherwise, some targets will fail. That's why these dependencies are explicitly pinned. cc = "=1.0.73" cmake = "=0.1.48" diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 9a585a39e1eeb..360bd3840d456 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1892,15 +1892,16 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the .to_string() }) }; - let lldb_exe = "lldb"; - let lldb_version = Command::new(lldb_exe) + + let lldb_exe = builder.config.lldb.clone().unwrap_or_else(|| PathBuf::from("lldb")); + let lldb_version = Command::new(&lldb_exe) .arg("--version") .output() .map(|output| String::from_utf8_lossy(&output.stdout).to_string()) .ok(); if let Some(ref vers) = lldb_version { cmd.arg("--lldb-version").arg(vers); - let lldb_python_dir = run(Command::new(lldb_exe).arg("-P")).ok(); + let lldb_python_dir = run(Command::new(&lldb_exe).arg("-P")).ok(); if let Some(ref dir) = lldb_python_dir { cmd.arg("--lldb-python-dir").arg(dir); } diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index ed45bc30362a5..0167c51fc7e2e 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -329,6 +329,7 @@ pub struct Config { pub nodejs: Option, pub npm: Option, pub gdb: Option, + pub lldb: Option, pub python: Option, pub reuse: Option, pub cargo_native_static: bool, @@ -834,6 +835,7 @@ define_config! { docs_minification: Option = "docs-minification", submodules: Option = "submodules", gdb: Option = "gdb", + lldb: Option = "lldb", nodejs: Option = "nodejs", npm: Option = "npm", python: Option = "python", @@ -1410,6 +1412,7 @@ impl Config { docs_minification, submodules, gdb, + lldb, nodejs, npm, python, @@ -1502,6 +1505,7 @@ impl Config { config.nodejs = nodejs.map(PathBuf::from); config.npm = npm.map(PathBuf::from); config.gdb = gdb.map(PathBuf::from); + config.lldb = lldb.map(PathBuf::from); config.python = python.map(PathBuf::from); config.reuse = reuse.map(PathBuf::from); config.submodules = submodules; diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs index db3df598a0c63..c3a03693f714f 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -175,4 +175,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ severity: ChangeSeverity::Warning, summary: "The deprecated field `changelog-seen` has been removed. Using that field in `config.toml` from now on will result in breakage.", }, + ChangeInfo { + change_id: 124501, + severity: ChangeSeverity::Info, + summary: "New option `build.lldb` that will override the default lldb binary path used in debuginfo tests", + }, ]; diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index fcc507b572c27..22dcb808c743e 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -50,39 +50,35 @@ fi CACHE_DOMAIN="${CACHE_DOMAIN:-ci-caches.rust-lang.org}" if [ -f "$docker_dir/$image/Dockerfile" ]; then - if isCI; then - hash_key=/tmp/.docker-hash-key.txt - rm -f "${hash_key}" - echo $image >> $hash_key - - cat "$docker_dir/$image/Dockerfile" >> $hash_key - # Look for all source files involves in the COPY command - copied_files=/tmp/.docker-copied-files.txt - rm -f "$copied_files" - for i in $(sed -n -e '/^COPY --from=/! s/^COPY \(.*\) .*$/\1/p' \ - "$docker_dir/$image/Dockerfile"); do - # List the file names - find "$script_dir/$i" -type f >> $copied_files - done - # Sort the file names and cat the content into the hash key - sort $copied_files | xargs cat >> $hash_key - - # Include the architecture in the hash key, since our Linux CI does not - # only run in x86_64 machines. - uname -m >> $hash_key - - docker --version >> $hash_key - - # Include cache version. Can be used to manually bust the Docker cache. - echo "2" >> $hash_key - - echo "Image input" - cat $hash_key - - cksum=$(sha512sum $hash_key | \ - awk '{print $1}') - echo "Image input checksum ${cksum}" - fi + hash_key=/tmp/.docker-hash-key.txt + rm -f "${hash_key}" + echo $image >> $hash_key + + cat "$docker_dir/$image/Dockerfile" >> $hash_key + # Look for all source files involves in the COPY command + copied_files=/tmp/.docker-copied-files.txt + rm -f "$copied_files" + for i in $(sed -n -e '/^COPY --from=/! s/^COPY \(.*\) .*$/\1/p' \ + "$docker_dir/$image/Dockerfile"); do + # List the file names + find "$script_dir/$i" -type f >> $copied_files + done + # Sort the file names and cat the content into the hash key + sort $copied_files | xargs cat >> $hash_key + + # Include the architecture in the hash key, since our Linux CI does not + # only run in x86_64 machines. + uname -m >> $hash_key + + # Include cache version. Can be used to manually bust the Docker cache. + echo "2" >> $hash_key + + echo "Image input" + cat $hash_key + + cksum=$(sha512sum $hash_key | \ + awk '{print $1}') + echo "Image input checksum ${cksum}" dockerfile="$docker_dir/$image/Dockerfile" if [ -x /usr/bin/cygpath ]; then @@ -105,10 +101,18 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then # It seems that it cannot be the same as $IMAGE_TAG, otherwise it overwrites the cache CACHE_IMAGE_TAG=${REGISTRY}/${REGISTRY_USERNAME}/rust-ci-cache:${cksum} - # On non-CI jobs, we don't do any caching. + # On non-CI jobs, we try to download a pre-built image from the rust-lang-ci + # ghcr.io registry. If it is not possible, we fall back to building the image + # locally. if ! isCI; then - retry docker build --rm -t rust-ci -f "$dockerfile" "$context" + if docker pull "${IMAGE_TAG}"; then + echo "Downloaded Docker image from CI" + docker tag "${IMAGE_TAG}" rust-ci + else + echo "Building local Docker image" + retry docker build --rm -t rust-ci -f "$dockerfile" "$context" + fi # On PR CI jobs, we don't have permissions to write to the registry cache, # but we can still read from it. elif [[ "$PR_CI_JOB" == "1" ]]; diff --git a/src/doc/rustc/src/platform-support/hermit.md b/src/doc/rustc/src/platform-support/hermit.md index 146079e36f44c..5aa787e53e1eb 100644 --- a/src/doc/rustc/src/platform-support/hermit.md +++ b/src/doc/rustc/src/platform-support/hermit.md @@ -4,7 +4,7 @@ The [Hermit] unikernel target allows compiling your applications into self-contained, specialized unikernel images that can be run in small virtual machines. -[Hermit]: https://github.com/hermitcore +[Hermit]: https://github.com/hermit-os Target triplets available so far: @@ -56,9 +56,9 @@ Rust does not yet ship pre-compiled artifacts for these targets. To compile for these targets, you will either need to build Rust with the targets enabled (see “Building the targets” above), or build your own copy of `core` by using `build-std` or similar. -Building Rust programs can be done by following the tutorial in our starter application [rusty-demo]. +As all Hermit programs are unikernels, building a Rust program also requires including the operating system code. A guide for doing so is provided in our starter [hermit-rs-template]. -[rusty-demo]: https://github.com/hermitcore/rusty-demo +[hermit-rs-template]: https://github.com/hermit-os/hermit-rs-template ## Testing @@ -67,8 +67,8 @@ These images can be chainloaded by Hermit's [loader] or hypervisor ([Uhyve]). QEMU can be used to boot Hermit binaries using the loader on any architecture. The targets do not support running the Rust test suite. -[loader]: https://github.com/hermitcore/rusty-loader -[Uhyve]: https://github.com/hermitcore/uhyve +[loader]: https://github.com/hermit-os/loader +[Uhyve]: https://github.com/hermit-os/uhyve ## Cross-compilation toolchains and C code diff --git a/tests/ui/check-cfg/cargo-feature.none.stderr b/tests/ui/check-cfg/cargo-feature.none.stderr index 09a1c95026722..ae2351b82ce81 100644 --- a/tests/ui/check-cfg/cargo-feature.none.stderr +++ b/tests/ui/check-cfg/cargo-feature.none.stderr @@ -6,7 +6,7 @@ LL | #[cfg(feature = "serde")] | = note: no expected values for `feature` = help: consider adding `serde` as a feature in `Cargo.toml` - = note: see for more information about checking conditional configuration + = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition value: (none) @@ -17,7 +17,7 @@ LL | #[cfg(feature)] | = note: no expected values for `feature` = help: consider defining some features in `Cargo.toml` - = note: see for more information about checking conditional configuration + = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `tokio_unstable` --> $DIR/cargo-feature.rs:22:7 @@ -26,8 +26,8 @@ LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(tokio_unstable)");` to the top of a `build.rs` - = note: see for more information about checking conditional configuration + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(tokio_unstable)");` to the top of the `build.rs` + = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `CONFIG_NVME` --> $DIR/cargo-feature.rs:26:7 @@ -35,8 +35,8 @@ warning: unexpected `cfg` condition name: `CONFIG_NVME` LL | #[cfg(CONFIG_NVME = "m")] | ^^^^^^^^^^^^^^^^^ | - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of a `build.rs` - = note: see for more information about checking conditional configuration + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of the `build.rs` + = note: see for more information about checking conditional configuration warning: 4 warnings emitted diff --git a/tests/ui/check-cfg/cargo-feature.some.stderr b/tests/ui/check-cfg/cargo-feature.some.stderr index 4db9c66fc8692..191efbf2d54d2 100644 --- a/tests/ui/check-cfg/cargo-feature.some.stderr +++ b/tests/ui/check-cfg/cargo-feature.some.stderr @@ -6,7 +6,7 @@ LL | #[cfg(feature = "serde")] | = note: expected values for `feature` are: `bitcode` = help: consider adding `serde` as a feature in `Cargo.toml` - = note: see for more information about checking conditional configuration + = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition value: (none) @@ -17,7 +17,7 @@ LL | #[cfg(feature)] | = note: expected values for `feature` are: `bitcode` = help: consider defining some features in `Cargo.toml` - = note: see for more information about checking conditional configuration + = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `tokio_unstable` --> $DIR/cargo-feature.rs:22:7 @@ -26,8 +26,8 @@ LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | = help: expected names are: `CONFIG_NVME`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(tokio_unstable)");` to the top of a `build.rs` - = note: see for more information about checking conditional configuration + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(tokio_unstable)");` to the top of the `build.rs` + = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `m` --> $DIR/cargo-feature.rs:26:7 @@ -38,8 +38,8 @@ LL | #[cfg(CONFIG_NVME = "m")] | help: there is a expected value with a similar name: `"y"` | = note: expected values for `CONFIG_NVME` are: `y` - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of a `build.rs` - = note: see for more information about checking conditional configuration + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of the `build.rs` + = note: see for more information about checking conditional configuration warning: 4 warnings emitted diff --git a/tests/ui/check-cfg/diagnotics.cargo.stderr b/tests/ui/check-cfg/diagnotics.cargo.stderr index 16417fe010544..1b7505682da36 100644 --- a/tests/ui/check-cfg/diagnotics.cargo.stderr +++ b/tests/ui/check-cfg/diagnotics.cargo.stderr @@ -5,7 +5,7 @@ LL | #[cfg(featur)] | ^^^^^^ help: there is a config with a similar name: `feature` | = help: expected values for `feature` are: `foo` - = note: see for more information about checking conditional configuration + = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition name: `featur` @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `featur` LL | #[cfg(featur = "foo")] | ^^^^^^^^^^^^^^ | - = note: see for more information about checking conditional configuration + = note: see for more information about checking conditional configuration help: there is a config with a similar name and value | LL | #[cfg(feature = "foo")] @@ -27,7 +27,7 @@ LL | #[cfg(featur = "fo")] | ^^^^^^^^^^^^^ | = help: expected values for `feature` are: `foo` - = note: see for more information about checking conditional configuration + = note: see for more information about checking conditional configuration help: there is a config with a similar name and different values | LL | #[cfg(feature = "foo")] @@ -39,8 +39,8 @@ warning: unexpected `cfg` condition name: `no_value` LL | #[cfg(no_value)] | ^^^^^^^^ help: there is a config with a similar name: `no_values` | - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(no_value)");` to the top of a `build.rs` - = note: see for more information about checking conditional configuration + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_value)");` to the top of the `build.rs` + = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `no_value` --> $DIR/diagnotics.rs:27:7 @@ -48,8 +48,8 @@ warning: unexpected `cfg` condition name: `no_value` LL | #[cfg(no_value = "foo")] | ^^^^^^^^^^^^^^^^ | - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(no_value, values(\"foo\"))");` to the top of a `build.rs` - = note: see for more information about checking conditional configuration + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_value, values(\"foo\"))");` to the top of the `build.rs` + = note: see for more information about checking conditional configuration help: there is a config with a similar name and no value | LL | #[cfg(no_values)] @@ -64,8 +64,8 @@ LL | #[cfg(no_values = "bar")] | help: remove the value | = note: no expected value for `no_values` - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(no_values, values(\"bar\"))");` to the top of a `build.rs` - = note: see for more information about checking conditional configuration + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_values, values(\"bar\"))");` to the top of the `build.rs` + = note: see for more information about checking conditional configuration warning: 6 warnings emitted diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr new file mode 100644 index 0000000000000..a4d4b7b359ec8 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr @@ -0,0 +1,20 @@ +error[E0277]: the trait bound `*mut (): Foo` is not satisfied + --> $DIR/simple.rs:19:17 + | +LL | needs_foo::<*mut ()>(); + | ^^^^^^^ the trait `Send` is not implemented for `*mut ()`, which is required by `*mut (): Foo` + | +note: required for `*mut ()` to implement `Foo` + --> $DIR/simple.rs:10:9 + | +LL | impl Foo for T where T: Send {} + | ^^^ ^ ---- unsatisfied trait bound introduced here +note: required by a bound in `needs_foo` + --> $DIR/simple.rs:14:17 + | +LL | fn needs_foo() {} + | ^^^ required by this bound in `needs_foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr new file mode 100644 index 0000000000000..1341ca8175aff --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `*mut (): Foo` is not satisfied + --> $DIR/simple.rs:19:17 + | +LL | needs_foo::<*mut ()>(); + | ^^^^^^^ the trait `Foo` is not implemented for `*mut ()` + | +note: required by a bound in `needs_foo` + --> $DIR/simple.rs:14:17 + | +LL | fn needs_foo() {} + | ^^^ required by this bound in `needs_foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs b/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs new file mode 100644 index 0000000000000..15ff80ae4d953 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs @@ -0,0 +1,23 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +#![feature(do_not_recommend)] + +trait Foo {} + +#[do_not_recommend] +impl Foo for T where T: Send {} +//[current]~^ NOTE required for `*mut ()` to implement `Foo` +//[current]~| NOTE unsatisfied trait bound introduced here + +fn needs_foo() {} +//~^ NOTE required by a bound in `needs_foo` +//~| NOTE required by this bound in `needs_foo` + +fn main() { + needs_foo::<*mut ()>(); + //~^ ERROR the trait bound `*mut (): Foo` is not satisfied + //[current]~| NOTE the trait `Send` is not implemented for `*mut ()` + //[next]~| NOTE the trait `Foo` is not implemented for `*mut ()` +} diff --git a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.rs b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.rs index bc9bb6ce2d79e..8bb4ff469076c 100644 --- a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.rs +++ b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.rs @@ -61,7 +61,7 @@ where // entering the cycle from `A` fails, but would work if we were to use the cache // result of `B`. impls_trait::, _, _, _>(); - //~^ ERROR the trait bound `X: IncompleteGuidance<_, _>` is not satisfied + //~^ ERROR the trait bound `A: Trait` is not satisfied } fn main() { diff --git a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.stderr b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.stderr index 78116ebba8274..cdb4ff4588f75 100644 --- a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.stderr +++ b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.stderr @@ -1,26 +1,28 @@ -error[E0277]: the trait bound `X: IncompleteGuidance<_, _>` is not satisfied +error[E0277]: the trait bound `A: Trait` is not satisfied --> $DIR/incompleteness-unstable-result.rs:63:19 | LL | impls_trait::, _, _, _>(); - | ^^^^ the trait `IncompleteGuidance<_, _>` is not implemented for `X`, which is required by `A: Trait<_, _, _>` + | ^^^^ the trait `Trait` is not implemented for `A`, which is required by `A: Trait<_, _, _>` | - = help: the following other types implement trait `IncompleteGuidance`: - > - > - > -note: required for `A` to implement `Trait<_, _, u8>` +note: required for `A` to implement `Trait` --> $DIR/incompleteness-unstable-result.rs:32:50 | LL | impl Trait for A | ^^^^^^^^^^^^^^ ^^^^ -LL | where -LL | T: IncompleteGuidance, - | ------------------------ unsatisfied trait bound introduced here +... +LL | A: Trait, + | -------------- unsatisfied trait bound introduced here + = note: 8 redundant requirements hidden + = note: required for `A` to implement `Trait` note: required by a bound in `impls_trait` --> $DIR/incompleteness-unstable-result.rs:51:28 | LL | fn impls_trait, U: ?Sized, V: ?Sized, D: ?Sized>() {} | ^^^^^^^^^^^^^^ required by this bound in `impls_trait` +help: consider extending the `where` clause, but there might be an alternative better way to express this requirement + | +LL | X: IncompleteGuidance, A: Trait + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs new file mode 100644 index 0000000000000..840a4eb648c59 --- /dev/null +++ b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs @@ -0,0 +1,24 @@ +//@ compile-flags: -Znext-solver + +trait Foo {} +trait Bar {} +trait Constrain { + type Output; +} + +impl Foo for T +where + T: Constrain, + U: Bar, +{ +} + +impl Constrain for () { + type Output = (); +} + +fn needs_foo() {} +fn main() { + needs_foo::<()>(); + //~^ the trait bound `(): Foo` is not satisfied +} diff --git a/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr new file mode 100644 index 0000000000000..6bf4e3cb53493 --- /dev/null +++ b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr @@ -0,0 +1,23 @@ +error[E0277]: the trait bound `(): Foo` is not satisfied + --> $DIR/point-at-failing-nested.rs:22:17 + | +LL | needs_foo::<()>(); + | ^^ the trait `Bar` is not implemented for `()`, which is required by `(): Foo` + | +note: required for `()` to implement `Foo` + --> $DIR/point-at-failing-nested.rs:9:12 + | +LL | impl Foo for T + | ^^^ ^ +... +LL | U: Bar, + | --- unsatisfied trait bound introduced here +note: required by a bound in `needs_foo` + --> $DIR/point-at-failing-nested.rs:20:17 + | +LL | fn needs_foo() {} + | ^^^ required by this bound in `needs_foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`.