File tree 3 files changed +12
-5
lines changed
testsuite/rust/compile/xfail 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,8 @@ struct Literal
249
249
BYTE_STRING,
250
250
INT,
251
251
FLOAT,
252
- BOOL
252
+ BOOL,
253
+ ERROR
253
254
};
254
255
255
256
private:
@@ -274,11 +275,11 @@ struct Literal
274
275
275
276
static Literal create_error ()
276
277
{
277
- return Literal (" " , CHAR , PrimitiveCoreType::CORETYPE_UNKNOWN);
278
+ return Literal (" " , ERROR , PrimitiveCoreType::CORETYPE_UNKNOWN);
278
279
}
279
280
280
281
// Returns whether literal is in an invalid state.
281
- bool is_error () const { return value_as_string == " " ; }
282
+ bool is_error () const { return type == ERROR ; }
282
283
};
283
284
284
285
/* Forward decl - definition moved to rust-expr.h as it requires LiteralExpr to
Original file line number Diff line number Diff line change @@ -359,6 +359,10 @@ class ASTLoweringExpr : public ASTLoweringBase
359
359
case AST::Literal::LitType::BOOL:
360
360
type = HIR::Literal::LitType::BOOL;
361
361
break ;
362
+ // Error literals should have been stripped during expansion
363
+ case AST::Literal::LitType::ERROR:
364
+ gcc_unreachable ();
365
+ break ;
362
366
}
363
367
auto crate_num = mappings->get_current_crate ();
364
368
Analysis::NodeMapping mapping (crate_num, expr.get_node_id (),
Original file line number Diff line number Diff line change 1
- fn foo ( e : & str ) -> & str {
2
- & "" // { dg-bogus "cannot strip expression in this position - outer attributes not allowed" "#391" { xfail *-*-* } }
1
+ // { dg-additional-options "-w" }
2
+
3
+ fn foo ( e : & str ) -> & str { // { dg-bogus "expected" "#391" { xfail *-*-* } }
4
+ & "" // { dg-bogus "expected" "#391" { xfail *-*-* } }
3
5
}
You can’t perform that action at this time.
0 commit comments