Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub fn expand_env<'cx>(
// Use the string literal in the code in the diagnostic to avoid confusing diagnostics,
// e.g. when the literal contains escape sequences.
let ast::ExprKind::Lit(ast::token::Lit {
kind: ast::token::LitKind::Str,
kind: ast::token::LitKind::Str | ast::token::LitKind::StrRaw(..),
symbol: original_var,
..
}) = &var_expr.kind
Expand Down
6 changes: 6 additions & 0 deletions tests/ui/macros/builtin-env-issue-114010.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// unset-rustc-env:oopsie

env![r#"oopsie"#];
//~^ ERROR environment variable `oopsie` not defined at compile time

fn main() {}
11 changes: 11 additions & 0 deletions tests/ui/macros/builtin-env-issue-114010.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: environment variable `oopsie` not defined at compile time
--> $DIR/builtin-env-issue-114010.rs:3:1
|
LL | env![r#"oopsie"#];
| ^^^^^^^^^^^^^^^^^
|
= help: use `std::env::var("oopsie")` to read the variable at run time
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error