Skip to content

sigils in front of macro_rules's expr nonterminal can convert a literal to a ~str #11836

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

Closed
huonw opened this issue Jan 27, 2014 · 2 comments
Closed
Labels
A-parser Area: The lexing & parsing of Rust source code to an AST A-syntaxext Area: Syntax extensions

Comments

@huonw
Copy link
Member

huonw commented Jan 27, 2014

#[feature(macro_rules)];

macro_rules! foo {
    ($e:expr) => { ~$e }
}

fn main() {
    *foo!(1); // fine
    *foo!("foo"); // error: type ~str cannot be derefenced
}

This would appear to go against Rust's non-textual macros.

(Writing ~($e) in the macro works.)

@ftxqxd
Copy link
Contributor

ftxqxd commented Sep 19, 2014

I don’t think this is a problem any more because box "foo" is of type Box<&'static str>.

@huonw
Copy link
Member Author

huonw commented Sep 19, 2014

There's no sigils attached to strings any more, so this is indeed fixed. Thanks.

@huonw huonw closed this as completed Sep 19, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 1, 2023
Don't suggest `a.mul_add(b, c)` if parameters are not float

clippy::suboptimal_flops used to not check if the second parameter to f32/f64.mul_add() was float. Since the method is only defined to take `Self` as parameters, the suggestion was wrong.

Fixes rust-lang#11831

changelog: [`suboptimal_float`]: Don't suggest `a.mul_add(b, c)` if parameters are not f32/f64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The lexing & parsing of Rust source code to an AST A-syntaxext Area: Syntax extensions
Projects
None yet
Development

No branches or pull requests

2 participants