diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-08-14 22:56:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-14 22:56:25 +0200 |
| commit | 409df9b530d0aaac7e0de5cfb652d847eedeae30 (patch) | |
| tree | a9a2cae18938c9931057cd3860af8cf4bf5da959 /src/libsyntax_ext/source_util.rs | |
| parent | 02e2a57f262256fda9a8e3c89cfb18fe6b64ee01 (diff) | |
| parent | 376636e51719588edba82fc284328e14ce1f2d74 (diff) | |
| download | rust-409df9b530d0aaac7e0de5cfb652d847eedeae30.tar.gz rust-409df9b530d0aaac7e0de5cfb652d847eedeae30.zip | |
Rollup merge of #63528 - petrochenkov:anyany, r=estebank
syntax: Remove `DummyResult::expr_only` The effect is that if a built-in macro both returns an erroneous AST fragment and is used in unexpected position, then the incorrect position error won't be reported. This combination of two errors should be rare and isn't worth an extra field that makes people ask questions in comments. (There wasn't even a test making sure it worked.) Addresses https://github.com/rust-lang/rust/pull/63468#discussion_r313504644 r? @estebank
Diffstat (limited to 'src/libsyntax_ext/source_util.rs')
| -rw-r--r-- | src/libsyntax_ext/source_util.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libsyntax_ext/source_util.rs b/src/libsyntax_ext/source_util.rs index 2c8d53a2315..cbc01b48afd 100644 --- a/src/libsyntax_ext/source_util.rs +++ b/src/libsyntax_ext/source_util.rs @@ -111,7 +111,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt<'_>, sp: Span, tts: &[tokenstream::To -> Box<dyn base::MacResult+'static> { let file = match get_single_str_from_tts(cx, sp, tts, "include_str!") { Some(f) => f, - None => return DummyResult::expr(sp) + None => return DummyResult::any(sp) }; let file = cx.resolve_path(file, sp); match fs::read_to_string(&file) { @@ -126,11 +126,11 @@ pub fn expand_include_str(cx: &mut ExtCtxt<'_>, sp: Span, tts: &[tokenstream::To }, Err(ref e) if e.kind() == ErrorKind::InvalidData => { cx.span_err(sp, &format!("{} wasn't a utf-8 file", file.display())); - DummyResult::expr(sp) + DummyResult::any(sp) } Err(e) => { cx.span_err(sp, &format!("couldn't read {}: {}", file.display(), e)); - DummyResult::expr(sp) + DummyResult::any(sp) } } } @@ -139,7 +139,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt<'_>, sp: Span, tts: &[tokenstream:: -> Box<dyn base::MacResult+'static> { let file = match get_single_str_from_tts(cx, sp, tts, "include_bytes!") { Some(f) => f, - None => return DummyResult::expr(sp) + None => return DummyResult::any(sp) }; let file = cx.resolve_path(file, sp); match fs::read(&file) { @@ -158,7 +158,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt<'_>, sp: Span, tts: &[tokenstream:: }, Err(e) => { cx.span_err(sp, &format!("couldn't read {}: {}", file.display(), e)); - DummyResult::expr(sp) + DummyResult::any(sp) } } } |
