librustc: replace panic!() with bug!()
This commit is contained in:
parent
2fa867a203
commit
e3a7a66f1a
|
@ -122,7 +122,7 @@ impl DepGraphEdges {
|
||||||
{
|
{
|
||||||
match self.current_node() {
|
match self.current_node() {
|
||||||
Some(open_node) => self.add_edge_from_open_node(open_node, op),
|
Some(open_node) => self.add_edge_from_open_node(open_node, op),
|
||||||
None => panic!("no current node, cannot add edge into dependency graph")
|
None => bug!("no current node, cannot add edge into dependency graph")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ impl DepGraphThreadData {
|
||||||
|
|
||||||
// Outline this too.
|
// Outline this too.
|
||||||
fn invalid_message(&self, string: &str) {
|
fn invalid_message(&self, string: &str) {
|
||||||
panic!("{}; see src/librustc/dep_graph/README.md for more information", string)
|
bug!("{}; see src/librustc/dep_graph/README.md for more information", string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,13 +231,13 @@ impl<'a> FnLikeNode<'a> {
|
||||||
span: i.span,
|
span: i.span,
|
||||||
attrs: &i.attrs,
|
attrs: &i.attrs,
|
||||||
}),
|
}),
|
||||||
_ => panic!("item FnLikeNode that is not fn-like"),
|
_ => bug!("item FnLikeNode that is not fn-like"),
|
||||||
},
|
},
|
||||||
map::NodeTraitItem(ti) => match ti.node {
|
map::NodeTraitItem(ti) => match ti.node {
|
||||||
ast::MethodTraitItem(ref sig, Some(ref body)) => {
|
ast::MethodTraitItem(ref sig, Some(ref body)) => {
|
||||||
method(ti.id, ti.name, sig, None, body, ti.span, &ti.attrs)
|
method(ti.id, ti.name, sig, None, body, ti.span, &ti.attrs)
|
||||||
}
|
}
|
||||||
_ => panic!("trait method FnLikeNode that is not fn-like"),
|
_ => bug!("trait method FnLikeNode that is not fn-like"),
|
||||||
},
|
},
|
||||||
map::NodeImplItem(ii) => {
|
map::NodeImplItem(ii) => {
|
||||||
match ii.node {
|
match ii.node {
|
||||||
|
@ -245,7 +245,7 @@ impl<'a> FnLikeNode<'a> {
|
||||||
method(ii.id, ii.name, sig, Some(ii.vis), body, ii.span, &ii.attrs)
|
method(ii.id, ii.name, sig, Some(ii.vis), body, ii.span, &ii.attrs)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
panic!("impl method FnLikeNode that is not fn-like")
|
bug!("impl method FnLikeNode that is not fn-like")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,9 +256,9 @@ impl<'a> FnLikeNode<'a> {
|
||||||
e.id,
|
e.id,
|
||||||
e.span,
|
e.span,
|
||||||
e.attrs.as_attr_slice())),
|
e.attrs.as_attr_slice())),
|
||||||
_ => panic!("expr FnLikeNode that is not fn-like"),
|
_ => bug!("expr FnLikeNode that is not fn-like"),
|
||||||
},
|
},
|
||||||
_ => panic!("other FnLikeNode that is not fn-like"),
|
_ => bug!("other FnLikeNode that is not fn-like"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,9 +335,9 @@ impl<'ast> Map<'ast> {
|
||||||
return self.opt_local_def_id(id)
|
return self.opt_local_def_id(id)
|
||||||
.map(|def_id| DepNode::Hir(def_id))
|
.map(|def_id| DepNode::Hir(def_id))
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
panic!("Walking parents from `{}` \
|
bug!("Walking parents from `{}` \
|
||||||
led to `NotPresent` at `{}`",
|
led to `NotPresent` at `{}`",
|
||||||
id0, id)
|
id0, id)
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,8 +363,8 @@ impl<'ast> Map<'ast> {
|
||||||
|
|
||||||
pub fn local_def_id(&self, node: NodeId) -> DefId {
|
pub fn local_def_id(&self, node: NodeId) -> DefId {
|
||||||
self.opt_local_def_id(node).unwrap_or_else(|| {
|
self.opt_local_def_id(node).unwrap_or_else(|| {
|
||||||
panic!("local_def_id: no entry for `{}`, which has a map of `{:?}`",
|
bug!("local_def_id: no entry for `{}`, which has a map of `{:?}`",
|
||||||
node, self.find_entry(node))
|
node, self.find_entry(node))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ impl<'ast> Map<'ast> {
|
||||||
pub fn get(&self, id: NodeId) -> Node<'ast> {
|
pub fn get(&self, id: NodeId) -> Node<'ast> {
|
||||||
match self.find(id) {
|
match self.find(id) {
|
||||||
Some(node) => node, // read recorded by `find`
|
Some(node) => node, // read recorded by `find`
|
||||||
None => panic!("couldn't find node id {} in the AST map", id)
|
None => bug!("couldn't find node id {} in the AST map", id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ impl<'ast> Map<'ast> {
|
||||||
self.read(id); // reveals some of the content of a node
|
self.read(id); // reveals some of the content of a node
|
||||||
abi
|
abi
|
||||||
}
|
}
|
||||||
None => panic!("expected foreign mod or inlined parent, found {}",
|
None => bug!("expected foreign mod or inlined parent, found {}",
|
||||||
self.node_to_string(parent))
|
self.node_to_string(parent))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -584,14 +584,14 @@ impl<'ast> Map<'ast> {
|
||||||
pub fn expect_item(&self, id: NodeId) -> &'ast Item {
|
pub fn expect_item(&self, id: NodeId) -> &'ast Item {
|
||||||
match self.find(id) { // read recorded by `find`
|
match self.find(id) { // read recorded by `find`
|
||||||
Some(NodeItem(item)) => item,
|
Some(NodeItem(item)) => item,
|
||||||
_ => panic!("expected item, found {}", self.node_to_string(id))
|
_ => bug!("expected item, found {}", self.node_to_string(id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn expect_trait_item(&self, id: NodeId) -> &'ast TraitItem {
|
pub fn expect_trait_item(&self, id: NodeId) -> &'ast TraitItem {
|
||||||
match self.find(id) {
|
match self.find(id) {
|
||||||
Some(NodeTraitItem(item)) => item,
|
Some(NodeTraitItem(item)) => item,
|
||||||
_ => panic!("expected trait item, found {}", self.node_to_string(id))
|
_ => bug!("expected trait item, found {}", self.node_to_string(id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,38 +600,38 @@ impl<'ast> Map<'ast> {
|
||||||
Some(NodeItem(i)) => {
|
Some(NodeItem(i)) => {
|
||||||
match i.node {
|
match i.node {
|
||||||
ItemStruct(ref struct_def, _) => struct_def,
|
ItemStruct(ref struct_def, _) => struct_def,
|
||||||
_ => panic!("struct ID bound to non-struct")
|
_ => bug!("struct ID bound to non-struct")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(NodeVariant(variant)) => {
|
Some(NodeVariant(variant)) => {
|
||||||
if variant.node.data.is_struct() {
|
if variant.node.data.is_struct() {
|
||||||
&variant.node.data
|
&variant.node.data
|
||||||
} else {
|
} else {
|
||||||
panic!("struct ID bound to enum variant that isn't struct-like")
|
bug!("struct ID bound to enum variant that isn't struct-like")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => panic!(format!("expected struct, found {}", self.node_to_string(id))),
|
_ => bug!("expected struct, found {}", self.node_to_string(id)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn expect_variant(&self, id: NodeId) -> &'ast Variant {
|
pub fn expect_variant(&self, id: NodeId) -> &'ast Variant {
|
||||||
match self.find(id) {
|
match self.find(id) {
|
||||||
Some(NodeVariant(variant)) => variant,
|
Some(NodeVariant(variant)) => variant,
|
||||||
_ => panic!(format!("expected variant, found {}", self.node_to_string(id))),
|
_ => bug!("expected variant, found {}", self.node_to_string(id)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn expect_foreign_item(&self, id: NodeId) -> &'ast ForeignItem {
|
pub fn expect_foreign_item(&self, id: NodeId) -> &'ast ForeignItem {
|
||||||
match self.find(id) {
|
match self.find(id) {
|
||||||
Some(NodeForeignItem(item)) => item,
|
Some(NodeForeignItem(item)) => item,
|
||||||
_ => panic!("expected foreign item, found {}", self.node_to_string(id))
|
_ => bug!("expected foreign item, found {}", self.node_to_string(id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn expect_expr(&self, id: NodeId) -> &'ast Expr {
|
pub fn expect_expr(&self, id: NodeId) -> &'ast Expr {
|
||||||
match self.find(id) { // read recorded by find
|
match self.find(id) { // read recorded by find
|
||||||
Some(NodeExpr(expr)) => expr,
|
Some(NodeExpr(expr)) => expr,
|
||||||
_ => panic!("expected expr, found {}", self.node_to_string(id))
|
_ => bug!("expected expr, found {}", self.node_to_string(id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@ impl<'ast> Map<'ast> {
|
||||||
NodeLocal(&Pat { node: PatKind::Ident(_,l,_), .. }) => {
|
NodeLocal(&Pat { node: PatKind::Ident(_,l,_), .. }) => {
|
||||||
PathName(l.node.name)
|
PathName(l.node.name)
|
||||||
},
|
},
|
||||||
_ => panic!("no path elem for {:?}", node)
|
_ => bug!("no path elem for {:?}", node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,7 +773,7 @@ impl<'ast> Map<'ast> {
|
||||||
pub fn span(&self, id: NodeId) -> Span {
|
pub fn span(&self, id: NodeId) -> Span {
|
||||||
self.read(id); // reveals span from node
|
self.read(id); // reveals span from node
|
||||||
self.opt_span(id)
|
self.opt_span(id)
|
||||||
.unwrap_or_else(|| panic!("AstMap.span: could not find span for id {:?}", id))
|
.unwrap_or_else(|| bug!("AstMap.span: could not find span for id {:?}", id))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn span_if_local(&self, id: DefId) -> Option<Span> {
|
pub fn span_if_local(&self, id: DefId) -> Option<Span> {
|
||||||
|
@ -1019,12 +1019,12 @@ impl<'a> NodePrinter for pprust::State<'a> {
|
||||||
NodePat(a) => self.print_pat(&a),
|
NodePat(a) => self.print_pat(&a),
|
||||||
NodeBlock(a) => self.print_block(&a),
|
NodeBlock(a) => self.print_block(&a),
|
||||||
NodeLifetime(a) => self.print_lifetime(&a),
|
NodeLifetime(a) => self.print_lifetime(&a),
|
||||||
NodeTyParam(_) => panic!("cannot print TyParam"),
|
NodeTyParam(_) => bug!("cannot print TyParam"),
|
||||||
// these cases do not carry enough information in the
|
// these cases do not carry enough information in the
|
||||||
// ast_map to reconstruct their full structure for pretty
|
// ast_map to reconstruct their full structure for pretty
|
||||||
// printing.
|
// printing.
|
||||||
NodeLocal(_) => panic!("cannot print isolated Local"),
|
NodeLocal(_) => bug!("cannot print isolated Local"),
|
||||||
NodeStructCtor(_) => panic!("cannot print isolated StructCtor"),
|
NodeStructCtor(_) => bug!("cannot print isolated StructCtor"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -404,7 +404,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
bound_failures.push((origin.clone(), kind.clone(), region));
|
bound_failures.push((origin.clone(), kind.clone(), region));
|
||||||
}
|
}
|
||||||
ProcessedErrors(..) => {
|
ProcessedErrors(..) => {
|
||||||
panic!("should not encounter a `ProcessedErrors` yet: {:?}", error)
|
bug!("should not encounter a `ProcessedErrors` yet: {:?}", error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,13 +182,13 @@ impl<'a, 'tcx> dot::Labeller<'a> for ConstraintGraph<'a, 'tcx> {
|
||||||
fn node_id(&self, n: &Node) -> dot::Id {
|
fn node_id(&self, n: &Node) -> dot::Id {
|
||||||
let node_id = match self.node_ids.get(n) {
|
let node_id = match self.node_ids.get(n) {
|
||||||
Some(node_id) => node_id,
|
Some(node_id) => node_id,
|
||||||
None => panic!("no node_id found for node: {:?}", n),
|
None => bug!("no node_id found for node: {:?}", n),
|
||||||
};
|
};
|
||||||
let name = || format!("node_{}", node_id);
|
let name = || format!("node_{}", node_id);
|
||||||
match dot::Id::new(name()) {
|
match dot::Id::new(name()) {
|
||||||
Ok(id) => id,
|
Ok(id) => id,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
panic!("failed to create graphviz node identified by {}", name());
|
bug!("failed to create graphviz node identified by {}", name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||||
while undo_log.len() > snapshot.length + 1 {
|
while undo_log.len() > snapshot.length + 1 {
|
||||||
match undo_log.pop().unwrap() {
|
match undo_log.pop().unwrap() {
|
||||||
OpenSnapshot => {
|
OpenSnapshot => {
|
||||||
panic!("Failure to observe stack discipline");
|
bug!("Failure to observe stack discipline");
|
||||||
}
|
}
|
||||||
CommitedSnapshot => {}
|
CommitedSnapshot => {}
|
||||||
AddVar(vid) => {
|
AddVar(vid) => {
|
||||||
|
|
|
@ -159,8 +159,8 @@ impl<'tcx> TypeVariableTable<'tcx> {
|
||||||
|
|
||||||
let (relations, default) = match old_value {
|
let (relations, default) = match old_value {
|
||||||
Bounded { relations, default } => (relations, default),
|
Bounded { relations, default } => (relations, default),
|
||||||
Known(_) => panic!("Asked to instantiate variable that is \
|
Known(_) => bug!("Asked to instantiate variable that is \
|
||||||
already instantiated")
|
already instantiated")
|
||||||
};
|
};
|
||||||
|
|
||||||
for &(dir, vid) in &relations {
|
for &(dir, vid) in &relations {
|
||||||
|
@ -318,7 +318,7 @@ impl<'tcx> sv::SnapshotVecDelegate for Delegate<'tcx> {
|
||||||
|
|
||||||
fn relations<'a>(v: &'a mut TypeVariableData) -> &'a mut Vec<Relation> {
|
fn relations<'a>(v: &'a mut TypeVariableData) -> &'a mut Vec<Relation> {
|
||||||
match v.value {
|
match v.value {
|
||||||
Known(_) => panic!("var_sub_var: variable is known"),
|
Known(_) => bug!("var_sub_var: variable is known"),
|
||||||
Bounded { ref mut relations, .. } => relations
|
Bounded { ref mut relations, .. } => relations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,7 @@ impl LintStore {
|
||||||
pub fn register_renamed(&mut self, old_name: &str, new_name: &str) {
|
pub fn register_renamed(&mut self, old_name: &str, new_name: &str) {
|
||||||
let target = match self.by_name.get(new_name) {
|
let target = match self.by_name.get(new_name) {
|
||||||
Some(&Id(lint_id)) => lint_id.clone(),
|
Some(&Id(lint_id)) => lint_id.clone(),
|
||||||
_ => panic!("invalid lint renaming of {} to {}", old_name, new_name)
|
_ => bug!("invalid lint renaming of {} to {}", old_name, new_name)
|
||||||
};
|
};
|
||||||
self.by_name.insert(old_name.to_string(), Renamed(new_name.to_string(), target));
|
self.by_name.insert(old_name.to_string(), Renamed(new_name.to_string(), target));
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ pub fn raw_struct_lint<'a>(sess: &'a Session,
|
||||||
format!("{} [-{} {}]", msg,
|
format!("{} [-{} {}]", msg,
|
||||||
match level {
|
match level {
|
||||||
Warn => 'W', Deny => 'D', Forbid => 'F',
|
Warn => 'W', Deny => 'D', Forbid => 'F',
|
||||||
Allow => panic!()
|
Allow => bug!()
|
||||||
}, name.replace("_", "-"))
|
}, name.replace("_", "-"))
|
||||||
},
|
},
|
||||||
Node(src) => {
|
Node(src) => {
|
||||||
|
|
|
@ -309,7 +309,7 @@ pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
|
||||||
{
|
{
|
||||||
let mut say = |s: &str| {
|
let mut say = |s: &str| {
|
||||||
match (sp, sess) {
|
match (sp, sess) {
|
||||||
(_, None) => panic!("{}", s),
|
(_, None) => bug!("{}", s),
|
||||||
(Some(sp), Some(sess)) => sess.span_err(sp, s),
|
(Some(sp), Some(sess)) => sess.span_err(sp, s),
|
||||||
(None, Some(sess)) => sess.err(s),
|
(None, Some(sess)) => sess.err(s),
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ impl PathResolution {
|
||||||
/// Get the definition, if fully resolved, otherwise panic.
|
/// Get the definition, if fully resolved, otherwise panic.
|
||||||
pub fn full_def(&self) -> Def {
|
pub fn full_def(&self) -> Def {
|
||||||
if self.depth != 0 {
|
if self.depth != 0 {
|
||||||
panic!("path not fully resolved: {:?}", self);
|
bug!("path not fully resolved: {:?}", self);
|
||||||
}
|
}
|
||||||
self.base_def
|
self.base_def
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ impl Def {
|
||||||
Def::TyParam(..) | Def::Struct(..) | Def::Trait(..) |
|
Def::TyParam(..) | Def::Struct(..) | Def::Trait(..) |
|
||||||
Def::Method(..) | Def::Const(..) | Def::AssociatedConst(..) |
|
Def::Method(..) | Def::Const(..) | Def::AssociatedConst(..) |
|
||||||
Def::PrimTy(..) | Def::Label(..) | Def::SelfTy(..) | Def::Err => {
|
Def::PrimTy(..) | Def::Label(..) | Def::SelfTy(..) | Def::Err => {
|
||||||
panic!("attempted .var_id() on invalid {:?}", self)
|
bug!("attempted .var_id() on invalid {:?}", self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ impl Def {
|
||||||
Def::PrimTy(..) |
|
Def::PrimTy(..) |
|
||||||
Def::SelfTy(..) |
|
Def::SelfTy(..) |
|
||||||
Def::Err => {
|
Def::Err => {
|
||||||
panic!("attempted .def_id() on invalid def: {:?}", self)
|
bug!("attempted .def_id() on invalid def: {:?}", self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -611,7 +611,7 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
Def::Err => panic!("Def::Err in memory categorization")
|
Def::Err => bug!("Def::Err in memory categorization")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -343,7 +343,7 @@ impl RegionMaps {
|
||||||
pub fn lookup_code_extent(&self, e: CodeExtentData) -> CodeExtent {
|
pub fn lookup_code_extent(&self, e: CodeExtentData) -> CodeExtent {
|
||||||
match self.code_extent_interner.borrow().get(&e) {
|
match self.code_extent_interner.borrow().get(&e) {
|
||||||
Some(&d) => d,
|
Some(&d) => d,
|
||||||
None => panic!("unknown code extent {:?}", e)
|
None => bug!("unknown code extent {:?}", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn node_extent(&self, n: ast::NodeId) -> CodeExtent {
|
pub fn node_extent(&self, n: ast::NodeId) -> CodeExtent {
|
||||||
|
@ -470,7 +470,7 @@ impl RegionMaps {
|
||||||
pub fn var_scope(&self, var_id: ast::NodeId) -> CodeExtent {
|
pub fn var_scope(&self, var_id: ast::NodeId) -> CodeExtent {
|
||||||
match self.var_map.borrow().get(&var_id) {
|
match self.var_map.borrow().get(&var_id) {
|
||||||
Some(&r) => r,
|
Some(&r) => r,
|
||||||
None => { panic!("no enclosing scope for id {:?}", var_id); }
|
None => { bug!("no enclosing scope for id {:?}", var_id); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,14 +155,14 @@ pub fn get_or_default_sysroot() -> PathBuf {
|
||||||
// gcc chokes on verbatim paths which fs::canonicalize generates
|
// gcc chokes on verbatim paths which fs::canonicalize generates
|
||||||
// so we try to avoid those kinds of paths.
|
// so we try to avoid those kinds of paths.
|
||||||
Ok(canon) => Some(rustcfs::fix_windows_verbatim_for_gcc(&canon)),
|
Ok(canon) => Some(rustcfs::fix_windows_verbatim_for_gcc(&canon)),
|
||||||
Err(e) => panic!("failed to get realpath: {}", e),
|
Err(e) => bug!("failed to get realpath: {}", e),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
match canonicalize(env::current_exe().ok()) {
|
match canonicalize(env::current_exe().ok()) {
|
||||||
Some(mut p) => { p.pop(); p.pop(); p }
|
Some(mut p) => { p.pop(); p.pop(); p }
|
||||||
None => panic!("can't determine value for sysroot")
|
None => bug!("can't determine value for sysroot")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,8 +145,8 @@ impl Graph {
|
||||||
/// Insert cached metadata mapping from a child impl back to its parent.
|
/// Insert cached metadata mapping from a child impl back to its parent.
|
||||||
pub fn record_impl_from_cstore(&mut self, parent: DefId, child: DefId) {
|
pub fn record_impl_from_cstore(&mut self, parent: DefId, child: DefId) {
|
||||||
if self.parent.insert(child, parent).is_some() {
|
if self.parent.insert(child, parent).is_some() {
|
||||||
panic!("When recording an impl from the crate store, information about its parent \
|
bug!("When recording an impl from the crate store, information about its parent \
|
||||||
was already present.");
|
was already present.");
|
||||||
}
|
}
|
||||||
|
|
||||||
self.children.entry(parent).or_insert(vec![]).push(child);
|
self.children.entry(parent).or_insert(vec![]).push(child);
|
||||||
|
|
|
@ -1647,7 +1647,7 @@ impl<'tcx, 'container> AdtDefData<'tcx, 'container> {
|
||||||
match def {
|
match def {
|
||||||
Def::Variant(_, vid) => self.variant_with_id(vid),
|
Def::Variant(_, vid) => self.variant_with_id(vid),
|
||||||
Def::Struct(..) | Def::TyAlias(..) => self.struct_variant(),
|
Def::Struct(..) | Def::TyAlias(..) => self.struct_variant(),
|
||||||
_ => panic!("unexpected def {:?} in variant_of_def", def)
|
_ => bug!("unexpected def {:?} in variant_of_def", def)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1857,7 +1857,7 @@ fn lookup_locally_or_in_crate_store<M, F>(descr: &str,
|
||||||
{
|
{
|
||||||
map.memoize(def_id, || {
|
map.memoize(def_id, || {
|
||||||
if def_id.is_local() {
|
if def_id.is_local() {
|
||||||
panic!("No def'n found for {:?} in tcx.{}", def_id, descr);
|
bug!("No def'n found for {:?} in tcx.{}", def_id, descr);
|
||||||
}
|
}
|
||||||
load_external()
|
load_external()
|
||||||
})
|
})
|
||||||
|
|
|
@ -987,14 +987,14 @@ impl<'tcx> TyS<'tcx> {
|
||||||
TyStruct(def, substs) => {
|
TyStruct(def, substs) => {
|
||||||
def.struct_variant().fields[0].ty(cx, substs)
|
def.struct_variant().fields[0].ty(cx, substs)
|
||||||
}
|
}
|
||||||
_ => panic!("simd_type called on invalid type")
|
_ => bug!("simd_type called on invalid type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn simd_size(&self, _cx: &TyCtxt) -> usize {
|
pub fn simd_size(&self, _cx: &TyCtxt) -> usize {
|
||||||
match self.sty {
|
match self.sty {
|
||||||
TyStruct(def, _) => def.struct_variant().fields.len(),
|
TyStruct(def, _) => def.struct_variant().fields.len(),
|
||||||
_ => panic!("simd_size called on invalid type")
|
_ => bug!("simd_size called on invalid type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1147,7 +1147,7 @@ impl<'tcx> TyS<'tcx> {
|
||||||
pub fn fn_sig(&self) -> &'tcx PolyFnSig<'tcx> {
|
pub fn fn_sig(&self) -> &'tcx PolyFnSig<'tcx> {
|
||||||
match self.sty {
|
match self.sty {
|
||||||
TyFnDef(_, _, ref f) | TyFnPtr(ref f) => &f.sig,
|
TyFnDef(_, _, ref f) | TyFnPtr(ref f) => &f.sig,
|
||||||
_ => panic!("Ty::fn_sig() called on non-fn type: {:?}", self)
|
_ => bug!("Ty::fn_sig() called on non-fn type: {:?}", self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1155,7 +1155,7 @@ impl<'tcx> TyS<'tcx> {
|
||||||
pub fn fn_abi(&self) -> abi::Abi {
|
pub fn fn_abi(&self) -> abi::Abi {
|
||||||
match self.sty {
|
match self.sty {
|
||||||
TyFnDef(_, _, ref f) | TyFnPtr(ref f) => f.abi,
|
TyFnDef(_, _, ref f) | TyFnPtr(ref f) => f.abi,
|
||||||
_ => panic!("Ty::fn_abi() called on non-fn type"),
|
_ => bug!("Ty::fn_abi() called on non-fn type"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ impl ParamSpace {
|
||||||
0 => TypeSpace,
|
0 => TypeSpace,
|
||||||
1 => SelfSpace,
|
1 => SelfSpace,
|
||||||
2 => FnSpace,
|
2 => FnSpace,
|
||||||
_ => panic!("Invalid ParamSpace: {}", u)
|
_ => bug!("Invalid ParamSpace: {}", u)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ impl IntTypeExt for attr::IntType {
|
||||||
(UnsignedInt(ast::UintTy::U32), ConstInt::U32(_)) => {},
|
(UnsignedInt(ast::UintTy::U32), ConstInt::U32(_)) => {},
|
||||||
(UnsignedInt(ast::UintTy::U64), ConstInt::U64(_)) => {},
|
(UnsignedInt(ast::UintTy::U64), ConstInt::U64(_)) => {},
|
||||||
(UnsignedInt(ast::UintTy::Us), ConstInt::Usize(_)) => {},
|
(UnsignedInt(ast::UintTy::Us), ConstInt::Usize(_)) => {},
|
||||||
_ => panic!("disr type mismatch: {:?} vs {:?}", self, val),
|
_ => bug!("disr type mismatch: {:?} vs {:?}", self, val),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue