Skip to content

Commit c07ebeb

Browse files
authored
Rollup merge of #102361 - fee1-dead-contrib:fix-102156, r=eholk
Fix ICE in const_trait check code This fixes #102156.
2 parents 877877a + d7fe44d commit c07ebeb

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

compiler/rustc_passes/src/check_const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
198198
of_trait: Some(trait_ref),
199199
..
200200
}) = item.kind
201+
&& let Some(def_id) = trait_ref.trait_def_id()
201202
{
202-
let def_id = trait_ref.trait_def_id().unwrap();
203203
let source_map = tcx.sess.source_map();
204204
if !tcx.has_attr(def_id, sym::const_trait) {
205205
tcx.sess
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(allocator_api)]
2+
#![feature(const_trait_impl)]
3+
4+
use core::convert::{From, TryFrom};
5+
//~^ ERROR
6+
//~| ERROR
7+
8+
use std::pin::Pin;
9+
use std::alloc::Allocator;
10+
impl<T: ?Sized, A: Allocator> const From<Box<T, A>> for Pin<Box<T, A>>
11+
where
12+
A: 'static,
13+
{}
14+
15+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0433]: failed to resolve: maybe a missing crate `core`?
2+
--> $DIR/issue-102156.rs:4:5
3+
|
4+
LL | use core::convert::{From, TryFrom};
5+
| ^^^^ maybe a missing crate `core`?
6+
|
7+
= help: consider adding `extern crate core` to use the `core` crate
8+
9+
error[E0433]: failed to resolve: maybe a missing crate `core`?
10+
--> $DIR/issue-102156.rs:4:5
11+
|
12+
LL | use core::convert::{From, TryFrom};
13+
| ^^^^ maybe a missing crate `core`?
14+
|
15+
= help: consider adding `extern crate core` to use the `core` crate
16+
17+
error: aborting due to 2 previous errors
18+
19+
For more information about this error, try `rustc --explain E0433`.

0 commit comments

Comments
 (0)