]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #67820 - ecstatic-morse:const-trait, r=oli-obk
authorMazdak Farrokhzad <twingoow@gmail.com>
Fri, 10 Jan 2020 01:47:32 +0000 (02:47 +0100)
committerGitHub <noreply@github.com>
Fri, 10 Jan 2020 01:47:32 +0000 (02:47 +0100)
Parse the syntax described in RFC 2632

This adds support for both `impl const Trait for Ty` and `?const Trait` bound syntax from rust-lang/rfcs#2632 to the parser. For now, both modifiers end up in a newly-added `constness` field on `ast::TraitRef`, although this may change once the implementation is fleshed out.

I was planning on using `delay_span_bug` when this syntax is encountered during lowering, but I can't write `should-ice` UI tests. I emit a normal error instead, which causes duplicates when the feature gate is not enabled (see the `.stderr` files for the feature gate tests). Not sure what the desired approach is; Maybe just do nothing when the syntax is encountered with the feature gate is enabled?

@oli-obk I went with `const_trait_impl` and `const_trait_bound_opt_out` for the names of these features. Are these to your liking?

cc #67792 #67794

r? @Centril


Trivial merge