Skip to content

Commit 6e00f0d

Browse files
authored
Rollup merge of #121434 - nnethercote:fix-121208-fallout, r=lcnr
Fix #121208 fallout #121208 converted lots of delayed bugs to bugs. Unsurprisingly, there were a few invalid conversion found via fuzzing. r? `@lcnr`
2 parents dda102c + 4f83e50 commit 6e00f0d

File tree

12 files changed

+119
-6
lines changed

12 files changed

+119
-6
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16361636
if let Some(old_def_id) = self.orig_opt_local_def_id(param) {
16371637
old_def_id
16381638
} else {
1639-
self.dcx().span_bug(lifetime.ident.span, "no def-id for fresh lifetime");
1639+
self.dcx()
1640+
.span_delayed_bug(lifetime.ident.span, "no def-id for fresh lifetime");
1641+
continue;
16401642
}
16411643
}
16421644

compiler/rustc_hir_analysis/src/collect/generics_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
315315

316316
if is_host_effect {
317317
if let Some(idx) = host_effect_index {
318-
tcx.dcx().span_bug(
318+
tcx.dcx().span_delayed_bug(
319319
param.span,
320320
format!("parent also has host effect param? index: {idx}, def: {def_id:?}"),
321321
);

compiler/rustc_hir_typeck/src/mem_categorization.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
582582
match ty.kind() {
583583
ty::Tuple(args) => Ok(args.len()),
584584
_ => {
585-
self.tcx().dcx().span_bug(span, "tuple pattern not applied to a tuple");
585+
self.tcx().dcx().span_delayed_bug(span, "tuple pattern not applied to a tuple");
586+
Err(())
586587
}
587588
}
588589
}

compiler/rustc_trait_selection/src/traits/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,7 @@ fn do_normalize_predicates<'tcx>(
172172
// the normalized predicates.
173173
let errors = infcx.resolve_regions(&outlives_env);
174174
if !errors.is_empty() {
175-
// @lcnr: Let's still ICE here for now. I want a test case
176-
// for that.
177-
tcx.dcx().span_bug(
175+
tcx.dcx().span_delayed_bug(
178176
span,
179177
format!("failed region resolution while normalizing {elaborated_env:?}: {errors:?}"),
180178
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fn bug<T>() -> impl CallbackMarker< Item = [(); { |_: &mut ()| 3; 4 }] > {}
2+
//~^ ERROR cannot find trait `CallbackMarker` in this scope
3+
4+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0405]: cannot find trait `CallbackMarker` in this scope
2+
--> $DIR/span-bug-issue-121431.rs:1:21
3+
|
4+
LL | fn bug<T>() -> impl CallbackMarker< Item = [(); { |_: &mut ()| 3; 4 }] > {}
5+
| ^^^^^^^^^^^^^^ not found in this scope
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0405`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(const_trait_impl)]
2+
#![feature(effects)]
3+
4+
struct S;
5+
trait T {}
6+
7+
impl const dyn T {
8+
//~^ ERROR inherent impls cannot be `const`
9+
//~| ERROR the const parameter `host` is not constrained by the impl trait, self type, or
10+
pub const fn new() -> std::sync::Mutex<dyn T> {}
11+
}
12+
13+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error: inherent impls cannot be `const`
2+
--> $DIR/span-bug-issue-121418.rs:7:12
3+
|
4+
LL | impl const dyn T {
5+
| ----- ^^^^^ inherent impl for this type
6+
| |
7+
| `const` because of this
8+
|
9+
= note: only trait implementations may be annotated with `const`
10+
11+
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
12+
--> $DIR/span-bug-issue-121418.rs:7:6
13+
|
14+
LL | impl const dyn T {
15+
| ^^^^^ unconstrained const parameter
16+
|
17+
= note: expressions using a const parameter must map each value to a distinct output value
18+
= note: proving the result of expressions other than the parameter are unique is not supported
19+
20+
error: aborting due to 2 previous errors
21+
22+
For more information about this error, try `rustc --explain E0207`.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
trait Bar {
2+
type Type;
3+
}
4+
struct Foo<'a>(&'a ());
5+
impl<'a> Bar for Foo<'f> { //~ ERROR undeclared lifetime
6+
type Type = u32;
7+
}
8+
9+
fn test() //~ ERROR implementation of `Bar` is not general enough
10+
where
11+
for<'a> <Foo<'a> as Bar>::Type: Sized,
12+
{
13+
}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0261]: use of undeclared lifetime name `'f`
2+
--> $DIR/span-bug-issue-121414.rs:5:22
3+
|
4+
LL | impl<'a> Bar for Foo<'f> {
5+
| - ^^ undeclared lifetime
6+
| |
7+
| help: consider introducing lifetime `'f` here: `'f,`
8+
9+
error: implementation of `Bar` is not general enough
10+
--> $DIR/span-bug-issue-121414.rs:9:4
11+
|
12+
LL | fn test()
13+
| ^^^^ implementation of `Bar` is not general enough
14+
|
15+
= note: `Bar` would have to be implemented for the type `Foo<'0>`, for any lifetime `'0`...
16+
= note: ...but `Bar` is actually implemented for the type `Foo<'1>`, for some specific lifetime `'1`
17+
18+
error: aborting due to 2 previous errors
19+
20+
For more information about this error, try `rustc --explain E0261`.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
fn test_missing_unsafe_warning_on_repr_packed() {
2+
struct Foo {
3+
x: String,
4+
}
5+
6+
let foo = Foo { x: String::new() };
7+
8+
let c = || {
9+
let (_, t2) = foo.x; //~ ERROR mismatched types
10+
};
11+
12+
c();
13+
}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/span-bug-issue-121410.rs:9:13
3+
|
4+
LL | let (_, t2) = foo.x;
5+
| ^^^^^^^ ----- this expression has type `String`
6+
| |
7+
| expected `String`, found `(_, _)`
8+
|
9+
= note: expected struct `String`
10+
found tuple `(_, _)`
11+
12+
error: aborting due to 1 previous error
13+
14+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)