Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ICE in -Zsave-analysis #72338

Merged
merged 1 commit into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/librustc_save_analysis/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,11 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
}

pub fn get_path_res(&self, id: NodeId) -> Res {
let hir_id = self.tcx.hir().node_id_to_hir_id(id);
// FIXME(#71104)
let hir_id = match self.tcx.hir().opt_node_id_to_hir_id(id) {
Some(id) => id,
None => return Res::Err,
};
match self.tcx.hir().get(hir_id) {
Node::TraitRef(tr) => tr.path.res,

Expand Down
7 changes: 7 additions & 0 deletions src/test/ui/save-analysis/issue-72267.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// compile-flags: -Z save-analysis

fn main() {
let _: Box<(dyn ?Sized)>;
//~^ ERROR `?Trait` is not permitted in trait object types
//~| ERROR at least one trait is required for an object type
}
15 changes: 15 additions & 0 deletions src/test/ui/save-analysis/issue-72267.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: `?Trait` is not permitted in trait object types
--> $DIR/issue-72267.rs:4:21
|
LL | let _: Box<(dyn ?Sized)>;
| ^^^^^^

error[E0224]: at least one trait is required for an object type
--> $DIR/issue-72267.rs:4:17
|
LL | let _: Box<(dyn ?Sized)>;
| ^^^^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0224`.