Skip to content
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

syntax: indicate an error when a macro ignores trailing tokens. #9673

Merged
merged 2 commits into from
Oct 2, 2013

Conversation

huonw
Copy link
Member

@huonw huonw commented Oct 2, 2013

That is, only a single expression or item gets parsed, so if there are
any extra tokens (e.g. the start of another item/expression) the user
should be told, rather than silently dropping them.

An example:

macro_rules! foo {
    () => {
        println("hi");
        println("bye);
    }
}

would expand to just println("hi"), which is almost certainly not
what the programmer wanted.

Fixes #8012.

That is, only a single expression or item gets parsed, so if there are
any extra tokens (e.g. the start of another item/expression) the user
should be told, rather than silently dropping them.

An example:

    macro_rules! foo {
        () => {
            println("hi");
            println("bye);
        }
    }

would expand to just `println("hi")`, which is almost certainly not
what the programmer wanted.

Fixes rust-lang#8012.
bors added a commit that referenced this pull request Oct 2, 2013
That is, only a single expression or item gets parsed, so if there are
any extra tokens (e.g. the start of another item/expression) the user
should be told, rather than silently dropping them.

An example:

    macro_rules! foo {
        () => {
            println("hi");
            println("bye);
        }
    }

would expand to just `println("hi")`, which is almost certainly not
what the programmer wanted.

Fixes #8012.
@bors bors closed this Oct 2, 2013
@bors bors merged commit 8284df9 into rust-lang:master Oct 2, 2013
@huonw huonw deleted the macros branch October 2, 2013 12:31
Dylan-DPC pushed a commit to Dylan-DPC/rust that referenced this pull request Nov 1, 2022
feat: type inference for generic associated types

This PR implements type inference for generic associated types. Basically, this PR lowers generic arguments for associated types in valid places and creates `Substitution`s for them.

I focused on the inference for correct Rust programs, so there are cases where we *accidentally* manage to infer things that are actually invalid (which would then be reported by flycheck so I deem them non-fatal). See the following tests and FIXME notes on them: `gats_with_dyn`, `gats_with_impl_trait`.

The added tests are rather arbitrary. Let me know if there are cases I'm missing or I should add.

Closes rust-lang#9673
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Macros attempting to expand to multiple items silently only expand to the first one
5 participants