]> git.lizzy.rs Git - rust.git/commit
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)
commitf3963873aac5fbc3ace85ae290710b58506f3645
treeb874b91c46dc830da454d15dc6dead5b4644120a
parente180d36d49ef7a14196bddd9b8741eb36d689277
parentfd1c00348b7b3521f7340a2d034b32406229fe1b
Rollup merge of #67820 - ecstatic-morse:const-trait, r=oli-obk

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