Skip to content

Commit e053bb7

Browse files
committed
remove sizedness_fast_path in fulfill.rs
It solves #141806. sizedness_fast_path in FulfillProcessor.process_obligation causes the panic if the Sized type doesn't exist. Signed-off-by: Shunpoco <[email protected]>
1 parent 1ae7c49 commit e053bb7

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

compiler/rustc_trait_selection/src/traits/fulfill.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ use super::{
3030
use crate::error_reporting::InferCtxtErrorExt;
3131
use crate::infer::{InferCtxt, TyOrConstInferVar};
3232
use crate::solve::StalledOnCoroutines;
33+
use crate::traits::EvaluateConstErr;
3334
use crate::traits::normalize::normalize_with_depth_to;
3435
use crate::traits::project::{PolyProjectionObligation, ProjectionCacheKeyExt as _};
3536
use crate::traits::query::evaluate_obligation::InferCtxtExt;
36-
use crate::traits::{EvaluateConstErr, sizedness_fast_path};
3737

3838
pub(crate) type PendingPredicateObligations<'tcx> = ThinVec<PendingPredicateObligation<'tcx>>;
3939

@@ -363,10 +363,6 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
363363

364364
let infcx = self.selcx.infcx;
365365

366-
if sizedness_fast_path(infcx.tcx, obligation.predicate, obligation.param_env) {
367-
return ProcessResult::Changed(thin_vec![]);
368-
}
369-
370366
if obligation.predicate.has_aliases() {
371367
let mut obligations = PredicateObligations::new();
372368
let predicate = normalize_with_depth_to(
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// ICE-141806
2+
trait Trait<T> {}
3+
fn func(x: *const dyn Trait<()>)
4+
where
5+
Missing: Sized, //~ ERROR E0412
6+
{
7+
let _x: *const dyn Trait<u8> = x as _;
8+
}
9+
10+
fn main() {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0412]: cannot find type `Missing` in this scope
2+
--> $DIR/missing-sized-not-panic.rs:5:5
3+
|
4+
LL | Missing: Sized,
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 E0412`.

0 commit comments

Comments
 (0)