From d1ba632f4f65051a6230db59e2ed2e1b1e8f12fc Mon Sep 17 00:00:00 2001 From: Bryanskiy Date: Fri, 22 Mar 2024 16:27:26 +0300 Subject: [PATCH 01/20] Delegation: fix ICE on `bound_vars` divergence --- .../src/collect/resolve_bound_vars.rs | 10 +++++- .../src/hir_ty_lowering/mod.rs | 8 +---- tests/ui/delegation/ice-issue-122550.rs | 18 +++++++++++ tests/ui/delegation/ice-issue-122550.stderr | 31 +++++++++++++++++++ 4 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 tests/ui/delegation/ice-issue-122550.rs create mode 100644 tests/ui/delegation/ice-issue-122550.stderr diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs index 27a26cfe4747f..ee3436805ca7f 100644 --- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs +++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs @@ -793,12 +793,20 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> { fd: &'tcx hir::FnDecl<'tcx>, body_id: hir::BodyId, _: Span, - _: LocalDefId, + def_id: LocalDefId, ) { let output = match fd.output { hir::FnRetTy::DefaultReturn(_) => None, hir::FnRetTy::Return(ty) => Some(ty), }; + if let Some(ty) = output + && let hir::TyKind::InferDelegation(sig_id, _) = ty.kind + { + let bound_vars: Vec<_> = + self.tcx.fn_sig(sig_id).skip_binder().bound_vars().iter().collect(); + let hir_id = self.tcx.local_def_id_to_hir_id(def_id); + self.map.late_bound_vars.insert(hir_id, bound_vars); + } self.visit_fn_like_elision(fd.inputs, output, matches!(fk, intravisit::FnKind::Closure)); intravisit::walk_fn_kind(self, fk); self.visit_nested_body(body_id) diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index 109e00d4f24e5..b115b4bc9a68b 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -2494,13 +2494,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { hir_ty: Option<&hir::Ty<'_>>, ) -> ty::PolyFnSig<'tcx> { let tcx = self.tcx(); - let bound_vars = if let hir::FnRetTy::Return(ret_ty) = decl.output - && let hir::TyKind::InferDelegation(sig_id, _) = ret_ty.kind - { - tcx.fn_sig(sig_id).skip_binder().bound_vars() - } else { - tcx.late_bound_vars(hir_id) - }; + let bound_vars = tcx.late_bound_vars(hir_id); debug!(?bound_vars); // We proactively collect all the inferred type params to emit a single error per fn def. diff --git a/tests/ui/delegation/ice-issue-122550.rs b/tests/ui/delegation/ice-issue-122550.rs new file mode 100644 index 0000000000000..92c0dda960543 --- /dev/null +++ b/tests/ui/delegation/ice-issue-122550.rs @@ -0,0 +1,18 @@ +#![feature(fn_delegation)] +#![allow(incomplete_features)] + +trait Trait { + fn description(&self) -> &str {} + //~^ ERROR mismatched types +} + +struct F; +struct S(F); + +impl S { + reuse ::description { &self.0 } + //~^ ERROR mismatched types + //~| ERROR the trait bound `S: Trait` is not satisfied +} + +fn main() {} diff --git a/tests/ui/delegation/ice-issue-122550.stderr b/tests/ui/delegation/ice-issue-122550.stderr new file mode 100644 index 0000000000000..c92170644e78f --- /dev/null +++ b/tests/ui/delegation/ice-issue-122550.stderr @@ -0,0 +1,31 @@ +error[E0308]: mismatched types + --> $DIR/ice-issue-122550.rs:5:35 + | +LL | fn description(&self) -> &str {} + | ^^ expected `&str`, found `()` + +error[E0308]: mismatched types + --> $DIR/ice-issue-122550.rs:13:39 + | +LL | reuse ::description { &self.0 } + | ^^^^^^^ expected `&S`, found `&F` + | + = note: expected reference `&S` + found reference `&F` + +error[E0277]: the trait bound `S: Trait` is not satisfied + --> $DIR/ice-issue-122550.rs:13:12 + | +LL | reuse ::description { &self.0 } + | ^ the trait `Trait` is not implemented for `S` + | +help: this trait has no implementations, consider adding one + --> $DIR/ice-issue-122550.rs:4:1 + | +LL | trait Trait { + | ^^^^^^^^^^^ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. From bf12aa49e71d6e444c34d7adb87647f36b7dde1a Mon Sep 17 00:00:00 2001 From: Michael Baikov Date: Thu, 21 Mar 2024 16:13:46 -0400 Subject: [PATCH 02/20] Don't emit an error about failing to produce a file with a specific name If user never gave an explicit name --- compiler/rustc_codegen_ssa/src/back/write.rs | 2 +- compiler/rustc_session/src/config.rs | 5 ++++ .../issues/no-explicit-path-issue-122509.rs | 23 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/ui/issues/no-explicit-path-issue-122509.rs diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 4eda4c2f08c69..b7bcaac3b18f6 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -592,7 +592,7 @@ fn produce_final_output_artifacts( .unwrap() .to_owned(); - if crate_output.outputs.contains_key(&output_type) { + if crate_output.outputs.contains_explicit_name(&output_type) { // 2) Multiple codegen units, with `--emit foo=some_name`. We have // no good solution for this case, so warn the user. sess.dcx().emit_warn(errors::IgnoringEmitPath { extension }); diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index e6eb1a3e83c6c..e4d2af95c572a 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -557,6 +557,11 @@ impl OutputTypes { self.0.contains_key(key) } + /// Returns `true` if user specified a name and not just produced type + pub fn contains_explicit_name(&self, key: &OutputType) -> bool { + self.0.get(key).map_or(false, |f| f.is_some()) + } + pub fn iter(&self) -> BTreeMapIter<'_, OutputType, Option> { self.0.iter() } diff --git a/tests/ui/issues/no-explicit-path-issue-122509.rs b/tests/ui/issues/no-explicit-path-issue-122509.rs new file mode 100644 index 0000000000000..4e8eefde5dad1 --- /dev/null +++ b/tests/ui/issues/no-explicit-path-issue-122509.rs @@ -0,0 +1,23 @@ +//@ build-pass +//@ compile-flags: -C codegen-units=2 --emit asm + +fn one() -> usize { + 1 +} + +pub mod a { + pub fn two() -> usize { + ::one() + ::one() + } +} + +pub mod b { + pub fn three() -> usize { + ::one() + ::a::two() + } +} + +fn main() { + a::two(); + b::three(); +} From b84326ec9caca0c8877bc58a85a8c7814ca6c052 Mon Sep 17 00:00:00 2001 From: Michael Baikov Date: Fri, 22 Mar 2024 11:20:55 -0400 Subject: [PATCH 03/20] tests/ui: Add a directory for warnings, add a test --- src/tools/tidy/src/ui_tests.rs | 2 +- tests/ui/{issues => warnings}/no-explicit-path-issue-122509.rs | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tests/ui/{issues => warnings}/no-explicit-path-issue-122509.rs (100%) diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 22927cffd1b9b..015d0518a405a 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -18,7 +18,7 @@ const ENTRY_LIMIT: usize = 900; // FIXME: The following limits should be reduced eventually. const ISSUES_ENTRY_LIMIT: usize = 1750; -const ROOT_ENTRY_LIMIT: usize = 859; +const ROOT_ENTRY_LIMIT: usize = 860; const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ "rs", // test source files diff --git a/tests/ui/issues/no-explicit-path-issue-122509.rs b/tests/ui/warnings/no-explicit-path-issue-122509.rs similarity index 100% rename from tests/ui/issues/no-explicit-path-issue-122509.rs rename to tests/ui/warnings/no-explicit-path-issue-122509.rs From 08235b1603f77f39468e7b2e552945501c0cc048 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 22 Mar 2024 16:56:13 -0400 Subject: [PATCH 04/20] Validate that we're only matching on unit struct for path pattern --- compiler/rustc_hir_typeck/src/pat.rs | 21 ++++++++++- ...70549-resolve-after-recovered-self-ctor.rs | 4 +- ...9-resolve-after-recovered-self-ctor.stderr | 9 +++-- .../no-match-tuple-variant-self-ctor.rs | 37 +++++++++++++++++++ ...tch-tuple-variant-self-ctor.struct_.stderr | 19 ++++++++++ ...match-tuple-variant-self-ctor.tuple.stderr | 9 +++++ 6 files changed, 91 insertions(+), 8 deletions(-) create mode 100644 tests/ui/pattern/no-match-tuple-variant-self-ctor.rs create mode 100644 tests/ui/pattern/no-match-tuple-variant-self-ctor.struct_.stderr create mode 100644 tests/ui/pattern/no-match-tuple-variant-self-ctor.tuple.stderr diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index dad43cb8abe97..8cb3b4b8e47d1 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -919,8 +919,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let e = report_unexpected_variant_res(tcx, res, qpath, pat.span, E0533, expected); return Ty::new_error(tcx, e); } - Res::SelfCtor(..) - | Res::Def( + Res::SelfCtor(def_id) => { + if let ty::Adt(adt_def, _) = *tcx.type_of(def_id).skip_binder().kind() + && adt_def.is_struct() + && let Some((CtorKind::Const, _)) = adt_def.non_enum_variant().ctor + { + // Ok, we allow unit struct ctors in patterns only. + } else { + let e = report_unexpected_variant_res( + tcx, + res, + qpath, + pat.span, + E0533, + "unit struct", + ); + return Ty::new_error(tcx, e); + } + } + Res::Def( DefKind::Ctor(_, CtorKind::Const) | DefKind::Const | DefKind::AssocConst diff --git a/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.rs b/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.rs index aeccd0d9f76ca..ada10fcda27d9 100644 --- a/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.rs +++ b/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.rs @@ -4,12 +4,12 @@ impl S { fn foo(&mur Self) {} //~^ ERROR expected identifier, found keyword `Self` //~| ERROR expected one of `:`, `@` - //~| ERROR the `Self` constructor can only be used with + //~| ERROR expected unit struct, found self constructor `Self` fn bar(&'static mur Self) {} //~^ ERROR unexpected lifetime //~| ERROR expected identifier, found keyword `Self` //~| ERROR expected one of `:`, `@` - //~| ERROR the `Self` constructor can only be used with + //~| ERROR expected unit struct, found self constructor `Self` fn baz(&mur Self @ _) {} //~^ ERROR expected one of `:`, `@` diff --git a/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr b/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr index 421f145403623..ec0af9a6caf1e 100644 --- a/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr +++ b/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr @@ -40,17 +40,18 @@ error: expected one of `:`, `@`, or `|`, found keyword `Self` LL | fn baz(&mur Self @ _) {} | ^^^^ expected one of `:`, `@`, or `|` -error: the `Self` constructor can only be used with tuple or unit structs +error[E0533]: expected unit struct, found self constructor `Self` --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:4:17 | LL | fn foo(&mur Self) {} - | ^^^^ help: use curly brackets: `Self { /* fields */ }` + | ^^^^ not a unit struct -error: the `Self` constructor can only be used with tuple or unit structs +error[E0533]: expected unit struct, found self constructor `Self` --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:25 | LL | fn bar(&'static mur Self) {} - | ^^^^ help: use curly brackets: `Self { /* fields */ }` + | ^^^^ not a unit struct error: aborting due to 8 previous errors +For more information about this error, try `rustc --explain E0533`. diff --git a/tests/ui/pattern/no-match-tuple-variant-self-ctor.rs b/tests/ui/pattern/no-match-tuple-variant-self-ctor.rs new file mode 100644 index 0000000000000..7c2821e77ab94 --- /dev/null +++ b/tests/ui/pattern/no-match-tuple-variant-self-ctor.rs @@ -0,0 +1,37 @@ +//@ revisions: tuple unit struct_ +//@[unit] check-pass + +#[cfg(unit)] +mod unit { + struct S; + impl S { + fn foo() { + let Self = S; + } + } +} + +#[cfg(tuple)] +mod tuple { + struct S(()); + impl S { + fn foo() { + let Self = S; + //[tuple]~^ ERROR expected unit struct + } + } +} + +#[cfg(struct_)] +mod struct_ { + struct S {} + impl S { + fn foo() { + let Self = S; + //[struct_]~^ ERROR expected value, found struct `S` + //[struct_]~| ERROR expected unit struct, found self constructor `Self` + } + } +} + +fn main() {} diff --git a/tests/ui/pattern/no-match-tuple-variant-self-ctor.struct_.stderr b/tests/ui/pattern/no-match-tuple-variant-self-ctor.struct_.stderr new file mode 100644 index 0000000000000..5ed3979feb807 --- /dev/null +++ b/tests/ui/pattern/no-match-tuple-variant-self-ctor.struct_.stderr @@ -0,0 +1,19 @@ +error[E0423]: expected value, found struct `S` + --> $DIR/no-match-tuple-variant-self-ctor.rs:30:24 + | +LL | struct S {} + | ----------- `S` defined here +... +LL | let Self = S; + | ^ help: use struct literal syntax instead: `S {}` + +error[E0533]: expected unit struct, found self constructor `Self` + --> $DIR/no-match-tuple-variant-self-ctor.rs:30:17 + | +LL | let Self = S; + | ^^^^ not a unit struct + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0423, E0533. +For more information about an error, try `rustc --explain E0423`. diff --git a/tests/ui/pattern/no-match-tuple-variant-self-ctor.tuple.stderr b/tests/ui/pattern/no-match-tuple-variant-self-ctor.tuple.stderr new file mode 100644 index 0000000000000..d31a4a7918990 --- /dev/null +++ b/tests/ui/pattern/no-match-tuple-variant-self-ctor.tuple.stderr @@ -0,0 +1,9 @@ +error[E0533]: expected unit struct, found self constructor `Self` + --> $DIR/no-match-tuple-variant-self-ctor.rs:19:17 + | +LL | let Self = S; + | ^^^^ not a unit struct + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0533`. From 87808e71be434dd5ba4fc23115ee84d9a3aaa094 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Sat, 23 Mar 2024 17:30:12 -0700 Subject: [PATCH 05/20] Use `chunk_by` when building `ReverseSccGraph` --- .../rustc_borrowck/src/region_infer/reverse_sccs.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs b/compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs index eeb944702a7f9..f94001de357a9 100644 --- a/compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs +++ b/compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs @@ -1,6 +1,5 @@ use crate::constraints::ConstraintSccIndex; use crate::RegionInferenceContext; -use itertools::Itertools; use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; use rustc_data_structures::graph::vec_graph::VecGraph; use rustc_data_structures::graph::WithSuccessors; @@ -48,16 +47,16 @@ impl RegionInferenceContext<'_> { .universal_regions .universal_regions() .map(|region| (self.constraint_sccs.scc(region), region)) - .collect_vec(); + .collect::>(); paired_scc_regions.sort(); let universal_regions = paired_scc_regions.iter().map(|&(_, region)| region).collect(); let mut scc_regions = FxIndexMap::default(); let mut start = 0; - for (scc, group) in &paired_scc_regions.into_iter().group_by(|(scc, _)| *scc) { - let group_size = group.count(); - scc_regions.insert(scc, start..start + group_size); - start += group_size; + for chunk in paired_scc_regions.chunk_by(|&(scc1, _), &(scc2, _)| scc1 == scc2) { + let (scc, _) = chunk[0]; + scc_regions.insert(scc, start..start + chunk.len()); + start += chunk.len(); } self.rev_scc_graph = Some(ReverseSccGraph { graph, scc_regions, universal_regions }); From 127c36c79490326ceeb14675425af672c589256d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 24 Mar 2024 10:01:50 +0100 Subject: [PATCH 06/20] add test for https://github.com/rust-lang/rust/issues/119731 Fixes #119731 --- .../unevaluated-const-ice-119731.rs | 39 ++++++++ .../unevaluated-const-ice-119731.stderr | 92 +++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs new file mode 100644 index 0000000000000..51cae20df84d4 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs @@ -0,0 +1,39 @@ +// rust-lang/rust#119731 +// ICE ... unevaluated constant UnevaluatedConst + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +mod v20 { + const v4: usize = 512; + pub type v11 = [[usize; v4]; v4]; + //~^ WARN type `v11` should have an upper camel case name + const v2: v11 = [[256; v4]; v4]; + + const v0: [[usize; v4]; v4] = v6(v8); + //~^ ERROR cannot find value `v8` in this scope + //~| ERROR cannot find function `v6` in this scope + pub struct v17 { + //~^ WARN type `v17` should have an upper camel case name + //~| ERROR `[[usize; v4]; v4]` is forbidden as the type of a const generic parameter + _p: (), + } + + impl v17<512, v0> { + pub const fn v21() -> v18 {} + //~^ ERROR cannot find type `v18` in this scope + } + + impl v17 { + //~^ ERROR maximum number of nodes exceeded in constant v20::v17::::{constant#1} + //~| ERROR maximum number of nodes exceeded in constant v20::v17::::{constant#1} + pub const fn v21() -> v18 { + //~^ ERROR cannot find type `v18` in this scope + v18 { _p: () } + //~^ ERROR cannot find struct, variant or union type `v18` in this scope + } + } +} +pub use v20::{v13, v17}; +//~^ ERROR unresolved import `v20::v13` +fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr new file mode 100644 index 0000000000000..39f022fbee9db --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr @@ -0,0 +1,92 @@ +error[E0432]: unresolved import `v20::v13` + --> $DIR/unevaluated-const-ice-119731.rs:37:15 + | +LL | pub use v20::{v13, v17}; + | ^^^ + | | + | no `v13` in `v20` + | help: a similar name exists in the module: `v11` + +error[E0425]: cannot find value `v8` in this scope + --> $DIR/unevaluated-const-ice-119731.rs:13:38 + | +LL | const v0: [[usize; v4]; v4] = v6(v8); + | ^^ not found in this scope + +error[E0412]: cannot find type `v18` in this scope + --> $DIR/unevaluated-const-ice-119731.rs:23:31 + | +LL | pub type v11 = [[usize; v4]; v4]; + | --------------------------------- similarly named type alias `v11` defined here +... +LL | pub const fn v21() -> v18 {} + | ^^^ help: a type alias with a similar name exists: `v11` + +error[E0412]: cannot find type `v18` in this scope + --> $DIR/unevaluated-const-ice-119731.rs:30:31 + | +LL | pub type v11 = [[usize; v4]; v4]; + | --------------------------------- similarly named type alias `v11` defined here +... +LL | pub const fn v21() -> v18 { + | ^^^ help: a type alias with a similar name exists: `v11` + +error[E0422]: cannot find struct, variant or union type `v18` in this scope + --> $DIR/unevaluated-const-ice-119731.rs:32:13 + | +LL | pub type v11 = [[usize; v4]; v4]; + | --------------------------------- similarly named type alias `v11` defined here +... +LL | v18 { _p: () } + | ^^^ help: a type alias with a similar name exists: `v11` + +warning: type `v11` should have an upper camel case name + --> $DIR/unevaluated-const-ice-119731.rs:9:14 + | +LL | pub type v11 = [[usize; v4]; v4]; + | ^^^ help: convert the identifier to upper camel case (notice the capitalization): `V11` + | + = note: `#[warn(non_camel_case_types)]` on by default + +warning: type `v17` should have an upper camel case name + --> $DIR/unevaluated-const-ice-119731.rs:16:16 + | +LL | pub struct v17 { + | ^^^ help: convert the identifier to upper camel case (notice the capitalization): `V17` + +error[E0425]: cannot find function `v6` in this scope + --> $DIR/unevaluated-const-ice-119731.rs:13:35 + | +LL | const v0: [[usize; v4]; v4] = v6(v8); + | ^^ not found in this scope + +error: `[[usize; v4]; v4]` is forbidden as the type of a const generic parameter + --> $DIR/unevaluated-const-ice-119731.rs:16:48 + | +LL | pub struct v17 { + | ^^^ + | + = note: the only supported types are integers, `bool` and `char` +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | + +error: maximum number of nodes exceeded in constant v20::v17::::{constant#1} + --> $DIR/unevaluated-const-ice-119731.rs:27:37 + | +LL | impl v17 { + | ^^ + +error: maximum number of nodes exceeded in constant v20::v17::::{constant#1} + --> $DIR/unevaluated-const-ice-119731.rs:27:37 + | +LL | impl v17 { + | ^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 9 previous errors; 2 warnings emitted + +Some errors have detailed explanations: E0412, E0422, E0425, E0432. +For more information about an error, try `rustc --explain E0412`. From db68dc27f4c7a18be8e01864eb5f95f8879858e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 24 Mar 2024 10:05:27 +0100 Subject: [PATCH 07/20] add test for #116599 Fixes #116599 --- .../unexpected-inference-var-ice-116599.rs | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/ui/nll/unexpected-inference-var-ice-116599.rs diff --git a/tests/ui/nll/unexpected-inference-var-ice-116599.rs b/tests/ui/nll/unexpected-inference-var-ice-116599.rs new file mode 100644 index 0000000000000..53eeba23224de --- /dev/null +++ b/tests/ui/nll/unexpected-inference-var-ice-116599.rs @@ -0,0 +1,44 @@ +// ICE unexpected inference var +// issue: rust-lang/rust#116599 +//@ check-pass + +pub trait EvaluateConstMethods { + type Trait: TraitWithConstMethods; + + /// **This block breaks** + const DATA_3: Data3 = { + <<::Method2 as ConstFn<_, _>>::Body< + <::Method1 as ConstFn<_, _>>::Body, + > as Contains<_>>::ITEM + }; +} + +pub trait TraitWithConstMethods { + /// "const trait method" of signature `fn(Data1) -> Data2` + type Method1: ConstFn; + + /// "const trait method" of signature `fn(Data2) -> Data3` + type Method2: ConstFn; +} + +/// A trait which tries to implement const methods in traits +pub trait ConstFn { + type Body>: Contains; +} + +/// A ZST which represents / "contains" a const value which can be pass to a [`ConstFn`] +pub trait Contains { + const ITEM: T; +} + +pub struct ContainsData1; +impl Contains for ContainsData1 { + const ITEM: Data1 = Data1 {}; +} + +// Arbitrary data +pub struct Data1 {} +pub struct Data2 {} +pub struct Data3 {} + +pub fn main() {} From 8ed5e6744fcd7dbda2a3fe0f061b39b4c440bb73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 24 Mar 2024 10:09:56 +0100 Subject: [PATCH 08/20] add test for #114464 Fixes #114464 --- .../convert-refree-region-vid-ice-114464.rs | 17 +++++++++++++++++ .../convert-refree-region-vid-ice-114464.stderr | 11 +++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/ui/const-generics/generic_const_exprs/convert-refree-region-vid-ice-114464.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/convert-refree-region-vid-ice-114464.stderr diff --git a/tests/ui/const-generics/generic_const_exprs/convert-refree-region-vid-ice-114464.rs b/tests/ui/const-generics/generic_const_exprs/convert-refree-region-vid-ice-114464.rs new file mode 100644 index 0000000000000..f58fd12e4d356 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/convert-refree-region-vid-ice-114464.rs @@ -0,0 +1,17 @@ +// ICE cannot convert Refree.. to a region vid +// issue: rust-lang/rust#114464 + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +fn test() {} + +fn wow<'a>() { + test::<{ + let _: &'a (); + //~^ ERROR cannot capture late-bound lifetime in constant + 3 + }>(); +} + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/convert-refree-region-vid-ice-114464.stderr b/tests/ui/const-generics/generic_const_exprs/convert-refree-region-vid-ice-114464.stderr new file mode 100644 index 0000000000000..a234c5e129d2e --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/convert-refree-region-vid-ice-114464.stderr @@ -0,0 +1,11 @@ +error: cannot capture late-bound lifetime in constant + --> $DIR/convert-refree-region-vid-ice-114464.rs:11:17 + | +LL | fn wow<'a>() { + | -- lifetime defined here +LL | test::<{ +LL | let _: &'a (); + | ^^ + +error: aborting due to 1 previous error + From cdea6d83824c9d8d03dc3d0e9869d1b06617e2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 24 Mar 2024 10:16:29 +0100 Subject: [PATCH 09/20] add test for ICE: no entry found for key for const function in generic_const_exprs #113133 Fixes #113133 --- .../no-entry-found-for-key-ice-gce-nlb-113133.rs | 13 +++++++++++++ ...no-entry-found-for-key-ice-gce-nlb-113133.stderr | 8 ++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/ui/const-generics/generic_const_exprs/no-entry-found-for-key-ice-gce-nlb-113133.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/no-entry-found-for-key-ice-gce-nlb-113133.stderr diff --git a/tests/ui/const-generics/generic_const_exprs/no-entry-found-for-key-ice-gce-nlb-113133.rs b/tests/ui/const-generics/generic_const_exprs/no-entry-found-for-key-ice-gce-nlb-113133.rs new file mode 100644 index 0000000000000..5673f1dd0738f --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/no-entry-found-for-key-ice-gce-nlb-113133.rs @@ -0,0 +1,13 @@ +// ICE no entry found for key generics_of +// issue: rust-lang/rust#113133 + +#![allow(incomplete_features)] +#![feature(generic_const_exprs, non_lifetime_binders)] + +pub fn foo() +where + for ():, + //~^ ERROR defaults for generic parameters are not allowed in `for<...>` binders +{} + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/no-entry-found-for-key-ice-gce-nlb-113133.stderr b/tests/ui/const-generics/generic_const_exprs/no-entry-found-for-key-ice-gce-nlb-113133.stderr new file mode 100644 index 0000000000000..5924a673da944 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/no-entry-found-for-key-ice-gce-nlb-113133.stderr @@ -0,0 +1,8 @@ +error: defaults for generic parameters are not allowed in `for<...>` binders + --> $DIR/no-entry-found-for-key-ice-gce-nlb-113133.rs:9:9 + | +LL | for ():, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + From b151e066591728798cb9718628d1e694eda99b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 24 Mar 2024 10:19:25 +0100 Subject: [PATCH 10/20] add test for ICE: min_specialization: Ok(['?0, Const { ty: usize, kind: Leaf(0x0000000000000000) }]) is not fully resolved #113045 Fixes https://github.com/rust-lang/rust/issues/113045 --- .../ice-const-not-fully-resolved-113045.rs | 15 +++++++++++++ ...ice-const-not-fully-resolved-113045.stderr | 21 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.rs create mode 100644 tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.stderr diff --git a/tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.rs b/tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.rs new file mode 100644 index 0000000000000..6f0f233b87021 --- /dev/null +++ b/tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.rs @@ -0,0 +1,15 @@ +// ICE min_specialization: +// Ok(['?0, Const { ty: usize, kind: Leaf(0x0000000000000000) }]) is not fully resolved +// issue: rust-lang/rust#113045 + +#![feature(min_specialization)] + +trait X {} + +impl<'a, const N: usize> X for [(); N] {} + +impl<'a, Unconstrained> X for [(); 0] {} +//~^ ERROR the type parameter `Unconstrained` is not constrained by the impl trait, self type, or predicates +//~| ERROR specialization impl does not specialize any associated items + +fn main() {} diff --git a/tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.stderr b/tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.stderr new file mode 100644 index 0000000000000..acbdb9b0a308e --- /dev/null +++ b/tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.stderr @@ -0,0 +1,21 @@ +error[E0207]: the type parameter `Unconstrained` is not constrained by the impl trait, self type, or predicates + --> $DIR/ice-const-not-fully-resolved-113045.rs:11:10 + | +LL | impl<'a, Unconstrained> X for [(); 0] {} + | ^^^^^^^^^^^^^ unconstrained type parameter + +error: specialization impl does not specialize any associated items + --> $DIR/ice-const-not-fully-resolved-113045.rs:11:1 + | +LL | impl<'a, Unconstrained> X for [(); 0] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: impl is a specialization of this impl + --> $DIR/ice-const-not-fully-resolved-113045.rs:9:1 + | +LL | impl<'a, const N: usize> X for [(); N] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0207`. From 6203ebe2747acb76a0bcf36b6e2429009a381cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 24 Mar 2024 10:28:25 +0100 Subject: [PATCH 11/20] add test for ICE with associated_const_equality #108220 Fixes #108220 --- .../assoc-const-AnonConst-ice-108220.rs | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/ui/generic-const-items/assoc-const-AnonConst-ice-108220.rs diff --git a/tests/ui/generic-const-items/assoc-const-AnonConst-ice-108220.rs b/tests/ui/generic-const-items/assoc-const-AnonConst-ice-108220.rs new file mode 100644 index 0000000000000..f5babb67b5639 --- /dev/null +++ b/tests/ui/generic-const-items/assoc-const-AnonConst-ice-108220.rs @@ -0,0 +1,35 @@ +// ICE assertion failed: matches!(self.def_kind(ct.def.did), DefKind :: AnonConst) +// issue: rust-lang/rust#108220 +//@ check-pass + +#![feature(associated_const_equality)] +#![allow(unused)] + +use std::marker::PhantomData; + +pub struct NoPin; + +pub trait SetAlternate {} + +impl SetAlternate<0> for NoPin {} + +pub trait PinA { + const A: u8; +} + +impl PinA for NoPin { + const A: u8 = 0; +} + +pub trait Pins {} + +impl Pins for T where + T: PinA + SetAlternate +{ +} + +struct Serial(PhantomData); + +impl Serial where NoPin: Pins {} + +fn main() {} From 5e0d8c3b6261db13d64d5f6aa43c7088876fbb20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 24 Mar 2024 10:35:24 +0100 Subject: [PATCH 12/20] add test for ICE: no errors encountered even though delay_span_bug issued, expected ReFree to map to ReEarlyBound #108580 Fixes https://github.com/rust-lang/rust/issues/108580 --- ...efree-to-map-to-reearlybound-ice-108580.rs | 16 ++++++++++++++++ ...e-to-map-to-reearlybound-ice-108580.stderr | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.rs create mode 100644 tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr diff --git a/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.rs b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.rs new file mode 100644 index 0000000000000..bb10701cf6fb7 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.rs @@ -0,0 +1,16 @@ +// ICE expected ReFree to map to ReEarlyBound +// issue: rust-lang/rust#108580 +//@ check-pass + +trait Foo { + fn bar(&self) -> impl Iterator + '_; +} + +impl Foo for () { + fn bar(&self) -> impl Iterator + '_ { + //~^ WARN impl trait in impl method signature does not match trait method signature + vec![()].into_iter() + } +} + +pub fn main() {} diff --git a/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr new file mode 100644 index 0000000000000..94f068cabaa82 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr @@ -0,0 +1,19 @@ +warning: impl trait in impl method signature does not match trait method signature + --> $DIR/expeced-refree-to-map-to-reearlybound-ice-108580.rs:10:22 + | +LL | fn bar(&self) -> impl Iterator + '_; + | ------------------------------------- return type from trait method defined here +... +LL | fn bar(&self) -> impl Iterator + '_ { + | ^^^^^^^^^^^^^^^^^^ + | + = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 for more information + = note: `#[warn(refining_impl_trait_internal)]` on by default +help: replace the return type so that it matches the trait + | +LL | fn bar(&self) -> impl Iterator + '_ { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +warning: 1 warning emitted + From 56ea366763b5fbac9ded4e0bdab7bd0fe1cb75b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 24 Mar 2024 10:41:34 +0100 Subject: [PATCH 13/20] add test for Failed to normalize closure with TAIT #109020 Fixes #109020 --- .../closure-normalization-ice-109020.rs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/ui/type-alias-impl-trait/closure-normalization-ice-109020.rs diff --git a/tests/ui/type-alias-impl-trait/closure-normalization-ice-109020.rs b/tests/ui/type-alias-impl-trait/closure-normalization-ice-109020.rs new file mode 100644 index 0000000000000..c5ee46024f987 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/closure-normalization-ice-109020.rs @@ -0,0 +1,41 @@ +// ICE Failed to normalize closure with TAIT +// issue: rust-lang/rust#109020 +//@ check-pass + +#![feature(type_alias_impl_trait)] + +use std::marker::PhantomData; + +type WithEmplacableForFn<'a> = impl EmplacableFn + 'a; + +fn with_emplacable_for<'a, F, R>(mut f: F) -> R +where + F: for<'b> FnMut(Emplacable>) -> R, +{ + fn with_emplacable_for_inner<'a, R>( + _: &'a (), + _: &mut dyn FnMut(Emplacable>) -> R, + ) -> R { + fn _constrain(_: &mut ()) -> WithEmplacableForFn<'_> { + () + } + loop {} + } + + with_emplacable_for_inner(&(), &mut f) +} + +trait EmplacableFn {} + +impl EmplacableFn for () {} + +struct Emplacable +where + F: EmplacableFn, +{ + phantom: PhantomData, +} + +fn main() { + with_emplacable_for(|_| {}); +} From e800b99347b88dc90bb105a0551011ac01ead624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 24 Mar 2024 10:49:16 +0100 Subject: [PATCH 14/20] add tests for ICE in mir building with captured value of unresolved type, None in compiler/rustc_mir_build/src/build/expr/as_place.rs #110453 Fixes #110453 --- ...-build-2021-closure-capture-ice-110453-1.rs | 18 ++++++++++++++++++ ...ld-2021-closure-capture-ice-110453-1.stderr | 14 ++++++++++++++ ...-build-2021-closure-capture-ice-110453-2.rs | 11 +++++++++++ ...ld-2021-closure-capture-ice-110453-2.stderr | 9 +++++++++ 4 files changed, 52 insertions(+) create mode 100644 tests/ui/mir/mir-build-2021-closure-capture-ice-110453-1.rs create mode 100644 tests/ui/mir/mir-build-2021-closure-capture-ice-110453-1.stderr create mode 100644 tests/ui/mir/mir-build-2021-closure-capture-ice-110453-2.rs create mode 100644 tests/ui/mir/mir-build-2021-closure-capture-ice-110453-2.stderr diff --git a/tests/ui/mir/mir-build-2021-closure-capture-ice-110453-1.rs b/tests/ui/mir/mir-build-2021-closure-capture-ice-110453-1.rs new file mode 100644 index 0000000000000..0b2e63bfcf772 --- /dev/null +++ b/tests/ui/mir/mir-build-2021-closure-capture-ice-110453-1.rs @@ -0,0 +1,18 @@ +// ICE in mir building with captured value of unresolved type +// None in compiler/rustc_mir_build/src/build/expr/as_place.rs +// issue: rust-lang/rust#110453 +//@ edition:2021 + +#![crate_type="lib"] + +pub struct B; +pub fn a() -> B { B } + +mod handlers { + pub struct C(B); + //~^ ERROR cannot find type `B` in this scope + pub fn c() -> impl Fn() -> C { + let a1 = (); + || C((crate::a(), a1).into()) + } +} diff --git a/tests/ui/mir/mir-build-2021-closure-capture-ice-110453-1.stderr b/tests/ui/mir/mir-build-2021-closure-capture-ice-110453-1.stderr new file mode 100644 index 0000000000000..468da0227d3d0 --- /dev/null +++ b/tests/ui/mir/mir-build-2021-closure-capture-ice-110453-1.stderr @@ -0,0 +1,14 @@ +error[E0412]: cannot find type `B` in this scope + --> $DIR/mir-build-2021-closure-capture-ice-110453-1.rs:12:18 + | +LL | pub struct C(B); + | ^ not found in this scope + | +help: consider importing this struct + | +LL + use crate::B; + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/mir/mir-build-2021-closure-capture-ice-110453-2.rs b/tests/ui/mir/mir-build-2021-closure-capture-ice-110453-2.rs new file mode 100644 index 0000000000000..d63ccc6651c7b --- /dev/null +++ b/tests/ui/mir/mir-build-2021-closure-capture-ice-110453-2.rs @@ -0,0 +1,11 @@ +// ICE in mir building with captured value of unresolved type +// None in compiler/rustc_mir_build/src/build/expr/as_place.rs +// issue: rust-lang/rust#110453 +//@ edition:2021 + +#![crate_type="lib"] + +pub fn dup(f: impl Fn(i32) -> i32) -> impl Fn(as_str) -> i32 { +//~^ ERROR cannot find type `as_str` in this scope + move |a| f(a * 2) +} diff --git a/tests/ui/mir/mir-build-2021-closure-capture-ice-110453-2.stderr b/tests/ui/mir/mir-build-2021-closure-capture-ice-110453-2.stderr new file mode 100644 index 0000000000000..8fe4981eb3f24 --- /dev/null +++ b/tests/ui/mir/mir-build-2021-closure-capture-ice-110453-2.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `as_str` in this scope + --> $DIR/mir-build-2021-closure-capture-ice-110453-2.rs:8:47 + | +LL | pub fn dup(f: impl Fn(i32) -> i32) -> impl Fn(as_str) -> i32 { + | ^^^^^^ not found in this scope + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0412`. From e4d816e66c9de3e78a330cd27287c10b831b1c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 24 Mar 2024 10:57:20 +0100 Subject: [PATCH 15/20] add tests for ICE: 'broken MIR: bad assignment: NoSolution' on trait with default method and no impls Fixes #109869 --- ...-method-but-no-impl-broken-mir-109869-1.rs | 21 +++++++++++++++++++ ...hod-but-no-impl-broken-mir-109869-1.stderr | 19 +++++++++++++++++ ...-method-but-no-impl-broken-mir-109869-2.rs | 17 +++++++++++++++ ...hod-but-no-impl-broken-mir-109869-2.stderr | 14 +++++++++++++ ...o-impl-broken-mir-109869-trivial-bounds.rs | 18 ++++++++++++++++ ...pl-broken-mir-109869-trivial-bounds.stderr | 14 +++++++++++++ 6 files changed, 103 insertions(+) create mode 100644 tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-1.rs create mode 100644 tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-1.stderr create mode 100644 tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-2.rs create mode 100644 tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-2.stderr create mode 100644 tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-trivial-bounds.rs create mode 100644 tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-trivial-bounds.stderr diff --git a/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-1.rs b/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-1.rs new file mode 100644 index 0000000000000..5cccda626084e --- /dev/null +++ b/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-1.rs @@ -0,0 +1,21 @@ +// ICE 'broken MIR: bad assignment: NoSolution' +// on trait with default method and no impls +// issue: rust-lang/rust#109869 + +type Spanned = (T, ()); + +trait Span {} + +impl Span for (T, ()) {} + +impl> From> for dyn Span +where + Self: Sized +{ + fn from((from, ()): Spanned) -> Self { + (T::from(from), ()) + //~^ ERROR mismatched types + } +} + +pub fn main() {} diff --git a/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-1.stderr b/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-1.stderr new file mode 100644 index 0000000000000..d43c9c018211c --- /dev/null +++ b/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-1.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/ice-trait-with-default-method-but-no-impl-broken-mir-109869-1.rs:16:9 + | +LL | fn from((from, ()): Spanned) -> Self { + | ---- expected `(dyn Span + 'static)` because of return type +LL | (T::from(from), ()) + | ^^^^^^^^^^^^^^^^^^^ expected `dyn Span`, found `(T, ())` + | + = note: expected trait object `(dyn Span + 'static)` + found tuple `(T, ())` + = help: `(T, ())` implements `Span` so you could box the found value and coerce it to the trait object `Box`, you will have to change the expected type as well +help: call `Into::into` on this expression to convert `(T, ())` into `(dyn Span + 'static)` + | +LL | (T::from(from), ()).into() + | +++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-2.rs b/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-2.rs new file mode 100644 index 0000000000000..2e0179fb164ef --- /dev/null +++ b/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-2.rs @@ -0,0 +1,17 @@ +// ICE 'broken MIR: bad assignment: NoSolution' +// on trait with default method and no impls +// issue: rust-lang/rust#109869 + +trait Empty {} + +impl Default for dyn Empty +where + Self: Sized, +{ + fn default() -> Self { + () + //~^ ERROR mismatched types + } +} + +pub fn main() {} diff --git a/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-2.stderr b/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-2.stderr new file mode 100644 index 0000000000000..5f00ced09b845 --- /dev/null +++ b/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-2.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/ice-trait-with-default-method-but-no-impl-broken-mir-109869-2.rs:12:9 + | +LL | fn default() -> Self { + | ---- expected `(dyn Empty + 'static)` because of return type +LL | () + | ^^ expected `dyn Empty`, found `()` + | + = note: expected trait object `(dyn Empty + 'static)` + found unit type `()` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-trivial-bounds.rs b/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-trivial-bounds.rs new file mode 100644 index 0000000000000..d8bc2a4321e11 --- /dev/null +++ b/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-trivial-bounds.rs @@ -0,0 +1,18 @@ +// ICE 'broken MIR: bad assignment: NoSolution' +// on trait with default method and no impls +// issue: rust-lang/rust#109869 + +#![feature(trivial_bounds)] +trait Empty {} + +impl Default for dyn Empty +where + Self: Sized, +{ + fn default() -> Self { + () + //~^ ERROR mismatched types + } +} + +pub fn main() {} diff --git a/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-trivial-bounds.stderr b/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-trivial-bounds.stderr new file mode 100644 index 0000000000000..872b7f5cee1d6 --- /dev/null +++ b/tests/ui/traits/ice-trait-with-default-method-but-no-impl-broken-mir-109869-trivial-bounds.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/ice-trait-with-default-method-but-no-impl-broken-mir-109869-trivial-bounds.rs:13:9 + | +LL | fn default() -> Self { + | ---- expected `(dyn Empty + 'static)` because of return type +LL | () + | ^^ expected `dyn Empty`, found `()` + | + = note: expected trait object `(dyn Empty + 'static)` + found unit type `()` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. From 47192937d42e47cae6b110dcbf755dbfea7956e8 Mon Sep 17 00:00:00 2001 From: Alex Macleod Date: Sun, 24 Mar 2024 13:57:59 +0000 Subject: [PATCH 16/20] Fix unpretty UI test when /tmp does not exist --- tests/ui/unpretty/avoid-crash.rs | 2 +- tests/ui/unpretty/avoid-crash.stderr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ui/unpretty/avoid-crash.rs b/tests/ui/unpretty/avoid-crash.rs index 94aa7e77dcb30..2105068617b1c 100644 --- a/tests/ui/unpretty/avoid-crash.rs +++ b/tests/ui/unpretty/avoid-crash.rs @@ -1,4 +1,4 @@ //@ normalize-stderr-test "error `.*`" -> "$$ERROR_MESSAGE" -//@ compile-flags: -o/tmp/ -Zunpretty=ast-tree +//@ compile-flags: -o. -Zunpretty=ast-tree fn main() {} diff --git a/tests/ui/unpretty/avoid-crash.stderr b/tests/ui/unpretty/avoid-crash.stderr index 6fa3e8ca630a4..1c966754e94e4 100644 --- a/tests/ui/unpretty/avoid-crash.stderr +++ b/tests/ui/unpretty/avoid-crash.stderr @@ -1,4 +1,4 @@ -error: failed to write `/tmp/` due to $ERROR_MESSAGE +error: failed to write `.` due to $ERROR_MESSAGE error: aborting due to 1 previous error From 2cb53473d92251a6ba2538fe034ab1ad62224ed1 Mon Sep 17 00:00:00 2001 From: Alex Macleod Date: Sun, 24 Mar 2024 14:57:57 +0000 Subject: [PATCH 17/20] Rename `{enter,exit}_lint_attrs` to `check_attributes{,_post}` --- compiler/rustc_lint/src/early.rs | 4 ++-- compiler/rustc_lint/src/late.rs | 9 ++------- compiler/rustc_lint/src/passes.rs | 18 ++++-------------- src/tools/clippy/clippy_config/src/msrvs.rs | 4 ++-- .../clippy_lints/src/cognitive_complexity.rs | 4 ++-- .../clippy/clippy_lints/src/missing_doc.rs | 4 ++-- .../src/utils/internal_lints/msrv_attr_impl.rs | 2 +- src/tools/clippy/clippy_utils/src/lib.rs | 8 ++++---- 8 files changed, 19 insertions(+), 34 deletions(-) diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index d78ec8c0dd348..9fae32a49c782 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -73,10 +73,10 @@ impl<'a, T: EarlyLintPass> EarlyContextAndPass<'a, T> { self.inlined_check_id(id); debug!("early context: enter_attrs({:?})", attrs); - lint_callback!(self, enter_lint_attrs, attrs); + lint_callback!(self, check_attributes, attrs); ensure_sufficient_stack(|| f(self)); debug!("early context: exit_attrs({:?})", attrs); - lint_callback!(self, exit_lint_attrs, attrs); + lint_callback!(self, check_attributes_post, attrs); self.context.builder.pop(push); } } diff --git a/compiler/rustc_lint/src/late.rs b/compiler/rustc_lint/src/late.rs index 384bd353d755d..99207e3f315cf 100644 --- a/compiler/rustc_lint/src/late.rs +++ b/compiler/rustc_lint/src/late.rs @@ -15,7 +15,6 @@ //! for all lint attributes. use crate::{passes::LateLintPassObject, LateContext, LateLintPass, LintStore}; -use rustc_ast as ast; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_data_structures::sync::{join, Lrc}; use rustc_hir as hir; @@ -62,13 +61,13 @@ impl<'tcx, T: LateLintPass<'tcx>> LateContextAndPass<'tcx, T> { let prev = self.context.last_node_with_lint_attrs; self.context.last_node_with_lint_attrs = id; debug!("late context: enter_attrs({:?})", attrs); - lint_callback!(self, enter_lint_attrs, attrs); + lint_callback!(self, check_attributes, attrs); for attr in attrs { lint_callback!(self, check_attribute, attr); } f(self); debug!("late context: exit_attrs({:?})", attrs); - lint_callback!(self, exit_lint_attrs, attrs); + lint_callback!(self, check_attributes_post, attrs); self.context.last_node_with_lint_attrs = prev; } @@ -310,10 +309,6 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas lint_callback!(self, check_path, p, id); hir_visit::walk_path(self, p); } - - fn visit_attribute(&mut self, attr: &'tcx ast::Attribute) { - lint_callback!(self, check_attribute, attr); - } } // Combines multiple lint passes into a single pass, at runtime. Each diff --git a/compiler/rustc_lint/src/passes.rs b/compiler/rustc_lint/src/passes.rs index 3e93cc0be6aa6..d8ba84eb7a1a8 100644 --- a/compiler/rustc_lint/src/passes.rs +++ b/compiler/rustc_lint/src/passes.rs @@ -41,13 +41,8 @@ macro_rules! late_lint_methods { fn check_variant(a: &'tcx rustc_hir::Variant<'tcx>); fn check_path(a: &rustc_hir::Path<'tcx>, b: rustc_hir::HirId); fn check_attribute(a: &'tcx rustc_ast::Attribute); - - /// Called when entering a syntax node that can have lint attributes such - /// as `#[allow(...)]`. Called with *all* the attributes of that node. - fn enter_lint_attrs(a: &'tcx [rustc_ast::Attribute]); - - /// Counterpart to `enter_lint_attrs`. - fn exit_lint_attrs(a: &'tcx [rustc_ast::Attribute]); + fn check_attributes(a: &'tcx [rustc_ast::Attribute]); + fn check_attributes_post(a: &'tcx [rustc_ast::Attribute]); ]); ) } @@ -162,16 +157,11 @@ macro_rules! early_lint_methods { fn check_impl_item(a: &rustc_ast::AssocItem); fn check_variant(a: &rustc_ast::Variant); fn check_attribute(a: &rustc_ast::Attribute); + fn check_attributes(a: &[rustc_ast::Attribute]); + fn check_attributes_post(a: &[rustc_ast::Attribute]); fn check_mac_def(a: &rustc_ast::MacroDef); fn check_mac(a: &rustc_ast::MacCall); - /// Called when entering a syntax node that can have lint attributes such - /// as `#[allow(...)]`. Called with *all* the attributes of that node. - fn enter_lint_attrs(a: &[rustc_ast::Attribute]); - - /// Counterpart to `enter_lint_attrs`. - fn exit_lint_attrs(a: &[rustc_ast::Attribute]); - fn enter_where_predicate(a: &rustc_ast::WherePredicate); fn exit_where_predicate(a: &rustc_ast::WherePredicate); ]); diff --git a/src/tools/clippy/clippy_config/src/msrvs.rs b/src/tools/clippy/clippy_config/src/msrvs.rs index bf4da5f14fe0a..149c4776dc9c9 100644 --- a/src/tools/clippy/clippy_config/src/msrvs.rs +++ b/src/tools/clippy/clippy_config/src/msrvs.rs @@ -143,13 +143,13 @@ impl Msrv { None } - pub fn enter_lint_attrs(&mut self, sess: &Session, attrs: &[Attribute]) { + pub fn check_attributes(&mut self, sess: &Session, attrs: &[Attribute]) { if let Some(version) = Self::parse_attr(sess, attrs) { self.stack.push(version); } } - pub fn exit_lint_attrs(&mut self, sess: &Session, attrs: &[Attribute]) { + pub fn check_attributes_post(&mut self, sess: &Session, attrs: &[Attribute]) { if Self::parse_attr(sess, attrs).is_some() { self.stack.pop(); } diff --git a/src/tools/clippy/clippy_lints/src/cognitive_complexity.rs b/src/tools/clippy/clippy_lints/src/cognitive_complexity.rs index 60f436dc5d2be..7dac3c5d9dabc 100644 --- a/src/tools/clippy/clippy_lints/src/cognitive_complexity.rs +++ b/src/tools/clippy/clippy_lints/src/cognitive_complexity.rs @@ -158,10 +158,10 @@ impl<'tcx> LateLintPass<'tcx> for CognitiveComplexity { } } - fn enter_lint_attrs(&mut self, cx: &LateContext<'tcx>, attrs: &'tcx [Attribute]) { + fn check_attributes(&mut self, cx: &LateContext<'tcx>, attrs: &'tcx [Attribute]) { self.limit.push_attrs(cx.sess(), attrs, "cognitive_complexity"); } - fn exit_lint_attrs(&mut self, cx: &LateContext<'tcx>, attrs: &'tcx [Attribute]) { + fn check_attributes_post(&mut self, cx: &LateContext<'tcx>, attrs: &'tcx [Attribute]) { self.limit.pop_attrs(cx.sess(), attrs, "cognitive_complexity"); } } diff --git a/src/tools/clippy/clippy_lints/src/missing_doc.rs b/src/tools/clippy/clippy_lints/src/missing_doc.rs index 6878fb3349d4a..2773427e72d5a 100644 --- a/src/tools/clippy/clippy_lints/src/missing_doc.rs +++ b/src/tools/clippy/clippy_lints/src/missing_doc.rs @@ -162,12 +162,12 @@ impl MissingDoc { impl_lint_pass!(MissingDoc => [MISSING_DOCS_IN_PRIVATE_ITEMS]); impl<'tcx> LateLintPass<'tcx> for MissingDoc { - fn enter_lint_attrs(&mut self, _: &LateContext<'tcx>, attrs: &'tcx [ast::Attribute]) { + fn check_attributes(&mut self, _: &LateContext<'tcx>, attrs: &'tcx [ast::Attribute]) { let doc_hidden = self.doc_hidden() || is_doc_hidden(attrs); self.doc_hidden_stack.push(doc_hidden); } - fn exit_lint_attrs(&mut self, _: &LateContext<'tcx>, _: &'tcx [ast::Attribute]) { + fn check_attributes_post(&mut self, _: &LateContext<'tcx>, _: &'tcx [ast::Attribute]) { self.doc_hidden_stack.pop().expect("empty doc_hidden_stack"); } diff --git a/src/tools/clippy/clippy_lints/src/utils/internal_lints/msrv_attr_impl.rs b/src/tools/clippy/clippy_lints/src/utils/internal_lints/msrv_attr_impl.rs index 6d5240db83249..8d208fbb7e954 100644 --- a/src/tools/clippy/clippy_lints/src/utils/internal_lints/msrv_attr_impl.rs +++ b/src/tools/clippy/clippy_lints/src/utils/internal_lints/msrv_attr_impl.rs @@ -42,7 +42,7 @@ impl LateLintPass<'_> for MsrvAttrImpl { .filter(|t| matches!(t.unpack(), GenericArgKind::Type(_))) .any(|t| match_type(cx, t.expect_ty(), &paths::MSRV)) }) - && !items.iter().any(|item| item.ident.name == sym!(enter_lint_attrs)) + && !items.iter().any(|item| item.ident.name == sym!(check_attributes)) { let context = if is_late_pass { "LateContext" } else { "EarlyContext" }; let lint_pass = if is_late_pass { "LateLintPass" } else { "EarlyLintPass" }; diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 3b1b99caebe23..8251bdf78fc7d 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -131,14 +131,14 @@ use rustc_middle::hir::nested_filter; #[macro_export] macro_rules! extract_msrv_attr { ($context:ident) => { - fn enter_lint_attrs(&mut self, cx: &rustc_lint::$context<'_>, attrs: &[rustc_ast::ast::Attribute]) { + fn check_attributes(&mut self, cx: &rustc_lint::$context<'_>, attrs: &[rustc_ast::ast::Attribute]) { let sess = rustc_lint::LintContext::sess(cx); - self.msrv.enter_lint_attrs(sess, attrs); + self.msrv.check_attributes(sess, attrs); } - fn exit_lint_attrs(&mut self, cx: &rustc_lint::$context<'_>, attrs: &[rustc_ast::ast::Attribute]) { + fn check_attributes_post(&mut self, cx: &rustc_lint::$context<'_>, attrs: &[rustc_ast::ast::Attribute]) { let sess = rustc_lint::LintContext::sess(cx); - self.msrv.exit_lint_attrs(sess, attrs); + self.msrv.check_attributes_post(sess, attrs); } }; } From e6918b1e5dcf4a2e88c2c39cddfb761dc4a71aca Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 24 Mar 2024 21:42:32 -0400 Subject: [PATCH 18/20] Add async-closures/once.rs back to cranelift tests --- compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh index 9b360fb303624..fcf3ba0357487 100755 --- a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh +++ b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh @@ -154,7 +154,6 @@ rm tests/ui/codegen/subtyping-enforces-type-equality.rs # assert_assignable bug # ====================== rm tests/ui/backtrace.rs # TODO warning rm tests/ui/process/nofile-limit.rs # TODO some AArch64 linking issue -rm tests/ui/async-await/async-closures/once.rs # FIXME bug in the rustc FnAbi calculation code rm tests/ui/stdio-is-blocking.rs # really slow with unoptimized libstd From 3733dcc72d3b8504ab812990b30e17bd5f0afd5b Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:19:07 +0000 Subject: [PATCH 19/20] Add needs-unwind annotations to a couple of tests --- .../rustc_codegen_cranelift/scripts/test_rustc_tests.sh | 6 ------ tests/run-make/libtest-junit/Makefile | 1 + tests/ui/asm/may_unwind.rs | 1 + tests/ui/stable-mir-print/basic_function.rs | 1 + 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh index 9b360fb303624..7f47fd972c44d 100755 --- a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh +++ b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh @@ -41,12 +41,6 @@ rm tests/ui/parser/unclosed-delimiter-in-dep.rs # submodule contains //~ERROR # missing features # ================ -# requires stack unwinding -# FIXME add needs-unwind to these tests -rm -r tests/run-make/libtest-junit -rm tests/ui/asm/may_unwind.rs -rm tests/ui/stable-mir-print/basic_function.rs - # extra warning about -Cpanic=abort for proc macros rm tests/ui/proc-macro/crt-static.rs rm tests/ui/proc-macro/proc-macro-deprecated-attr.rs diff --git a/tests/run-make/libtest-junit/Makefile b/tests/run-make/libtest-junit/Makefile index d97cafccf1fd4..26e56242dd239 100644 --- a/tests/run-make/libtest-junit/Makefile +++ b/tests/run-make/libtest-junit/Makefile @@ -1,4 +1,5 @@ # ignore-cross-compile +# needs-unwind contains should_panic test include ../tools.mk # Test expected libtest's junit output diff --git a/tests/ui/asm/may_unwind.rs b/tests/ui/asm/may_unwind.rs index 216408b38733a..1d4f50d5fe89d 100644 --- a/tests/ui/asm/may_unwind.rs +++ b/tests/ui/asm/may_unwind.rs @@ -1,5 +1,6 @@ //@ run-pass //@ needs-asm-support +//@ needs-unwind #![feature(asm_unwind)] diff --git a/tests/ui/stable-mir-print/basic_function.rs b/tests/ui/stable-mir-print/basic_function.rs index deefef63bdb6e..5f582ece6fb41 100644 --- a/tests/ui/stable-mir-print/basic_function.rs +++ b/tests/ui/stable-mir-print/basic_function.rs @@ -1,6 +1,7 @@ //@ compile-flags: -Z unpretty=stable-mir -Z mir-opt-level=3 //@ check-pass //@ only-x86_64 +//@ needs-unwind unwind edges are different with panic=abort fn foo(i: i32) -> i32 { i + 1 From 5f5dcaefe648390e2d5763c8f6480bba0ffb55bb Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:24:08 +0000 Subject: [PATCH 20/20] Add needs-unwind for proc macro tests Rustc gives a warning when compiling proc macros with panic=abort. --- .../rustc_codegen_cranelift/scripts/test_rustc_tests.sh | 9 --------- tests/ui/proc-macro/allowed-signatures.rs | 3 ++- tests/ui/proc-macro/crt-static.rs | 1 + .../proc-macro/no-mangle-in-proc-macro-issue-111888.rs | 1 + tests/ui/proc-macro/no-missing-docs.rs | 1 + tests/ui/proc-macro/proc-macro-deprecated-attr.rs | 1 + tests/ui/proc-macro/quote-debug.rs | 1 + tests/ui/proc-macro/quote-debug.stdout | 1 + tests/ui/rust-2018/proc-macro-crate-in-paths.rs | 1 + 9 files changed, 9 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh index 7f47fd972c44d..b6651fa28919b 100755 --- a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh +++ b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh @@ -41,15 +41,6 @@ rm tests/ui/parser/unclosed-delimiter-in-dep.rs # submodule contains //~ERROR # missing features # ================ -# extra warning about -Cpanic=abort for proc macros -rm tests/ui/proc-macro/crt-static.rs -rm tests/ui/proc-macro/proc-macro-deprecated-attr.rs -rm tests/ui/proc-macro/quote-debug.rs -rm tests/ui/proc-macro/no-missing-docs.rs -rm tests/ui/rust-2018/proc-macro-crate-in-paths.rs -rm tests/ui/proc-macro/allowed-signatures.rs -rm tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs - # vendor intrinsics rm tests/ui/simd/array-type.rs # "Index argument for `simd_insert` is not a constant" rm tests/ui/asm/x86_64/evex512-implicit-feature.rs # unimplemented AVX512 x86 vendor intrinsic diff --git a/tests/ui/proc-macro/allowed-signatures.rs b/tests/ui/proc-macro/allowed-signatures.rs index 8dede3f50b59b..c70d62ab57b0d 100644 --- a/tests/ui/proc-macro/allowed-signatures.rs +++ b/tests/ui/proc-macro/allowed-signatures.rs @@ -1,6 +1,7 @@ //@ check-pass //@ force-host //@ no-prefer-dynamic +//@ needs-unwind compiling proc macros with panic=abort causes a warning #![crate_type = "proc-macro"] #![allow(private_interfaces)] @@ -9,7 +10,7 @@ use proc_macro::TokenStream; #[proc_macro] pub fn foo(t: T) -> TokenStream { - TokenStream::new() + TokenStream::new() } trait Project { diff --git a/tests/ui/proc-macro/crt-static.rs b/tests/ui/proc-macro/crt-static.rs index 0874c4e8a38bd..0255d26254e28 100644 --- a/tests/ui/proc-macro/crt-static.rs +++ b/tests/ui/proc-macro/crt-static.rs @@ -7,6 +7,7 @@ //@ force-host //@ no-prefer-dynamic //@ needs-dynamic-linking +//@ needs-unwind compiling proc macros with panic=abort causes a warning #![crate_type = "proc-macro"] diff --git a/tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs b/tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs index e04d45bbd0dfe..1424754f0cabf 100644 --- a/tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs +++ b/tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs @@ -1,6 +1,7 @@ //@ build-pass //@ force-host //@ no-prefer-dynamic +//@ needs-unwind compiling proc macros with panic=abort causes a warning //@ aux-build:exports_no_mangle.rs #![crate_type = "proc-macro"] diff --git a/tests/ui/proc-macro/no-missing-docs.rs b/tests/ui/proc-macro/no-missing-docs.rs index 124af9bea756d..49d9ead340b2e 100644 --- a/tests/ui/proc-macro/no-missing-docs.rs +++ b/tests/ui/proc-macro/no-missing-docs.rs @@ -4,6 +4,7 @@ //@ build-pass (FIXME(62277): could be check-pass?) //@ force-host //@ no-prefer-dynamic +//@ needs-unwind compiling proc macros with panic=abort causes a warning #![crate_type = "proc-macro"] #![deny(missing_docs)] diff --git a/tests/ui/proc-macro/proc-macro-deprecated-attr.rs b/tests/ui/proc-macro/proc-macro-deprecated-attr.rs index 5e06a1c6cf8ba..85e930bf7f590 100644 --- a/tests/ui/proc-macro/proc-macro-deprecated-attr.rs +++ b/tests/ui/proc-macro/proc-macro-deprecated-attr.rs @@ -1,6 +1,7 @@ //@ check-pass //@ force-host //@ no-prefer-dynamic +//@ needs-unwind compiling proc macros with panic=abort causes a warning #![deny(deprecated)] diff --git a/tests/ui/proc-macro/quote-debug.rs b/tests/ui/proc-macro/quote-debug.rs index f1593b505f9a3..11d144d609f5a 100644 --- a/tests/ui/proc-macro/quote-debug.rs +++ b/tests/ui/proc-macro/quote-debug.rs @@ -2,6 +2,7 @@ //@ force-host //@ no-prefer-dynamic //@ compile-flags: -Z unpretty=expanded +//@ needs-unwind compiling proc macros with panic=abort causes a warning // // This file is not actually used as a proc-macro - instead, // it's just used to show the output of the `quote!` macro diff --git a/tests/ui/proc-macro/quote-debug.stdout b/tests/ui/proc-macro/quote-debug.stdout index 51f34423366ff..d84b4e051e872 100644 --- a/tests/ui/proc-macro/quote-debug.stdout +++ b/tests/ui/proc-macro/quote-debug.stdout @@ -4,6 +4,7 @@ //@ force-host //@ no-prefer-dynamic //@ compile-flags: -Z unpretty=expanded +//@ needs-unwind compiling proc macros with panic=abort causes a warning // // This file is not actually used as a proc-macro - instead, // it's just used to show the output of the `quote!` macro diff --git a/tests/ui/rust-2018/proc-macro-crate-in-paths.rs b/tests/ui/rust-2018/proc-macro-crate-in-paths.rs index ce29fc51a4fda..e5a4b7a9d5cb7 100644 --- a/tests/ui/rust-2018/proc-macro-crate-in-paths.rs +++ b/tests/ui/rust-2018/proc-macro-crate-in-paths.rs @@ -1,6 +1,7 @@ //@ build-pass (FIXME(62277): could be check-pass?) //@ force-host //@ no-prefer-dynamic +//@ needs-unwind compiling proc macros with panic=abort causes a warning #![crate_type = "proc-macro"] #![deny(rust_2018_compatibility)]