]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #41828 - arielb1:lvalue-ops, r=eddyb
authorCorey Farwell <coreyf@rwell.org>
Tue, 9 May 2017 02:34:50 +0000 (22:34 -0400)
committerGitHub <noreply@github.com>
Tue, 9 May 2017 02:34:50 +0000 (22:34 -0400)
try to fix lvalue ops for real

Hopefully this is the last PR needed.

Fixes #41726.
Fixes #41742.
Fixes #41774.

105 files changed:
src/Cargo.lock
src/doc/rustc-ux-guidelines.md
src/etc/platform-intrinsics/hexagon/hvx_v60.json [new file with mode: 0644]
src/grammar/.gitignore [new file with mode: 0644]
src/grammar/lexer.l [new file with mode: 0644]
src/grammar/parser-lalr-main.c [new file with mode: 0644]
src/grammar/parser-lalr.y [new file with mode: 0644]
src/grammar/raw-string-literal-ambiguity.md [new file with mode: 0644]
src/grammar/testparser.py [new file with mode: 0755]
src/grammar/tokens.h [new file with mode: 0644]
src/librustc/hir/check_attr.rs
src/librustc/hir/intravisit.rs
src/librustc/hir/map/mod.rs
src/librustc/infer/error_reporting/mod.rs
src/librustc/lint/context.rs
src/librustc/middle/const_val.rs
src/librustc/middle/effect.rs
src/librustc/middle/entry.rs
src/librustc/middle/intrinsicck.rs
src/librustc/middle/region.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/traits/error_reporting.rs
src/librustc/ty/maps.rs
src/librustc/ty/mod.rs
src/librustc/ty/util.rs
src/librustc_borrowck/borrowck/check_loans.rs
src/librustc_borrowck/borrowck/gather_loans/move_error.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_const_eval/check_match.rs
src/librustc_driver/target_features.rs
src/librustc_errors/diagnostic.rs
src/librustc_errors/diagnostic_builder.rs
src/librustc_errors/lib.rs
src/librustc_incremental/assert_dep_graph.rs
src/librustc_incremental/persist/dirty_clean.rs
src/librustc_lint/builtin.rs
src/librustc_lint/lib.rs
src/librustc_lint/unused.rs
src/librustc_metadata/creader.rs
src/librustc_metadata/locator.rs
src/librustc_mir/transform/qualify_consts.rs
src/librustc_passes/ast_validation.rs
src/librustc_passes/consts.rs
src/librustc_passes/loops.rs
src/librustc_passes/static_recursion.rs
src/librustc_platform_intrinsics/hexagon.rs [new file with mode: 0644]
src/librustc_platform_intrinsics/lib.rs
src/librustc_privacy/lib.rs
src/librustc_resolve/lib.rs
src/librustc_resolve/macros.rs
src/librustc_resolve/resolve_imports.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/autoderef.rs
src/librustc_typeck/check/callee.rs
src/librustc_typeck/check/cast.rs
src/librustc_typeck/check/coercion.rs
src/librustc_typeck/check/compare_method.rs
src/librustc_typeck/check/intrinsic.rs
src/librustc_typeck/check/method/confirm.rs
src/librustc_typeck/check/method/suggest.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/op.rs
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/coherence/builtin.rs
src/librustc_typeck/coherence/inherent_impls.rs
src/librustc_typeck/coherence/inherent_impls_overlap.rs
src/librustc_typeck/coherence/mod.rs
src/librustc_typeck/coherence/orphan.rs
src/librustc_typeck/coherence/overlap.rs
src/librustc_typeck/collect.rs
src/librustc_typeck/impl_wf_check.rs
src/librustc_typeck/lib.rs
src/librustdoc/html/format.rs
src/libstd/fs.rs
src/libstd/thread/mod.rs
src/libsyntax/Cargo.toml
src/libsyntax/attr.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/lib.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs
src/test/compile-fail/issue-3008-1.rs
src/test/compile-fail/issue-3008-2.rs
src/test/compile-fail/issue-32326.rs
src/test/compile-fail/issue-3779.rs
src/test/compile-fail/issue-41255.rs [new file with mode: 0644]
src/test/compile-fail/non-exhaustive-match.rs
src/test/compile-fail/type-recursive.rs
src/test/parse-fail/lex-bare-cr-string-literal-doc-comment.rs
src/test/run-make/trace-macros-flag/Makefile [deleted file]
src/test/run-make/trace-macros-flag/hello.rs [deleted file]
src/test/run-make/trace-macros-flag/hello.trace [deleted file]
src/test/run-pass/associated-const-type-parameters.rs
src/test/run-pass/lex-bare-cr-nondoc-comment.rs [new file with mode: 0644]
src/test/ui/macros/trace-macro.rs [new file with mode: 0644]
src/test/ui/macros/trace-macro.stderr [new file with mode: 0644]
src/test/ui/span/E0072.stderr
src/test/ui/span/multiline-span-E0072.stderr
src/test/ui/span/recursive-type-field.rs [new file with mode: 0644]
src/test/ui/span/recursive-type-field.stderr [new file with mode: 0644]

index 5fa0829f2f8d1ffdf00eef6ad3493075d1b561c2..0b21ec986502109c1b62b4288b57f9d9da488fcf 100644 (file)
@@ -860,8 +860,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 name = "syntax"
 version = "0.0.0"
 dependencies = [
+ "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc_bitflags 0.0.0",
  "rustc_data_structures 0.0.0",
  "rustc_errors 0.0.0",
  "serialize 0.0.0",
index 15b3bfebfac2e24806d56360e55ea5e7fcb9decd..0b2069e25aaf8a92e95d6f88be5b8fcfeb0ae44a 100644 (file)
@@ -56,18 +56,22 @@ Error explanations are long form descriptions of error messages provided with
 the compiler. They are accessible via the `--explain` flag. Each explanation
 comes with an example of how to trigger it and advice on how to fix it.
 
+Please read [RFC 1567](https://github.com/rust-lang/rfcs/blob/master/text/1567-long-error-codes-explanation-normalization.md)
+for details on how to format and write long error codes.
+
 * All of them are accessible [online](http://doc.rust-lang.org/error-index.html),
   which are auto-generated from rustc source code in different places:
   [librustc](https://github.com/rust-lang/rust/blob/master/src/librustc/diagnostics.rs),
+  [libsyntax](https://github.com/rust-lang/rust/blob/master/src/libsyntax/diagnostics.rs),
   [librustc_borrowck](https://github.com/rust-lang/rust/blob/master/src/librustc_borrowck/diagnostics.rs),
   [librustc_const_eval](https://github.com/rust-lang/rust/blob/master/src/librustc_const_eval/diagnostics.rs),
-  [librustc_lint](https://github.com/rust-lang/rust/blob/master/src/librustc_lint/types.rs),
   [librustc_metadata](https://github.com/rust-lang/rust/blob/master/src/librustc_metadata/diagnostics.rs),
   [librustc_mir](https://github.com/rust-lang/rust/blob/master/src/librustc_mir/diagnostics.rs),
   [librustc_passes](https://github.com/rust-lang/rust/blob/master/src/librustc_passes/diagnostics.rs),
   [librustc_privacy](https://github.com/rust-lang/rust/blob/master/src/librustc_privacy/diagnostics.rs),
   [librustc_resolve](https://github.com/rust-lang/rust/blob/master/src/librustc_resolve/diagnostics.rs),
   [librustc_trans](https://github.com/rust-lang/rust/blob/master/src/librustc_trans/diagnostics.rs),
+  [librustc_plugin](https://github.com/rust-lang/rust/blob/master/src/librustc_plugin/diagnostics.rs),
   [librustc_typeck](https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/diagnostics.rs).
 * Explanations have full markdown support. Use it, especially to highlight
 code with backticks.
@@ -79,7 +83,7 @@ code with backticks.
 * Flags should be orthogonal to each other. For example, if we'd have a
 json-emitting variant of multiple actions `foo` and `bar`, an additional
 --json flag is better than adding `--foo-json` and `--bar-json`.
-* Always give options a long descriptive name, if only for better
+* Always give options a long descriptive name, if only for more
 understandable compiler scripts.
 * The `--verbose` flag is for adding verbose information to `rustc` output
 when not compiling a program. For example, using it with the `--version` flag
diff --git a/src/etc/platform-intrinsics/hexagon/hvx_v60.json b/src/etc/platform-intrinsics/hexagon/hvx_v60.json
new file mode 100644 (file)
index 0000000..a1897e6
--- /dev/null
@@ -0,0 +1,1326 @@
+{
+    "platform": "Q6_",
+    "intrinsic_prefix": "",
+    "llvm_prefix": "llvm.hexagon.V6.",
+    "number_info": {
+        "signed": {
+            "kind": "s",
+            "data_type": { "8": "b", "16": "h", "32": "w" },
+            "data_type_plain": { "8": "b", "16": "h", "32": "w" }
+        },
+        "unsigned": {
+            "kind": "u",
+            "data_type": { "8": "ub", "16": "uh", "32": "uw" },
+            "data_type_plain": { "8": "b", "16": "h", "32": "w" }
+        },
+        "float": {
+            "kind": "f",
+            "data_type": { "8": "b", "16": "h", "32": "w" },
+            "data_type_plain": { "8": "b", "16": "h", "32": "w" }
+        }
+    },
+    "width_info": {
+        "64": { "width_b": "64", "width_suffix": "" },
+        "128": { "width_b": "128", "width_suffix": ".128B" },
+        "512": { "width_b": "64", "width_suffix": "" },
+        "1024": { "widthd_b": "64", "width_b": "128", "width_suffix": ".128B",  "widthd_suffix": "" },
+        "2048": { "widthd_b": "128", "widthd_suffix": ".128B" }
+    },
+    "intrinsics": [
+        {
+            "intrinsic": "R_vextract{1.width_b}",
+            "width": [512, 1024],
+            "llvm": "extractw{1.width_suffix}",
+            "ret": "U32",
+            "args": ["u32", "U32"]
+        },
+        {
+            "intrinsic": "V_lo{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "lo{0.width_suffix}",
+            "ret": "u32",
+            "args": ["0d"]
+        },
+        {
+            "intrinsic": "V_hi{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "hi{0.width_suffix}",
+            "ret": "u32",
+            "args": ["0d"]
+        },
+        {
+            "intrinsic": "V_vsplat_R{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "lvsplat{1.data_type}{0.width_suffix}",
+            "ret": "u32",
+            "args": ["0S"]
+        },
+        {
+            "intrinsic": "Q_and_QQ{0.width_b}",
+            "width": [64, 128],
+            "llvm": "pred.and{0.width_suffix}",
+            "ret": "u32",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "Q_not_Q{0.width_b}",
+            "width": [64, 128],
+            "llvm": "pred.not{0.width_suffix}",
+            "ret": "u32",
+            "args": ["0"]
+        },
+        {
+            "intrinsic": "Q_or_QQ{0.width_b}",
+            "width": [64, 128],
+            "llvm": "pred.or{0.width_suffix}",
+            "ret": "u32",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "Q_xor_QQ{0.width_b}",
+            "width": [64, 128],
+            "llvm": "pred.xor{0.width_suffix}",
+            "ret": "u32",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vabsdiff_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vabsdiff{1.data_type}{0.width_suffix}",
+            "ret": "u(8-16)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vabsdiff_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vabsdiff{1.data_type}{0.width_suffix}",
+            "ret": "u(16-32)",
+            "args": ["0s", "0s"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vabs_V{1.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vabs{1.data_type}{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vabs_V{1.data_type}_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vabs{1.data_type}.sat{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vadd_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vadd{0.data_type}{0.width_suffix}",
+            "ret": "s(8-32)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vadd_V{1.data_type}V{2.data_type}_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vadd{0.data_type}sat{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vadd_V{1.data_type}V{2.data_type}_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vadd{0.data_type}sat{0.width_suffix}",
+            "ret": "u(8-16)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vadd_W{1.data_type}W{2.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vadd{0.data_type}.dv{0.widthd_suffix}",
+            "ret": "s(8-32)d",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vadd_W{1.data_type}W{2.data_type}_sat{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vadd{0.data_type}sat.dv{0.widthd_suffix}",
+            "ret": "s(16-32)d",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vadd_W{1.data_type}W{2.data_type}_sat{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vadd{0.data_type}sat.dv{0.widthd_suffix}",
+            "ret": "u(8-16)d",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V_valign_VVR{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "valignb{0.width_suffix}",
+            "ret": "u8",
+            "args": ["0", "0", "U32"]
+        },
+        {
+            "intrinsic": "V_valign_VVI{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "valignbi{0.width_suffix}",
+            "ret": "u8",
+            "args": ["0", "0", "U32"]
+        },
+        {
+            "intrinsic": "V_vlalign_VVR{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vlalignb{0.width_suffix}",
+            "ret": "u8",
+            "args": ["0", "0", "U32"]
+        },
+        {
+            "intrinsic": "V_vlalign_VVI{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vlalignbi{0.width_suffix}",
+            "ret": "u8",
+            "args": ["0", "0", "U32"]
+        },
+        {
+            "intrinsic": "V_vand_VV{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vand{0.width_suffix}",
+            "ret": "u16",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V_vand_QR{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vandqrt{0.width_suffix}",
+            "ret": "u8",
+            "args": ["u32hhh", "U32"]
+        },
+        {
+            "intrinsic": "V_vandor_VQR{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vandqrt.acc{0.width_suffix}",
+            "ret": "u8",
+            "args": ["0", "u32hhh", "U32"]
+        },
+        {
+            "intrinsic": "Q_vand_VR{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vandvrt{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["u8", "U32"]
+        },
+        {
+            "intrinsic": "Q_vandor_QVR{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vandvrt{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["0", "u8", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vasl_V{1.data_type}R{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vasl{0.data_type}{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vasl_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vasl{0.data_type}v{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vaslacc_V{1.data_type}V{2.data_type}R{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vasl{0.data_type}.acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "0", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vasr_V{1.data_type}R{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vasr{0.data_type}{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vasr_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vasr{0.data_type}v{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vasracc_V{1.data_type}V{2.data_type}R{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vasr{0.data_type}.acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "0", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vasr_V{1.data_type}V{2.data_type}R{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vasr{0.data_type}{1.data_type}{0.width_suffix}",
+            "ret": "s16",
+            "args": ["0hw", "0hw", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vasr_V{1.data_type}V{2.data_type}R_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vasr{1.data_type}{0.data_type_plain}sat{0.width_suffix}",
+            "ret": "i(8-16)",
+            "args": ["0hws", "0hws", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vasr_V{1.data_type}V{2.data_type}R_rnd_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vasr{1.data_type}{0.data_type_plain}rndsat{0.width_suffix}",
+            "ret": "i(8-16)",
+            "args": ["0hws", "0hws", "U32"]
+        },
+        {
+            "intrinsic": "V_equals_V{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vassign{0.width_suffix}",
+            "ret": "u32",
+            "args": ["0"]
+        },
+        {
+            "intrinsic": "W_equals_W{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vassignp{0.widthd_suffix}",
+            "ret": "u32d",
+            "args": ["0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vavg_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vavg{0.data_type}{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vavg_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vavg{0.data_type}{0.width_suffix}",
+            "ret": "u(8-16)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vavg_V{1.data_type}V{2.data_type}_rnd{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vavgrnd{0.data_type}{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vavg_V{1.data_type}V{2.data_type}_rnd{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vavgrnd{0.data_type}{0.width_suffix}",
+            "ret": "u(8-16)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vcl0_V{1.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vcl0{0.data_type_plain}{0.width_suffix}",
+            "ret": "u(16-32)",
+            "args": ["0"]
+        },
+        {
+            "intrinsic": "W_vcombine_VV{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vcombine{0.widthd_suffix}",
+            "ret": "u8d",
+            "args": ["0h", "0h"]
+        },
+        {
+            "intrinsic": "V_vzero{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vd0{0.width_suffix}",
+            "ret": "u32",
+            "args": []
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdeal_V{1.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdeal{1.data_type}{0.width_suffix}",
+            "ret": "s(8-16)",
+            "args": ["0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdeale_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdeal{1.data_type}4w{0.width_suffix}",
+            "ret": "s8",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "W_vdeal_VVR{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vdealvdd{0.widthd_suffix}",
+            "ret": "u8d",
+            "args": ["0h", "0h", "U32"]
+        },
+        {
+            "intrinsic": "V_vdelta_VV{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdelta{0.width_suffix}",
+            "ret": "u8",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpy_V{1.data_type}Rb{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpybus{0.width_suffix}",
+            "ret": "s16",
+            "args": ["u8", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}V{2.data_type}Rb{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpybus.acc{0.width_suffix}",
+            "ret": "s16",
+            "args": ["s16", "u8", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vdmpy_W{1.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpybus.dv{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["u8d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vdmpyacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpybus.dv.acc{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["s16d", "u8d", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpy_V{1.data_type}Rb{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhb{0.width_suffix}",
+            "ret": "s32",
+            "args": ["s16", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}V{2.data_type}Rb{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhb.acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["s32", "s16", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vdmpy_W{1.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhb.dv{0.widthd_suffix}",
+            "ret": "s32d",
+            "args": ["s16d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vdmpyacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhb.dv.acc{0.widthd_suffix}",
+            "ret": "s32d",
+            "args": ["s32d", "s16d", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpy_W{1.data_type}Rh_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhisat{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0d", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpy_V{1.data_type}Rh_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhsat{0.width_suffix}",
+            "ret": "s32",
+            "args": ["s16", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpy_W{1.data_type}Ruh_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhsuisat{0.width_suffix}",
+            "ret": "s32",
+            "args": ["s16d", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpy_V{1.data_type}Ruh_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhsusat{0.width_suffix}",
+            "ret": "s32",
+            "args": ["s16", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpy_V{1.data_type}V{2.data_type}_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhvsat{0.width_suffix}",
+            "ret": "s32",
+            "args": ["s16", "s16"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}W{2.data_type}Rh_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhisat_acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "0d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vdsad_W{1.data_type}Ruh{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vdsaduh{0.widthd_suffix}",
+            "ret": "u32d",
+            "args": ["u16d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vdsadacc_W{1.data_type}W{2.data_type}Ruh{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vdsaduh.acc{0.widthd_suffix}",
+            "ret": "u32d",
+            "args": ["0", "u16d", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}V{2.data_type}Rh_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhsat_acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "s16", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}W{2.data_type}Ruh_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhsuisat_acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "s16d", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}V{2.data_type}Ruh_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhsusat_acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "s16", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}V{2.data_type}V{3.data_type}_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vdmpyhvsat_acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "s16", "s16"]
+        },
+        {
+            "intrinsic": "Q_vcmp_eq_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "veq{1.data_type}{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["s(8-32)", "1"]
+        },
+        {
+            "intrinsic": "Q_vcmp_eqand_QV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "veq{2.data_type}.and{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["0", "s(8-32)", "2"]
+        },
+        {
+            "intrinsic": "Q_vcmp_eqor_QV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "veq{2.data_type}.or{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["0", "s(8-32)", "2"]
+        },
+        {
+            "intrinsic": "Q_vcmp_eqxacc_QV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "veq{2.data_type}.xor{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["0", "s(8-32)", "2"]
+        },
+        {
+            "intrinsic": "Q_vcmp_gt_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vgt{1.data_type}{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["s(8-32)", "1"]
+        },
+        {
+            "intrinsic": "Q_vcmp_gt_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vgt{1.data_type}{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["u(8-16)", "1"]
+        },
+        {
+            "intrinsic": "Q_vcmp_gtand_QV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vgt{2.data_type}.and{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["0", "s(8-32)", "2"]
+        },
+        {
+            "intrinsic": "Q_vcmp_gtand_QV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vgt{2.data_type}.and{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["0", "u(8-16)", "2"]
+        },
+        {
+            "intrinsic": "Q_vcmp_gtor_QV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vgt{2.data_type}.or{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["0", "s(8-32)", "2"]
+        },
+        {
+            "intrinsic": "Q_vcmp_gtor_QV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vgt{2.data_type}.or{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["0", "u(8-16)", "2"]
+        },
+        {
+            "intrinsic": "Q_vcmp_gtxacc_QV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vgt{2.data_type}.xor{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["0", "s(8-32)", "2"]
+        },
+        {
+            "intrinsic": "Q_vcmp_gtxacc_QV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vgt{2.data_type}.xor{0.width_suffix}",
+            "ret": "u32hhh",
+            "args": ["0", "u(8-16)", "2"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vinsert_V{1.data_type}R{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vinsertwr{0.width_suffix}",
+            "ret": "s32",
+            "args": ["S32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vlsr_V{1.data_type}R{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vlsr{0.data_type_plain}{0.width_suffix}",
+            "ret": "u(16-32)",
+            "args": ["0", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vlsr_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vlsr{0.data_type}v{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vlut32_V{1.data_type}V{2.data_type}R{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vlutvv{0.data_type}{0.width_suffix}",
+            "ret": "s8",
+            "args": ["0", "0", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vlut16_V{1.data_type}V{2.data_type}R{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vlutvw{0.data_type}{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["s8", "s16", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vlut32or_V{1.data_type}V{2.data_type}V{3.data_type}R{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vlutvv{0.data_type}.oracc{0.width_suffix}",
+            "ret": "s8",
+            "args": ["0", "0", "0", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vlut16or_W{1.data_type}V{2.data_type}V{3.data_type}R{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vlutvw{0.data_type}.oracc{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["0", "s8", "s16", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmax_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmax{0.data_type}{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmax_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmax{0.data_type}{0.width_suffix}",
+            "ret": "u(8-16)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmin_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmin{0.data_type}{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmin_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmin{0.data_type}{0.width_suffix}",
+            "ret": "u(8-16)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpa_W{1.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpabus{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["u8d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpaacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpabus.acc{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["0", "u8d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpa_W{1.data_type}W{2.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpab{1.kind}{2.kind}v{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["u8d", "i8d"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpa_W{1.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpahb{0.widthd_suffix}",
+            "ret": "s32d",
+            "args": ["s16d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpaacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpahb.acc{0.widthd_suffix}",
+            "ret": "s32d",
+            "args": ["0", "s16d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpy_V{1.data_type}V{2.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpy{1.data_type}us{0.widthd_suffix}",
+            "ret": "s(16-32)d",
+            "args": ["0n", "0nu"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpyacc_W{1.data_type}V{2.data_type}V{3.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpy{2.data_type}us.acc{0.widthd_suffix}",
+            "ret": "s(16-32)d",
+            "args": ["0", "0n", "0nu"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpy_V{1.data_type}V{2.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpybusv{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["u8", "s8"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpyacc_W{1.data_type}V{2.data_type}V{3.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpybusv.acc{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["0", "0nu", "0n"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpy_V{1.data_type}V{2.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpy{1.data_type}v{0.widthd_suffix}",
+            "ret": "i(16-32)d",
+            "args": ["0n", "0n"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpyacc_W{1.data_type}V{2.data_type}V{3.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpy{2.data_type}v.acc{0.widthd_suffix}",
+            "ret": "i(16-32)d",
+            "args": ["0", "0n", "0n"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpye_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyewuh{0.width_suffix}",
+            "ret": "s32",
+            "args": ["s32", "u16"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpy_V{1.data_type}R{1.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpy{1.data_type}{0.widthd_suffix}",
+            "ret": "i32d",
+            "args": ["0n", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpyacc_W{1.data_type}V{2.data_type}R{2.data_type}_sat{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpy{2.data_type}sat.acc{0.widthd_suffix}",
+            "ret": "s32d",
+            "args": ["0", "0n", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpy_V{1.data_type}R{1.data_type}_s1_rnd_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpy{1.data_type}srs{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0nd", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpy_V{1.data_type}R{1.data_type}_s1_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpy{1.data_type}ss{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0nd", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpy_V{1.data_type}V{2.data_type}_s1_rnd_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpy{1.data_type}vsrs{0.width_suffix}",
+            "ret": "s16",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyieo_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyieo{1.data_type}{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0nd", "0nd"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyieacc_V{1.data_type}V{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyie{2.data_type}{3.data_type}.acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "0", "i16"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyie_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyie{1.data_type}{2.data_type}{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "u16"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyi_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyi{1.data_type}{0.width_suffix}",
+            "ret": "s16",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyiacc_V{1.data_type}V{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyi{1.data_type}.acc{0.width_suffix}",
+            "ret": "s16",
+            "args": ["0", "0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyi_V{1.data_type}Rb{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyi{1.data_type}b{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyiacc_V{1.data_type}V{2.data_type}Rb{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyi{1.data_type}b.acc{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "0", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyi_V{1.data_type}Rh{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyi{1.data_type}h{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyiacc_V{1.data_type}V{2.data_type}Rh{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyi{1.data_type}h.acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "0", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyi_V{1.data_type}Rub{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyi{1.data_type}ub{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyiacc_V{1.data_type}V{2.data_type}Rub{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyi{1.data_type}ub.acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "0", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyo_V{1.data_type}V{2.data_type}_s1_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyo{1.data_type}{2.data_type}{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "0nd"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyo_V{1.data_type}V{2.data_type}_s1_rnd_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyo{1.data_type}{2.data_type}.rnd{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "0nd"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyo_V{1.data_type}V{2.data_type}_s1_rnd_sat_shift{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyo{1.data_type}{2.data_type}.rnd.sacc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "0nd"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyo_V{1.data_type}V{2.data_type}_s1_sat_shift{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyo{1.data_type}{2.data_type}.sacc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "0nd"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmpyio_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmpyio{1.data_type}{2.data_type}{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "0nd"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpy_V{1.data_type}R{1.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpy{1.data_type}{0.widthd_suffix}",
+            "ret": "u16d",
+            "args": ["0n", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vmpyacc_W{1.data_type}V{2.data_type}R{2.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vmpy{2.data_type}.acc{0.widthd_suffix}",
+            "ret": "u(16-32)d",
+            "args": ["0", "0n", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vmux_QVV{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vmux{0.width_suffix}",
+            "ret": "u32",
+            "args": ["0hhh", "0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vnavg_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vnavg{0.data_type}{0.width_suffix}",
+            "ret": "i(16-32)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vnavg_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vnavg{0.data_type}{0.width_suffix}",
+            "ret": "u8",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vnormamt_V{1.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vnormamt{0.data_type}{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0"]
+        },
+        {
+            "intrinsic": "V_vnot_VV{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vnot{0.width_suffix}",
+            "ret": "u16",
+            "args": ["0"]
+        },
+        {
+            "intrinsic": "V_vor_VV{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vor{0.width_suffix}",
+            "ret": "u16",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vpacke_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vpack{1.data_type}e{0.width_suffix}",
+            "ret": "s(8-16)",
+            "args": ["0hw", "0hw"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vpacko_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vpack{1.data_type}o{0.width_suffix}",
+            "ret": "s(8-16)",
+            "args": ["0hw", "0hw"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vpack_V{1.data_type}V{2.data_type}_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vpack{1.data_type}{0.data_type}.sat{0.width_suffix}",
+            "ret": "i(8-16)",
+            "args": ["0hws", "0hws"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vpopcount_V{1.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vpopcount{0.data_type}{0.width_suffix}",
+            "ret": "s16",
+            "args": ["0"]
+        },
+        {
+            "intrinsic": "V_vrdelta_VV{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vrdelta{0.width_suffix}",
+            "ret": "u8",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vrmpy_V{1.data_type}Rb{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vrmpybus{0.width_suffix}",
+            "ret": "s32",
+            "args": ["u8", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vrmpyacc_V{1.data_type}V{2.data_type}Rb{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vrmpybus.acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "u8", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vrmpy_W{1.data_type}RbI{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vrmpybusi{0.widthd_suffix}",
+            "ret": "s32d",
+            "args": ["u8d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vrmpyacc_W{1.data_type}W{2.data_type}RbI{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vrmpybusi.acc{0.widthd_suffix}",
+            "ret": "s32d",
+            "args": ["0", "u8d", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vrmpy_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vrmpybusv{0.width_suffix}",
+            "ret": "s32",
+            "args": ["u8", "s8"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vrmpyacc_V{1.data_type}V{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vrmpybusv.acc{0.width_suffix}",
+            "ret": "s32",
+            "args": ["0", "u8", "s8"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vrmpy_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vrmpy{1.data_type}v{0.width_suffix}",
+            "ret": "i32",
+            "args": ["0nndd", "0nndd"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vrmpyacc_V{1.data_type}V{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vrmpy{1.data_type}v.acc{0.width_suffix}",
+            "ret": "i32",
+            "args": ["0", "0nndd", "0nndd"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vrmpy_V{1.data_type}Rub{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vrmpyub{0.width_suffix}",
+            "ret": "u32",
+            "args": ["u8", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vrmpyacc_V{1.data_type}V{2.data_type}Rub{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vrmpyub.acc{0.width_suffix}",
+            "ret": "u32",
+            "args": ["0", "u8", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vrmpy_W{1.data_type}RubI{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vrmpyubi{0.widthd_suffix}",
+            "ret": "u32d",
+            "args": ["u8d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vrmpyacc_W{1.data_type}W{2.data_type}RubI{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vrmpyubi.acc{0.widthd_suffix}",
+            "ret": "u32d",
+            "args": ["0", "u8d", "U32"]
+        },
+        {
+            "intrinsic": "V_vror_VR{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vror{0.width_suffix}",
+            "ret": "u8",
+            "args": ["0", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vround_V{1.data_type}V{2.data_type}_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vround{1.data_type}{0.data_type}{0.width_suffix}",
+            "ret": "i(8-16)",
+            "args": ["0hws", "0hws"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vrsad_W{1.data_type}RubI{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vrsadubi{0.widthd_suffix}",
+            "ret": "u32d",
+            "args": ["u8d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vrsadacc_W{1.data_type}W{2.data_type}RubI{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vrsadubi.acc{0.widthd_suffix}",
+            "ret": "u32d",
+            "args": ["0", "u8d", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vsat_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vsat{1.data_type}{0.data_type}{0.width_suffix}",
+            "ret": "u8",
+            "args": ["0hws", "0hws"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vsat_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vsat{1.data_type}{0.data_type}{0.width_suffix}",
+            "ret": "s16",
+            "args": ["0hw", "0hw"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vsxt_V{1.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vs{1.data_type}{0.widthd_suffix}",
+            "ret": "s(16-32)d",
+            "args": ["0n"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vzxt_V{1.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vz{1.data_type_plain}{0.widthd_suffix}",
+            "ret": "u(16-32)d",
+            "args": ["0n"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_condacc_QV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vadd{0.data_type}q{0.width_suffix}",
+            "ret": "s(8-32)",
+            "args": ["u32hhh", "0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_condacc_QnV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vadd{0.data_type}nq{0.width_suffix}",
+            "ret": "s(8-32)",
+            "args": ["u32hhh", "0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_condnac_QV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vsub{0.data_type}q{0.width_suffix}",
+            "ret": "s(8-32)",
+            "args": ["u32hhh", "0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_condnac_QnV{2.data_type}V{3.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vsub{0.data_type}nq{0.width_suffix}",
+            "ret": "s(8-32)",
+            "args": ["u32hhh", "0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vshuffe_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vshufe{1.data_type}{0.width_suffix}",
+            "ret": "s16",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vshuffo_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vshufo{1.data_type}{0.width_suffix}",
+            "ret": "s16",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vshuff_V{1.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vshuff{1.data_type}{0.width_suffix}",
+            "ret": "s(8-16)",
+            "args": ["0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vshuffe_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vshuffe{1.data_type}{0.width_suffix}",
+            "ret": "s8",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vshuffo_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vshuffo{1.data_type}{0.width_suffix}",
+            "ret": "s8",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vshuffoe_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vshuffoe{1.data_type}{0.width_suffix}",
+            "ret": "s(8-16)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "W_vshuff_VVR{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vshufvvd{0.widthd_suffix}",
+            "ret": "u8d",
+            "args": ["0h", "0h", "U32"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vsub_V{1.data_type}V{2.data_type}{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vsub{0.data_type}{0.width_suffix}",
+            "ret": "s(8-32)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vsub_V{1.data_type}V{2.data_type}_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vsub{0.data_type}sat{0.width_suffix}",
+            "ret": "s(16-32)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "V{0.data_type}_vsub_V{1.data_type}V{2.data_type}_sat{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vsub{0.data_type}sat{0.width_suffix}",
+            "ret": "u(8-16)",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vsub_W{1.data_type}W{2.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vsub{0.data_type}.dv{0.widthd_suffix}",
+            "ret": "s(8-32)d",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vsub_W{1.data_type}W{2.data_type}_sat{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vsub{0.data_type}sat.dv{0.widthd_suffix}",
+            "ret": "s(16-32)d",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vsub_W{1.data_type}W{2.data_type}_sat{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vsub{0.data_type}sat.dv{0.widthd_suffix}",
+            "ret": "u(8-16)d",
+            "args": ["0", "0"]
+        },
+        {
+            "intrinsic": "W_vswap_QVV{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vswap{0.widthd_suffix}",
+            "ret": "u8d",
+            "args": ["u32hhh", "0h", "0h"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vtmpy_W{1.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vtmpyb{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["0nd", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vtmpyacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vtmpyb.acc{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["0", "0nd", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vtmpy_W{1.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vtmpybus{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["u8d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vtmpyacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vtmpybus.acc{0.widthd_suffix}",
+            "ret": "s16d",
+            "args": ["0", "u8d", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vtmpy_W{1.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vtmpyhb{0.widthd_suffix}",
+            "ret": "s32d",
+            "args": ["0nd", "U32"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vunpack_V{1.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vunpack{1.data_type}{0.widthd_suffix}",
+            "ret": "i(16-32)d",
+            "args": ["0n"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vunpackoor_W{1.data_type}V{2.data_type}{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vunpacko{2.data_type}{0.widthd_suffix}",
+            "ret": "s(16-32)d",
+            "args": ["0", "0n"]
+        },
+        {
+            "intrinsic": "W{0.data_type}_vtmpyacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}",
+            "width": [512, 1024],
+            "llvm": "vtmpyhb.acc{0.widthd_suffix}",
+            "ret": "s32d",
+            "args": ["0", "0nd", "U32"]
+        },
+        {
+            "intrinsic": "V_vxor_VV{0.width_b}",
+            "width": [512, 1024],
+            "llvm": "vxor{0.width_suffix}",
+            "ret": "u16",
+            "args": ["0", "0"]
+        }
+    ]
+}
diff --git a/src/grammar/.gitignore b/src/grammar/.gitignore
new file mode 100644 (file)
index 0000000..3e44987
--- /dev/null
@@ -0,0 +1,3 @@
+*.class
+*.java
+*.tokens
diff --git a/src/grammar/lexer.l b/src/grammar/lexer.l
new file mode 100644 (file)
index 0000000..77737c9
--- /dev/null
@@ -0,0 +1,343 @@
+%{
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#include <stdio.h>
+#include <ctype.h>
+
+static int num_hashes;
+static int end_hashes;
+static int saw_non_hash;
+
+%}
+
+%option stack
+%option yylineno
+
+%x str
+%x rawstr
+%x rawstr_esc_begin
+%x rawstr_esc_body
+%x rawstr_esc_end
+%x byte
+%x bytestr
+%x rawbytestr
+%x rawbytestr_nohash
+%x pound
+%x shebang_or_attr
+%x ltorchar
+%x linecomment
+%x doc_line
+%x blockcomment
+%x doc_block
+%x suffix
+
+ident [a-zA-Z\x80-\xff_][a-zA-Z0-9\x80-\xff_]*
+
+%%
+
+<suffix>{ident}            { BEGIN(INITIAL); }
+<suffix>(.|\n)  { yyless(0); BEGIN(INITIAL); }
+
+[ \n\t\r]             { }
+
+\xef\xbb\xbf {
+  // UTF-8 byte order mark (BOM), ignore if in line 1, error otherwise
+  if (yyget_lineno() != 1) {
+    return -1;
+  }
+}
+
+\/\/(\/|\!)           { BEGIN(doc_line); yymore(); }
+<doc_line>\n          { BEGIN(INITIAL);
+                        yyleng--;
+                        yytext[yyleng] = 0;
+                        return ((yytext[2] == '!') ? INNER_DOC_COMMENT : OUTER_DOC_COMMENT);
+                      }
+<doc_line>[^\n]*      { yymore(); }
+
+\/\/|\/\/\/\/         { BEGIN(linecomment); }
+<linecomment>\n       { BEGIN(INITIAL); }
+<linecomment>[^\n]*   { }
+
+\/\*(\*|\!)[^*]       { yy_push_state(INITIAL); yy_push_state(doc_block); yymore(); }
+<doc_block>\/\*       { yy_push_state(doc_block); yymore(); }
+<doc_block>\*\/       {
+    yy_pop_state();
+    if (yy_top_state() == doc_block) {
+        yymore();
+    } else {
+        return ((yytext[2] == '!') ? INNER_DOC_COMMENT : OUTER_DOC_COMMENT);
+    }
+}
+<doc_block>(.|\n)     { yymore(); }
+
+\/\*                  { yy_push_state(blockcomment); }
+<blockcomment>\/\*    { yy_push_state(blockcomment); }
+<blockcomment>\*\/    { yy_pop_state(); }
+<blockcomment>(.|\n)   { }
+
+_        { return UNDERSCORE; }
+as       { return AS; }
+box      { return BOX; }
+break    { return BREAK; }
+const    { return CONST; }
+continue { return CONTINUE; }
+crate    { return CRATE; }
+else     { return ELSE; }
+enum     { return ENUM; }
+extern   { return EXTERN; }
+false    { return FALSE; }
+fn       { return FN; }
+for      { return FOR; }
+if       { return IF; }
+impl     { return IMPL; }
+in       { return IN; }
+let      { return LET; }
+loop     { return LOOP; }
+match    { return MATCH; }
+mod      { return MOD; }
+move     { return MOVE; }
+mut      { return MUT; }
+priv     { return PRIV; }
+proc     { return PROC; }
+pub      { return PUB; }
+ref      { return REF; }
+return   { return RETURN; }
+self     { return SELF; }
+static   { return STATIC; }
+struct   { return STRUCT; }
+trait    { return TRAIT; }
+true     { return TRUE; }
+type     { return TYPE; }
+typeof   { return TYPEOF; }
+unsafe   { return UNSAFE; }
+use      { return USE; }
+where    { return WHERE; }
+while    { return WHILE; }
+
+{ident}  { return IDENT; }
+
+0x[0-9a-fA-F_]+                                    { BEGIN(suffix); return LIT_INTEGER; }
+0o[0-8_]+                                          { BEGIN(suffix); return LIT_INTEGER; }
+0b[01_]+                                           { BEGIN(suffix); return LIT_INTEGER; }
+[0-9][0-9_]*                                       { BEGIN(suffix); return LIT_INTEGER; }
+[0-9][0-9_]*\.(\.|[a-zA-Z])    { yyless(yyleng - 2); BEGIN(suffix); return LIT_INTEGER; }
+
+[0-9][0-9_]*\.[0-9_]*([eE][-\+]?[0-9_]+)?          { BEGIN(suffix); return LIT_FLOAT; }
+[0-9][0-9_]*(\.[0-9_]*)?[eE][-\+]?[0-9_]+          { BEGIN(suffix); return LIT_FLOAT; }
+
+;      { return ';'; }
+,      { return ','; }
+\.\.\. { return DOTDOTDOT; }
+\.\.   { return DOTDOT; }
+\.     { return '.'; }
+\(     { return '('; }
+\)     { return ')'; }
+\{     { return '{'; }
+\}     { return '}'; }
+\[     { return '['; }
+\]     { return ']'; }
+@      { return '@'; }
+#      { BEGIN(pound); yymore(); }
+<pound>\! { BEGIN(shebang_or_attr); yymore(); }
+<shebang_or_attr>\[ {
+  BEGIN(INITIAL);
+  yyless(2);
+  return SHEBANG;
+}
+<shebang_or_attr>[^\[\n]*\n {
+  // Since the \n was eaten as part of the token, yylineno will have
+  // been incremented to the value 2 if the shebang was on the first
+  // line. This yyless undoes that, setting yylineno back to 1.
+  yyless(yyleng - 1);
+  if (yyget_lineno() == 1) {
+    BEGIN(INITIAL);
+    return SHEBANG_LINE;
+  } else {
+    BEGIN(INITIAL);
+    yyless(2);
+    return SHEBANG;
+  }
+}
+<pound>. { BEGIN(INITIAL); yyless(1); return '#'; }
+
+\~     { return '~'; }
+::     { return MOD_SEP; }
+:      { return ':'; }
+\$     { return '$'; }
+\?     { return '?'; }
+
+==    { return EQEQ; }
+=>    { return FAT_ARROW; }
+=     { return '='; }
+\!=   { return NE; }
+\!    { return '!'; }
+\<=   { return LE; }
+\<\<  { return SHL; }
+\<\<= { return SHLEQ; }
+\<    { return '<'; }
+\>=   { return GE; }
+\>\>  { return SHR; }
+\>\>= { return SHREQ; }
+\>    { return '>'; }
+
+\x27                                  { BEGIN(ltorchar); yymore(); }
+<ltorchar>static                      { BEGIN(INITIAL); return STATIC_LIFETIME; }
+<ltorchar>{ident}                     { BEGIN(INITIAL); return LIFETIME; }
+<ltorchar>\\[nrt\\\x27\x220]\x27      { BEGIN(suffix); return LIT_CHAR; }
+<ltorchar>\\x[0-9a-fA-F]{2}\x27       { BEGIN(suffix); return LIT_CHAR; }
+<ltorchar>\\u\{[0-9a-fA-F]?{6}\}\x27  { BEGIN(suffix); return LIT_CHAR; }
+<ltorchar>.\x27                       { BEGIN(suffix); return LIT_CHAR; }
+<ltorchar>[\x80-\xff]{2,4}\x27        { BEGIN(suffix); return LIT_CHAR; }
+<ltorchar><<EOF>>                     { BEGIN(INITIAL); return -1; }
+
+b\x22              { BEGIN(bytestr); yymore(); }
+<bytestr>\x22      { BEGIN(suffix); return LIT_BYTE_STR; }
+
+<bytestr><<EOF>>                { return -1; }
+<bytestr>\\[n\nrt\\\x27\x220]   { yymore(); }
+<bytestr>\\x[0-9a-fA-F]{2}      { yymore(); }
+<bytestr>\\u\{[0-9a-fA-F]?{6}\} { yymore(); }
+<bytestr>\\[^n\nrt\\\x27\x220]  { return -1; }
+<bytestr>(.|\n)                 { yymore(); }
+
+br\x22                      { BEGIN(rawbytestr_nohash); yymore(); }
+<rawbytestr_nohash>\x22     { BEGIN(suffix); return LIT_BYTE_STR_RAW; }
+<rawbytestr_nohash>(.|\n)   { yymore(); }
+<rawbytestr_nohash><<EOF>>  { return -1; }
+
+br/# {
+    BEGIN(rawbytestr);
+    yymore();
+    num_hashes = 0;
+    saw_non_hash = 0;
+    end_hashes = 0;
+}
+<rawbytestr># {
+    if (!saw_non_hash) {
+        num_hashes++;
+    } else if (end_hashes != 0) {
+        end_hashes++;
+        if (end_hashes == num_hashes) {
+            BEGIN(INITIAL);
+            return LIT_BYTE_STR_RAW;
+        }
+    }
+    yymore();
+}
+<rawbytestr>\x22# {
+    end_hashes = 1;
+    if (end_hashes == num_hashes) {
+        BEGIN(INITIAL);
+        return LIT_BYTE_STR_RAW;
+    }
+    yymore();
+}
+<rawbytestr>(.|\n) {
+    if (!saw_non_hash) {
+        saw_non_hash = 1;
+    }
+    if (end_hashes != 0) {
+        end_hashes = 0;
+    }
+    yymore();
+}
+<rawbytestr><<EOF>> { return -1; }
+
+b\x27                        { BEGIN(byte); yymore(); }
+<byte>\\[nrt\\\x27\x220]\x27 { BEGIN(INITIAL); return LIT_BYTE; }
+<byte>\\x[0-9a-fA-F]{2}\x27  { BEGIN(INITIAL); return LIT_BYTE; }
+<byte>\\u[0-9a-fA-F]{4}\x27  { BEGIN(INITIAL); return LIT_BYTE; }
+<byte>\\U[0-9a-fA-F]{8}\x27  { BEGIN(INITIAL); return LIT_BYTE; }
+<byte>.\x27                  { BEGIN(INITIAL); return LIT_BYTE; }
+<byte><<EOF>>                { BEGIN(INITIAL); return -1; }
+
+r\x22           { BEGIN(rawstr); yymore(); }
+<rawstr>\x22    { BEGIN(suffix); return LIT_STR_RAW; }
+<rawstr>(.|\n)  { yymore(); }
+<rawstr><<EOF>> { return -1; }
+
+r/#             {
+    BEGIN(rawstr_esc_begin);
+    yymore();
+    num_hashes = 0;
+    saw_non_hash = 0;
+    end_hashes = 0;
+}
+
+<rawstr_esc_begin># {
+    num_hashes++;
+    yymore();
+}
+<rawstr_esc_begin>\x22 {
+    BEGIN(rawstr_esc_body);
+    yymore();
+}
+<rawstr_esc_begin>(.|\n) { return -1; }
+
+<rawstr_esc_body>\x22/# {
+  BEGIN(rawstr_esc_end);
+  yymore();
+ }
+<rawstr_esc_body>(.|\n) {
+  yymore();
+ }
+
+<rawstr_esc_end># {
+  end_hashes++;
+  if (end_hashes == num_hashes) {
+    BEGIN(INITIAL);
+    return LIT_STR_RAW;
+  }
+  yymore();
+ }
+<rawstr_esc_end>[^#] {
+  end_hashes = 0;
+  BEGIN(rawstr_esc_body);
+  yymore();
+ }
+
+<rawstr_esc_begin,rawstr_esc_body,rawstr_esc_end><<EOF>> { return -1; }
+
+\x22                     { BEGIN(str); yymore(); }
+<str>\x22                { BEGIN(suffix); return LIT_STR; }
+
+<str><<EOF>>                { return -1; }
+<str>\\[n\nr\rt\\\x27\x220] { yymore(); }
+<str>\\x[0-9a-fA-F]{2}      { yymore(); }
+<str>\\u\{[0-9a-fA-F]?{6}\} { yymore(); }
+<str>\\[^n\nrt\\\x27\x220]  { return -1; }
+<str>(.|\n)                 { yymore(); }
+
+\<-  { return LARROW; }
+-\>  { return RARROW; }
+-    { return '-'; }
+-=   { return MINUSEQ; }
+&&   { return ANDAND; }
+&    { return '&'; }
+&=   { return ANDEQ; }
+\|\| { return OROR; }
+\|   { return '|'; }
+\|=  { return OREQ; }
+\+   { return '+'; }
+\+=  { return PLUSEQ; }
+\*   { return '*'; }
+\*=  { return STAREQ; }
+\/   { return '/'; }
+\/=  { return SLASHEQ; }
+\^   { return '^'; }
+\^=  { return CARETEQ; }
+%    { return '%'; }
+%=   { return PERCENTEQ; }
+
+<<EOF>> { return 0; }
+
+%%
diff --git a/src/grammar/parser-lalr-main.c b/src/grammar/parser-lalr-main.c
new file mode 100644 (file)
index 0000000..db88a1f
--- /dev/null
@@ -0,0 +1,203 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+extern int yylex();
+extern int rsparse();
+
+#define PUSHBACK_LEN 4
+
+static char pushback[PUSHBACK_LEN];
+static int verbose;
+
+void print(const char* format, ...) {
+  va_list args;
+  va_start(args, format);
+  if (verbose) {
+    vprintf(format, args);
+  }
+  va_end(args);
+}
+
+// If there is a non-null char at the head of the pushback queue,
+// dequeue it and shift the rest of the queue forwards. Otherwise,
+// return the token from calling yylex.
+int rslex() {
+  if (pushback[0] == '\0') {
+    return yylex();
+  } else {
+    char c = pushback[0];
+    memmove(pushback, pushback + 1, PUSHBACK_LEN - 1);
+    pushback[PUSHBACK_LEN - 1] = '\0';
+    return c;
+  }
+}
+
+// Note: this does nothing if the pushback queue is full. As long as
+// there aren't more than PUSHBACK_LEN consecutive calls to push_back
+// in an action, this shouldn't be a problem.
+void push_back(char c) {
+  for (int i = 0; i < PUSHBACK_LEN; ++i) {
+    if (pushback[i] == '\0') {
+      pushback[i] = c;
+      break;
+    }
+  }
+}
+
+extern int rsdebug;
+
+struct node {
+  struct node *next;
+  struct node *prev;
+  int own_string;
+  char const *name;
+  int n_elems;
+  struct node *elems[];
+};
+
+struct node *nodes = NULL;
+int n_nodes;
+
+struct node *mk_node(char const *name, int n, ...) {
+  va_list ap;
+  int i = 0;
+  unsigned sz = sizeof(struct node) + (n * sizeof(struct node *));
+  struct node *nn, *nd = (struct node *)malloc(sz);
+
+  print("# New %d-ary node: %s = %p\n", n, name, nd);
+
+  nd->own_string = 0;
+  nd->prev = NULL;
+  nd->next = nodes;
+  if (nodes) {
+    nodes->prev = nd;
+  }
+  nodes = nd;
+
+  nd->name = name;
+  nd->n_elems = n;
+
+  va_start(ap, n);
+  while (i < n) {
+    nn = va_arg(ap, struct node *);
+    print("#   arg[%d]: %p\n", i, nn);
+    print("#            (%s ...)\n", nn->name);
+    nd->elems[i++] = nn;
+  }
+  va_end(ap);
+  n_nodes++;
+  return nd;
+}
+
+struct node *mk_atom(char *name) {
+  struct node *nd = mk_node((char const *)strdup(name), 0);
+  nd->own_string = 1;
+  return nd;
+}
+
+struct node *mk_none() {
+  return mk_atom("<none>");
+}
+
+struct node *ext_node(struct node *nd, int n, ...) {
+  va_list ap;
+  int i = 0, c = nd->n_elems + n;
+  unsigned sz = sizeof(struct node) + (c * sizeof(struct node *));
+  struct node *nn;
+
+  print("# Extending %d-ary node by %d nodes: %s = %p",
+        nd->n_elems, c, nd->name, nd);
+
+  if (nd->next) {
+    nd->next->prev = nd->prev;
+  }
+  if (nd->prev) {
+    nd->prev->next = nd->next;
+  }
+  nd = realloc(nd, sz);
+  nd->prev = NULL;
+  nd->next = nodes;
+  nodes->prev = nd;
+  nodes = nd;
+
+  print(" ==> %p\n", nd);
+
+  va_start(ap, n);
+  while (i < n) {
+    nn = va_arg(ap, struct node *);
+    print("#   arg[%d]: %p\n", i, nn);
+    print("#            (%s ...)\n", nn->name);
+    nd->elems[nd->n_elems++] = nn;
+    ++i;
+  }
+  va_end(ap);
+  return nd;
+}
+
+int const indent_step = 4;
+
+void print_indent(int depth) {
+  while (depth) {
+    if (depth-- % indent_step == 0) {
+      print("|");
+    } else {
+      print(" ");
+    }
+  }
+}
+
+void print_node(struct node *n, int depth) {
+  int i = 0;
+  print_indent(depth);
+  if (n->n_elems == 0) {
+    print("%s\n", n->name);
+  } else {
+    print("(%s\n", n->name);
+    for (i = 0; i < n->n_elems; ++i) {
+      print_node(n->elems[i], depth + indent_step);
+    }
+    print_indent(depth);
+    print(")\n");
+  }
+}
+
+int main(int argc, char **argv) {
+  if (argc == 2 && strcmp(argv[1], "-v") == 0) {
+    verbose = 1;
+  } else {
+    verbose = 0;
+  }
+  int ret = 0;
+  struct node *tmp;
+  memset(pushback, '\0', PUSHBACK_LEN);
+  ret = rsparse();
+  print("--- PARSE COMPLETE: ret:%d, n_nodes:%d ---\n", ret, n_nodes);
+  if (nodes) {
+    print_node(nodes, 0);
+  }
+  while (nodes) {
+    tmp = nodes;
+    nodes = tmp->next;
+    if (tmp->own_string) {
+      free((void*)tmp->name);
+    }
+    free(tmp);
+  }
+  return ret;
+}
+
+void rserror(char const *s) {
+  fprintf(stderr, "%s\n", s);
+}
diff --git a/src/grammar/parser-lalr.y b/src/grammar/parser-lalr.y
new file mode 100644 (file)
index 0000000..c9fcdf7
--- /dev/null
@@ -0,0 +1,1945 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+%{
+#define YYERROR_VERBOSE
+#define YYSTYPE struct node *
+struct node;
+extern int yylex();
+extern void yyerror(char const *s);
+extern struct node *mk_node(char const *name, int n, ...);
+extern struct node *mk_atom(char *text);
+extern struct node *mk_none();
+extern struct node *ext_node(struct node *nd, int n, ...);
+extern void push_back(char c);
+extern char *yytext;
+%}
+%debug
+
+%token SHL
+%token SHR
+%token LE
+%token EQEQ
+%token NE
+%token GE
+%token ANDAND
+%token OROR
+%token SHLEQ
+%token SHREQ
+%token MINUSEQ
+%token ANDEQ
+%token OREQ
+%token PLUSEQ
+%token STAREQ
+%token SLASHEQ
+%token CARETEQ
+%token PERCENTEQ
+%token DOTDOT
+%token DOTDOTDOT
+%token MOD_SEP
+%token RARROW
+%token LARROW
+%token FAT_ARROW
+%token LIT_BYTE
+%token LIT_CHAR
+%token LIT_INTEGER
+%token LIT_FLOAT
+%token LIT_STR
+%token LIT_STR_RAW
+%token LIT_BYTE_STR
+%token LIT_BYTE_STR_RAW
+%token IDENT
+%token UNDERSCORE
+%token LIFETIME
+
+// keywords
+%token SELF
+%token STATIC
+%token AS
+%token BREAK
+%token CRATE
+%token ELSE
+%token ENUM
+%token EXTERN
+%token FALSE
+%token FN
+%token FOR
+%token IF
+%token IMPL
+%token IN
+%token LET
+%token LOOP
+%token MATCH
+%token MOD
+%token MOVE
+%token MUT
+%token PRIV
+%token PUB
+%token REF
+%token RETURN
+%token STRUCT
+%token TRUE
+%token TRAIT
+%token TYPE
+%token UNSAFE
+%token DEFAULT
+%token USE
+%token WHILE
+%token CONTINUE
+%token PROC
+%token BOX
+%token CONST
+%token WHERE
+%token TYPEOF
+%token INNER_DOC_COMMENT
+%token OUTER_DOC_COMMENT
+
+%token SHEBANG
+%token SHEBANG_LINE
+%token STATIC_LIFETIME
+
+ /*
+   Quoting from the Bison manual:
+
+   "Finally, the resolution of conflicts works by comparing the precedence
+   of the rule being considered with that of the lookahead token. If the
+   token's precedence is higher, the choice is to shift. If the rule's
+   precedence is higher, the choice is to reduce. If they have equal
+   precedence, the choice is made based on the associativity of that
+   precedence level. The verbose output file made by ‘-v’ (see Invoking
+   Bison) says how each conflict was resolved"
+ */
+
+// We expect no shift/reduce or reduce/reduce conflicts in this grammar;
+// all potential ambiguities are scrutinized and eliminated manually.
+%expect 0
+
+// fake-precedence symbol to cause '|' bars in lambda context to parse
+// at low precedence, permit things like |x| foo = bar, where '=' is
+// otherwise lower-precedence than '|'. Also used for proc() to cause
+// things like proc() a + b to parse as proc() { a + b }.
+%precedence LAMBDA
+
+%precedence SELF
+
+// MUT should be lower precedence than IDENT so that in the pat rule,
+// "& MUT pat" has higher precedence than "binding_mode ident [@ pat]"
+%precedence MUT
+
+// IDENT needs to be lower than '{' so that 'foo {' is shifted when
+// trying to decide if we've got a struct-construction expr (esp. in
+// contexts like 'if foo { .')
+//
+// IDENT also needs to be lower precedence than '<' so that '<' in
+// 'foo:bar . <' is shifted (in a trait reference occurring in a
+// bounds list), parsing as foo:(bar<baz>) rather than (foo:bar)<baz>.
+%precedence IDENT
+
+// A couple fake-precedence symbols to use in rules associated with +
+// and < in trailing type contexts. These come up when you have a type
+// in the RHS of operator-AS, such as "foo as bar<baz>". The "<" there
+// has to be shifted so the parser keeps trying to parse a type, even
+// though it might well consider reducing the type "bar" and then
+// going on to "<" as a subsequent binop. The "+" case is with
+// trailing type-bounds ("foo as bar:A+B"), for the same reason.
+%precedence SHIFTPLUS
+
+%precedence MOD_SEP
+%precedence RARROW ':'
+
+// In where clauses, "for" should have greater precedence when used as
+// a higher ranked constraint than when used as the beginning of a
+// for_in_type (which is a ty)
+%precedence FORTYPE
+%precedence FOR
+
+// Binops & unops, and their precedences
+%precedence BOX
+%precedence BOXPLACE
+%nonassoc DOTDOT
+
+// RETURN needs to be lower-precedence than tokens that start
+// prefix_exprs
+%precedence RETURN
+
+%right '=' SHLEQ SHREQ MINUSEQ ANDEQ OREQ PLUSEQ STAREQ SLASHEQ CARETEQ PERCENTEQ
+%right LARROW
+%left OROR
+%left ANDAND
+%left EQEQ NE
+%left '<' '>' LE GE
+%left '|'
+%left '^'
+%left '&'
+%left SHL SHR
+%left '+' '-'
+%precedence AS
+%left '*' '/' '%'
+%precedence '!'
+
+%precedence '{' '[' '(' '.'
+
+%precedence RANGE
+
+%start crate
+
+%%
+
+////////////////////////////////////////////////////////////////////////
+// Part 1: Items and attributes
+////////////////////////////////////////////////////////////////////////
+
+crate
+: maybe_shebang inner_attrs maybe_mod_items  { mk_node("crate", 2, $2, $3); }
+| maybe_shebang maybe_mod_items  { mk_node("crate", 1, $2); }
+;
+
+maybe_shebang
+: SHEBANG_LINE
+| %empty
+;
+
+maybe_inner_attrs
+: inner_attrs
+| %empty                   { $$ = mk_none(); }
+;
+
+inner_attrs
+: inner_attr               { $$ = mk_node("InnerAttrs", 1, $1); }
+| inner_attrs inner_attr   { $$ = ext_node($1, 1, $2); }
+;
+
+inner_attr
+: SHEBANG '[' meta_item ']'   { $$ = mk_node("InnerAttr", 1, $3); }
+| INNER_DOC_COMMENT           { $$ = mk_node("InnerAttr", 1, mk_node("doc-comment", 1, mk_atom(yytext))); }
+;
+
+maybe_outer_attrs
+: outer_attrs
+| %empty                   { $$ = mk_none(); }
+;
+
+outer_attrs
+: outer_attr               { $$ = mk_node("OuterAttrs", 1, $1); }
+| outer_attrs outer_attr   { $$ = ext_node($1, 1, $2); }
+;
+
+outer_attr
+: '#' '[' meta_item ']'    { $$ = $3; }
+| OUTER_DOC_COMMENT        { $$ = mk_node("doc-comment", 1, mk_atom(yytext)); }
+;
+
+meta_item
+: ident                      { $$ = mk_node("MetaWord", 1, $1); }
+| ident '=' lit              { $$ = mk_node("MetaNameValue", 2, $1, $3); }
+| ident '(' meta_seq ')'     { $$ = mk_node("MetaList", 2, $1, $3); }
+| ident '(' meta_seq ',' ')' { $$ = mk_node("MetaList", 2, $1, $3); }
+;
+
+meta_seq
+: %empty                   { $$ = mk_none(); }
+| meta_item                { $$ = mk_node("MetaItems", 1, $1); }
+| meta_seq ',' meta_item   { $$ = ext_node($1, 1, $3); }
+;
+
+maybe_mod_items
+: mod_items
+| %empty             { $$ = mk_none(); }
+;
+
+mod_items
+: mod_item                               { $$ = mk_node("Items", 1, $1); }
+| mod_items mod_item                     { $$ = ext_node($1, 1, $2); }
+;
+
+attrs_and_vis
+: maybe_outer_attrs visibility           { $$ = mk_node("AttrsAndVis", 2, $1, $2); }
+;
+
+mod_item
+: attrs_and_vis item    { $$ = mk_node("Item", 2, $1, $2); }
+;
+
+// items that can appear outside of a fn block
+item
+: stmt_item
+| item_macro
+;
+
+// items that can appear in "stmts"
+stmt_item
+: item_static
+| item_const
+| item_type
+| block_item
+| view_item
+;
+
+item_static
+: STATIC ident ':' ty '=' expr ';'  { $$ = mk_node("ItemStatic", 3, $2, $4, $6); }
+| STATIC MUT ident ':' ty '=' expr ';'  { $$ = mk_node("ItemStatic", 3, $3, $5, $7); }
+;
+
+item_const
+: CONST ident ':' ty '=' expr ';'  { $$ = mk_node("ItemConst", 3, $2, $4, $6); }
+;
+
+item_macro
+: path_expr '!' maybe_ident parens_delimited_token_trees ';'  { $$ = mk_node("ItemMacro", 3, $1, $3, $4); }
+| path_expr '!' maybe_ident braces_delimited_token_trees      { $$ = mk_node("ItemMacro", 3, $1, $3, $4); }
+| path_expr '!' maybe_ident brackets_delimited_token_trees ';'{ $$ = mk_node("ItemMacro", 3, $1, $3, $4); }
+;
+
+view_item
+: use_item
+| extern_fn_item
+| EXTERN CRATE ident ';'                      { $$ = mk_node("ViewItemExternCrate", 1, $3); }
+| EXTERN CRATE ident AS ident ';'             { $$ = mk_node("ViewItemExternCrate", 2, $3, $5); }
+;
+
+extern_fn_item
+: EXTERN maybe_abi item_fn                    { $$ = mk_node("ViewItemExternFn", 2, $2, $3); }
+;
+
+use_item
+: USE view_path ';'                           { $$ = mk_node("ViewItemUse", 1, $2); }
+;
+
+view_path
+: path_no_types_allowed                                    { $$ = mk_node("ViewPathSimple", 1, $1); }
+| path_no_types_allowed MOD_SEP '{'                '}'     { $$ = mk_node("ViewPathList", 2, $1, mk_atom("ViewPathListEmpty")); }
+|                       MOD_SEP '{'                '}'     { $$ = mk_node("ViewPathList", 1, mk_atom("ViewPathListEmpty")); }
+| path_no_types_allowed MOD_SEP '{' idents_or_self '}'     { $$ = mk_node("ViewPathList", 2, $1, $4); }
+|                       MOD_SEP '{' idents_or_self '}'     { $$ = mk_node("ViewPathList", 1, $3); }
+| path_no_types_allowed MOD_SEP '{' idents_or_self ',' '}' { $$ = mk_node("ViewPathList", 2, $1, $4); }
+|                       MOD_SEP '{' idents_or_self ',' '}' { $$ = mk_node("ViewPathList", 1, $3); }
+| path_no_types_allowed MOD_SEP '*'                        { $$ = mk_node("ViewPathGlob", 1, $1); }
+|                               '{'                '}'     { $$ = mk_atom("ViewPathListEmpty"); }
+|                               '{' idents_or_self '}'     { $$ = mk_node("ViewPathList", 1, $2); }
+|                               '{' idents_or_self ',' '}' { $$ = mk_node("ViewPathList", 1, $2); }
+| path_no_types_allowed AS ident                           { $$ = mk_node("ViewPathSimple", 2, $1, $3); }
+;
+
+block_item
+: item_fn
+| item_unsafe_fn
+| item_mod
+| item_foreign_mod          { $$ = mk_node("ItemForeignMod", 1, $1); }
+| item_struct
+| item_enum
+| item_trait
+| item_impl
+;
+
+maybe_ty_ascription
+: ':' ty_sum { $$ = $2; }
+| %empty { $$ = mk_none(); }
+;
+
+maybe_init_expr
+: '=' expr { $$ = $2; }
+| %empty   { $$ = mk_none(); }
+;
+
+// structs
+item_struct
+: STRUCT ident generic_params maybe_where_clause struct_decl_args
+{
+  $$ = mk_node("ItemStruct", 4, $2, $3, $4, $5);
+}
+| STRUCT ident generic_params struct_tuple_args maybe_where_clause ';'
+{
+  $$ = mk_node("ItemStruct", 4, $2, $3, $4, $5);
+}
+| STRUCT ident generic_params maybe_where_clause ';'
+{
+  $$ = mk_node("ItemStruct", 3, $2, $3, $4);
+}
+;
+
+struct_decl_args
+: '{' struct_decl_fields '}'                  { $$ = $2; }
+| '{' struct_decl_fields ',' '}'              { $$ = $2; }
+;
+
+struct_tuple_args
+: '(' struct_tuple_fields ')'                 { $$ = $2; }
+| '(' struct_tuple_fields ',' ')'             { $$ = $2; }
+;
+
+struct_decl_fields
+: struct_decl_field                           { $$ = mk_node("StructFields", 1, $1); }
+| struct_decl_fields ',' struct_decl_field    { $$ = ext_node($1, 1, $3); }
+| %empty                                      { $$ = mk_none(); }
+;
+
+struct_decl_field
+: attrs_and_vis ident ':' ty_sum              { $$ = mk_node("StructField", 3, $1, $2, $4); }
+;
+
+struct_tuple_fields
+: struct_tuple_field                          { $$ = mk_node("StructFields", 1, $1); }
+| struct_tuple_fields ',' struct_tuple_field  { $$ = ext_node($1, 1, $3); }
+;
+
+struct_tuple_field
+: attrs_and_vis ty_sum                    { $$ = mk_node("StructField", 2, $1, $2); }
+;
+
+// enums
+item_enum
+: ENUM ident generic_params maybe_where_clause '{' enum_defs '}'     { $$ = mk_node("ItemEnum", 0); }
+| ENUM ident generic_params maybe_where_clause '{' enum_defs ',' '}' { $$ = mk_node("ItemEnum", 0); }
+;
+
+enum_defs
+: enum_def               { $$ = mk_node("EnumDefs", 1, $1); }
+| enum_defs ',' enum_def { $$ = ext_node($1, 1, $3); }
+| %empty                 { $$ = mk_none(); }
+;
+
+enum_def
+: attrs_and_vis ident enum_args { $$ = mk_node("EnumDef", 3, $1, $2, $3); }
+;
+
+enum_args
+: '{' struct_decl_fields '}'     { $$ = mk_node("EnumArgs", 1, $2); }
+| '{' struct_decl_fields ',' '}' { $$ = mk_node("EnumArgs", 1, $2); }
+| '(' maybe_ty_sums ')'          { $$ = mk_node("EnumArgs", 1, $2); }
+| '=' expr                       { $$ = mk_node("EnumArgs", 1, $2); }
+| %empty                         { $$ = mk_none(); }
+;
+
+item_mod
+: MOD ident ';'                                 { $$ = mk_node("ItemMod", 1, $2); }
+| MOD ident '{' maybe_mod_items '}'             { $$ = mk_node("ItemMod", 2, $2, $4); }
+| MOD ident '{' inner_attrs maybe_mod_items '}' { $$ = mk_node("ItemMod", 3, $2, $4, $5); }
+;
+
+item_foreign_mod
+: EXTERN maybe_abi '{' maybe_foreign_items '}'             { $$ = mk_node("ItemForeignMod", 1, $4); }
+| EXTERN maybe_abi '{' inner_attrs maybe_foreign_items '}' { $$ = mk_node("ItemForeignMod", 2, $4, $5); }
+;
+
+maybe_abi
+: str
+| %empty { $$ = mk_none(); }
+;
+
+maybe_foreign_items
+: foreign_items
+| %empty { $$ = mk_none(); }
+;
+
+foreign_items
+: foreign_item               { $$ = mk_node("ForeignItems", 1, $1); }
+| foreign_items foreign_item { $$ = ext_node($1, 1, $2); }
+;
+
+foreign_item
+: attrs_and_vis STATIC item_foreign_static { $$ = mk_node("ForeignItem", 2, $1, $3); }
+| attrs_and_vis item_foreign_fn            { $$ = mk_node("ForeignItem", 2, $1, $2); }
+| attrs_and_vis UNSAFE item_foreign_fn     { $$ = mk_node("ForeignItem", 2, $1, $3); }
+;
+
+item_foreign_static
+: maybe_mut ident ':' ty ';'               { $$ = mk_node("StaticItem", 3, $1, $2, $4); }
+;
+
+item_foreign_fn
+: FN ident generic_params fn_decl_allow_variadic maybe_where_clause ';' { $$ = mk_node("ForeignFn", 4, $2, $3, $4, $5); }
+;
+
+fn_decl_allow_variadic
+: fn_params_allow_variadic ret_ty { $$ = mk_node("FnDecl", 2, $1, $2); }
+;
+
+fn_params_allow_variadic
+: '(' ')'                      { $$ = mk_none(); }
+| '(' params ')'               { $$ = $2; }
+| '(' params ',' ')'           { $$ = $2; }
+| '(' params ',' DOTDOTDOT ')' { $$ = $2; }
+;
+
+visibility
+: PUB      { $$ = mk_atom("Public"); }
+| %empty   { $$ = mk_atom("Inherited"); }
+;
+
+idents_or_self
+: ident_or_self                    { $$ = mk_node("IdentsOrSelf", 1, $1); }
+| ident_or_self AS ident           { $$ = mk_node("IdentsOrSelf", 2, $1, $3); }
+| idents_or_self ',' ident_or_self { $$ = ext_node($1, 1, $3); }
+;
+
+ident_or_self
+: ident
+| SELF  { $$ = mk_atom(yytext); }
+;
+
+item_type
+: TYPE ident generic_params maybe_where_clause '=' ty_sum ';'  { $$ = mk_node("ItemTy", 4, $2, $3, $4, $6); }
+;
+
+for_sized
+: FOR '?' ident { $$ = mk_node("ForSized", 1, $3); }
+| FOR ident '?' { $$ = mk_node("ForSized", 1, $2); }
+| %empty        { $$ = mk_none(); }
+;
+
+item_trait
+: maybe_unsafe TRAIT ident generic_params for_sized maybe_ty_param_bounds maybe_where_clause '{' maybe_trait_items '}'
+{
+  $$ = mk_node("ItemTrait", 7, $1, $3, $4, $5, $6, $7, $9);
+}
+;
+
+maybe_trait_items
+: trait_items
+| %empty { $$ = mk_none(); }
+;
+
+trait_items
+: trait_item               { $$ = mk_node("TraitItems", 1, $1); }
+| trait_items trait_item   { $$ = ext_node($1, 1, $2); }
+;
+
+trait_item
+: trait_const
+| trait_type
+| trait_method
+;
+
+trait_const
+: maybe_outer_attrs CONST ident maybe_ty_ascription maybe_const_default ';' { $$ = mk_node("ConstTraitItem", 4, $1, $3, $4, $5); }
+;
+
+maybe_const_default
+: '=' expr { $$ = mk_node("ConstDefault", 1, $2); }
+| %empty   { $$ = mk_none(); }
+;
+
+trait_type
+: maybe_outer_attrs TYPE ty_param ';' { $$ = mk_node("TypeTraitItem", 2, $1, $3); }
+;
+
+maybe_unsafe
+: UNSAFE { $$ = mk_atom("Unsafe"); }
+| %empty { $$ = mk_none(); }
+;
+
+maybe_default_maybe_unsafe
+: DEFAULT UNSAFE { $$ = mk_atom("DefaultUnsafe"); }
+| DEFAULT        { $$ = mk_atom("Default"); }
+|         UNSAFE { $$ = mk_atom("Unsafe"); }
+| %empty { $$ = mk_none(); }
+
+trait_method
+: type_method { $$ = mk_node("Required", 1, $1); }
+| method      { $$ = mk_node("Provided", 1, $1); }
+;
+
+type_method
+: attrs_and_vis maybe_unsafe FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause ';'
+{
+  $$ = mk_node("TypeMethod", 6, $1, $2, $4, $5, $6, $7);
+}
+| attrs_and_vis maybe_unsafe EXTERN maybe_abi FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause ';'
+{
+  $$ = mk_node("TypeMethod", 7, $1, $2, $4, $6, $7, $8, $9);
+}
+;
+
+method
+: attrs_and_vis maybe_unsafe FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause inner_attrs_and_block
+{
+  $$ = mk_node("Method", 7, $1, $2, $4, $5, $6, $7, $8);
+}
+| attrs_and_vis maybe_unsafe EXTERN maybe_abi FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause inner_attrs_and_block
+{
+  $$ = mk_node("Method", 8, $1, $2, $4, $6, $7, $8, $9, $10);
+}
+;
+
+impl_method
+: attrs_and_vis maybe_unsafe FN ident generic_params fn_decl_with_self maybe_where_clause inner_attrs_and_block
+{
+  $$ = mk_node("Method", 7, $1, $2, $4, $5, $6, $7, $8);
+}
+| attrs_and_vis maybe_unsafe EXTERN maybe_abi FN ident generic_params fn_decl_with_self maybe_where_clause inner_attrs_and_block
+{
+  $$ = mk_node("Method", 8, $1, $2, $4, $6, $7, $8, $9, $10);
+}
+;
+
+// There are two forms of impl:
+//
+// impl (<...>)? TY { ... }
+// impl (<...>)? TRAIT for TY { ... }
+//
+// Unfortunately since TY can begin with '<' itself -- as part of a
+// TyQualifiedPath type -- there's an s/r conflict when we see '<' after IMPL:
+// should we reduce one of the early rules of TY (such as maybe_once)
+// or shall we continue shifting into the generic_params list for the
+// impl?
+//
+// The production parser disambiguates a different case here by
+// permitting / requiring the user to provide parens around types when
+// they are ambiguous with traits. We do the same here, regrettably,
+// by splitting ty into ty and ty_prim.
+item_impl
+: maybe_default_maybe_unsafe IMPL generic_params ty_prim_sum maybe_where_clause '{' maybe_inner_attrs maybe_impl_items '}'
+{
+  $$ = mk_node("ItemImpl", 6, $1, $3, $4, $5, $7, $8);
+}
+| maybe_default_maybe_unsafe IMPL generic_params '(' ty ')' maybe_where_clause '{' maybe_inner_attrs maybe_impl_items '}'
+{
+  $$ = mk_node("ItemImpl", 6, $1, $3, 5, $6, $9, $10);
+}
+| maybe_default_maybe_unsafe IMPL generic_params trait_ref FOR ty_sum maybe_where_clause '{' maybe_inner_attrs maybe_impl_items '}'
+{
+  $$ = mk_node("ItemImpl", 6, $3, $4, $6, $7, $9, $10);
+}
+| maybe_default_maybe_unsafe IMPL generic_params '!' trait_ref FOR ty_sum maybe_where_clause '{' maybe_inner_attrs maybe_impl_items '}'
+{
+  $$ = mk_node("ItemImplNeg", 7, $1, $3, $5, $7, $8, $10, $11);
+}
+| maybe_default_maybe_unsafe IMPL generic_params trait_ref FOR DOTDOT '{' '}'
+{
+  $$ = mk_node("ItemImplDefault", 3, $1, $3, $4);
+}
+| maybe_default_maybe_unsafe IMPL generic_params '!' trait_ref FOR DOTDOT '{' '}'
+{
+  $$ = mk_node("ItemImplDefaultNeg", 3, $1, $3, $4);
+}
+;
+
+maybe_impl_items
+: impl_items
+| %empty { $$ = mk_none(); }
+;
+
+impl_items
+: impl_item               { $$ = mk_node("ImplItems", 1, $1); }
+| impl_item impl_items    { $$ = ext_node($1, 1, $2); }
+;
+
+impl_item
+: impl_method
+| attrs_and_vis item_macro { $$ = mk_node("ImplMacroItem", 2, $1, $2); }
+| impl_const
+| impl_type
+;
+
+impl_const
+: attrs_and_vis item_const { $$ = mk_node("ImplConst", 1, $1, $2); }
+;
+
+impl_type
+: attrs_and_vis TYPE ident generic_params '=' ty_sum ';'  { $$ = mk_node("ImplType", 4, $1, $3, $4, $6); }
+;
+
+item_fn
+: FN ident generic_params fn_decl maybe_where_clause inner_attrs_and_block
+{
+  $$ = mk_node("ItemFn", 5, $2, $3, $4, $5, $6);
+}
+;
+
+item_unsafe_fn
+: UNSAFE FN ident generic_params fn_decl maybe_where_clause inner_attrs_and_block
+{
+  $$ = mk_node("ItemUnsafeFn", 5, $3, $4, $5, $6, $7);
+}
+| UNSAFE EXTERN maybe_abi FN ident generic_params fn_decl maybe_where_clause inner_attrs_and_block
+{
+  $$ = mk_node("ItemUnsafeFn", 6, $3, $5, $6, $7, $8, $9);
+}
+;
+
+fn_decl
+: fn_params ret_ty   { $$ = mk_node("FnDecl", 2, $1, $2); }
+;
+
+fn_decl_with_self
+: fn_params_with_self ret_ty   { $$ = mk_node("FnDecl", 2, $1, $2); }
+;
+
+fn_decl_with_self_allow_anon_params
+: fn_anon_params_with_self ret_ty   { $$ = mk_node("FnDecl", 2, $1, $2); }
+;
+
+fn_params
+: '(' maybe_params ')'  { $$ = $2; }
+;
+
+fn_anon_params
+: '(' anon_param anon_params_allow_variadic_tail ')' { $$ = ext_node($2, 1, $3); }
+| '(' ')'                                            { $$ = mk_none(); }
+;
+
+fn_params_with_self
+: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')'              { $$ = mk_node("SelfValue", 3, $2, $4, $5); }
+| '(' '&' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')'          { $$ = mk_node("SelfRegion", 3, $3, $5, $6); }
+| '(' '&' lifetime maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfRegion", 4, $3, $4, $6, $7); }
+| '(' maybe_params ')'                                                       { $$ = mk_node("SelfStatic", 1, $2); }
+;
+
+fn_anon_params_with_self
+: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')'              { $$ = mk_node("SelfValue", 3, $2, $4, $5); }
+| '(' '&' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')'          { $$ = mk_node("SelfRegion", 3, $3, $5, $6); }
+| '(' '&' lifetime maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfRegion", 4, $3, $4, $6, $7); }
+| '(' maybe_anon_params ')'                                                       { $$ = mk_node("SelfStatic", 1, $2); }
+;
+
+maybe_params
+: params
+| params ','
+| %empty  { $$ = mk_none(); }
+;
+
+params
+: param                { $$ = mk_node("Args", 1, $1); }
+| params ',' param     { $$ = ext_node($1, 1, $3); }
+;
+
+param
+: pat ':' ty_sum   { $$ = mk_node("Arg", 2, $1, $3); }
+;
+
+inferrable_params
+: inferrable_param                       { $$ = mk_node("InferrableParams", 1, $1); }
+| inferrable_params ',' inferrable_param { $$ = ext_node($1, 1, $3); }
+;
+
+inferrable_param
+: pat maybe_ty_ascription { $$ = mk_node("InferrableParam", 2, $1, $2); }
+;
+
+maybe_unboxed_closure_kind
+: %empty
+| ':'
+| '&' maybe_mut ':'
+;
+
+maybe_comma_params
+: ','            { $$ = mk_none(); }
+| ',' params     { $$ = $2; }
+| ',' params ',' { $$ = $2; }
+| %empty         { $$ = mk_none(); }
+;
+
+maybe_comma_anon_params
+: ','                 { $$ = mk_none(); }
+| ',' anon_params     { $$ = $2; }
+| ',' anon_params ',' { $$ = $2; }
+| %empty              { $$ = mk_none(); }
+;
+
+maybe_anon_params
+: anon_params
+| anon_params ','
+| %empty      { $$ = mk_none(); }
+;
+
+anon_params
+: anon_param                 { $$ = mk_node("Args", 1, $1); }
+| anon_params ',' anon_param { $$ = ext_node($1, 1, $3); }
+;
+
+// anon means it's allowed to be anonymous (type-only), but it can
+// still have a name
+anon_param
+: named_arg ':' ty   { $$ = mk_node("Arg", 2, $1, $3); }
+| ty
+;
+
+anon_params_allow_variadic_tail
+: ',' DOTDOTDOT                                  { $$ = mk_none(); }
+| ',' anon_param anon_params_allow_variadic_tail { $$ = mk_node("Args", 2, $2, $3); }
+| %empty                                         { $$ = mk_none(); }
+;
+
+named_arg
+: ident
+| UNDERSCORE        { $$ = mk_atom("PatWild"); }
+| '&' ident         { $$ = $2; }
+| '&' UNDERSCORE    { $$ = mk_atom("PatWild"); }
+| ANDAND ident      { $$ = $2; }
+| ANDAND UNDERSCORE { $$ = mk_atom("PatWild"); }
+| MUT ident         { $$ = $2; }
+;
+
+ret_ty
+: RARROW '!'         { $$ = mk_none(); }
+| RARROW ty          { $$ = mk_node("ret-ty", 1, $2); }
+| %prec IDENT %empty { $$ = mk_none(); }
+;
+
+generic_params
+: '<' lifetimes '>'                   { $$ = mk_node("Generics", 2, $2, mk_none()); }
+| '<' lifetimes ',' '>'               { $$ = mk_node("Generics", 2, $2, mk_none()); }
+| '<' lifetimes SHR                   { push_back('>'); $$ = mk_node("Generics", 2, $2, mk_none()); }
+| '<' lifetimes ',' SHR               { push_back('>'); $$ = mk_node("Generics", 2, $2, mk_none()); }
+| '<' lifetimes ',' ty_params '>'     { $$ = mk_node("Generics", 2, $2, $4); }
+| '<' lifetimes ',' ty_params ',' '>' { $$ = mk_node("Generics", 2, $2, $4); }
+| '<' lifetimes ',' ty_params SHR     { push_back('>'); $$ = mk_node("Generics", 2, $2, $4); }
+| '<' lifetimes ',' ty_params ',' SHR { push_back('>'); $$ = mk_node("Generics", 2, $2, $4); }
+| '<' ty_params '>'                   { $$ = mk_node("Generics", 2, mk_none(), $2); }
+| '<' ty_params ',' '>'               { $$ = mk_node("Generics", 2, mk_none(), $2); }
+| '<' ty_params SHR                   { push_back('>'); $$ = mk_node("Generics", 2, mk_none(), $2); }
+| '<' ty_params ',' SHR               { push_back('>'); $$ = mk_node("Generics", 2, mk_none(), $2); }
+| %empty                              { $$ = mk_none(); }
+;
+
+maybe_where_clause
+: %empty                              { $$ = mk_none(); }
+| where_clause
+;
+
+where_clause
+: WHERE where_predicates              { $$ = mk_node("WhereClause", 1, $2); }
+| WHERE where_predicates ','          { $$ = mk_node("WhereClause", 1, $2); }
+;
+
+where_predicates
+: where_predicate                      { $$ = mk_node("WherePredicates", 1, $1); }
+| where_predicates ',' where_predicate { $$ = ext_node($1, 1, $3); }
+;
+
+where_predicate
+: maybe_for_lifetimes lifetime ':' bounds    { $$ = mk_node("WherePredicate", 3, $1, $2, $4); }
+| maybe_for_lifetimes ty ':' ty_param_bounds { $$ = mk_node("WherePredicate", 3, $1, $2, $4); }
+;
+
+maybe_for_lifetimes
+: FOR '<' lifetimes '>' { $$ = mk_none(); }
+| %prec FORTYPE %empty  { $$ = mk_none(); }
+
+ty_params
+: ty_param               { $$ = mk_node("TyParams", 1, $1); }
+| ty_params ',' ty_param { $$ = ext_node($1, 1, $3); }
+;
+
+// A path with no type parameters; e.g. `foo::bar::Baz`
+//
+// These show up in 'use' view-items, because these are processed
+// without respect to types.
+path_no_types_allowed
+: ident                               { $$ = mk_node("ViewPath", 1, $1); }
+| MOD_SEP ident                       { $$ = mk_node("ViewPath", 1, $2); }
+| SELF                                { $$ = mk_node("ViewPath", 1, mk_atom("Self")); }
+| MOD_SEP SELF                        { $$ = mk_node("ViewPath", 1, mk_atom("Self")); }
+| path_no_types_allowed MOD_SEP ident { $$ = ext_node($1, 1, $3); }
+;
+
+// A path with a lifetime and type parameters, with no double colons
+// before the type parameters; e.g. `foo::bar<'a>::Baz<T>`
+//
+// These show up in "trait references", the components of
+// type-parameter bounds lists, as well as in the prefix of the
+// path_generic_args_and_bounds rule, which is the full form of a
+// named typed expression.
+//
+// They do not have (nor need) an extra '::' before '<' because
+// unlike in expr context, there are no "less-than" type exprs to
+// be ambiguous with.
+path_generic_args_without_colons
+: %prec IDENT
+  ident                                                                       { $$ = mk_node("components", 1, $1); }
+| %prec IDENT
+  ident generic_args                                                          { $$ = mk_node("components", 2, $1, $2); }
+| %prec IDENT
+  ident '(' maybe_ty_sums ')' ret_ty                                          { $$ = mk_node("components", 2, $1, $3); }
+| %prec IDENT
+  path_generic_args_without_colons MOD_SEP ident                              { $$ = ext_node($1, 1, $3); }
+| %prec IDENT
+  path_generic_args_without_colons MOD_SEP ident generic_args                 { $$ = ext_node($1, 2, $3, $4); }
+| %prec IDENT
+  path_generic_args_without_colons MOD_SEP ident '(' maybe_ty_sums ')' ret_ty { $$ = ext_node($1, 2, $3, $5); }
+;
+
+generic_args
+: '<' generic_values '>'   { $$ = $2; }
+| '<' generic_values SHR   { push_back('>'); $$ = $2; }
+| '<' generic_values GE    { push_back('='); $$ = $2; }
+| '<' generic_values SHREQ { push_back('>'); push_back('='); $$ = $2; }
+// If generic_args starts with "<<", the first arg must be a
+// TyQualifiedPath because that's the only type that can start with a
+// '<'. This rule parses that as the first ty_sum and then continues
+// with the rest of generic_values.
+| SHL ty_qualified_path_and_generic_values '>'   { $$ = $2; }
+| SHL ty_qualified_path_and_generic_values SHR   { push_back('>'); $$ = $2; }
+| SHL ty_qualified_path_and_generic_values GE    { push_back('='); $$ = $2; }
+| SHL ty_qualified_path_and_generic_values SHREQ { push_back('>'); push_back('='); $$ = $2; }
+;
+
+generic_values
+: maybe_lifetimes maybe_ty_sums_and_or_bindings { $$ = mk_node("GenericValues", 2, $1, $2); }
+;
+
+maybe_ty_sums_and_or_bindings
+: ty_sums
+| ty_sums ','
+| ty_sums ',' bindings { $$ = mk_node("TySumsAndBindings", 2, $1, $3); }
+| bindings
+| bindings ','
+| %empty               { $$ = mk_none(); }
+;
+
+maybe_bindings
+: ',' bindings { $$ = $2; }
+| %empty       { $$ = mk_none(); }
+;
+
+////////////////////////////////////////////////////////////////////////
+// Part 2: Patterns
+////////////////////////////////////////////////////////////////////////
+
+pat
+: UNDERSCORE                                      { $$ = mk_atom("PatWild"); }
+| '&' pat                                         { $$ = mk_node("PatRegion", 1, $2); }
+| '&' MUT pat                                     { $$ = mk_node("PatRegion", 1, $3); }
+| ANDAND pat                                      { $$ = mk_node("PatRegion", 1, mk_node("PatRegion", 1, $2)); }
+| '(' ')'                                         { $$ = mk_atom("PatUnit"); }
+| '(' pat_tup ')'                                 { $$ = mk_node("PatTup", 1, $2); }
+| '(' pat_tup ',' ')'                             { $$ = mk_node("PatTup", 1, $2); }
+| '[' pat_vec ']'                                 { $$ = mk_node("PatVec", 1, $2); }
+| lit_or_path
+| lit_or_path DOTDOTDOT lit_or_path               { $$ = mk_node("PatRange", 2, $1, $3); }
+| path_expr '{' pat_struct '}'                    { $$ = mk_node("PatStruct", 2, $1, $3); }
+| path_expr '(' DOTDOT ')'                        { $$ = mk_node("PatEnum", 1, $1); }
+| path_expr '(' pat_tup ')'                       { $$ = mk_node("PatEnum", 2, $1, $3); }
+| path_expr '!' maybe_ident delimited_token_trees { $$ = mk_node("PatMac", 3, $1, $3, $4); }
+| binding_mode ident                              { $$ = mk_node("PatIdent", 2, $1, $2); }
+|              ident '@' pat                      { $$ = mk_node("PatIdent", 3, mk_node("BindByValue", 1, mk_atom("MutImmutable")), $1, $3); }
+| binding_mode ident '@' pat                      { $$ = mk_node("PatIdent", 3, $1, $2, $4); }
+| BOX pat                                         { $$ = mk_node("PatUniq", 1, $2); }
+| '<' ty_sum maybe_as_trait_ref '>' MOD_SEP ident { $$ = mk_node("PatQualifiedPath", 3, $2, $3, $6); }
+| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident maybe_as_trait_ref '>' MOD_SEP ident
+{
+  $$ = mk_node("PatQualifiedPath", 3, mk_node("PatQualifiedPath", 3, $2, $3, $6), $7, $10);
+}
+;
+
+pats_or
+: pat              { $$ = mk_node("Pats", 1, $1); }
+| pats_or '|' pat  { $$ = ext_node($1, 1, $3); }
+;
+
+binding_mode
+: REF         { $$ = mk_node("BindByRef", 1, mk_atom("MutImmutable")); }
+| REF MUT     { $$ = mk_node("BindByRef", 1, mk_atom("MutMutable")); }
+| MUT         { $$ = mk_node("BindByValue", 1, mk_atom("MutMutable")); }
+;
+
+lit_or_path
+: path_expr    { $$ = mk_node("PatLit", 1, $1); }
+| lit          { $$ = mk_node("PatLit", 1, $1); }
+| '-' lit      { $$ = mk_node("PatLit", 1, $2); }
+;
+
+pat_field
+:                  ident        { $$ = mk_node("PatField", 1, $1); }
+|     binding_mode ident        { $$ = mk_node("PatField", 2, $1, $2); }
+| BOX              ident        { $$ = mk_node("PatField", 2, mk_atom("box"), $2); }
+| BOX binding_mode ident        { $$ = mk_node("PatField", 3, mk_atom("box"), $2, $3); }
+|              ident ':' pat    { $$ = mk_node("PatField", 2, $1, $3); }
+| binding_mode ident ':' pat    { $$ = mk_node("PatField", 3, $1, $2, $4); }
+;
+
+pat_fields
+: pat_field                  { $$ = mk_node("PatFields", 1, $1); }
+| pat_fields ',' pat_field   { $$ = ext_node($1, 1, $3); }
+;
+
+pat_struct
+: pat_fields                 { $$ = mk_node("PatStruct", 2, $1, mk_atom("false")); }
+| pat_fields ','             { $$ = mk_node("PatStruct", 2, $1, mk_atom("false")); }
+| pat_fields ',' DOTDOT      { $$ = mk_node("PatStruct", 2, $1, mk_atom("true")); }
+| DOTDOT                     { $$ = mk_node("PatStruct", 1, mk_atom("true")); }
+;
+
+pat_tup
+: pat               { $$ = mk_node("pat_tup", 1, $1); }
+| pat_tup ',' pat   { $$ = ext_node($1, 1, $3); }
+;
+
+pat_vec
+: pat_vec_elts                                  { $$ = mk_node("PatVec", 2, $1, mk_none()); }
+| pat_vec_elts                             ','  { $$ = mk_node("PatVec", 2, $1, mk_none()); }
+| pat_vec_elts     DOTDOT                       { $$ = mk_node("PatVec", 2, $1, mk_none()); }
+| pat_vec_elts ',' DOTDOT                       { $$ = mk_node("PatVec", 2, $1, mk_none()); }
+| pat_vec_elts     DOTDOT ',' pat_vec_elts      { $$ = mk_node("PatVec", 2, $1, $4); }
+| pat_vec_elts     DOTDOT ',' pat_vec_elts ','  { $$ = mk_node("PatVec", 2, $1, $4); }
+| pat_vec_elts ',' DOTDOT ',' pat_vec_elts      { $$ = mk_node("PatVec", 2, $1, $5); }
+| pat_vec_elts ',' DOTDOT ',' pat_vec_elts ','  { $$ = mk_node("PatVec", 2, $1, $5); }
+|                  DOTDOT ',' pat_vec_elts      { $$ = mk_node("PatVec", 2, mk_none(), $3); }
+|                  DOTDOT ',' pat_vec_elts ','  { $$ = mk_node("PatVec", 2, mk_none(), $3); }
+|                  DOTDOT                       { $$ = mk_node("PatVec", 2, mk_none(), mk_none()); }
+| %empty                                        { $$ = mk_node("PatVec", 2, mk_none(), mk_none()); }
+;
+
+pat_vec_elts
+: pat                    { $$ = mk_node("PatVecElts", 1, $1); }
+| pat_vec_elts ',' pat   { $$ = ext_node($1, 1, $3); }
+;
+
+////////////////////////////////////////////////////////////////////////
+// Part 3: Types
+////////////////////////////////////////////////////////////////////////
+
+ty
+: ty_prim
+| ty_closure
+| '<' ty_sum maybe_as_trait_ref '>' MOD_SEP ident                                      { $$ = mk_node("TyQualifiedPath", 3, $2, $3, $6); }
+| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident maybe_as_trait_ref '>' MOD_SEP ident { $$ = mk_node("TyQualifiedPath", 3, mk_node("TyQualifiedPath", 3, $2, $3, $6), $7, $10); }
+| '(' ty_sums ')'                                                                      { $$ = mk_node("TyTup", 1, $2); }
+| '(' ty_sums ',' ')'                                                                  { $$ = mk_node("TyTup", 1, $2); }
+| '(' ')'                                                                              { $$ = mk_atom("TyNil"); }
+;
+
+ty_prim
+: %prec IDENT path_generic_args_without_colons              { $$ = mk_node("TyPath", 2, mk_node("global", 1, mk_atom("false")), $1); }
+| %prec IDENT MOD_SEP path_generic_args_without_colons      { $$ = mk_node("TyPath", 2, mk_node("global", 1, mk_atom("true")), $2); }
+| %prec IDENT SELF MOD_SEP path_generic_args_without_colons { $$ = mk_node("TyPath", 2, mk_node("self", 1, mk_atom("true")), $3); }
+| BOX ty                                                    { $$ = mk_node("TyBox", 1, $2); }
+| '*' maybe_mut_or_const ty                                 { $$ = mk_node("TyPtr", 2, $2, $3); }
+| '&' ty                                                    { $$ = mk_node("TyRptr", 2, mk_atom("MutImmutable"), $2); }
+| '&' MUT ty                                                { $$ = mk_node("TyRptr", 2, mk_atom("MutMutable"), $3); }
+| ANDAND ty                                                 { $$ = mk_node("TyRptr", 1, mk_node("TyRptr", 2, mk_atom("MutImmutable"), $2)); }
+| ANDAND MUT ty                                             { $$ = mk_node("TyRptr", 1, mk_node("TyRptr", 2, mk_atom("MutMutable"), $3)); }
+| '&' lifetime maybe_mut ty                                 { $$ = mk_node("TyRptr", 3, $2, $3, $4); }
+| ANDAND lifetime maybe_mut ty                              { $$ = mk_node("TyRptr", 1, mk_node("TyRptr", 3, $2, $3, $4)); }
+| '[' ty ']'                                                { $$ = mk_node("TyVec", 1, $2); }
+| '[' ty ',' DOTDOT expr ']'                                { $$ = mk_node("TyFixedLengthVec", 2, $2, $5); }
+| '[' ty ';' expr ']'                                       { $$ = mk_node("TyFixedLengthVec", 2, $2, $4); }
+| TYPEOF '(' expr ')'                                       { $$ = mk_node("TyTypeof", 1, $3); }
+| UNDERSCORE                                                { $$ = mk_atom("TyInfer"); }
+| ty_bare_fn
+| ty_proc
+| for_in_type
+;
+
+ty_bare_fn
+:                         FN ty_fn_decl { $$ = $2; }
+| UNSAFE                  FN ty_fn_decl { $$ = $3; }
+|        EXTERN maybe_abi FN ty_fn_decl { $$ = $4; }
+| UNSAFE EXTERN maybe_abi FN ty_fn_decl { $$ = $5; }
+;
+
+ty_fn_decl
+: generic_params fn_anon_params ret_ty { $$ = mk_node("TyFnDecl", 3, $1, $2, $3); }
+;
+
+ty_closure
+: UNSAFE '|' anon_params '|' maybe_bounds ret_ty { $$ = mk_node("TyClosure", 3, $3, $5, $6); }
+|        '|' anon_params '|' maybe_bounds ret_ty { $$ = mk_node("TyClosure", 3, $2, $4, $5); }
+| UNSAFE OROR maybe_bounds ret_ty                { $$ = mk_node("TyClosure", 2, $3, $4); }
+|        OROR maybe_bounds ret_ty                { $$ = mk_node("TyClosure", 2, $2, $3); }
+;
+
+ty_proc
+: PROC generic_params fn_params maybe_bounds ret_ty { $$ = mk_node("TyProc", 4, $2, $3, $4, $5); }
+;
+
+for_in_type
+: FOR '<' maybe_lifetimes '>' for_in_type_suffix { $$ = mk_node("ForInType", 2, $3, $5); }
+;
+
+for_in_type_suffix
+: ty_proc
+| ty_bare_fn
+| trait_ref
+| ty_closure
+;
+
+maybe_mut
+: MUT              { $$ = mk_atom("MutMutable"); }
+| %prec MUT %empty { $$ = mk_atom("MutImmutable"); }
+;
+
+maybe_mut_or_const
+: MUT    { $$ = mk_atom("MutMutable"); }
+| CONST  { $$ = mk_atom("MutImmutable"); }
+| %empty { $$ = mk_atom("MutImmutable"); }
+;
+
+ty_qualified_path_and_generic_values
+: ty_qualified_path maybe_bindings
+{
+  $$ = mk_node("GenericValues", 3, mk_none(), mk_node("TySums", 1, mk_node("TySum", 1, $1)), $2);
+}
+| ty_qualified_path ',' ty_sums maybe_bindings
+{
+  $$ = mk_node("GenericValues", 3, mk_none(), mk_node("TySums", 2, $1, $3), $4);
+}
+;
+
+ty_qualified_path
+: ty_sum AS trait_ref '>' MOD_SEP ident                     { $$ = mk_node("TyQualifiedPath", 3, $1, $3, $6); }
+| ty_sum AS trait_ref '>' MOD_SEP ident '+' ty_param_bounds { $$ = mk_node("TyQualifiedPath", 3, $1, $3, $6); }
+;
+
+maybe_ty_sums
+: ty_sums
+| ty_sums ','
+| %empty { $$ = mk_none(); }
+;
+
+ty_sums
+: ty_sum             { $$ = mk_node("TySums", 1, $1); }
+| ty_sums ',' ty_sum { $$ = ext_node($1, 1, $3); }
+;
+
+ty_sum
+: ty                     { $$ = mk_node("TySum", 1, $1); }
+| ty '+' ty_param_bounds { $$ = mk_node("TySum", 2, $1, $3); }
+;
+
+ty_prim_sum
+: ty_prim                     { $$ = mk_node("TySum", 1, $1); }
+| ty_prim '+' ty_param_bounds { $$ = mk_node("TySum", 2, $1, $3); }
+;
+
+maybe_ty_param_bounds
+: ':' ty_param_bounds { $$ = $2; }
+| %empty              { $$ = mk_none(); }
+;
+
+ty_param_bounds
+: boundseq
+| %empty { $$ = mk_none(); }
+;
+
+boundseq
+: polybound
+| boundseq '+' polybound { $$ = ext_node($1, 1, $3); }
+;
+
+polybound
+: FOR '<' maybe_lifetimes '>' bound { $$ = mk_node("PolyBound", 2, $3, $5); }
+| bound
+| '?' bound { $$ = $2; }
+;
+
+bindings
+: binding              { $$ = mk_node("Bindings", 1, $1); }
+| bindings ',' binding { $$ = ext_node($1, 1, $3); }
+;
+
+binding
+: ident '=' ty { mk_node("Binding", 2, $1, $3); }
+;
+
+ty_param
+: ident maybe_ty_param_bounds maybe_ty_default           { $$ = mk_node("TyParam", 3, $1, $2, $3); }
+| ident '?' ident maybe_ty_param_bounds maybe_ty_default { $$ = mk_node("TyParam", 4, $1, $3, $4, $5); }
+;
+
+maybe_bounds
+: %prec SHIFTPLUS
+  ':' bounds             { $$ = $2; }
+| %prec SHIFTPLUS %empty { $$ = mk_none(); }
+;
+
+bounds
+: bound            { $$ = mk_node("bounds", 1, $1); }
+| bounds '+' bound { $$ = ext_node($1, 1, $3); }
+;
+
+bound
+: lifetime
+| trait_ref
+;
+
+maybe_ltbounds
+: %prec SHIFTPLUS
+  ':' ltbounds       { $$ = $2; }
+| %empty             { $$ = mk_none(); }
+;
+
+ltbounds
+: lifetime              { $$ = mk_node("ltbounds", 1, $1); }
+| ltbounds '+' lifetime { $$ = ext_node($1, 1, $3); }
+;
+
+maybe_ty_default
+: '=' ty_sum { $$ = mk_node("TyDefault", 1, $2); }
+| %empty     { $$ = mk_none(); }
+;
+
+maybe_lifetimes
+: lifetimes
+| lifetimes ','
+| %empty { $$ = mk_none(); }
+;
+
+lifetimes
+: lifetime_and_bounds               { $$ = mk_node("Lifetimes", 1, $1); }
+| lifetimes ',' lifetime_and_bounds { $$ = ext_node($1, 1, $3); }
+;
+
+lifetime_and_bounds
+: LIFETIME maybe_ltbounds         { $$ = mk_node("lifetime", 2, mk_atom(yytext), $2); }
+| STATIC_LIFETIME                 { $$ = mk_atom("static_lifetime"); }
+;
+
+lifetime
+: LIFETIME         { $$ = mk_node("lifetime", 1, mk_atom(yytext)); }
+| STATIC_LIFETIME  { $$ = mk_atom("static_lifetime"); }
+;
+
+trait_ref
+: %prec IDENT path_generic_args_without_colons
+| %prec IDENT MOD_SEP path_generic_args_without_colons { $$ = $2; }
+;
+
+////////////////////////////////////////////////////////////////////////
+// Part 4: Blocks, statements, and expressions
+////////////////////////////////////////////////////////////////////////
+
+inner_attrs_and_block
+: '{' maybe_inner_attrs maybe_stmts '}'        { $$ = mk_node("ExprBlock", 2, $2, $3); }
+;
+
+block
+: '{' maybe_stmts '}'                          { $$ = mk_node("ExprBlock", 1, $2); }
+;
+
+maybe_stmts
+: stmts
+| stmts nonblock_expr { $$ = ext_node($1, 1, $2); }
+| nonblock_expr
+| %empty              { $$ = mk_none(); }
+;
+
+// There are two sub-grammars within a "stmts: exprs" derivation
+// depending on whether each stmt-expr is a block-expr form; this is to
+// handle the "semicolon rule" for stmt sequencing that permits
+// writing
+//
+//     if foo { bar } 10
+//
+// as a sequence of two stmts (one if-expr stmt, one lit-10-expr
+// stmt). Unfortunately by permitting juxtaposition of exprs in
+// sequence like that, the non-block expr grammar has to have a
+// second limited sub-grammar that excludes the prefix exprs that
+// are ambiguous with binops. That is to say:
+//
+//     {10} - 1
+//
+// should parse as (progn (progn 10) (- 1)) not (- (progn 10) 1), that
+// is to say, two statements rather than one, at least according to
+// the mainline rust parser.
+//
+// So we wind up with a 3-way split in exprs that occur in stmt lists:
+// block, nonblock-prefix, and nonblock-nonprefix.
+//
+// In non-stmts contexts, expr can relax this trichotomy.
+//
+// There is also one other expr subtype: nonparen_expr disallows exprs
+// surrounded by parens (including tuple expressions), this is
+// necessary for BOX (place) expressions, so a parens expr following
+// the BOX is always parsed as the place.
+
+stmts
+: stmt           { $$ = mk_node("stmts", 1, $1); }
+| stmts stmt     { $$ = ext_node($1, 1, $2); }
+;
+
+stmt
+: let
+|                 stmt_item
+|             PUB stmt_item { $$ = $2; }
+| outer_attrs     stmt_item { $$ = $2; }
+| outer_attrs PUB stmt_item { $$ = $3; }
+| full_block_expr
+| block
+| nonblock_expr ';'
+| ';'                   { $$ = mk_none(); }
+;
+
+maybe_exprs
+: exprs
+| exprs ','
+| %empty { $$ = mk_none(); }
+;
+
+maybe_expr
+: expr
+| %empty { $$ = mk_none(); }
+;
+
+exprs
+: expr                                                        { $$ = mk_node("exprs", 1, $1); }
+| exprs ',' expr                                              { $$ = ext_node($1, 1, $3); }
+;
+
+path_expr
+: path_generic_args_with_colons
+| MOD_SEP path_generic_args_with_colons      { $$ = $2; }
+| SELF MOD_SEP path_generic_args_with_colons { $$ = mk_node("SelfPath", 1, $3); }
+;
+
+// A path with a lifetime and type parameters with double colons before
+// the type parameters; e.g. `foo::bar::<'a>::Baz::<T>`
+//
+// These show up in expr context, in order to disambiguate from "less-than"
+// expressions.
+path_generic_args_with_colons
+: ident                                              { $$ = mk_node("components", 1, $1); }
+| path_generic_args_with_colons MOD_SEP ident        { $$ = ext_node($1, 1, $3); }
+| path_generic_args_with_colons MOD_SEP generic_args { $$ = ext_node($1, 1, $3); }
+;
+
+// the braces-delimited macro is a block_expr so it doesn't appear here
+macro_expr
+: path_expr '!' maybe_ident parens_delimited_token_trees   { $$ = mk_node("MacroExpr", 3, $1, $3, $4); }
+| path_expr '!' maybe_ident brackets_delimited_token_trees { $$ = mk_node("MacroExpr", 3, $1, $3, $4); }
+;
+
+nonblock_expr
+: lit                                                           { $$ = mk_node("ExprLit", 1, $1); }
+| %prec IDENT
+  path_expr                                                     { $$ = mk_node("ExprPath", 1, $1); }
+| SELF                                                          { $$ = mk_node("ExprPath", 1, mk_node("ident", 1, mk_atom("self"))); }
+| macro_expr                                                    { $$ = mk_node("ExprMac", 1, $1); }
+| path_expr '{' struct_expr_fields '}'                          { $$ = mk_node("ExprStruct", 2, $1, $3); }
+| nonblock_expr '.' path_generic_args_with_colons               { $$ = mk_node("ExprField", 2, $1, $3); }
+| nonblock_expr '.' LIT_INTEGER                                 { $$ = mk_node("ExprTupleIndex", 1, $1); }
+| nonblock_expr '[' maybe_expr ']'                              { $$ = mk_node("ExprIndex", 2, $1, $3); }
+| nonblock_expr '(' maybe_exprs ')'                             { $$ = mk_node("ExprCall", 2, $1, $3); }
+| '[' vec_expr ']'                                              { $$ = mk_node("ExprVec", 1, $2); }
+| '(' maybe_exprs ')'                                           { $$ = mk_node("ExprParen", 1, $2); }
+| CONTINUE                                                      { $$ = mk_node("ExprAgain", 0); }
+| CONTINUE lifetime                                             { $$ = mk_node("ExprAgain", 1, $2); }
+| RETURN                                                        { $$ = mk_node("ExprRet", 0); }
+| RETURN expr                                                   { $$ = mk_node("ExprRet", 1, $2); }
+| BREAK                                                         { $$ = mk_node("ExprBreak", 0); }
+| BREAK lifetime                                                { $$ = mk_node("ExprBreak", 1, $2); }
+| nonblock_expr LARROW expr                                     { $$ = mk_node("ExprInPlace", 2, $1, $3); }
+| nonblock_expr '=' expr                                        { $$ = mk_node("ExprAssign", 2, $1, $3); }
+| nonblock_expr SHLEQ expr                                      { $$ = mk_node("ExprAssignShl", 2, $1, $3); }
+| nonblock_expr SHREQ expr                                      { $$ = mk_node("ExprAssignShr", 2, $1, $3); }
+| nonblock_expr MINUSEQ expr                                    { $$ = mk_node("ExprAssignSub", 2, $1, $3); }
+| nonblock_expr ANDEQ expr                                      { $$ = mk_node("ExprAssignBitAnd", 2, $1, $3); }
+| nonblock_expr OREQ expr                                       { $$ = mk_node("ExprAssignBitOr", 2, $1, $3); }
+| nonblock_expr PLUSEQ expr                                     { $$ = mk_node("ExprAssignAdd", 2, $1, $3); }
+| nonblock_expr STAREQ expr                                     { $$ = mk_node("ExprAssignMul", 2, $1, $3); }
+| nonblock_expr SLASHEQ expr                                    { $$ = mk_node("ExprAssignDiv", 2, $1, $3); }
+| nonblock_expr CARETEQ expr                                    { $$ = mk_node("ExprAssignBitXor", 2, $1, $3); }
+| nonblock_expr PERCENTEQ expr                                  { $$ = mk_node("ExprAssignRem", 2, $1, $3); }
+| nonblock_expr OROR expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiOr"), $1, $3); }
+| nonblock_expr ANDAND expr                                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiAnd"), $1, $3); }
+| nonblock_expr EQEQ expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiEq"), $1, $3); }
+| nonblock_expr NE expr                                         { $$ = mk_node("ExprBinary", 3, mk_atom("BiNe"), $1, $3); }
+| nonblock_expr '<' expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiLt"), $1, $3); }
+| nonblock_expr '>' expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiGt"), $1, $3); }
+| nonblock_expr LE expr                                         { $$ = mk_node("ExprBinary", 3, mk_atom("BiLe"), $1, $3); }
+| nonblock_expr GE expr                                         { $$ = mk_node("ExprBinary", 3, mk_atom("BiGe"), $1, $3); }
+| nonblock_expr '|' expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitOr"), $1, $3); }
+| nonblock_expr '^' expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitXor"), $1, $3); }
+| nonblock_expr '&' expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitAnd"), $1, $3); }
+| nonblock_expr SHL expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiShl"), $1, $3); }
+| nonblock_expr SHR expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiShr"), $1, $3); }
+| nonblock_expr '+' expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiAdd"), $1, $3); }
+| nonblock_expr '-' expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiSub"), $1, $3); }
+| nonblock_expr '*' expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiMul"), $1, $3); }
+| nonblock_expr '/' expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiDiv"), $1, $3); }
+| nonblock_expr '%' expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiRem"), $1, $3); }
+| nonblock_expr DOTDOT                                          { $$ = mk_node("ExprRange", 2, $1, mk_none()); }
+| nonblock_expr DOTDOT expr                                     { $$ = mk_node("ExprRange", 2, $1, $3); }
+|               DOTDOT expr                                     { $$ = mk_node("ExprRange", 2, mk_none(), $2); }
+|               DOTDOT                                          { $$ = mk_node("ExprRange", 2, mk_none(), mk_none()); }
+| nonblock_expr AS ty                                           { $$ = mk_node("ExprCast", 2, $1, $3); }
+| BOX nonparen_expr                                             { $$ = mk_node("ExprBox", 1, $2); }
+| %prec BOXPLACE BOX '(' maybe_expr ')' nonblock_expr           { $$ = mk_node("ExprBox", 2, $3, $5); }
+| expr_qualified_path
+| nonblock_prefix_expr
+;
+
+expr
+: lit                                                 { $$ = mk_node("ExprLit", 1, $1); }
+| %prec IDENT
+  path_expr                                           { $$ = mk_node("ExprPath", 1, $1); }
+| SELF                                                { $$ = mk_node("ExprPath", 1, mk_node("ident", 1, mk_atom("self"))); }
+| macro_expr                                          { $$ = mk_node("ExprMac", 1, $1); }
+| path_expr '{' struct_expr_fields '}'                { $$ = mk_node("ExprStruct", 2, $1, $3); }
+| expr '.' path_generic_args_with_colons              { $$ = mk_node("ExprField", 2, $1, $3); }
+| expr '.' LIT_INTEGER                                { $$ = mk_node("ExprTupleIndex", 1, $1); }
+| expr '[' maybe_expr ']'                             { $$ = mk_node("ExprIndex", 2, $1, $3); }
+| expr '(' maybe_exprs ')'                            { $$ = mk_node("ExprCall", 2, $1, $3); }
+| '(' maybe_exprs ')'                                 { $$ = mk_node("ExprParen", 1, $2); }
+| '[' vec_expr ']'                                    { $$ = mk_node("ExprVec", 1, $2); }
+| CONTINUE                                            { $$ = mk_node("ExprAgain", 0); }
+| CONTINUE ident                                      { $$ = mk_node("ExprAgain", 1, $2); }
+| RETURN                                              { $$ = mk_node("ExprRet", 0); }
+| RETURN expr                                         { $$ = mk_node("ExprRet", 1, $2); }
+| BREAK                                               { $$ = mk_node("ExprBreak", 0); }
+| BREAK ident                                         { $$ = mk_node("ExprBreak", 1, $2); }
+| expr LARROW expr                                    { $$ = mk_node("ExprInPlace", 2, $1, $3); }
+| expr '=' expr                                       { $$ = mk_node("ExprAssign", 2, $1, $3); }
+| expr SHLEQ expr                                     { $$ = mk_node("ExprAssignShl", 2, $1, $3); }
+| expr SHREQ expr                                     { $$ = mk_node("ExprAssignShr", 2, $1, $3); }
+| expr MINUSEQ expr                                   { $$ = mk_node("ExprAssignSub", 2, $1, $3); }
+| expr ANDEQ expr                                     { $$ = mk_node("ExprAssignBitAnd", 2, $1, $3); }
+| expr OREQ expr                                      { $$ = mk_node("ExprAssignBitOr", 2, $1, $3); }
+| expr PLUSEQ expr                                    { $$ = mk_node("ExprAssignAdd", 2, $1, $3); }
+| expr STAREQ expr                                    { $$ = mk_node("ExprAssignMul", 2, $1, $3); }
+| expr SLASHEQ expr                                   { $$ = mk_node("ExprAssignDiv", 2, $1, $3); }
+| expr CARETEQ expr                                   { $$ = mk_node("ExprAssignBitXor", 2, $1, $3); }
+| expr PERCENTEQ expr                                 { $$ = mk_node("ExprAssignRem", 2, $1, $3); }
+| expr OROR expr                                      { $$ = mk_node("ExprBinary", 3, mk_atom("BiOr"), $1, $3); }
+| expr ANDAND expr                                    { $$ = mk_node("ExprBinary", 3, mk_atom("BiAnd"), $1, $3); }
+| expr EQEQ expr                                      { $$ = mk_node("ExprBinary", 3, mk_atom("BiEq"), $1, $3); }
+| expr NE expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiNe"), $1, $3); }
+| expr '<' expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiLt"), $1, $3); }
+| expr '>' expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiGt"), $1, $3); }
+| expr LE expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiLe"), $1, $3); }
+| expr GE expr                                        { $$ = mk_node("ExprBinary", 3, mk_atom("BiGe"), $1, $3); }
+| expr '|' expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitOr"), $1, $3); }
+| expr '^' expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitXor"), $1, $3); }
+| expr '&' expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitAnd"), $1, $3); }
+| expr SHL expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiShl"), $1, $3); }
+| expr SHR expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiShr"), $1, $3); }
+| expr '+' expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiAdd"), $1, $3); }
+| expr '-' expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiSub"), $1, $3); }
+| expr '*' expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiMul"), $1, $3); }
+| expr '/' expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiDiv"), $1, $3); }
+| expr '%' expr                                       { $$ = mk_node("ExprBinary", 3, mk_atom("BiRem"), $1, $3); }
+| expr DOTDOT                                         { $$ = mk_node("ExprRange", 2, $1, mk_none()); }
+| expr DOTDOT expr                                    { $$ = mk_node("ExprRange", 2, $1, $3); }
+|      DOTDOT expr                                    { $$ = mk_node("ExprRange", 2, mk_none(), $2); }
+|      DOTDOT                                         { $$ = mk_node("ExprRange", 2, mk_none(), mk_none()); }
+| expr AS ty                                          { $$ = mk_node("ExprCast", 2, $1, $3); }
+| BOX nonparen_expr                                   { $$ = mk_node("ExprBox", 1, $2); }
+| %prec BOXPLACE BOX '(' maybe_expr ')' expr          { $$ = mk_node("ExprBox", 2, $3, $5); }
+| expr_qualified_path
+| block_expr
+| block
+| nonblock_prefix_expr
+;
+
+nonparen_expr
+: lit                                                 { $$ = mk_node("ExprLit", 1, $1); }
+| %prec IDENT
+  path_expr                                           { $$ = mk_node("ExprPath", 1, $1); }
+| SELF                                                { $$ = mk_node("ExprPath", 1, mk_node("ident", 1, mk_atom("self"))); }
+| macro_expr                                          { $$ = mk_node("ExprMac", 1, $1); }
+| path_expr '{' struct_expr_fields '}'                { $$ = mk_node("ExprStruct", 2, $1, $3); }
+| nonparen_expr '.' path_generic_args_with_colons     { $$ = mk_node("ExprField", 2, $1, $3); }
+| nonparen_expr '.' LIT_INTEGER                       { $$ = mk_node("ExprTupleIndex", 1, $1); }
+| nonparen_expr '[' maybe_expr ']'                    { $$ = mk_node("ExprIndex", 2, $1, $3); }
+| nonparen_expr '(' maybe_exprs ')'                   { $$ = mk_node("ExprCall", 2, $1, $3); }
+| '[' vec_expr ']'                                    { $$ = mk_node("ExprVec", 1, $2); }
+| CONTINUE                                            { $$ = mk_node("ExprAgain", 0); }
+| CONTINUE ident                                      { $$ = mk_node("ExprAgain", 1, $2); }
+| RETURN                                              { $$ = mk_node("ExprRet", 0); }
+| RETURN expr                                         { $$ = mk_node("ExprRet", 1, $2); }
+| BREAK                                               { $$ = mk_node("ExprBreak", 0); }
+| BREAK ident                                         { $$ = mk_node("ExprBreak", 1, $2); }
+| nonparen_expr LARROW nonparen_expr                  { $$ = mk_node("ExprInPlace", 2, $1, $3); }
+| nonparen_expr '=' nonparen_expr                     { $$ = mk_node("ExprAssign", 2, $1, $3); }
+| nonparen_expr SHLEQ nonparen_expr                   { $$ = mk_node("ExprAssignShl", 2, $1, $3); }
+| nonparen_expr SHREQ nonparen_expr                   { $$ = mk_node("ExprAssignShr", 2, $1, $3); }
+| nonparen_expr MINUSEQ nonparen_expr                 { $$ = mk_node("ExprAssignSub", 2, $1, $3); }
+| nonparen_expr ANDEQ nonparen_expr                   { $$ = mk_node("ExprAssignBitAnd", 2, $1, $3); }
+| nonparen_expr OREQ nonparen_expr                    { $$ = mk_node("ExprAssignBitOr", 2, $1, $3); }
+| nonparen_expr PLUSEQ nonparen_expr                  { $$ = mk_node("ExprAssignAdd", 2, $1, $3); }
+| nonparen_expr STAREQ nonparen_expr                  { $$ = mk_node("ExprAssignMul", 2, $1, $3); }
+| nonparen_expr SLASHEQ nonparen_expr                 { $$ = mk_node("ExprAssignDiv", 2, $1, $3); }
+| nonparen_expr CARETEQ nonparen_expr                 { $$ = mk_node("ExprAssignBitXor", 2, $1, $3); }
+| nonparen_expr PERCENTEQ nonparen_expr               { $$ = mk_node("ExprAssignRem", 2, $1, $3); }
+| nonparen_expr OROR nonparen_expr                    { $$ = mk_node("ExprBinary", 3, mk_atom("BiOr"), $1, $3); }
+| nonparen_expr ANDAND nonparen_expr                  { $$ = mk_node("ExprBinary", 3, mk_atom("BiAnd"), $1, $3); }
+| nonparen_expr EQEQ nonparen_expr                    { $$ = mk_node("ExprBinary", 3, mk_atom("BiEq"), $1, $3); }
+| nonparen_expr NE nonparen_expr                      { $$ = mk_node("ExprBinary", 3, mk_atom("BiNe"), $1, $3); }
+| nonparen_expr '<' nonparen_expr                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiLt"), $1, $3); }
+| nonparen_expr '>' nonparen_expr                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiGt"), $1, $3); }
+| nonparen_expr LE nonparen_expr                      { $$ = mk_node("ExprBinary", 3, mk_atom("BiLe"), $1, $3); }
+| nonparen_expr GE nonparen_expr                      { $$ = mk_node("ExprBinary", 3, mk_atom("BiGe"), $1, $3); }
+| nonparen_expr '|' nonparen_expr                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitOr"), $1, $3); }
+| nonparen_expr '^' nonparen_expr                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitXor"), $1, $3); }
+| nonparen_expr '&' nonparen_expr                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitAnd"), $1, $3); }
+| nonparen_expr SHL nonparen_expr                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiShl"), $1, $3); }
+| nonparen_expr SHR nonparen_expr                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiShr"), $1, $3); }
+| nonparen_expr '+' nonparen_expr                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiAdd"), $1, $3); }
+| nonparen_expr '-' nonparen_expr                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiSub"), $1, $3); }
+| nonparen_expr '*' nonparen_expr                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiMul"), $1, $3); }
+| nonparen_expr '/' nonparen_expr                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiDiv"), $1, $3); }
+| nonparen_expr '%' nonparen_expr                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiRem"), $1, $3); }
+| nonparen_expr DOTDOT                                { $$ = mk_node("ExprRange", 2, $1, mk_none()); }
+| nonparen_expr DOTDOT nonparen_expr                  { $$ = mk_node("ExprRange", 2, $1, $3); }
+|               DOTDOT nonparen_expr                  { $$ = mk_node("ExprRange", 2, mk_none(), $2); }
+|               DOTDOT                                { $$ = mk_node("ExprRange", 2, mk_none(), mk_none()); }
+| nonparen_expr AS ty                                 { $$ = mk_node("ExprCast", 2, $1, $3); }
+| BOX nonparen_expr                                   { $$ = mk_node("ExprBox", 1, $2); }
+| %prec BOXPLACE BOX '(' maybe_expr ')' expr          { $$ = mk_node("ExprBox", 1, $3, $5); }
+| expr_qualified_path
+| block_expr
+| block
+| nonblock_prefix_expr
+;
+
+expr_nostruct
+: lit                                                 { $$ = mk_node("ExprLit", 1, $1); }
+| %prec IDENT
+  path_expr                                           { $$ = mk_node("ExprPath", 1, $1); }
+| SELF                                                { $$ = mk_node("ExprPath", 1, mk_node("ident", 1, mk_atom("self"))); }
+| macro_expr                                          { $$ = mk_node("ExprMac", 1, $1); }
+| expr_nostruct '.' path_generic_args_with_colons     { $$ = mk_node("ExprField", 2, $1, $3); }
+| expr_nostruct '.' LIT_INTEGER                       { $$ = mk_node("ExprTupleIndex", 1, $1); }
+| expr_nostruct '[' maybe_expr ']'                    { $$ = mk_node("ExprIndex", 2, $1, $3); }
+| expr_nostruct '(' maybe_exprs ')'                   { $$ = mk_node("ExprCall", 2, $1, $3); }
+| '[' vec_expr ']'                                    { $$ = mk_node("ExprVec", 1, $2); }
+| '(' maybe_exprs ')'                                 { $$ = mk_node("ExprParen", 1, $2); }
+| CONTINUE                                            { $$ = mk_node("ExprAgain", 0); }
+| CONTINUE ident                                      { $$ = mk_node("ExprAgain", 1, $2); }
+| RETURN                                              { $$ = mk_node("ExprRet", 0); }
+| RETURN expr                                         { $$ = mk_node("ExprRet", 1, $2); }
+| BREAK                                               { $$ = mk_node("ExprBreak", 0); }
+| BREAK ident                                         { $$ = mk_node("ExprBreak", 1, $2); }
+| expr_nostruct LARROW expr_nostruct                  { $$ = mk_node("ExprInPlace", 2, $1, $3); }
+| expr_nostruct '=' expr_nostruct                     { $$ = mk_node("ExprAssign", 2, $1, $3); }
+| expr_nostruct SHLEQ expr_nostruct                   { $$ = mk_node("ExprAssignShl", 2, $1, $3); }
+| expr_nostruct SHREQ expr_nostruct                   { $$ = mk_node("ExprAssignShr", 2, $1, $3); }
+| expr_nostruct MINUSEQ expr_nostruct                 { $$ = mk_node("ExprAssignSub", 2, $1, $3); }
+| expr_nostruct ANDEQ expr_nostruct                   { $$ = mk_node("ExprAssignBitAnd", 2, $1, $3); }
+| expr_nostruct OREQ expr_nostruct                    { $$ = mk_node("ExprAssignBitOr", 2, $1, $3); }
+| expr_nostruct PLUSEQ expr_nostruct                  { $$ = mk_node("ExprAssignAdd", 2, $1, $3); }
+| expr_nostruct STAREQ expr_nostruct                  { $$ = mk_node("ExprAssignMul", 2, $1, $3); }
+| expr_nostruct SLASHEQ expr_nostruct                 { $$ = mk_node("ExprAssignDiv", 2, $1, $3); }
+| expr_nostruct CARETEQ expr_nostruct                 { $$ = mk_node("ExprAssignBitXor", 2, $1, $3); }
+| expr_nostruct PERCENTEQ expr_nostruct               { $$ = mk_node("ExprAssignRem", 2, $1, $3); }
+| expr_nostruct OROR expr_nostruct                    { $$ = mk_node("ExprBinary", 3, mk_atom("BiOr"), $1, $3); }
+| expr_nostruct ANDAND expr_nostruct                  { $$ = mk_node("ExprBinary", 3, mk_atom("BiAnd"), $1, $3); }
+| expr_nostruct EQEQ expr_nostruct                    { $$ = mk_node("ExprBinary", 3, mk_atom("BiEq"), $1, $3); }
+| expr_nostruct NE expr_nostruct                      { $$ = mk_node("ExprBinary", 3, mk_atom("BiNe"), $1, $3); }
+| expr_nostruct '<' expr_nostruct                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiLt"), $1, $3); }
+| expr_nostruct '>' expr_nostruct                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiGt"), $1, $3); }
+| expr_nostruct LE expr_nostruct                      { $$ = mk_node("ExprBinary", 3, mk_atom("BiLe"), $1, $3); }
+| expr_nostruct GE expr_nostruct                      { $$ = mk_node("ExprBinary", 3, mk_atom("BiGe"), $1, $3); }
+| expr_nostruct '|' expr_nostruct                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitOr"), $1, $3); }
+| expr_nostruct '^' expr_nostruct                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitXor"), $1, $3); }
+| expr_nostruct '&' expr_nostruct                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitAnd"), $1, $3); }
+| expr_nostruct SHL expr_nostruct                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiShl"), $1, $3); }
+| expr_nostruct SHR expr_nostruct                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiShr"), $1, $3); }
+| expr_nostruct '+' expr_nostruct                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiAdd"), $1, $3); }
+| expr_nostruct '-' expr_nostruct                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiSub"), $1, $3); }
+| expr_nostruct '*' expr_nostruct                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiMul"), $1, $3); }
+| expr_nostruct '/' expr_nostruct                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiDiv"), $1, $3); }
+| expr_nostruct '%' expr_nostruct                     { $$ = mk_node("ExprBinary", 3, mk_atom("BiRem"), $1, $3); }
+| expr_nostruct DOTDOT               %prec RANGE      { $$ = mk_node("ExprRange", 2, $1, mk_none()); }
+| expr_nostruct DOTDOT expr_nostruct                  { $$ = mk_node("ExprRange", 2, $1, $3); }
+|               DOTDOT expr_nostruct                  { $$ = mk_node("ExprRange", 2, mk_none(), $2); }
+|               DOTDOT                                { $$ = mk_node("ExprRange", 2, mk_none(), mk_none()); }
+| expr_nostruct AS ty                                 { $$ = mk_node("ExprCast", 2, $1, $3); }
+| BOX nonparen_expr                                   { $$ = mk_node("ExprBox", 1, $2); }
+| %prec BOXPLACE BOX '(' maybe_expr ')' expr_nostruct { $$ = mk_node("ExprBox", 1, $3, $5); }
+| expr_qualified_path
+| block_expr
+| block
+| nonblock_prefix_expr_nostruct
+;
+
+nonblock_prefix_expr_nostruct
+: '-' expr_nostruct                         { $$ = mk_node("ExprUnary", 2, mk_atom("UnNeg"), $2); }
+| '!' expr_nostruct                         { $$ = mk_node("ExprUnary", 2, mk_atom("UnNot"), $2); }
+| '*' expr_nostruct                         { $$ = mk_node("ExprUnary", 2, mk_atom("UnDeref"), $2); }
+| '&' maybe_mut expr_nostruct               { $$ = mk_node("ExprAddrOf", 2, $2, $3); }
+| ANDAND maybe_mut expr_nostruct            { $$ = mk_node("ExprAddrOf", 1, mk_node("ExprAddrOf", 2, $2, $3)); }
+| lambda_expr_nostruct
+| MOVE lambda_expr_nostruct                 { $$ = $2; }
+| proc_expr_nostruct
+;
+
+nonblock_prefix_expr
+: '-' expr                         { $$ = mk_node("ExprUnary", 2, mk_atom("UnNeg"), $2); }
+| '!' expr                         { $$ = mk_node("ExprUnary", 2, mk_atom("UnNot"), $2); }
+| '*' expr                         { $$ = mk_node("ExprUnary", 2, mk_atom("UnDeref"), $2); }
+| '&' maybe_mut expr               { $$ = mk_node("ExprAddrOf", 2, $2, $3); }
+| ANDAND maybe_mut expr            { $$ = mk_node("ExprAddrOf", 1, mk_node("ExprAddrOf", 2, $2, $3)); }
+| lambda_expr
+| MOVE lambda_expr                 { $$ = $2; }
+| proc_expr
+;
+
+expr_qualified_path
+: '<' ty_sum maybe_as_trait_ref '>' MOD_SEP ident maybe_qpath_params
+{
+  $$ = mk_node("ExprQualifiedPath", 4, $2, $3, $6, $7);
+}
+| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident maybe_as_trait_ref '>' MOD_SEP ident
+{
+  $$ = mk_node("ExprQualifiedPath", 3, mk_node("ExprQualifiedPath", 3, $2, $3, $6), $7, $10);
+}
+| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident generic_args maybe_as_trait_ref '>' MOD_SEP ident
+{
+  $$ = mk_node("ExprQualifiedPath", 3, mk_node("ExprQualifiedPath", 4, $2, $3, $6, $7), $8, $11);
+}
+| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident maybe_as_trait_ref '>' MOD_SEP ident generic_args
+{
+  $$ = mk_node("ExprQualifiedPath", 4, mk_node("ExprQualifiedPath", 3, $2, $3, $6), $7, $10, $11);
+}
+| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident generic_args maybe_as_trait_ref '>' MOD_SEP ident generic_args
+{
+  $$ = mk_node("ExprQualifiedPath", 4, mk_node("ExprQualifiedPath", 4, $2, $3, $6, $7), $8, $11, $12);
+}
+
+maybe_qpath_params
+: MOD_SEP generic_args { $$ = $2; }
+| %empty               { $$ = mk_none(); }
+;
+
+maybe_as_trait_ref
+: AS trait_ref { $$ = $2; }
+| %empty       { $$ = mk_none(); }
+;
+
+lambda_expr
+: %prec LAMBDA
+  OROR ret_ty expr                                        { $$ = mk_node("ExprFnBlock", 3, mk_none(), $2, $3); }
+| %prec LAMBDA
+  '|' maybe_unboxed_closure_kind '|' ret_ty expr          { $$ = mk_node("ExprFnBlock", 3, mk_none(), $4, $5); }
+| %prec LAMBDA
+  '|' inferrable_params '|' ret_ty expr                   { $$ = mk_node("ExprFnBlock", 3, $2, $4, $5); }
+| %prec LAMBDA
+  '|' '&' maybe_mut ':' inferrable_params '|' ret_ty expr { $$ = mk_node("ExprFnBlock", 3, $5, $7, $8); }
+| %prec LAMBDA
+  '|' ':' inferrable_params '|' ret_ty expr               { $$ = mk_node("ExprFnBlock", 3, $3, $5, $6); }
+;
+
+lambda_expr_nostruct
+: %prec LAMBDA
+  OROR expr_nostruct                                        { $$ = mk_node("ExprFnBlock", 2, mk_none(), $2); }
+| %prec LAMBDA
+  '|' maybe_unboxed_closure_kind '|'  expr_nostruct         { $$ = mk_node("ExprFnBlock", 2, mk_none(), $4); }
+| %prec LAMBDA
+  '|' inferrable_params '|' expr_nostruct                   { $$ = mk_node("ExprFnBlock", 2, $2, $4); }
+| %prec LAMBDA
+  '|' '&' maybe_mut ':' inferrable_params '|' expr_nostruct { $$ = mk_node("ExprFnBlock", 2, $5, $7); }
+| %prec LAMBDA
+  '|' ':' inferrable_params '|' expr_nostruct               { $$ = mk_node("ExprFnBlock", 2, $3, $5); }
+
+;
+
+proc_expr
+: %prec LAMBDA
+  PROC '(' ')' expr                         { $$ = mk_node("ExprProc", 2, mk_none(), $4); }
+| %prec LAMBDA
+  PROC '(' inferrable_params ')' expr       { $$ = mk_node("ExprProc", 2, $3, $5); }
+;
+
+proc_expr_nostruct
+: %prec LAMBDA
+  PROC '(' ')' expr_nostruct                     { $$ = mk_node("ExprProc", 2, mk_none(), $4); }
+| %prec LAMBDA
+  PROC '(' inferrable_params ')' expr_nostruct   { $$ = mk_node("ExprProc", 2, $3, $5); }
+;
+
+vec_expr
+: maybe_exprs
+| exprs ';' expr { $$ = mk_node("VecRepeat", 2, $1, $3); }
+;
+
+struct_expr_fields
+: field_inits
+| field_inits ','
+| maybe_field_inits default_field_init { $$ = ext_node($1, 1, $2); }
+;
+
+maybe_field_inits
+: field_inits
+| field_inits ','
+| %empty { $$ = mk_none(); }
+;
+
+field_inits
+: field_init                 { $$ = mk_node("FieldInits", 1, $1); }
+| field_inits ',' field_init { $$ = ext_node($1, 1, $3); }
+;
+
+field_init
+: ident ':' expr   { $$ = mk_node("FieldInit", 2, $1, $3); }
+;
+
+default_field_init
+: DOTDOT expr   { $$ = mk_node("DefaultFieldInit", 1, $2); }
+;
+
+block_expr
+: expr_match
+| expr_if
+| expr_if_let
+| expr_while
+| expr_while_let
+| expr_loop
+| expr_for
+| UNSAFE block                                           { $$ = mk_node("UnsafeBlock", 1, $2); }
+| path_expr '!' maybe_ident braces_delimited_token_trees { $$ = mk_node("Macro", 3, $1, $3, $4); }
+;
+
+full_block_expr
+: block_expr
+| full_block_expr '.' path_generic_args_with_colons %prec IDENT         { $$ = mk_node("ExprField", 2, $1, $3); }
+| full_block_expr '.' path_generic_args_with_colons '[' maybe_expr ']'  { $$ = mk_node("ExprIndex", 3, $1, $3, $5); }
+| full_block_expr '.' path_generic_args_with_colons '(' maybe_exprs ')' { $$ = mk_node("ExprCall", 3, $1, $3, $5); }
+| full_block_expr '.' LIT_INTEGER                                       { $$ = mk_node("ExprTupleIndex", 1, $1); }
+;
+
+expr_match
+: MATCH expr_nostruct '{' '}'                                     { $$ = mk_node("ExprMatch", 1, $2); }
+| MATCH expr_nostruct '{' match_clauses                       '}' { $$ = mk_node("ExprMatch", 2, $2, $4); }
+| MATCH expr_nostruct '{' match_clauses nonblock_match_clause '}' { $$ = mk_node("ExprMatch", 2, $2, ext_node($4, 1, $5)); }
+| MATCH expr_nostruct '{'               nonblock_match_clause '}' { $$ = mk_node("ExprMatch", 2, $2, mk_node("Arms", 1, $4)); }
+;
+
+match_clauses
+: match_clause               { $$ = mk_node("Arms", 1, $1); }
+| match_clauses match_clause { $$ = ext_node($1, 1, $2); }
+;
+
+match_clause
+: nonblock_match_clause ','
+| block_match_clause
+| block_match_clause ','
+;
+
+nonblock_match_clause
+: maybe_outer_attrs pats_or maybe_guard FAT_ARROW nonblock_expr   { $$ = mk_node("Arm", 4, $1, $2, $3, $5); }
+| maybe_outer_attrs pats_or maybe_guard FAT_ARROW full_block_expr { $$ = mk_node("Arm", 4, $1, $2, $3, $5); }
+;
+
+block_match_clause
+: maybe_outer_attrs pats_or maybe_guard FAT_ARROW block { $$ = mk_node("Arm", 4, $1, $2, $3, $5); }
+;
+
+maybe_guard
+: IF expr_nostruct           { $$ = $2; }
+| %empty                     { $$ = mk_none(); }
+;
+
+expr_if
+: IF expr_nostruct block                              { $$ = mk_node("ExprIf", 2, $2, $3); }
+| IF expr_nostruct block ELSE block_or_if             { $$ = mk_node("ExprIf", 3, $2, $3, $5); }
+;
+
+expr_if_let
+: IF LET pat '=' expr_nostruct block                  { $$ = mk_node("ExprIfLet", 3, $3, $5, $6); }
+| IF LET pat '=' expr_nostruct block ELSE block_or_if { $$ = mk_node("ExprIfLet", 4, $3, $5, $6, $8); }
+;
+
+block_or_if
+: block
+| expr_if
+| expr_if_let
+;
+
+expr_while
+: maybe_label WHILE expr_nostruct block               { $$ = mk_node("ExprWhile", 3, $1, $3, $4); }
+;
+
+expr_while_let
+: maybe_label WHILE LET pat '=' expr_nostruct block   { $$ = mk_node("ExprWhileLet", 4, $1, $4, $6, $7); }
+;
+
+expr_loop
+: maybe_label LOOP block                              { $$ = mk_node("ExprLoop", 2, $1, $3); }
+;
+
+expr_for
+: maybe_label FOR pat IN expr_nostruct block          { $$ = mk_node("ExprForLoop", 4, $1, $3, $5, $6); }
+;
+
+maybe_label
+: lifetime ':'
+| %empty { $$ = mk_none(); }
+;
+
+let
+: LET pat maybe_ty_ascription maybe_init_expr ';' { $$ = mk_node("DeclLocal", 3, $2, $3, $4); }
+;
+
+////////////////////////////////////////////////////////////////////////
+// Part 5: Macros and misc. rules
+////////////////////////////////////////////////////////////////////////
+
+lit
+: LIT_BYTE                   { $$ = mk_node("LitByte", 1, mk_atom(yytext)); }
+| LIT_CHAR                   { $$ = mk_node("LitChar", 1, mk_atom(yytext)); }
+| LIT_INTEGER                { $$ = mk_node("LitInteger", 1, mk_atom(yytext)); }
+| LIT_FLOAT                  { $$ = mk_node("LitFloat", 1, mk_atom(yytext)); }
+| TRUE                       { $$ = mk_node("LitBool", 1, mk_atom(yytext)); }
+| FALSE                      { $$ = mk_node("LitBool", 1, mk_atom(yytext)); }
+| str
+;
+
+str
+: LIT_STR                    { $$ = mk_node("LitStr", 1, mk_atom(yytext), mk_atom("CookedStr")); }
+| LIT_STR_RAW                { $$ = mk_node("LitStr", 1, mk_atom(yytext), mk_atom("RawStr")); }
+| LIT_BYTE_STR                 { $$ = mk_node("LitByteStr", 1, mk_atom(yytext), mk_atom("ByteStr")); }
+| LIT_BYTE_STR_RAW             { $$ = mk_node("LitByteStr", 1, mk_atom(yytext), mk_atom("RawByteStr")); }
+;
+
+maybe_ident
+: %empty { $$ = mk_none(); }
+| ident
+;
+
+ident
+: IDENT                      { $$ = mk_node("ident", 1, mk_atom(yytext)); }
+;
+
+unpaired_token
+: SHL                        { $$ = mk_atom(yytext); }
+| SHR                        { $$ = mk_atom(yytext); }
+| LE                         { $$ = mk_atom(yytext); }
+| EQEQ                       { $$ = mk_atom(yytext); }
+| NE                         { $$ = mk_atom(yytext); }
+| GE                         { $$ = mk_atom(yytext); }
+| ANDAND                     { $$ = mk_atom(yytext); }
+| OROR                       { $$ = mk_atom(yytext); }
+| LARROW                     { $$ = mk_atom(yytext); }
+| SHLEQ                      { $$ = mk_atom(yytext); }
+| SHREQ                      { $$ = mk_atom(yytext); }
+| MINUSEQ                    { $$ = mk_atom(yytext); }
+| ANDEQ                      { $$ = mk_atom(yytext); }
+| OREQ                       { $$ = mk_atom(yytext); }
+| PLUSEQ                     { $$ = mk_atom(yytext); }
+| STAREQ                     { $$ = mk_atom(yytext); }
+| SLASHEQ                    { $$ = mk_atom(yytext); }
+| CARETEQ                    { $$ = mk_atom(yytext); }
+| PERCENTEQ                  { $$ = mk_atom(yytext); }
+| DOTDOT                     { $$ = mk_atom(yytext); }
+| DOTDOTDOT                  { $$ = mk_atom(yytext); }
+| MOD_SEP                    { $$ = mk_atom(yytext); }
+| RARROW                     { $$ = mk_atom(yytext); }
+| FAT_ARROW                  { $$ = mk_atom(yytext); }
+| LIT_BYTE                   { $$ = mk_atom(yytext); }
+| LIT_CHAR                   { $$ = mk_atom(yytext); }
+| LIT_INTEGER                { $$ = mk_atom(yytext); }
+| LIT_FLOAT                  { $$ = mk_atom(yytext); }
+| LIT_STR                    { $$ = mk_atom(yytext); }
+| LIT_STR_RAW                { $$ = mk_atom(yytext); }
+| LIT_BYTE_STR               { $$ = mk_atom(yytext); }
+| LIT_BYTE_STR_RAW           { $$ = mk_atom(yytext); }
+| IDENT                      { $$ = mk_atom(yytext); }
+| UNDERSCORE                 { $$ = mk_atom(yytext); }
+| LIFETIME                   { $$ = mk_atom(yytext); }
+| SELF                       { $$ = mk_atom(yytext); }
+| STATIC                     { $$ = mk_atom(yytext); }
+| AS                         { $$ = mk_atom(yytext); }
+| BREAK                      { $$ = mk_atom(yytext); }
+| CRATE                      { $$ = mk_atom(yytext); }
+| ELSE                       { $$ = mk_atom(yytext); }
+| ENUM                       { $$ = mk_atom(yytext); }
+| EXTERN                     { $$ = mk_atom(yytext); }
+| FALSE                      { $$ = mk_atom(yytext); }
+| FN                         { $$ = mk_atom(yytext); }
+| FOR                        { $$ = mk_atom(yytext); }
+| IF                         { $$ = mk_atom(yytext); }
+| IMPL                       { $$ = mk_atom(yytext); }
+| IN                         { $$ = mk_atom(yytext); }
+| LET                        { $$ = mk_atom(yytext); }
+| LOOP                       { $$ = mk_atom(yytext); }
+| MATCH                      { $$ = mk_atom(yytext); }
+| MOD                        { $$ = mk_atom(yytext); }
+| MOVE                       { $$ = mk_atom(yytext); }
+| MUT                        { $$ = mk_atom(yytext); }
+| PRIV                       { $$ = mk_atom(yytext); }
+| PUB                        { $$ = mk_atom(yytext); }
+| REF                        { $$ = mk_atom(yytext); }
+| RETURN                     { $$ = mk_atom(yytext); }
+| STRUCT                     { $$ = mk_atom(yytext); }
+| TRUE                       { $$ = mk_atom(yytext); }
+| TRAIT                      { $$ = mk_atom(yytext); }
+| TYPE                       { $$ = mk_atom(yytext); }
+| UNSAFE                     { $$ = mk_atom(yytext); }
+| USE                        { $$ = mk_atom(yytext); }
+| WHILE                      { $$ = mk_atom(yytext); }
+| CONTINUE                   { $$ = mk_atom(yytext); }
+| PROC                       { $$ = mk_atom(yytext); }
+| BOX                        { $$ = mk_atom(yytext); }
+| CONST                      { $$ = mk_atom(yytext); }
+| WHERE                      { $$ = mk_atom(yytext); }
+| TYPEOF                     { $$ = mk_atom(yytext); }
+| INNER_DOC_COMMENT          { $$ = mk_atom(yytext); }
+| OUTER_DOC_COMMENT          { $$ = mk_atom(yytext); }
+| SHEBANG                    { $$ = mk_atom(yytext); }
+| STATIC_LIFETIME            { $$ = mk_atom(yytext); }
+| ';'                        { $$ = mk_atom(yytext); }
+| ','                        { $$ = mk_atom(yytext); }
+| '.'                        { $$ = mk_atom(yytext); }
+| '@'                        { $$ = mk_atom(yytext); }
+| '#'                        { $$ = mk_atom(yytext); }
+| '~'                        { $$ = mk_atom(yytext); }
+| ':'                        { $$ = mk_atom(yytext); }
+| '$'                        { $$ = mk_atom(yytext); }
+| '='                        { $$ = mk_atom(yytext); }
+| '?'                        { $$ = mk_atom(yytext); }
+| '!'                        { $$ = mk_atom(yytext); }
+| '<'                        { $$ = mk_atom(yytext); }
+| '>'                        { $$ = mk_atom(yytext); }
+| '-'                        { $$ = mk_atom(yytext); }
+| '&'                        { $$ = mk_atom(yytext); }
+| '|'                        { $$ = mk_atom(yytext); }
+| '+'                        { $$ = mk_atom(yytext); }
+| '*'                        { $$ = mk_atom(yytext); }
+| '/'                        { $$ = mk_atom(yytext); }
+| '^'                        { $$ = mk_atom(yytext); }
+| '%'                        { $$ = mk_atom(yytext); }
+;
+
+token_trees
+: %empty                     { $$ = mk_node("TokenTrees", 0); }
+| token_trees token_tree     { $$ = ext_node($1, 1, $2); }
+;
+
+token_tree
+: delimited_token_trees
+| unpaired_token         { $$ = mk_node("TTTok", 1, $1); }
+;
+
+delimited_token_trees
+: parens_delimited_token_trees
+| braces_delimited_token_trees
+| brackets_delimited_token_trees
+;
+
+parens_delimited_token_trees
+: '(' token_trees ')'
+{
+  $$ = mk_node("TTDelim", 3,
+               mk_node("TTTok", 1, mk_atom("(")),
+               $2,
+               mk_node("TTTok", 1, mk_atom(")")));
+}
+;
+
+braces_delimited_token_trees
+: '{' token_trees '}'
+{
+  $$ = mk_node("TTDelim", 3,
+               mk_node("TTTok", 1, mk_atom("{")),
+               $2,
+               mk_node("TTTok", 1, mk_atom("}")));
+}
+;
+
+brackets_delimited_token_trees
+: '[' token_trees ']'
+{
+  $$ = mk_node("TTDelim", 3,
+               mk_node("TTTok", 1, mk_atom("[")),
+               $2,
+               mk_node("TTTok", 1, mk_atom("]")));
+}
+;
\ No newline at end of file
diff --git a/src/grammar/raw-string-literal-ambiguity.md b/src/grammar/raw-string-literal-ambiguity.md
new file mode 100644 (file)
index 0000000..c909f23
--- /dev/null
@@ -0,0 +1,64 @@
+Rust's lexical grammar is not context-free. Raw string literals are the source
+of the problem. Informally, a raw string literal is an `r`, followed by `N`
+hashes (where N can be zero), a quote, any characters, then a quote followed
+by `N` hashes. Critically, once inside the first pair of quotes,
+another quote cannot be followed by `N` consecutive hashes. e.g.
+`r###""###"###` is invalid.
+
+This grammar describes this as best possible:
+
+    R -> 'r' S
+    S -> '"' B '"'
+    S -> '#' S '#'
+    B -> . B
+    B -> ε
+
+Where `.` represents any character, and `ε` the empty string. Consider the
+string `r#""#"#`. This string is not a valid raw string literal, but can be
+accepted as one by the above grammar, using the derivation:
+
+    R : #""#"#
+    S : ""#"
+    S : "#
+    B : #
+    B : ε
+
+(Where `T : U` means the rule `T` is applied, and `U` is the remainder of the
+string.) The difficulty arises from the fact that it is fundamentally
+context-sensitive. In particular, the context needed is the number of hashes.
+
+To prove that Rust's string literals are not context-free, we will use
+the fact that context-free languages are closed under intersection with
+regular languages, and the
+[pumping lemma for context-free languages](https://en.wikipedia.org/wiki/Pumping_lemma_for_context-free_languages).
+
+Consider the regular language `R = r#+""#*"#+`. If Rust's raw string literals are
+context-free, then their intersection with `R`, `R'`, should also be context-free.
+Therefore, to prove that raw string literals are not context-free,
+it is sufficient to prove that `R'` is not context-free.
+
+The language `R'` is `{r#^n""#^m"#^n | m < n}`.
+
+Assume `R'` *is* context-free. Then `R'` has some pumping length `p > 0` for which
+the pumping lemma applies. Consider the following string `s` in `R'`:
+
+`r#^p""#^{p-1}"#^p`
+
+e.g. for `p = 2`: `s = r##""#"##`
+
+Then `s = uvwxy` for some choice of `uvwxy` such that `vx` is non-empty,
+`|vwx| < p+1`, and `uv^iwx^iy` is in `R'` for all `i >= 0`.
+
+Neither `v` nor `x` can contain a `"` or `r`, as the number of these characters
+in any string in `R'` is fixed. So `v` and `x` contain only hashes.
+Consequently, of the three sequences of hashes, `v` and `x` combined
+can only pump two of them.
+If we ever choose the central sequence of hashes, then one of the outer sequences
+will not grow when we pump, leading to an imbalance between the outer sequences.
+Therefore, we must pump both outer sequences of hashes. However,
+there are `p+2` characters between these two sequences of hashes, and `|vwx|` must
+be less than `p+1`. Therefore we have a contradiction, and `R'` must not be
+context-free.
+
+Since `R'` is not context-free, it follows that the Rust's raw string literals
+must not be context-free.
diff --git a/src/grammar/testparser.py b/src/grammar/testparser.py
new file mode 100755 (executable)
index 0000000..37be41b
--- /dev/null
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+#
+# Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+# ignore-tidy-linelength
+
+import sys
+
+import os
+import subprocess
+import argparse
+
+# usage: testparser.py [-h] [-p PARSER [PARSER ...]] -s SOURCE_DIR
+
+# Parsers should read from stdin and return exit status 0 for a
+# successful parse, and nonzero for an unsuccessful parse
+
+parser = argparse.ArgumentParser()
+parser.add_argument('-p', '--parser', nargs='+')
+parser.add_argument('-s', '--source-dir', nargs=1, required=True)
+args = parser.parse_args(sys.argv[1:])
+
+total = 0
+ok = {}
+bad = {}
+for parser in args.parser:
+    ok[parser] = 0
+    bad[parser] = []
+devnull = open(os.devnull, 'w')
+print("\n")
+
+for base, dirs, files in os.walk(args.source_dir[0]):
+    for f in filter(lambda p: p.endswith('.rs'), files):
+        p = os.path.join(base, f)
+        parse_fail = 'parse-fail' in p
+        if sys.version_info.major == 3:
+            lines = open(p, encoding='utf-8').readlines()
+        else:
+            lines = open(p).readlines()
+        if any('ignore-test' in line or 'ignore-lexer-test' in line for line in lines):
+            continue
+        total += 1
+        for parser in args.parser:
+            if subprocess.call(parser, stdin=open(p), stderr=subprocess.STDOUT, stdout=devnull) == 0:
+                if parse_fail:
+                    bad[parser].append(p)
+                else:
+                    ok[parser] += 1
+            else:
+                if parse_fail:
+                    ok[parser] += 1
+                else:
+                    bad[parser].append(p)
+        parser_stats = ', '.join(['{}: {}'.format(parser, ok[parser]) for parser in args.parser])
+        sys.stdout.write("\033[K\r total: {}, {}, scanned {}"
+                         .format(total, os.path.relpath(parser_stats), os.path.relpath(p)))
+
+devnull.close()
+
+print("\n")
+
+for parser in args.parser:
+    filename = os.path.basename(parser) + '.bad'
+    print("writing {} files that did not yield the correct result with {} to {}".format(len(bad[parser]), parser, filename))
+    with open(filename, "w") as f:
+        for p in bad[parser]:
+            f.write(p)
+            f.write("\n")
diff --git a/src/grammar/tokens.h b/src/grammar/tokens.h
new file mode 100644 (file)
index 0000000..081bd05
--- /dev/null
@@ -0,0 +1,91 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Token {
+  SHL = 257, // Parser generators reserve 0-256 for char literals
+  SHR,
+  LE,
+  EQEQ,
+  NE,
+  GE,
+  ANDAND,
+  OROR,
+  SHLEQ,
+  SHREQ,
+  MINUSEQ,
+  ANDEQ,
+  OREQ,
+  PLUSEQ,
+  STAREQ,
+  SLASHEQ,
+  CARETEQ,
+  PERCENTEQ,
+  DOTDOT,
+  DOTDOTDOT,
+  MOD_SEP,
+  RARROW,
+  FAT_ARROW,
+  LIT_BYTE,
+  LIT_CHAR,
+  LIT_INTEGER,
+  LIT_FLOAT,
+  LIT_STR,
+  LIT_STR_RAW,
+  LIT_BYTE_STR,
+  LIT_BYTE_STR_RAW,
+  IDENT,
+  UNDERSCORE,
+  LIFETIME,
+
+  // keywords
+  SELF,
+  STATIC,
+  AS,
+  BREAK,
+  CRATE,
+  ELSE,
+  ENUM,
+  EXTERN,
+  FALSE,
+  FN,
+  FOR,
+  IF,
+  IMPL,
+  IN,
+  LET,
+  LOOP,
+  MATCH,
+  MOD,
+  MOVE,
+  MUT,
+  PRIV,
+  PUB,
+  REF,
+  RETURN,
+  STRUCT,
+  TRUE,
+  TRAIT,
+  TYPE,
+  UNSAFE,
+  USE,
+  WHILE,
+  CONTINUE,
+  PROC,
+  BOX,
+  CONST,
+  WHERE,
+  TYPEOF,
+  INNER_DOC_COMMENT,
+  OUTER_DOC_COMMENT,
+
+  SHEBANG,
+  SHEBANG_LINE,
+  STATIC_LIFETIME
+};
index bf292ccb8d86d064212c1d33c40e56b90c0c144a..f553c03d09bd680e683243f3bc57a1171640dd22 100644 (file)
@@ -43,7 +43,7 @@ impl<'a> CheckAttrVisitor<'a> {
     fn check_inline(&self, attr: &ast::Attribute, target: Target) {
         if target != Target::Fn {
             struct_span_err!(self.sess, attr.span, E0518, "attribute should be applied to function")
-                .span_label(attr.span, &format!("requires a function"))
+                .span_label(attr.span, "requires a function")
                 .emit();
         }
     }
@@ -123,7 +123,7 @@ fn check_repr(&self, attr: &ast::Attribute, target: Target) {
                 _ => continue,
             };
             struct_span_err!(self.sess, attr.span, E0517, "{}", message)
-                .span_label(attr.span, &format!("requires {}", label))
+                .span_label(attr.span, format!("requires {}", label))
                 .emit();
         }
         if conflicting_reprs > 1 {
index def6b2b3421f6f4135e0741b575506381f5a2e10..836d9775a3f69b7f5292897801ec0eb30b85310d 100644 (file)
@@ -140,23 +140,6 @@ pub fn inter(self) -> Option<&'this Map<'tcx>> {
 /// to monitor future changes to `Visitor` in case a new method with a
 /// new default implementation gets introduced.)
 pub trait Visitor<'v> : Sized {
-    /// Invokes the suitable visitor method for the given `Node`
-    /// extracted from the hir map.
-    fn visit_hir_map_node(&mut self, node: map::Node<'v>) {
-        match node {
-            map::NodeItem(a) => self.visit_item(a),
-            map::NodeForeignItem(a) => self.visit_foreign_item(a),
-            map::NodeTraitItem(a) => self.visit_trait_item(a),
-            map::NodeImplItem(a) => self.visit_impl_item(a),
-            map::NodeExpr(a) => self.visit_expr(a),
-            map::NodeStmt(a) => self.visit_stmt(a),
-            map::NodeTy(a) => self.visit_ty(a),
-            map::NodePat(a) => self.visit_pat(a),
-            map::NodeBlock(a) => self.visit_block(a),
-            _ => bug!("Visitor::visit_hir_map_node() not yet impl for node `{:?}`", node)
-        }
-    }
-
     ///////////////////////////////////////////////////////////////////////////
     // Nested items.
 
index abc967dec905c23459cfc9fc567679316d5467af..c715484a934df37afc1ed353c9cc0fd73cbff14b 100644 (file)
@@ -442,20 +442,21 @@ pub fn body_owner_def_id(&self, id: BodyId) -> DefId {
         self.local_def_id(self.body_owner(id))
     }
 
-    /// Given a body owner's id, returns the `BodyId` associated with it.
-    pub fn body_owned_by(&self, id: NodeId) -> BodyId {
+    /// Given a node id, returns the `BodyId` associated with it,
+    /// if the node is a body owner, otherwise returns `None`.
+    pub fn maybe_body_owned_by(&self, id: NodeId) -> Option<BodyId> {
         if let Some(entry) = self.find_entry(id) {
             if let Some(body_id) = entry.associated_body() {
                 // For item-like things and closures, the associated
                 // body has its own distinct id, and that is returned
                 // by `associated_body`.
-                body_id
+                Some(body_id)
             } else {
                 // For some expressions, the expression is its own body.
                 if let EntryExpr(_, expr) = entry {
-                    BodyId { node_id: expr.id }
+                    Some(BodyId { node_id: expr.id })
                 } else {
-                    span_bug!(self.span(id), "id `{}` has no associated body: {:?}", id, entry);
+                    None
                 }
             }
         } else {
@@ -463,6 +464,14 @@ pub fn body_owned_by(&self, id: NodeId) -> BodyId {
         }
     }
 
+    /// Given a body owner's id, returns the `BodyId` associated with it.
+    pub fn body_owned_by(&self, id: NodeId) -> BodyId {
+        self.maybe_body_owned_by(id).unwrap_or_else(|| {
+            span_bug!(self.span(id), "body_owned_by: {} has no associated body",
+                      self.node_to_string(id));
+        })
+    }
+
     pub fn ty_param_owner(&self, id: NodeId) -> NodeId {
         match self.get(id) {
             NodeItem(&Item { node: ItemTrait(..), .. }) => id,
index 8f2bdd4e85c77ac725745b0724b8f6ef90a0a8fd..4c27bade0f7215e06cc36936f9b232ca96cc5bb8 100644 (file)
@@ -668,9 +668,9 @@ pub fn note_type_err(&self,
             }
         }
 
-        diag.span_label(span, &terr);
+        diag.span_label(span, terr.to_string());
         if let Some((sp, msg)) = secondary_span {
-            diag.span_label(sp, &msg);
+            diag.span_label(sp, msg);
         }
 
         self.note_error_origin(diag, &cause);
index 6947e7c3f4085ce579d75f7a32f1bfd86f07bb3b..6f3e84247f797ddbfdadfd43ffa73d341fbedff7 100644 (file)
@@ -680,12 +680,12 @@ fn with_lint_attrs<F>(&mut self,
                                                             "{}({}) overruled by outer forbid({})",
                                                             level.as_str(), lint_name,
                                                             lint_name);
-                    diag_builder.span_label(span, &format!("overruled by previous forbid"));
+                    diag_builder.span_label(span, "overruled by previous forbid");
                     match now_source {
                         LintSource::Default => &mut diag_builder,
                         LintSource::Node(_, forbid_source_span) => {
                             diag_builder.span_label(forbid_source_span,
-                                                    &format!("`forbid` level set here"))
+                                                    "`forbid` level set here")
                         },
                         LintSource::CommandLine(_) => {
                             diag_builder.note("`forbid` lint level was set on command line")
index 74026abe64db2fd1c27a0b4a000bfbc490e04c5b..3bbaf5c9299f8945e301378c874a15cd57473c52 100644 (file)
@@ -197,7 +197,7 @@ pub fn note(&self,
     {
         match self.description() {
             ConstEvalErrDescription::Simple(message) => {
-                diag.span_label(self.span, &message);
+                diag.span_label(self.span, message);
             }
         }
 
index d2b8ed8c2970770250d35fe78699d06d548d4316..e03948db3683187e542d3fba3f4dc993a6264109 100644 (file)
@@ -74,7 +74,7 @@ fn require_unsafe_ext(&mut self, node_id: ast::NodeId, span: Span,
                     struct_span_err!(
                         self.tcx.sess, span, E0133,
                         "{} requires unsafe function or block", description)
-                        .span_label(span, &description)
+                        .span_label(span, description)
                         .emit();
                 }
             }
index 8da7560387f879d3794ad17068c760e4bcac60bf..24748b6cf65b8aab05159071a883fcd4821885b4 100644 (file)
@@ -128,8 +128,8 @@ fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) {
             } else {
                 struct_span_err!(ctxt.session, item.span, E0137,
                           "multiple functions with a #[main] attribute")
-                .span_label(item.span, &format!("additional #[main] function"))
-                .span_label(ctxt.attr_main_fn.unwrap().1, &format!("first #[main] function"))
+                .span_label(item.span, "additional #[main] function")
+                .span_label(ctxt.attr_main_fn.unwrap().1, "first #[main] function")
                 .emit();
             }
         },
@@ -141,8 +141,8 @@ fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) {
                     ctxt.session, item.span, E0138,
                     "multiple 'start' functions")
                     .span_label(ctxt.start_fn.unwrap().1,
-                                &format!("previous `start` function here"))
-                    .span_label(item.span, &format!("multiple `start` functions"))
+                                "previous `start` function here")
+                    .span_label(item.span, "multiple `start` functions")
                     .emit();
             }
         },
index 435dd05358d47e11162b8248ce191666a1e7b452..a759a9061f8428874475d8a2f61be1e8426d6057 100644 (file)
@@ -92,7 +92,7 @@ fn check_transmute(&self, span: Span, from: Ty<'gcx>, to: Ty<'gcx>) {
                     struct_span_err!(self.infcx.tcx.sess, span, E0591,
                                      "`{}` is zero-sized and can't be transmuted to `{}`",
                                      from, to)
-                        .span_note(span, &format!("cast with `as` to a pointer instead"))
+                        .span_note(span, "cast with `as` to a pointer instead")
                         .emit();
                     return;
                 }
@@ -126,7 +126,7 @@ fn check_transmute(&self, span: Span, from: Ty<'gcx>, to: Ty<'gcx>) {
                   from, skeleton_string(from, sk_from),
                   to, skeleton_string(to, sk_to))
             .span_label(span,
-                &format!("transmuting between {} and {}",
+                format!("transmuting between {} and {}",
                     skeleton_string(from, sk_from),
                     skeleton_string(to, sk_to)))
             .emit();
index d1d5e9d6cb18f78b52fea08b19b6a6dbc17afda8..087ab4b94da3d254f2678bd6011748de0b197106 100644 (file)
 use std::rc::Rc;
 use serialize;
 use syntax::codemap;
-use syntax::ast::{self, NodeId};
+use syntax::ast;
 use syntax_pos::Span;
 use ty::TyCtxt;
 use ty::maps::Providers;
 
-use hir; use hir::def_id::DefId;
-use hir::intravisit::{self, Visitor, FnKind, NestedVisitorMap};
-use hir::{Block, Item, FnDecl, Arm, Pat, PatKind, Stmt, Expr, Local};
+use hir;
+use hir::def_id::DefId;
+use hir::intravisit::{self, Visitor, NestedVisitorMap};
+use hir::{Block, Arm, Pat, PatKind, Stmt, Expr, Local};
+use mir::transform::MirSource;
 
 pub type CodeExtent<'tcx> = &'tcx CodeExtentData;
 
@@ -811,7 +813,17 @@ fn resolve_expr<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, expr:
         }
     }
 
-    intravisit::walk_expr(visitor, expr);
+    match expr.node {
+        // Manually recurse over closures, because they are the only
+        // case of nested bodies that share the parent environment.
+        hir::ExprClosure(.., body, _) => {
+            let body = visitor.tcx.hir.body(body);
+            visitor.visit_body(body);
+        }
+
+        _ => intravisit::walk_expr(visitor, expr)
+    }
+
     visitor.cx = prev_cx;
 }
 
@@ -1041,74 +1053,6 @@ fn record_rvalue_scope<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>
     }
 }
 
-fn resolve_item_like<'a, 'tcx, F>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, walk: F)
-    where F: FnOnce(&mut RegionResolutionVisitor<'a, 'tcx>)
-{
-    // Items create a new outer block scope as far as we're concerned.
-    let prev_cx = visitor.cx;
-    let prev_ts = mem::replace(&mut visitor.terminating_scopes, NodeSet());
-    visitor.cx = Context {
-        root_id: None,
-        var_parent: None,
-        parent: None,
-    };
-    walk(visitor);
-    visitor.cx = prev_cx;
-    visitor.terminating_scopes = prev_ts;
-}
-
-fn resolve_fn<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>,
-                        kind: FnKind<'tcx>,
-                        decl: &'tcx hir::FnDecl,
-                        body_id: hir::BodyId,
-                        sp: Span,
-                        id: ast::NodeId) {
-    visitor.cx.parent = Some(visitor.new_code_extent(
-        CodeExtentData::CallSiteScope { fn_id: id, body_id: body_id.node_id }));
-
-    debug!("region::resolve_fn(id={:?}, \
-            span={:?}, \
-            body.id={:?}, \
-            cx.parent={:?})",
-           id,
-           visitor.tcx.sess.codemap().span_to_string(sp),
-           body_id,
-           visitor.cx.parent);
-
-    let fn_decl_scope = visitor.new_code_extent(
-        CodeExtentData::ParameterScope { fn_id: id, body_id: body_id.node_id });
-
-    if let Some(root_id) = visitor.cx.root_id {
-        visitor.region_maps.record_fn_parent(body_id.node_id, root_id);
-    }
-
-    let outer_cx = visitor.cx;
-    let outer_ts = mem::replace(&mut visitor.terminating_scopes, NodeSet());
-    visitor.terminating_scopes.insert(body_id.node_id);
-
-    // The arguments and `self` are parented to the fn.
-    visitor.cx = Context {
-        root_id: Some(body_id.node_id),
-        parent: None,
-        var_parent: Some(fn_decl_scope),
-    };
-
-    intravisit::walk_fn_decl(visitor, decl);
-    intravisit::walk_fn_kind(visitor, kind);
-
-    // The body of the every fn is a root scope.
-    visitor.cx = Context {
-        root_id: Some(body_id.node_id),
-        parent: Some(fn_decl_scope),
-        var_parent: Some(fn_decl_scope),
-    };
-    visitor.visit_nested_body(body_id);
-
-    // Restore context we had at the start.
-    visitor.cx = outer_cx;
-    visitor.terminating_scopes = outer_ts;
-}
-
 impl<'a, 'tcx> RegionResolutionVisitor<'a, 'tcx> {
     pub fn intern_code_extent(&mut self,
                               data: CodeExtentData,
@@ -1152,29 +1096,57 @@ fn new_node_extent_with_dtor(&mut self, id: ast::NodeId) -> CodeExtent<'tcx> {
 
 impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'a, 'tcx> {
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::OnlyBodies(&self.map)
+        NestedVisitorMap::None
     }
 
     fn visit_block(&mut self, b: &'tcx Block) {
         resolve_block(self, b);
     }
 
-    fn visit_item(&mut self, i: &'tcx Item) {
-        resolve_item_like(self, |this| intravisit::walk_item(this, i));
-    }
+    fn visit_body(&mut self, body: &'tcx hir::Body) {
+        let body_id = body.id();
+        let owner_id = self.map.body_owner(body_id);
 
-    fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) {
-        resolve_item_like(self, |this| intravisit::walk_impl_item(this, ii));
-    }
+        debug!("visit_body(id={:?}, span={:?}, body.id={:?}, cx.parent={:?})",
+               owner_id,
+               self.tcx.sess.codemap().span_to_string(body.value.span),
+               body_id,
+               self.cx.parent);
 
-    fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) {
-        resolve_item_like(self, |this| intravisit::walk_trait_item(this, ti));
-    }
+        let outer_cx = self.cx;
+        let outer_ts = mem::replace(&mut self.terminating_scopes, NodeSet());
 
-    fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx FnDecl,
-                b: hir::BodyId, s: Span, n: NodeId) {
-        resolve_fn(self, fk, fd, b, s, n);
+        // Only functions have an outer terminating (drop) scope,
+        // while temporaries in constant initializers are 'static.
+        if let MirSource::Fn(_) = MirSource::from_node(self.tcx, owner_id) {
+            self.terminating_scopes.insert(body_id.node_id);
+        }
+
+        if let Some(root_id) = self.cx.root_id {
+            self.region_maps.record_fn_parent(body_id.node_id, root_id);
+        }
+        self.cx.root_id = Some(body_id.node_id);
+
+        self.cx.parent = Some(self.new_code_extent(
+            CodeExtentData::CallSiteScope { fn_id: owner_id, body_id: body_id.node_id }));
+        self.cx.parent = Some(self.new_code_extent(
+            CodeExtentData::ParameterScope { fn_id: owner_id, body_id: body_id.node_id }));
+
+        // The arguments and `self` are parented to the fn.
+        self.cx.var_parent = self.cx.parent.take();
+        for argument in &body.arguments {
+            self.visit_pat(&argument.pat);
+        }
+
+        // The body of the every fn is a root scope.
+        self.cx.parent = self.cx.var_parent;
+        self.visit_expr(&body.value);
+
+        // Restore context we had at the start.
+        self.cx = outer_cx;
+        self.terminating_scopes = outer_ts;
     }
+
     fn visit_arm(&mut self, a: &'tcx Arm) {
         resolve_arm(self, a);
     }
@@ -1192,21 +1164,18 @@ fn visit_local(&mut self, l: &'tcx Local) {
     }
 }
 
-fn region_maps<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn_id: DefId)
+fn region_maps<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
     -> Rc<RegionMaps<'tcx>>
 {
-    let closure_base_def_id = tcx.closure_base_def_id(fn_id);
-    if closure_base_def_id != fn_id {
+    let closure_base_def_id = tcx.closure_base_def_id(def_id);
+    if closure_base_def_id != def_id {
         return tcx.region_maps(closure_base_def_id);
     }
 
     let mut maps = RegionMaps::new();
 
-    let fn_node_id = tcx.hir.as_local_node_id(fn_id)
-                            .expect("fn DefId should be for LOCAL_CRATE");
-    let node = tcx.hir.get(fn_node_id);
-
-    {
+    let id = tcx.hir.as_local_node_id(def_id).unwrap();
+    if let Some(body) = tcx.hir.maybe_body_owned_by(id) {
         let mut visitor = RegionResolutionVisitor {
             tcx: tcx,
             region_maps: &mut maps,
@@ -1218,7 +1187,8 @@ fn region_maps<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn_id: DefId)
             },
             terminating_scopes: NodeSet(),
         };
-        visitor.visit_hir_map_node(node);
+
+        visitor.visit_body(tcx.hir.body(body));
     }
 
     Rc::new(maps)
index a8ba708cc2cd41427904d4fdb279b3a53efd2f8b..67b8dfb2d8e0ca5df51ed05ee7b7db783d6df48a 100644 (file)
@@ -574,9 +574,9 @@ fn signal_shadowing_problem(sess: &Session, name: ast::Name, orig: Original, sha
                                         {} name that is already in scope",
                                        shadower.kind.desc(), name, orig.kind.desc()))
     };
-    err.span_label(orig.span, &"first declared here");
+    err.span_label(orig.span, "first declared here");
     err.span_label(shadower.span,
-                   &format!("lifetime {} already in scope", name));
+                   format!("lifetime {} already in scope", name));
     err.emit();
 }
 
@@ -919,7 +919,7 @@ fn resolve_lifetime_ref(&mut self, lifetime_ref: &hir::Lifetime) {
         } else {
             struct_span_err!(self.sess, lifetime_ref.span, E0261,
                 "use of undeclared lifetime name `{}`", lifetime_ref.name)
-                .span_label(lifetime_ref.span, &format!("undeclared lifetime"))
+                .span_label(lifetime_ref.span, "undeclared lifetime")
                 .emit();
         }
     }
@@ -1328,7 +1328,7 @@ fn resolve_elided_lifetimes(&mut self, lifetime_refs: &[hir::Lifetime]) {
         } else {
             format!("expected lifetime parameter")
         };
-        err.span_label(span, &msg);
+        err.span_label(span, msg);
 
         if let Some(params) = error {
             if lifetime_refs.len() == 1 {
@@ -1438,7 +1438,7 @@ fn check_lifetime_defs(&mut self, old_scope: ScopeRef, lifetimes: &[hir::Lifetim
                     let mut err = struct_span_err!(self.sess, lifetime.span, E0262,
                                   "invalid lifetime parameter name: `{}`", lifetime.name);
                     err.span_label(lifetime.span,
-                                   &format!("{} is a reserved lifetime name", lifetime.name));
+                                   format!("{} is a reserved lifetime name", lifetime.name));
                     err.emit();
                 }
             }
@@ -1452,9 +1452,9 @@ fn check_lifetime_defs(&mut self, old_scope: ScopeRef, lifetimes: &[hir::Lifetim
                                      "lifetime name `{}` declared twice in the same scope",
                                      lifetime_j.lifetime.name)
                         .span_label(lifetime_j.lifetime.span,
-                                    &format!("declared twice"))
+                                    "declared twice")
                         .span_label(lifetime_i.lifetime.span,
-                                   &format!("previous declaration here"))
+                                   "previous declaration here")
                         .emit();
                 }
             }
index e846d74febfb7af6f7a83fe6710ce9d8abd2f30e..152e3353994b3b32315d8591d4e482f2792b461d 100644 (file)
@@ -484,12 +484,12 @@ pub fn report_extra_impl_obligation(&self,
 
         if let Some(trait_item_span) = self.tcx.hir.span_if_local(trait_item_def_id) {
             let span = self.tcx.sess.codemap().def_span(trait_item_span);
-            err.span_label(span, &format!("definition of `{}` from trait", item_name));
+            err.span_label(span, format!("definition of `{}` from trait", item_name));
         }
 
         err.span_label(
             error_span,
-            &format!("impl has extra requirement {}", requirement));
+            format!("impl has extra requirement {}", requirement));
 
         if let Some(node_id) = lint_id {
             self.tcx.sess.add_lint_diagnostic(EXTRA_REQUIREMENT_IN_IMPL,
@@ -582,7 +582,7 @@ pub fn report_selection_error(&self,
                         }
 
                         err.span_label(span,
-                                       &format!("{}the trait `{}` is not implemented for `{}`",
+                                       format!("{}the trait `{}` is not implemented for `{}`",
                                                 pre_message,
                                                 trait_ref,
                                                 trait_ref.self_ty()));
@@ -738,11 +738,11 @@ fn report_type_argument_mismatch(&self,
             expected_ref,
             found_ref);
 
-        err.span_label(span, &format!("{}", type_error));
+        err.span_label(span, format!("{}", type_error));
 
         if let Some(sp) = found_span {
-            err.span_label(span, &format!("requires `{}`", found_ref));
-            err.span_label(sp, &format!("implements `{}`", expected_ref));
+            err.span_label(span, format!("requires `{}`", found_ref));
+            err.span_label(sp, format!("implements `{}`", expected_ref));
         }
 
         err
@@ -765,12 +765,12 @@ fn report_arg_count_mismatch(&self,
             if expected == 1 { "" } else { "s" },
             if expected == 1 { "is" } else { "are" });
 
-        err.span_label(span, &format!("expected {} that takes {} argument{}",
+        err.span_label(span, format!("expected {} that takes {} argument{}",
                                       if is_closure { "closure" } else { "function" },
                                       expected,
                                       if expected == 1 { "" } else { "s" }));
         if let Some(span) = found_span {
-            err.span_label(span, &format!("takes {} argument{}",
+            err.span_label(span, format!("takes {} argument{}",
                                           found,
                                           if found == 1 { "" } else { "s" }));
         }
@@ -789,7 +789,7 @@ pub fn recursive_type_with_infinite_size_error(self,
         let mut err = struct_span_err!(self.sess, span, E0072,
                                        "recursive type `{}` has infinite size",
                                        self.item_path_str(type_def_id));
-        err.span_label(span, &format!("recursive type has infinite size"));
+        err.span_label(span, "recursive type has infinite size");
         err.help(&format!("insert indirection (e.g., a `Box`, `Rc`, or `&`) \
                            at some point to make `{}` representable",
                           self.item_path_str(type_def_id)));
@@ -808,7 +808,7 @@ pub fn report_object_safety_error(self,
             self.sess, span, E0038,
             "the trait `{}` cannot be made into an object",
             trait_str);
-        err.span_label(span, &format!("the trait `{}` cannot be made into an object", trait_str));
+        err.span_label(span, format!("the trait `{}` cannot be made into an object", trait_str));
 
         let mut reported_violations = FxHashSet();
         for violation in violations {
@@ -1043,7 +1043,7 @@ pub fn need_type_info(&self, body_id: hir::BodyId, span: Span, ty: Ty<'tcx>) {
                                        "type annotations needed");
 
         for (target_span, label_message) in labels {
-            err.span_label(target_span, &label_message);
+            err.span_label(target_span, label_message);
         }
 
         err.emit();
index a737e7caa3e59dc7639d69b49ec702d2134530bc..82a4c1e1e626a9e45defaddbae224a31d0641d7b 100644 (file)
@@ -181,7 +181,7 @@ pub fn report_cycle(self, CycleError { span, cycle }: CycleError) {
             let mut err =
                 struct_span_err!(self.sess, span, E0391,
                                  "unsupported cyclic reference between types/traits detected");
-            err.span_label(span, &format!("cyclic reference"));
+            err.span_label(span, "cyclic reference");
 
             err.span_note(stack[0].0, &format!("the cycle begins when {}...",
                                                stack[0].1.describe(self)));
index a361c80a2529f34090920688e728b255a6ffb2da..99a5f6325ac7515242f3c9322af7ded3fb295b8c 100644 (file)
@@ -1238,7 +1238,7 @@ pub fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId)
         match tcx.hir.find(id) {
             Some(hir_map::NodeImplItem(ref impl_item)) => {
                 match impl_item.node {
-                    hir::ImplItemKind::Type(_) | hir::ImplItemKind::Const(..) => {
+                    hir::ImplItemKind::Type(_) => {
                         // associated types don't have their own entry (for some reason),
                         // so for now just grab environment for the impl
                         let impl_id = tcx.hir.get_parent(id);
@@ -1247,7 +1247,8 @@ pub fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId)
                                                             impl_def_id,
                                                             Some(tcx.item_extent(id)))
                     }
-                    hir::ImplItemKind::Method(_, ref body) => {
+                    hir::ImplItemKind::Const(_, body) |
+                    hir::ImplItemKind::Method(_, body) => {
                         tcx.construct_parameter_environment(
                             impl_item.span,
                             tcx.hir.local_def_id(id),
@@ -1257,56 +1258,37 @@ pub fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId)
             }
             Some(hir_map::NodeTraitItem(trait_item)) => {
                 match trait_item.node {
-                    hir::TraitItemKind::Type(..) | hir::TraitItemKind::Const(..) => {
-                        // associated types don't have their own entry (for some reason),
-                        // so for now just grab environment for the trait
-                        let trait_id = tcx.hir.get_parent(id);
-                        let trait_def_id = tcx.hir.local_def_id(trait_id);
+                    hir::TraitItemKind::Type(..) |
+                    hir::TraitItemKind::Const(_, None) |
+                    hir::TraitItemKind::Method(_, hir::TraitMethod::Required(_))=> {
                         tcx.construct_parameter_environment(trait_item.span,
-                                                            trait_def_id,
+                                                            tcx.hir.local_def_id(id),
                                                             Some(tcx.item_extent(id)))
                     }
-                    hir::TraitItemKind::Method(_, ref body) => {
-                        // Use call-site for extent (unless this is a
-                        // trait method with no default; then fallback
-                        // to the method id).
-                        let extent = if let hir::TraitMethod::Provided(body_id) = *body {
-                            // default impl: use call_site extent as free_id_outlive bound.
-                            tcx.call_site_extent(id, body_id.node_id)
-                        } else {
-                            // no default impl: use item extent as free_id_outlive bound.
-                            tcx.item_extent(id)
-                        };
+                    hir::TraitItemKind::Const(_, Some(body)) |
+                    hir::TraitItemKind::Method(_, hir::TraitMethod::Provided(body)) => {
                         tcx.construct_parameter_environment(
                             trait_item.span,
                             tcx.hir.local_def_id(id),
-                            Some(extent))
+                            Some(tcx.call_site_extent(id, body.node_id)))
                     }
                 }
             }
             Some(hir_map::NodeItem(item)) => {
                 match item.node {
-                    hir::ItemFn(.., body_id) => {
-                        // We assume this is a function.
-                        let fn_def_id = tcx.hir.local_def_id(id);
-
+                    hir::ItemConst(_, body) |
+                    hir::ItemStatic(.., body) |
+                    hir::ItemFn(.., body) => {
                         tcx.construct_parameter_environment(
                             item.span,
-                            fn_def_id,
-                            Some(tcx.call_site_extent(id, body_id.node_id)))
+                            tcx.hir.local_def_id(id),
+                            Some(tcx.call_site_extent(id, body.node_id)))
                     }
                     hir::ItemEnum(..) |
                     hir::ItemStruct(..) |
                     hir::ItemUnion(..) |
                     hir::ItemTy(..) |
                     hir::ItemImpl(..) |
-                    hir::ItemConst(..) |
-                    hir::ItemStatic(..) => {
-                        let def_id = tcx.hir.local_def_id(id);
-                        tcx.construct_parameter_environment(item.span,
-                                                            def_id,
-                                                            Some(tcx.item_extent(id)))
-                    }
                     hir::ItemTrait(..) => {
                         let def_id = tcx.hir.local_def_id(id);
                         tcx.construct_parameter_environment(item.span,
index 24dfae3c54065f76b43073d2d0435d3ccff400ff..06d09bd350a4c8eab5002311887379924ba4bdfd 100644 (file)
@@ -145,11 +145,11 @@ pub enum CopyImplementationError<'tcx> {
 ///
 /// The ordering of the cases is significant. They are sorted so that cmp::max
 /// will keep the "more erroneous" of two values.
-#[derive(Copy, Clone, PartialOrd, Ord, Eq, PartialEq, Debug)]
+#[derive(Clone, PartialOrd, Ord, Eq, PartialEq, Debug)]
 pub enum Representability {
     Representable,
     ContainsRecursive,
-    SelfRecursive,
+    SelfRecursive(Vec<Span>),
 }
 
 impl<'tcx> ParameterEnvironment<'tcx> {
@@ -1006,18 +1006,22 @@ pub fn layout<'lcx>(&'tcx self, infcx: &InferCtxt<'a, 'tcx, 'lcx>)
 
     /// Check whether a type is representable. This means it cannot contain unboxed
     /// structural recursion. This check is needed for structs and enums.
-    pub fn is_representable(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span)
+    pub fn is_representable(&'tcx self,
+                            tcx: TyCtxt<'a, 'tcx, 'tcx>,
+                            sp: Span)
                             -> Representability {
 
         // Iterate until something non-representable is found
-        fn find_nonrepresentable<'a, 'tcx, It>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-                                               sp: Span,
-                                               seen: &mut Vec<Ty<'tcx>>,
-                                               iter: It)
-                                               -> Representability
-        where It: Iterator<Item=Ty<'tcx>> {
-            iter.fold(Representability::Representable,
-                      |r, ty| cmp::max(r, is_type_structurally_recursive(tcx, sp, seen, ty)))
+        fn fold_repr<It: Iterator<Item=Representability>>(iter: It) -> Representability {
+            iter.fold(Representability::Representable, |r1, r2| {
+                match (r1, r2) {
+                    (Representability::SelfRecursive(v1),
+                     Representability::SelfRecursive(v2)) => {
+                        Representability::SelfRecursive(v1.iter().map(|s| *s).chain(v2).collect())
+                    }
+                    (r1, r2) => cmp::max(r1, r2)
+                }
+            })
         }
 
         fn are_inner_types_recursive<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span,
@@ -1025,7 +1029,10 @@ fn are_inner_types_recursive<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span,
                                                -> Representability {
             match ty.sty {
                 TyTuple(ref ts, _) => {
-                    find_nonrepresentable(tcx, sp, seen, ts.iter().cloned())
+                    // Find non representable
+                    fold_repr(ts.iter().map(|ty| {
+                        is_type_structurally_recursive(tcx, sp, seen, ty)
+                    }))
                 }
                 // Fixed-length vectors.
                 // FIXME(#11924) Behavior undecided for zero-length vectors.
@@ -1033,10 +1040,17 @@ fn are_inner_types_recursive<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span,
                     is_type_structurally_recursive(tcx, sp, seen, ty)
                 }
                 TyAdt(def, substs) => {
-                    find_nonrepresentable(tcx,
-                                          sp,
-                                          seen,
-                                          def.all_fields().map(|f| f.ty(tcx, substs)))
+                    // Find non representable fields with their spans
+                    fold_repr(def.all_fields().map(|field| {
+                        let ty = field.ty(tcx, substs);
+                        let span = tcx.hir.span_if_local(field.did).unwrap_or(sp);
+                        match is_type_structurally_recursive(tcx, span, seen, ty) {
+                            Representability::SelfRecursive(_) => {
+                                Representability::SelfRecursive(vec![span])
+                            }
+                            x => x,
+                        }
+                    }))
                 }
                 TyClosure(..) => {
                     // this check is run on type definitions, so we don't expect
@@ -1075,7 +1089,7 @@ fn is_type_structurally_recursive<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                                     sp: Span,
                                                     seen: &mut Vec<Ty<'tcx>>,
                                                     ty: Ty<'tcx>) -> Representability {
-            debug!("is_type_structurally_recursive: {:?}", ty);
+            debug!("is_type_structurally_recursive: {:?} {:?}", ty, sp);
 
             match ty.sty {
                 TyAdt(def, _) => {
@@ -1096,7 +1110,7 @@ fn is_type_structurally_recursive<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                 debug!("SelfRecursive: {:?} contains {:?}",
                                        seen_type,
                                        ty);
-                                return Representability::SelfRecursive;
+                                return Representability::SelfRecursive(vec![sp]);
                             }
                         }
 
index 1c5a6c3985cfc43f92b1b06b9f33c0b6813317b2..adabbe11f5ecc80cceb5a27fb56adb816003573c 100644 (file)
@@ -469,13 +469,13 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                                                   nl, new_loan_msg);
                     err.span_label(
                             old_loan.span,
-                            &format!("first mutable borrow occurs here{}", old_loan_msg));
+                            format!("first mutable borrow occurs here{}", old_loan_msg));
                     err.span_label(
                             new_loan.span,
-                            &format!("second mutable borrow occurs here{}", new_loan_msg));
+                            format!("second mutable borrow occurs here{}", new_loan_msg));
                     err.span_label(
                             previous_end_span,
-                            &format!("first borrow ends here"));
+                            "first borrow ends here");
                     err
                 }
 
@@ -486,13 +486,13 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                                      nl);
                     err.span_label(
                             old_loan.span,
-                            &format!("first closure is constructed here"));
+                            "first closure is constructed here");
                     err.span_label(
                             new_loan.span,
-                            &format!("second closure is constructed here"));
+                            "second closure is constructed here");
                     err.span_label(
                             previous_end_span,
-                            &format!("borrow from first closure ends here"));
+                            "borrow from first closure ends here");
                     err
                 }
 
@@ -503,13 +503,13 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                                                    nl, ol_pronoun, old_loan_msg);
                     err.span_label(
                             new_loan.span,
-                            &format!("closure construction occurs here{}", new_loan_msg));
+                            format!("closure construction occurs here{}", new_loan_msg));
                     err.span_label(
                             old_loan.span,
-                            &format!("borrow occurs here{}", old_loan_msg));
+                            format!("borrow occurs here{}", old_loan_msg));
                     err.span_label(
                             previous_end_span,
-                            &format!("borrow ends here"));
+                            "borrow ends here");
                     err
                 }
 
@@ -520,13 +520,13 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                                                    nl, new_loan_msg, new_loan.kind.to_user_str());
                     err.span_label(
                             new_loan.span,
-                            &format!("borrow occurs here{}", new_loan_msg));
+                            format!("borrow occurs here{}", new_loan_msg));
                     err.span_label(
                             old_loan.span,
-                            &format!("closure construction occurs here{}", old_loan_msg));
+                            format!("closure construction occurs here{}", old_loan_msg));
                     err.span_label(
                             previous_end_span,
-                            &format!("borrow from closure ends here"));
+                            "borrow from closure ends here");
                     err
                 }
 
@@ -542,17 +542,17 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                                                    old_loan_msg);
                     err.span_label(
                             new_loan.span,
-                            &format!("{} borrow occurs here{}",
+                            format!("{} borrow occurs here{}",
                                      new_loan.kind.to_user_str(),
                                      new_loan_msg));
                     err.span_label(
                             old_loan.span,
-                            &format!("{} borrow occurs here{}",
+                            format!("{} borrow occurs here{}",
                                      old_loan.kind.to_user_str(),
                                      old_loan_msg));
                     err.span_label(
                             previous_end_span,
-                            &format!("{} borrow ends here",
+                            format!("{} borrow ends here",
                                      old_loan.kind.to_user_str()));
                     err
                 }
@@ -562,7 +562,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                 euv::ClosureCapture(span) => {
                     err.span_label(
                         span,
-                        &format!("borrow occurs due to use of `{}` in closure", nl));
+                        format!("borrow occurs due to use of `{}` in closure", nl));
                 }
                 _ => { }
             }
@@ -571,7 +571,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                 euv::ClosureCapture(span) => {
                     err.span_label(
                         span,
-                        &format!("previous borrow occurs due to use of `{}` in closure",
+                        format!("previous borrow occurs due to use of `{}` in closure",
                                  ol));
                 }
                 _ => { }
@@ -633,11 +633,11 @@ fn check_for_copy_of_frozen_path(&self,
                                  "cannot use `{}` because it was mutably borrowed",
                                  &self.bccx.loan_path_to_string(copy_path))
                     .span_label(loan_span,
-                               &format!("borrow of `{}` occurs here",
+                               format!("borrow of `{}` occurs here",
                                        &self.bccx.loan_path_to_string(&loan_path))
                                )
                     .span_label(span,
-                               &format!("use of borrowed `{}`",
+                               format!("use of borrowed `{}`",
                                         &self.bccx.loan_path_to_string(&loan_path)))
                     .emit();
             }
@@ -662,12 +662,12 @@ fn check_for_move_of_borrowed_path(&self,
                                          &self.bccx.loan_path_to_string(move_path));
                         err.span_label(
                             loan_span,
-                            &format!("borrow of `{}` occurs here",
+                            format!("borrow of `{}` occurs here",
                                     &self.bccx.loan_path_to_string(&loan_path))
                             );
                         err.span_label(
                             span,
-                            &format!("move into closure occurs here")
+                            "move into closure occurs here"
                             );
                         err
                     }
@@ -679,12 +679,12 @@ fn check_for_move_of_borrowed_path(&self,
                                          &self.bccx.loan_path_to_string(move_path));
                         err.span_label(
                             loan_span,
-                            &format!("borrow of `{}` occurs here",
+                            format!("borrow of `{}` occurs here",
                                     &self.bccx.loan_path_to_string(&loan_path))
                             );
                         err.span_label(
                             span,
-                            &format!("move out of `{}` occurs here",
+                            format!("move out of `{}` occurs here",
                                 &self.bccx.loan_path_to_string(move_path))
                             );
                         err
@@ -857,10 +857,10 @@ pub fn report_illegal_mutation(&self,
                          "cannot assign to `{}` because it is borrowed",
                          self.bccx.loan_path_to_string(loan_path))
             .span_label(loan.span,
-                       &format!("borrow of `{}` occurs here",
+                       format!("borrow of `{}` occurs here",
                                self.bccx.loan_path_to_string(loan_path)))
             .span_label(span,
-                       &format!("assignment to borrowed `{}` occurs here",
+                       format!("assignment to borrowed `{}` occurs here",
                                self.bccx.loan_path_to_string(loan_path)))
             .emit();
     }
index b7ce9d982331c92a80b8e61c1154ece340dcf824..1ee6d565d0d7debd0718f06e5382d62f7b3cc776 100644 (file)
@@ -94,7 +94,7 @@ fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &Vec<Move
         }
         if let NoteClosureEnv(upvar_id) = error.move_from.note {
             err.span_label(bccx.tcx.hir.span(upvar_id.var_id),
-                           &"captured outer variable");
+                           "captured outer variable");
         }
         err.emit();
 
@@ -147,7 +147,7 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                              move_from.descriptive_string(bccx.tcx));
             err.span_label(
                 move_from.span,
-                &format!("cannot move out of {}", move_from.descriptive_string(bccx.tcx))
+                format!("cannot move out of {}", move_from.descriptive_string(bccx.tcx))
                 );
             err
         }
@@ -160,7 +160,7 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                                                    "cannot move out of type `{}`, \
                                                     a non-copy array",
                                                    b.ty);
-                    err.span_label(move_from.span, &format!("cannot move out of here"));
+                    err.span_label(move_from.span, "cannot move out of here");
                     err
                 }
                 (_, Kind::Pattern) => {
@@ -177,7 +177,7 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                                                    "cannot move out of type `{}`, \
                                                    which implements the `Drop` trait",
                                                    b.ty);
-                    err.span_label(move_from.span, &format!("cannot move out of here"));
+                    err.span_label(move_from.span, "cannot move out of here");
                     err
                 },
                 _ => {
@@ -198,12 +198,12 @@ fn note_move_destination(mut err: DiagnosticBuilder,
     if is_first_note {
         err.span_label(
             move_to_span,
-            &format!("hint: to prevent move, use `ref {0}` or `ref mut {0}`",
+            format!("hint: to prevent move, use `ref {0}` or `ref mut {0}`",
                      pat_name));
         err
     } else {
         err.span_label(move_to_span,
-                      &format!("...and here (use `ref {0}` or `ref mut {0}`)",
+                      format!("...and here (use `ref {0}` or `ref mut {0}`)",
                                pat_name));
         err
     }
index f8073455bd08ad422077ffd583228274fa7aa002..7eb73a87532eb9b427878d81eb3d25dfeef358be 100644 (file)
@@ -546,7 +546,7 @@ pub fn report_use_of_moved_value(&self,
                     "{} of possibly uninitialized variable: `{}`",
                     verb,
                     self.loan_path_to_string(lp))
-                .span_label(use_span, &format!("use of possibly uninitialized `{}`",
+                .span_label(use_span, format!("use of possibly uninitialized `{}`",
                     self.loan_path_to_string(lp)))
                 .emit();
                 return;
@@ -616,12 +616,12 @@ pub fn report_use_of_moved_value(&self,
         err = if use_span == move_span {
             err.span_label(
                 use_span,
-                &format!("value moved{} here in previous iteration of loop",
+                format!("value moved{} here in previous iteration of loop",
                          move_note));
             err
         } else {
-            err.span_label(use_span, &format!("value {} here after move", verb_participle))
-               .span_label(move_span, &format!("value moved{} here", move_note));
+            err.span_label(use_span, format!("value {} here after move", verb_participle))
+               .span_label(move_span, format!("value moved{} here", move_note));
             err
         };
 
@@ -657,9 +657,9 @@ pub fn report_reassigned_immutable_variable(&self,
             self.tcx.sess, span, E0384,
             "re-assignment of immutable variable `{}`",
             self.loan_path_to_string(lp));
-        err.span_label(span, &format!("re-assignment of immutable variable"));
+        err.span_label(span, "re-assignment of immutable variable");
         if span != assign.span {
-            err.span_label(assign.span, &format!("first assignment to `{}`",
+            err.span_label(assign.span, format!("first assignment to `{}`",
                                               self.loan_path_to_string(lp)));
         }
         err.emit();
@@ -821,7 +821,7 @@ pub fn report_aliasability_violation(&self,
                 let mut err = struct_span_err!(
                     self.tcx.sess, span, E0389,
                     "{} in a `&` reference", prefix);
-                err.span_label(span, &"assignment into an immutable reference");
+                err.span_label(span, "assignment into an immutable reference");
                 err
             }
         };
@@ -914,7 +914,7 @@ fn note_immutability_blame(&self,
                         }
                         db.span_label(
                             let_span,
-                            &format!("consider changing this to `mut {}`", snippet)
+                            format!("consider changing this to `mut {}`", snippet)
                         );
                     }
                 }
@@ -927,7 +927,7 @@ fn note_immutability_blame(&self,
                         if let Ok(snippet) = snippet {
                             db.span_label(
                                 let_span,
-                                &format!("consider changing this to `{}`",
+                                format!("consider changing this to `{}`",
                                          snippet.replace("ref ", "ref mut "))
                             );
                         }
@@ -936,7 +936,7 @@ fn note_immutability_blame(&self,
                         if let (Some(local_ty), is_implicit_self) = self.local_ty(node_id) {
                             if let Some(msg) =
                                  self.suggest_mut_for_immutable(local_ty, is_implicit_self) {
-                                db.span_label(local_ty.span, &msg);
+                                db.span_label(local_ty.span, msg);
                             }
                         }
                     }
@@ -950,7 +950,7 @@ fn note_immutability_blame(&self,
 
                 if let hir_map::Node::NodeField(ref field) = self.tcx.hir.get(node_id) {
                     if let Some(msg) = self.suggest_mut_for_immutable(&field.ty, false) {
-                        db.span_label(field.ty.span, &msg);
+                        db.span_label(field.ty.span, msg);
                     }
                 }
             }
@@ -975,10 +975,10 @@ fn report_out_of_scope_escaping_closure_capture(&self,
                           which is owned by the current function",
                          cmt_path_or_string)
             .span_label(capture_span,
-                       &format!("{} is borrowed here",
+                       format!("{} is borrowed here",
                                 cmt_path_or_string))
             .span_label(err.span,
-                       &format!("may outlive borrowed value {}",
+                       format!("may outlive borrowed value {}",
                                 cmt_path_or_string))
             .span_suggestion(err.span,
                              &format!("to force the closure to take ownership of {} \
@@ -1029,15 +1029,15 @@ fn note_and_explain_bckerr(&self, db: &mut DiagnosticBuilder, err: BckError<'tcx
                         match db.span.primary_span() {
                             Some(primary) => {
                                 db.span = MultiSpan::from_span(s);
-                                db.span_label(primary, &format!("capture occurs here"));
-                                db.span_label(s, &"does not live long enough");
+                                db.span_label(primary, "capture occurs here");
+                                db.span_label(s, "does not live long enough");
                                 true
                             }
                             None => false
                         }
                     }
                     _ => {
-                        db.span_label(error_span, &"does not live long enough");
+                        db.span_label(error_span, "does not live long enough");
                         false
                     }
                 };
@@ -1049,7 +1049,7 @@ fn note_and_explain_bckerr(&self, db: &mut DiagnosticBuilder, err: BckError<'tcx
                     (Some(s1), Some(s2)) if s1 == s2 => {
                         if !is_closure {
                             db.span = MultiSpan::from_span(s1);
-                            db.span_label(error_span, &value_msg);
+                            db.span_label(error_span, value_msg);
                             let msg = match opt_loan_path(&err.cmt) {
                                 None => value_kind.to_string(),
                                 Some(lp) => {
@@ -1057,29 +1057,29 @@ fn note_and_explain_bckerr(&self, db: &mut DiagnosticBuilder, err: BckError<'tcx
                                 }
                             };
                             db.span_label(s1,
-                                          &format!("{} dropped here while still borrowed", msg));
+                                          format!("{} dropped here while still borrowed", msg));
                         } else {
-                            db.span_label(s1, &format!("{} dropped before borrower", value_kind));
+                            db.span_label(s1, format!("{} dropped before borrower", value_kind));
                         }
                         db.note("values in a scope are dropped in the opposite order \
                                 they are created");
                     }
                     (Some(s1), Some(s2)) if !is_closure => {
                         db.span = MultiSpan::from_span(s2);
-                        db.span_label(error_span, &value_msg);
+                        db.span_label(error_span, value_msg);
                         let msg = match opt_loan_path(&err.cmt) {
                             None => value_kind.to_string(),
                             Some(lp) => {
                                 format!("`{}`", self.loan_path_to_string(&lp))
                             }
                         };
-                        db.span_label(s2, &format!("{} dropped here while still borrowed", msg));
-                        db.span_label(s1, &format!("{} needs to live until here", value_kind));
+                        db.span_label(s2, format!("{} dropped here while still borrowed", msg));
+                        db.span_label(s1, format!("{} needs to live until here", value_kind));
                     }
                     _ => {
                         match sub_span {
                             Some(s) => {
-                                db.span_label(s, &format!("{} needs to live until here",
+                                db.span_label(s, format!("{} needs to live until here",
                                                           value_kind));
                             }
                             None => {
@@ -1092,7 +1092,7 @@ fn note_and_explain_bckerr(&self, db: &mut DiagnosticBuilder, err: BckError<'tcx
                         }
                         match super_span {
                             Some(s) => {
-                                db.span_label(s, &format!("{} only lives until here", value_kind));
+                                db.span_label(s, format!("{} only lives until here", value_kind));
                             }
                             None => {
                                 self.tcx.note_and_explain_region(
@@ -1162,23 +1162,23 @@ fn note_and_explain_mutbl_error(&self, db: &mut DiagnosticBuilder, err: &BckErro
             }
             _ => {
                 if let Categorization::Deref(..) = err.cmt.cat {
-                    db.span_label(*error_span, &"cannot borrow as mutable");
+                    db.span_label(*error_span, "cannot borrow as mutable");
                 } else if let Categorization::Local(local_id) = err.cmt.cat {
                     let span = self.tcx.hir.span(local_id);
                     if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(span) {
                         if snippet.starts_with("ref mut ") || snippet.starts_with("&mut ") {
-                            db.span_label(*error_span, &format!("cannot reborrow mutably"));
-                            db.span_label(*error_span, &format!("try removing `&mut` here"));
+                            db.span_label(*error_span, "cannot reborrow mutably");
+                            db.span_label(*error_span, "try removing `&mut` here");
                         } else {
-                            db.span_label(*error_span, &format!("cannot borrow mutably"));
+                            db.span_label(*error_span, "cannot borrow mutably");
                         }
                     } else {
-                        db.span_label(*error_span, &format!("cannot borrow mutably"));
+                        db.span_label(*error_span, "cannot borrow mutably");
                     }
                 } else if let Categorization::Interior(ref cmt, _) = err.cmt.cat {
                     if let mc::MutabilityCategory::McImmutable = cmt.mutbl {
                         db.span_label(*error_span,
-                                      &"cannot mutably borrow immutable field");
+                                      "cannot mutably borrow immutable field");
                     }
                 }
             }
index 6ec5f38aa5bb529c94ac7d9edc7ba133e68c3b35..cd31290eb554c0fdce766f290657f32defc79bb6 100644 (file)
@@ -258,7 +258,7 @@ fn check_irrefutable(&self, pat: &Pat, is_fn_arg: bool) {
                 "refutable pattern in {}: `{}` not covered",
                 origin, pattern_string
             );
-            diag.span_label(pat.span, &format!("pattern `{}` not covered", pattern_string));
+            diag.span_label(pat.span, format!("pattern `{}` not covered", pattern_string));
             diag.emit();
         });
     }
@@ -328,7 +328,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
                                 let span = first_pat.0.span;
                                 struct_span_err!(cx.tcx.sess, span, E0162,
                                                 "irrefutable if-let pattern")
-                                    .span_label(span, &format!("irrefutable pattern"))
+                                    .span_label(span, "irrefutable pattern")
                                     .emit();
                                 printed_if_let_err = true;
                             }
@@ -355,7 +355,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
                                 1 => {
                                     struct_span_err!(cx.tcx.sess, span, E0165,
                                                      "irrefutable while-let pattern")
-                                        .span_label(span, &format!("irrefutable pattern"))
+                                        .span_label(span, "irrefutable pattern")
                                         .emit();
                                 },
                                 _ => bug!(),
@@ -369,7 +369,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
                             diagnostic.set_span(pat.span);
                             // if we had a catchall pattern, hint at that
                             if let Some(catchall) = catchall {
-                                diagnostic.span_label(pat.span, &"this is an unreachable pattern");
+                                diagnostic.span_label(pat.span, "this is an unreachable pattern");
                                 diagnostic.span_note(catchall, "this pattern matches any value");
                             }
                             cx.tcx.sess.add_lint_diagnostic(lint::builtin::UNREACHABLE_PATTERNS,
@@ -426,7 +426,7 @@ fn check_exhaustive<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
                         "refutable pattern in `for` loop binding: \
                                 `{}` not covered",
                                 pattern_string)
-                        .span_label(sp, &format!("pattern `{}` not covered", pattern_string))
+                        .span_label(sp, format!("pattern `{}` not covered", pattern_string))
                         .emit();
                 },
                 _ => {
@@ -453,7 +453,7 @@ fn check_exhaustive<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
                     create_e0004(cx.tcx.sess, sp,
                                  format!("non-exhaustive patterns: {} not covered",
                                          joined_patterns))
-                        .span_label(sp, &label_text)
+                        .span_label(sp, label_text)
                         .emit();
                 },
             }
@@ -485,18 +485,18 @@ fn check_legality_of_move_bindings(cx: &MatchVisitor,
         if sub.map_or(false, |p| p.contains_bindings()) {
             struct_span_err!(cx.tcx.sess, p.span, E0007,
                              "cannot bind by-move with sub-bindings")
-                .span_label(p.span, &format!("binds an already bound by-move value by moving it"))
+                .span_label(p.span, "binds an already bound by-move value by moving it")
                 .emit();
         } else if has_guard {
             struct_span_err!(cx.tcx.sess, p.span, E0008,
                       "cannot bind by-move into a pattern guard")
-                .span_label(p.span, &format!("moves value into pattern guard"))
+                .span_label(p.span, "moves value into pattern guard")
                 .emit();
         } else if by_ref_span.is_some() {
             struct_span_err!(cx.tcx.sess, p.span, E0009,
                             "cannot bind by-move and by-ref in the same pattern")
-                    .span_label(p.span, &format!("by-move pattern here"))
-                    .span_label(by_ref_span.unwrap(), &format!("both by-ref and by-move used"))
+                    .span_label(p.span, "by-move pattern here")
+                    .span_label(by_ref_span.unwrap(), "both by-ref and by-move used")
                     .emit();
         }
     };
@@ -546,7 +546,7 @@ fn borrow(&mut self,
             ty::MutBorrow => {
                 struct_span_err!(self.cx.tcx.sess, span, E0301,
                           "cannot mutably borrow in a pattern guard")
-                    .span_label(span, &format!("borrowed mutably in pattern guard"))
+                    .span_label(span, "borrowed mutably in pattern guard")
                     .emit();
             }
             ty::ImmBorrow | ty::UniqueImmBorrow => {}
@@ -557,7 +557,7 @@ fn mutate(&mut self, _: ast::NodeId, span: Span, _: cmt, mode: MutateMode) {
         match mode {
             MutateMode::JustWrite | MutateMode::WriteAndRead => {
                 struct_span_err!(self.cx.tcx.sess, span, E0302, "cannot assign in a pattern guard")
-                    .span_label(span, &format!("assignment in pattern guard"))
+                    .span_label(span, "assignment in pattern guard")
                     .emit();
             }
             MutateMode::Init => {}
@@ -588,7 +588,7 @@ fn visit_pat(&mut self, pat: &Pat) {
                 if !self.bindings_allowed {
                     struct_span_err!(self.cx.tcx.sess, pat.span, E0303,
                                      "pattern bindings are not allowed after an `@`")
-                        .span_label(pat.span,  &format!("not allowed after `@`"))
+                        .span_label(pat.span,  "not allowed after `@`")
                         .emit();
                 }
 
index 4f3abbb362ff90ff1b3a5315cff8408708b093ff..718f2b515068b3415033e2cf578e2cb39fd135e5 100644 (file)
@@ -27,6 +27,8 @@
                                                  "ssse3\0", "tbm\0", "lzcnt\0", "popcnt\0",
                                                  "sse4a\0", "rdrnd\0", "rdseed\0", "fma\0"];
 
+const HEXAGON_WHITELIST: &'static [&'static str] = &["hvx\0", "hvx-double\0"];
+
 /// Add `target_feature = "..."` cfgs for a variety of platform
 /// specific features (SSE, NEON etc.).
 ///
@@ -38,6 +40,7 @@ pub fn add_configuration(cfg: &mut ast::CrateConfig, sess: &Session) {
     let whitelist = match &*sess.target.target.arch {
         "arm" => ARM_WHITELIST,
         "x86" | "x86_64" => X86_WHITELIST,
+        "hexagon" => HEXAGON_WHITELIST,
         _ => &[],
     };
 
index 38fa35ecb126299a7fec1f01638447bf3c510b07..0822f7134998572349e5c5cecb70fbfcf559bd00 100644 (file)
@@ -114,9 +114,8 @@ pub fn is_fatal(&self) -> bool {
     /// all, and you just supplied a `Span` to create the diagnostic,
     /// then the snippet will just include that `Span`, which is
     /// called the primary span.
-    pub fn span_label(&mut self, span: Span, label: &fmt::Display)
-                      -> &mut Self {
-        self.span.push_span_label(span, format!("{}", label));
+    pub fn span_label<T: Into<String>>(&mut self, span: Span, label: T) -> &mut Self {
+        self.span.push_span_label(span, label.into());
         self
     }
 
index 9dfd47b8464d78ed730e51879491f49f4a660133..a9c2bbeba2aa4ba0486eb4db917c7dcd883be258 100644 (file)
@@ -112,8 +112,10 @@ pub fn emit(&mut self) {
     /// all, and you just supplied a `Span` to create the diagnostic,
     /// then the snippet will just include that `Span`, which is
     /// called the primary span.
-    forward!(pub fn span_label(&mut self, span: Span, label: &fmt::Display)
-                               -> &mut Self);
+    pub fn span_label<T: Into<String>>(&mut self, span: Span, label: T) -> &mut Self {
+        self.diagnostic.span_label(span, label);
+        self
+    }
 
     forward!(pub fn note_expected_found(&mut self,
                                         label: &fmt::Display,
index 02d8297dd46140e30f3bef15f5fb7cd4f82a91fe..db8c9ac306bba718ff4ff9c6a64050289bdda97b 100644 (file)
@@ -388,6 +388,14 @@ pub fn span_bug_no_panic<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
     pub fn span_note_without_error<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
         self.emit(&sp.into(), msg, Note);
     }
+    pub fn span_note_diag<'a>(&'a self,
+                              sp: Span,
+                              msg: &str)
+                              -> DiagnosticBuilder<'a> {
+        let mut db = DiagnosticBuilder::new(self, Note, msg);
+        db.set_span(sp);
+        db
+    }
     pub fn span_unimpl<S: Into<MultiSpan>>(&self, sp: S, msg: &str) -> ! {
         self.span_bug(sp, &format!("unimplemented {}", msg));
     }
index 7905128bb6eca4266c734c38a9762e2628edcd3d..39fe2188f68d1f5756015404d19c0b49999e7003 100644 (file)
@@ -154,7 +154,7 @@ fn process_attrs(&mut self, node_id: ast::NodeId, attrs: &[ast::Attribute]) {
                     None => {
                         self.tcx.sess.span_fatal(
                             attr.span,
-                            &format!("missing DepNode variant"));
+                            "missing DepNode variant");
                     }
                 };
                 self.then_this_would_need.push((attr.span,
@@ -201,7 +201,7 @@ fn check_paths<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         for &(target_span, _, _, _) in then_this_would_need {
             tcx.sess.span_err(
                 target_span,
-                &format!("no #[rustc_if_this_changed] annotation detected"));
+                "no #[rustc_if_this_changed] annotation detected");
 
         }
         return;
@@ -219,7 +219,7 @@ fn check_paths<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             } else {
                 tcx.sess.span_err(
                     target_span,
-                    &format!("OK"));
+                    "OK");
             }
         }
     }
index b73b3e161f9b547fcfb0ef6f0b26090ad794d31d..5facfe36efdb93c8b452b186e50b15526f23e1e3 100644 (file)
@@ -383,7 +383,7 @@ fn check_config(tcx: TyCtxt, attr: &Attribute) -> bool {
 
     tcx.sess.span_fatal(
         attr.span,
-        &format!("no cfg attribute"));
+        "no cfg attribute");
 }
 
 fn expect_associated_value(tcx: TyCtxt, item: &NestedMetaItem) -> ast::Name {
index c9ec152841b2025a1e57e8b09344355aba06a405..715a769158bc3fb832b0613d52f996068cb6eda6 100644 (file)
@@ -692,6 +692,82 @@ fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) {
     }
 }
 
+declare_lint! {
+    pub ILLEGAL_FLOATING_POINT_LITERAL_PATTERN,
+    Warn,
+    "floating-point literals cannot be used in patterns"
+}
+
+/// Checks for floating point literals in patterns.
+#[derive(Clone)]
+pub struct IllegalFloatLiteralPattern;
+
+impl LintPass for IllegalFloatLiteralPattern {
+    fn get_lints(&self) -> LintArray {
+        lint_array!(ILLEGAL_FLOATING_POINT_LITERAL_PATTERN)
+    }
+}
+
+fn fl_lit_check_expr(cx: &EarlyContext, expr: &ast::Expr) {
+    use self::ast::{ExprKind, LitKind};
+    match expr.node {
+        ExprKind::Lit(ref l) => {
+            match l.node {
+                LitKind::FloatUnsuffixed(..) |
+                LitKind::Float(..) => {
+                    cx.span_lint(ILLEGAL_FLOATING_POINT_LITERAL_PATTERN,
+                                 l.span,
+                                 "floating-point literals cannot be used in patterns");
+                    error!("span mc spanspam");
+                    },
+                _ => (),
+            }
+        }
+        // These may occur in patterns
+        // and can maybe contain float literals
+        ExprKind::Unary(_, ref f) => fl_lit_check_expr(cx, f),
+        // These may occur in patterns
+        // and can't contain float literals
+        ExprKind::Path(..) => (),
+        // If something unhandled is encountered, we need to expand the
+        // search or ignore more ExprKinds.
+        _ => span_bug!(expr.span, "Unhandled expression {:?} in float lit pattern lint",
+                       expr.node),
+    }
+}
+
+impl EarlyLintPass for IllegalFloatLiteralPattern {
+    fn check_pat(&mut self, cx: &EarlyContext, pat: &ast::Pat) {
+        use self::ast::PatKind;
+        pat.walk(&mut |p| {
+            match p.node {
+                // Wildcard patterns and paths are uninteresting for the lint
+                PatKind::Wild |
+                PatKind::Path(..) => (),
+
+                // The walk logic recurses inside these
+                PatKind::Ident(..) |
+                PatKind::Struct(..) |
+                PatKind::Tuple(..) |
+                PatKind::TupleStruct(..) |
+                PatKind::Ref(..) |
+                PatKind::Box(..) |
+                PatKind::Slice(..) => (),
+
+                // Extract the expressions and check them
+                PatKind::Lit(ref e) => fl_lit_check_expr(cx, e),
+                PatKind::Range(ref st, ref en, _) => {
+                    fl_lit_check_expr(cx, st);
+                    fl_lit_check_expr(cx, en);
+                },
+
+                PatKind::Mac(_) => bug!("lint must run post-expansion"),
+            }
+            true
+        });
+    }
+}
+
 declare_lint! {
     pub UNCONDITIONAL_RECURSION,
     Warn,
index c1c14cb1fd29e3d8f3e6d6500a193d0f65fa4367..53ea3a8333f2d761c8027d1d9295ac87829d7d1d 100644 (file)
@@ -113,6 +113,7 @@ macro_rules! add_lint_group {
                        UnusedParens,
                        UnusedImportBraces,
                        AnonymousParameters,
+                       IllegalFloatLiteralPattern,
                        );
 
     add_early_builtin_with_new!(sess,
@@ -201,6 +202,10 @@ macro_rules! add_lint_group {
             id: LintId::of(ILLEGAL_FLOATING_POINT_CONSTANT_PATTERN),
             reference: "issue #36890 <https://github.com/rust-lang/rust/issues/36890>",
         },
+        FutureIncompatibleInfo {
+            id: LintId::of(ILLEGAL_FLOATING_POINT_LITERAL_PATTERN),
+            reference: "issue #41620 <https://github.com/rust-lang/rust/issues/41620>",
+        },
         FutureIncompatibleInfo {
             id: LintId::of(ILLEGAL_STRUCT_OR_ENUM_CONSTANT_PATTERN),
             reference: "issue #36891 <https://github.com/rust-lang/rust/issues/36891>",
index 86bf209ccf8c8d92c5c841f684f356f869293b20..93ff609a280ae1d4b0d24431dcadef941b32b6a2 100644 (file)
@@ -215,7 +215,7 @@ fn is_enclosed(cx: &LateContext, id: ast::NodeId) -> Option<(String, ast::NodeId
                 let mut db = cx.struct_span_lint(UNUSED_UNSAFE, blk.span,
                                                  "unnecessary `unsafe` block");
 
-                db.span_label(blk.span, &"unnecessary `unsafe` block");
+                db.span_label(blk.span, "unnecessary `unsafe` block");
                 if let Some((kind, id)) = is_enclosed(cx, blk.id) {
                     db.span_note(cx.tcx.hir.span(id),
                                  &format!("because it's nested under this `unsafe` {}", kind));
index 966e814e3379075741b2809585814f95e5a5624b..325511c9787e1b62655b9c47a0047bd4c1f7201c 100644 (file)
@@ -88,7 +88,7 @@ fn register_native_lib(sess: &Session,
             Some(span) => {
                 struct_span_err!(sess, span, E0454,
                                  "#[link(name = \"\")] given with empty name")
-                    .span_label(span, &format!("empty name given"))
+                    .span_label(span, "empty name given")
                     .emit();
             }
             None => {
@@ -1029,7 +1029,7 @@ fn process_foreign_mod(&mut self, i: &ast::Item, fm: &ast::ForeignMod,
                 Some(k) => {
                     struct_span_err!(self.sess, m.span, E0458,
                               "unknown kind: `{}`", k)
-                        .span_label(m.span, &format!("unknown kind")).emit();
+                        .span_label(m.span, "unknown kind").emit();
                     cstore::NativeUnknown
                 }
                 None => cstore::NativeUnknown
@@ -1042,7 +1042,7 @@ fn process_foreign_mod(&mut self, i: &ast::Item, fm: &ast::ForeignMod,
                 None => {
                     struct_span_err!(self.sess, m.span, E0459,
                                      "#[link(...)] specified without `name = \"foo\"`")
-                        .span_label(m.span, &format!("missing `name` argument")).emit();
+                        .span_label(m.span, "missing `name` argument").emit();
                     Symbol::intern("foo")
                 }
             };
index e8bc8b01652a62a5c71161b6b8e489a21ea21a6f..84bb82de370e4f55f5e4635060d8ccde38fa4dc9 100644 (file)
@@ -367,7 +367,7 @@ pub fn report_errs(&mut self) -> ! {
                 && self.triple != config::host_triple() {
                 err.note(&format!("the `{}` target may not be installed", self.triple));
             }
-            err.span_label(self.span, &format!("can't find crate"));
+            err.span_label(self.span, "can't find crate");
             err
         };
 
index 4b1c82f383f85ce1a638dc2e048b0980f1af43a3..0d592b4d72be5b11df3d9ddd232ca0fa39cb921b 100644 (file)
@@ -242,9 +242,9 @@ fn deny_drop(&self) {
                    to the crate attributes to enable");
         } else {
             self.find_drop_implementation_method_span()
-                .map(|span| err.span_label(span, &format!("destructor defined here")));
+                .map(|span| err.span_label(span, "destructor defined here"));
 
-            err.span_label(self.span, &format!("constants cannot have destructors"));
+            err.span_label(self.span, "constants cannot have destructors");
         }
 
         err.emit();
@@ -291,8 +291,8 @@ fn try_consume(&mut self) -> bool {
                 "cannot refer to statics by value, use a constant instead"
             };
             struct_span_err!(self.tcx.sess, self.span, E0394, "{}", msg)
-                .span_label(self.span, &format!("referring to another static by value"))
-                .note(&format!("use the address-of operator or a constant instead"))
+                .span_label(self.span, "referring to another static by value")
+                .note("use the address-of operator or a constant instead")
                 .emit();
 
             // Replace STATIC with NOT_CONST to avoid further errors.
@@ -529,7 +529,7 @@ fn visit_lvalue(&mut self,
                                         "raw pointers cannot be dereferenced in {}s",
                                         this.mode)
                                     .span_label(this.span,
-                                        &format!("dereference of raw pointer in constant"))
+                                        "dereference of raw pointer in constant")
                                     .emit();
                                 }
                             }
@@ -645,7 +645,7 @@ fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
                             struct_span_err!(self.tcx.sess,  self.span, E0017,
                                              "references in {}s may only refer \
                                               to immutable values", self.mode)
-                                .span_label(self.span, &format!("{}s require immutable values",
+                                .span_label(self.span, format!("{}s require immutable values",
                                                                 self.mode))
                                 .emit();
                         }
@@ -713,7 +713,7 @@ fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
                             self.mode)
                         .span_label(
                             self.span,
-                            &format!("comparing raw pointers in static"))
+                            "comparing raw pointers in static")
                         .emit();
                     }
                 }
@@ -724,7 +724,7 @@ fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
                 if self.mode != Mode::Fn {
                     struct_span_err!(self.tcx.sess, self.span, E0010,
                                      "allocations are not allowed in {}s", self.mode)
-                        .span_label(self.span, &format!("allocation not allowed in {}s", self.mode))
+                        .span_label(self.span, format!("allocation not allowed in {}s", self.mode))
                         .emit();
                 }
             }
index 8c45a6669453354fdfcbe5b9202502f2f9a7d545..d7fee7f3110f4cdb90e197f16dcfcab5fc0f0b63 100644 (file)
@@ -55,7 +55,7 @@ fn invalid_visibility(&self, vis: &Visibility, span: Span, note: Option<&str>) {
                                            E0449,
                                            "unnecessary visibility qualifier");
             if vis == &Visibility::Public {
-                err.span_label(span, &format!("`pub` not needed here"));
+                err.span_label(span, "`pub` not needed here");
             }
             if let Some(note) = note {
                 err.note(note);
@@ -80,7 +80,7 @@ fn check_trait_fn_not_const(&self, constness: Spanned<Constness>) {
             Constness::Const => {
                 struct_span_err!(self.session, constness.span, E0379,
                                  "trait fns cannot be declared const")
-                    .span_label(constness.span, &format!("trait fns cannot be const"))
+                    .span_label(constness.span, "trait fns cannot be const")
                     .emit();
             }
             _ => {}
@@ -272,7 +272,7 @@ fn visit_foreign_item(&mut self, fi: &'a ForeignItem) {
                                                    E0130,
                                                    "patterns aren't allowed in foreign function \
                                                     declarations");
-                    err.span_label(span, &format!("pattern not allowed in foreign function"));
+                    err.span_label(span, "pattern not allowed in foreign function");
                     if is_recent {
                         err.span_note(span,
                                       "this is a recent error, see issue #35203 for more details");
index 608238dfe3735d6f46ea5b71648f0a1d7424e308..a0998b1bd1bfb3fd7cd3a54da70b140d3987da0a 100644 (file)
@@ -180,7 +180,7 @@ fn visit_pat(&mut self, p: &'tcx hir::Pat) {
                     Ok(Ordering::Greater) => {
                         struct_span_err!(self.tcx.sess, start.span, E0030,
                             "lower range bound must be less than or equal to upper")
-                            .span_label(start.span, &format!("lower bound larger than upper bound"))
+                            .span_label(start.span, "lower bound larger than upper bound")
                             .emit();
                     }
                     Err(ErrorReported) => {}
index 2ea235af103788b0f9de6e09b5f3a36b139ffbdd..21a4c007fb1926b35144ee74db78919dd8ebf430 100644 (file)
@@ -118,7 +118,7 @@ fn visit_expr(&mut self, e: &'hir hir::Expr) {
                                              "`break` with value from a `{}` loop",
                                              kind.name())
                                 .span_label(e.span,
-                                            &format!("can only break with a value inside `loop`"))
+                                            "can only break with a value inside `loop`")
                                 .emit();
                         }
                     }
@@ -154,12 +154,12 @@ fn require_loop(&self, name: &str, span: Span) {
             Loop(_) => {}
             Closure => {
                 struct_span_err!(self.sess, span, E0267, "`{}` inside of a closure", name)
-                .span_label(span, &format!("cannot break inside of a closure"))
+                .span_label(span, "cannot break inside of a closure")
                 .emit();
             }
             Normal => {
                 struct_span_err!(self.sess, span, E0268, "`{}` outside of loop", name)
-                .span_label(span, &format!("cannot break outside of a loop"))
+                .span_label(span, "cannot break outside of a loop")
                 .emit();
             }
         }
@@ -169,7 +169,7 @@ fn emit_unlabled_cf_in_while_condition(&mut self, span: Span, cf_type: &str) {
         struct_span_err!(self.sess, span, E0590,
                          "`break` or `continue` with no label in the condition of a `while` loop")
             .span_label(span,
-                        &format!("unlabeled `{}` in the condition of a `while` loop", cf_type))
+                        format!("unlabeled `{}` in the condition of a `while` loop", cf_type))
             .emit();
     }
 }
index d0bf49b7b337d17fff8910c0f17a82602fdc2962..8d455adc23c99d95b500988fec69e1874f192d79 100644 (file)
@@ -138,7 +138,7 @@ fn with_item_id_pushed<F>(&mut self, id: ast::NodeId, f: F, span: Span)
             });
             if !any_static {
                 struct_span_err!(self.sess, span, E0265, "recursive constant")
-                    .span_label(span, &format!("recursion not allowed in constant"))
+                    .span_label(span, "recursion not allowed in constant")
                     .emit();
             }
             return;
diff --git a/src/librustc_platform_intrinsics/hexagon.rs b/src/librustc_platform_intrinsics/hexagon.rs
new file mode 100644 (file)
index 0000000..56d6398
--- /dev/null
@@ -0,0 +1,2937 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// DO NOT EDIT: autogenerated by etc/platform-intrinsics/generator.py
+// ignore-tidy-linelength
+
+#![allow(unused_imports)]
+
+use {Intrinsic, Type};
+use IntrinsicDef::Named;
+
+// The default inlining settings trigger a pathological behaviour in
+// LLVM, which causes makes compilation very slow. See #28273.
+#[inline(never)]
+pub fn find(name: &str) -> Option<Intrinsic> {
+    if !name.starts_with("Q6_") { return None }
+    Some(match &name["Q6_".len()..] {
+        "R_vextract64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x16, &::U32]; &INPUTS },
+            output: &::U32,
+            definition: Named("llvm.hexagon.V6.extractw")
+        },
+        "R_vextract128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x32, &::U32]; &INPUTS },
+            output: &::U32,
+            definition: Named("llvm.hexagon.V6.extractw.128B")
+        },
+        "V_lo64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32x32]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.lo")
+        },
+        "V_lo128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32x64]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.lo.128B")
+        },
+        "V_hi64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32x32]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.hi")
+        },
+        "V_hi128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32x64]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.hi.128B")
+        },
+        "V_vsplat_R64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.lvsplatuw")
+        },
+        "V_vsplat_R128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.lvsplatuw.128B")
+        },
+        "Q_and_QQ64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.pred.and")
+        },
+        "Q_and_QQ128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.pred.and.128B")
+        },
+        "Q_not_Q64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.pred.not")
+        },
+        "Q_not_Q128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.pred.not.128B")
+        },
+        "Q_or_QQ64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.pred.or")
+        },
+        "Q_or_QQ128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.pred.or.128B")
+        },
+        "Q_xor_QQ64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.pred.xor")
+        },
+        "Q_xor_QQ128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.pred.xor.128B")
+        },
+        "Vub_vabsdiff_VubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vabsdiffub")
+        },
+        "Vuh_vabsdiff_VuhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vabsdiffuh")
+        },
+        "Vub_vabsdiff_VubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vabsdiffub.128B")
+        },
+        "Vuh_vabsdiff_VuhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vabsdiffuh.128B")
+        },
+        "Vuh_vabsdiff_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vabsdiffh")
+        },
+        "Vuw_vabsdiff_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.vabsdiffw")
+        },
+        "Vuh_vabsdiff_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vabsdiffh.128B")
+        },
+        "Vuw_vabsdiff_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vabsdiffw.128B")
+        },
+        "Vh_vabs_Vh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vabsh")
+        },
+        "Vw_vabs_Vw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vabsw")
+        },
+        "Vh_vabs_Vh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vabsh.128B")
+        },
+        "Vw_vabs_Vw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vabsw.128B")
+        },
+        "Vh_vabs_Vh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vabsh.sat")
+        },
+        "Vw_vabs_Vw_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vabsw.sat")
+        },
+        "Vh_vabs_Vh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vabsh.sat.128B")
+        },
+        "Vw_vabs_Vw_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vabsw.sat.128B")
+        },
+        "Vb_vadd_VbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vaddb")
+        },
+        "Vh_vadd_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vaddh")
+        },
+        "Vw_vadd_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vaddw")
+        },
+        "Vb_vadd_VbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vaddb.128B")
+        },
+        "Vh_vadd_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vaddh.128B")
+        },
+        "Vw_vadd_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vaddw.128B")
+        },
+        "Vh_vadd_VhVh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vaddhsat")
+        },
+        "Vw_vadd_VwVw_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vaddwsat")
+        },
+        "Vh_vadd_VhVh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vaddhsat.128B")
+        },
+        "Vw_vadd_VwVw_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vaddwsat.128B")
+        },
+        "Vub_vadd_VubVub_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vaddubsat")
+        },
+        "Vuh_vadd_VuhVuh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vadduhsat")
+        },
+        "Vub_vadd_VubVub_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vaddubsat.128B")
+        },
+        "Vuh_vadd_VuhVuh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vadduhsat.128B")
+        },
+        "Wb_vadd_WbWb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vaddb.dv")
+        },
+        "Wh_vadd_WhWh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vaddh.dv")
+        },
+        "Ww_vadd_WwWw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vaddw.dv")
+        },
+        "Wb_vadd_WbWb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x256, &::I8x256]; &INPUTS },
+            output: &::I8x256,
+            definition: Named("llvm.hexagon.V6.vaddb.dv.128B")
+        },
+        "Wh_vadd_WhWh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::I16x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vaddh.dv.128B")
+        },
+        "Ww_vadd_WwWw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x64, &::I32x64]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vaddw.dv.128B")
+        },
+        "Wh_vadd_WhWh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vaddhsat.dv")
+        },
+        "Ww_vadd_WwWw_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vaddwsat.dv")
+        },
+        "Wh_vadd_WhWh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::I16x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vaddhsat.dv.128B")
+        },
+        "Ww_vadd_WwWw_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x64, &::I32x64]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vaddwsat.dv.128B")
+        },
+        "Wub_vadd_WubWub_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vaddubsat.dv")
+        },
+        "Wuh_vadd_WuhWuh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vadduhsat.dv")
+        },
+        "Wub_vadd_WubWub_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U8x256]; &INPUTS },
+            output: &::U8x256,
+            definition: Named("llvm.hexagon.V6.vaddubsat.dv.128B")
+        },
+        "Wuh_vadd_WuhWuh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x128, &::U16x128]; &INPUTS },
+            output: &::U16x128,
+            definition: Named("llvm.hexagon.V6.vadduhsat.dv.128B")
+        },
+        "V_valign_VVR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U8x64, &::U32]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.valignb")
+        },
+        "V_valign_VVR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U8x128, &::U32]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.valignb.128B")
+        },
+        "V_valign_VVI64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U8x64, &::U32]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.valignbi")
+        },
+        "V_valign_VVI128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U8x128, &::U32]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.valignbi.128B")
+        },
+        "V_vlalign_VVR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U8x64, &::U32]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vlalignb")
+        },
+        "V_vlalign_VVR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U8x128, &::U32]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vlalignb.128B")
+        },
+        "V_vlalign_VVI64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U8x64, &::U32]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vlalignbi")
+        },
+        "V_vlalign_VVI128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U8x128, &::U32]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vlalignbi.128B")
+        },
+        "V_vand_VV64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vand")
+        },
+        "V_vand_VV128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vand.128B")
+        },
+        "V_vand_QR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vandqrt")
+        },
+        "V_vand_QR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vandqrt.128B")
+        },
+        "V_vandor_VQR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U32x2, &::U32]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vandqrt.acc")
+        },
+        "V_vandor_VQR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U32x4, &::U32]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vandqrt.acc.128B")
+        },
+        "Q_vand_VR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vandvrt")
+        },
+        "Q_vand_VR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vandvrt.128B")
+        },
+        "Q_vandor_QVR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U8x64, &::U32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vandvrt")
+        },
+        "Q_vandor_QVR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U8x128, &::U32]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vandvrt.128B")
+        },
+        "Vh_vasl_VhR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vaslh")
+        },
+        "Vw_vasl_VwR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vaslw")
+        },
+        "Vh_vasl_VhR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vaslh.128B")
+        },
+        "Vw_vasl_VwR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vaslw.128B")
+        },
+        "Vh_vasl_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vaslhv")
+        },
+        "Vw_vasl_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vaslwv")
+        },
+        "Vh_vasl_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vaslhv.128B")
+        },
+        "Vw_vasl_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vaslwv.128B")
+        },
+        "Vw_vaslacc_VwVwR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vaslw.acc")
+        },
+        "Vw_vaslacc_VwVwR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vaslw.acc.128B")
+        },
+        "Vh_vasr_VhR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vasrh")
+        },
+        "Vw_vasr_VwR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vasrw")
+        },
+        "Vh_vasr_VhR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vasrh.128B")
+        },
+        "Vw_vasr_VwR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vasrw.128B")
+        },
+        "Vh_vasr_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vasrhv")
+        },
+        "Vw_vasr_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vasrwv")
+        },
+        "Vh_vasr_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vasrhv.128B")
+        },
+        "Vw_vasr_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vasrwv.128B")
+        },
+        "Vw_vasracc_VwVwR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vasrw.acc")
+        },
+        "Vw_vasracc_VwVwR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vasrw.acc.128B")
+        },
+        "Vh_vasr_VwVwR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vasrhw")
+        },
+        "Vh_vasr_VwVwR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vasrhw.128B")
+        },
+        "Vb_vasr_VhVhR_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::I16x32, &::U32]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vasrhbsat")
+        },
+        "Vub_vasr_VhVhR_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::I16x32, &::U32]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vasrhbsat")
+        },
+        "Vh_vasr_VwVwR_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vasrwhsat")
+        },
+        "Vuh_vasr_VwVwR_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vasrwhsat")
+        },
+        "Vb_vasr_VhVhR_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I16x64, &::U32]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vasrhbsat.128B")
+        },
+        "Vub_vasr_VhVhR_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I16x64, &::U32]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vasrhbsat.128B")
+        },
+        "Vh_vasr_VwVwR_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vasrwhsat.128B")
+        },
+        "Vuh_vasr_VwVwR_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vasrwhsat.128B")
+        },
+        "Vb_vasr_VhVhR_rnd_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::I16x32, &::U32]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vasrhbrndsat")
+        },
+        "Vub_vasr_VhVhR_rnd_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::I16x32, &::U32]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vasrhbrndsat")
+        },
+        "Vh_vasr_VwVwR_rnd_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vasrwhrndsat")
+        },
+        "Vuh_vasr_VwVwR_rnd_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vasrwhrndsat")
+        },
+        "Vb_vasr_VhVhR_rnd_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I16x64, &::U32]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vasrhbrndsat.128B")
+        },
+        "Vub_vasr_VhVhR_rnd_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I16x64, &::U32]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vasrhbrndsat.128B")
+        },
+        "Vh_vasr_VwVwR_rnd_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vasrwhrndsat.128B")
+        },
+        "Vuh_vasr_VwVwR_rnd_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vasrwhrndsat.128B")
+        },
+        "V_equals_V64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32x16]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.vassign")
+        },
+        "V_equals_V128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32x32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vassign.128B")
+        },
+        "W_equals_W64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32x32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vassignp")
+        },
+        "W_equals_W128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32x64]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vassignp.128B")
+        },
+        "Vh_vavg_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vavgh")
+        },
+        "Vw_vavg_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vavgw")
+        },
+        "Vh_vavg_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vavgh.128B")
+        },
+        "Vw_vavg_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vavgw.128B")
+        },
+        "Vub_vavg_VubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vavgub")
+        },
+        "Vuh_vavg_VuhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vavguh")
+        },
+        "Vub_vavg_VubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vavgub.128B")
+        },
+        "Vuh_vavg_VuhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vavguh.128B")
+        },
+        "Vh_vavg_VhVh_rnd64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vavgrndh")
+        },
+        "Vw_vavg_VwVw_rnd64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vavgrndw")
+        },
+        "Vh_vavg_VhVh_rnd128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vavgrndh.128B")
+        },
+        "Vw_vavg_VwVw_rnd128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vavgrndw.128B")
+        },
+        "Vub_vavg_VubVub_rnd64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vavgrndub")
+        },
+        "Vuh_vavg_VuhVuh_rnd64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vavgrnduh")
+        },
+        "Vub_vavg_VubVub_rnd128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vavgrndub.128B")
+        },
+        "Vuh_vavg_VuhVuh_rnd128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vavgrnduh.128B")
+        },
+        "Vuh_vcl0_Vuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vcl0h")
+        },
+        "Vuw_vcl0_Vuw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32x16]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.vcl0w")
+        },
+        "Vuh_vcl0_Vuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vcl0h.128B")
+        },
+        "Vuw_vcl0_Vuw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U32x32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vcl0w.128B")
+        },
+        "W_vcombine_VV64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vcombine")
+        },
+        "W_vcombine_VV128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x256,
+            definition: Named("llvm.hexagon.V6.vcombine.128B")
+        },
+        "V_vzero64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.vd0")
+        },
+        "V_vzero128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vd0.128B")
+        },
+        "Vb_vdeal_Vb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I8x64]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vdealb")
+        },
+        "Vh_vdeal_Vh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vdealh")
+        },
+        "Vb_vdeal_Vb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vdealb.128B")
+        },
+        "Vh_vdeal_Vh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vdealh.128B")
+        },
+        "Vb_vdeale_VbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vdealb4w")
+        },
+        "Vb_vdeale_VbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vdealb4w.128B")
+        },
+        "W_vdeal_VVR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U8x64, &::U32]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vdealvdd")
+        },
+        "W_vdeal_VVR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U8x128, &::U32]; &INPUTS },
+            output: &::U8x256,
+            definition: Named("llvm.hexagon.V6.vdealvdd.128B")
+        },
+        "V_vdelta_VV64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vdelta")
+        },
+        "V_vdelta_VV128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vdelta.128B")
+        },
+        "Vh_vdmpy_VubRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vdmpybus")
+        },
+        "Vh_vdmpy_VubRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vdmpybus.128B")
+        },
+        "Vh_vdmpyacc_VhVubRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::U8x64, &::U32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vdmpybus.acc")
+        },
+        "Vh_vdmpyacc_VhVubRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::U8x128, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vdmpybus.acc.128B")
+        },
+        "Wh_vdmpy_WubRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vdmpybus.dv")
+        },
+        "Wh_vdmpy_WubRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U32]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vdmpybus.dv.128B")
+        },
+        "Wh_vdmpyacc_WhWubRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::U8x128, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vdmpybus.dv.acc")
+        },
+        "Wh_vdmpyacc_WhWubRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::U8x256, &::U32]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vdmpybus.dv.acc.128B")
+        },
+        "Vw_vdmpy_VhRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vdmpyhb")
+        },
+        "Vw_vdmpy_VhRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhb.128B")
+        },
+        "Vw_vdmpyacc_VwVhRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I16x32, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vdmpyhb.acc")
+        },
+        "Vw_vdmpyacc_VwVhRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhb.acc.128B")
+        },
+        "Ww_vdmpy_WhRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhb.dv")
+        },
+        "Ww_vdmpy_WhRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::U32]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vdmpyhb.dv.128B")
+        },
+        "Ww_vdmpyacc_WwWhRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhb.dv.acc")
+        },
+        "Ww_vdmpyacc_WwWhRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::I16x128, &::U32]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vdmpyhb.dv.acc.128B")
+        },
+        "Vw_vdmpy_WwRh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vdmpyhisat")
+        },
+        "Vw_vdmpy_WwRh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhisat.128B")
+        },
+        "Vw_vdmpy_VhRh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vdmpyhsat")
+        },
+        "Vw_vdmpy_VhRh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhsat.128B")
+        },
+        "Vw_vdmpy_WhRuh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vdmpyhsuisat")
+        },
+        "Vw_vdmpy_WhRuh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhsuisat.128B")
+        },
+        "Vw_vdmpy_VhRuh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vdmpyhsusat")
+        },
+        "Vw_vdmpy_VhRuh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhsusat.128B")
+        },
+        "Vw_vdmpy_VhVh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vdmpyhvsat")
+        },
+        "Vw_vdmpy_VhVh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhvsat.128B")
+        },
+        "Vw_vdmpyacc_VwWwRh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x32, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vdmpyhisat_acc")
+        },
+        "Vw_vdmpyacc_VwWwRh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhisat_acc.128B")
+        },
+        "Wuw_vdsad_WuhRuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vdsaduh")
+        },
+        "Wuw_vdsad_WuhRuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x128, &::U32]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vdsaduh.128B")
+        },
+        "Wuw_vdsadacc_WuwWuhRuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U16x64, &::U32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vdsaduh.acc")
+        },
+        "Wuw_vdsadacc_WuwWuhRuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x64, &::U16x128, &::U32]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vdsaduh.acc.128B")
+        },
+        "Vw_vdmpyacc_VwVhRh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I16x32, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vdmpyhsat_acc")
+        },
+        "Vw_vdmpyacc_VwVhRh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhsat_acc.128B")
+        },
+        "Vw_vdmpyacc_VwWhRuh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I16x64, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vdmpyhsuisat_acc")
+        },
+        "Vw_vdmpyacc_VwWhRuh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x128, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhsuisat_acc.128B")
+        },
+        "Vw_vdmpyacc_VwVhRuh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I16x32, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vdmpyhsusat_acc")
+        },
+        "Vw_vdmpyacc_VwVhRuh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhsusat_acc.128B")
+        },
+        "Vw_vdmpyacc_VwVhVh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vdmpyhvsat_acc")
+        },
+        "Vw_vdmpyacc_VwVhVh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vdmpyhvsat_acc.128B")
+        },
+        "Q_vcmp_eq_VbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.veqb")
+        },
+        "Q_vcmp_eq_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.veqh")
+        },
+        "Q_vcmp_eq_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.veqw")
+        },
+        "Q_vcmp_eq_VbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.veqb.128B")
+        },
+        "Q_vcmp_eq_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.veqh.128B")
+        },
+        "Q_vcmp_eq_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.veqw.128B")
+        },
+        "Q_vcmp_eqand_QVbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.veqb.and")
+        },
+        "Q_vcmp_eqand_QVhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.veqh.and")
+        },
+        "Q_vcmp_eqand_QVwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.veqw.and")
+        },
+        "Q_vcmp_eqand_QVbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.veqb.and.128B")
+        },
+        "Q_vcmp_eqand_QVhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.veqh.and.128B")
+        },
+        "Q_vcmp_eqand_QVwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.veqw.and.128B")
+        },
+        "Q_vcmp_eqor_QVbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.veqb.or")
+        },
+        "Q_vcmp_eqor_QVhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.veqh.or")
+        },
+        "Q_vcmp_eqor_QVwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.veqw.or")
+        },
+        "Q_vcmp_eqor_QVbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.veqb.or.128B")
+        },
+        "Q_vcmp_eqor_QVhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.veqh.or.128B")
+        },
+        "Q_vcmp_eqor_QVwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.veqw.or.128B")
+        },
+        "Q_vcmp_eqxacc_QVbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.veqb.xor")
+        },
+        "Q_vcmp_eqxacc_QVhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.veqh.xor")
+        },
+        "Q_vcmp_eqxacc_QVwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.veqw.xor")
+        },
+        "Q_vcmp_eqxacc_QVbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.veqb.xor.128B")
+        },
+        "Q_vcmp_eqxacc_QVhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.veqh.xor.128B")
+        },
+        "Q_vcmp_eqxacc_QVwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.veqw.xor.128B")
+        },
+        "Q_vcmp_gt_VbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtb")
+        },
+        "Q_vcmp_gt_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgth")
+        },
+        "Q_vcmp_gt_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtw")
+        },
+        "Q_vcmp_gt_VbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtb.128B")
+        },
+        "Q_vcmp_gt_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgth.128B")
+        },
+        "Q_vcmp_gt_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtw.128B")
+        },
+        "Q_vcmp_gt_VubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtub")
+        },
+        "Q_vcmp_gt_VuhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtuh")
+        },
+        "Q_vcmp_gt_VubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtub.128B")
+        },
+        "Q_vcmp_gt_VuhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtuh.128B")
+        },
+        "Q_vcmp_gtand_QVbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtb.and")
+        },
+        "Q_vcmp_gtand_QVhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgth.and")
+        },
+        "Q_vcmp_gtand_QVwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtw.and")
+        },
+        "Q_vcmp_gtand_QVbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtb.and.128B")
+        },
+        "Q_vcmp_gtand_QVhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgth.and.128B")
+        },
+        "Q_vcmp_gtand_QVwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtw.and.128B")
+        },
+        "Q_vcmp_gtand_QVubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U8x64, &::U8x64]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtub.and")
+        },
+        "Q_vcmp_gtand_QVuhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U16x32, &::U16x32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtuh.and")
+        },
+        "Q_vcmp_gtand_QVubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U8x128, &::U8x128]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtub.and.128B")
+        },
+        "Q_vcmp_gtand_QVuhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U16x64, &::U16x64]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtuh.and.128B")
+        },
+        "Q_vcmp_gtor_QVbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtb.or")
+        },
+        "Q_vcmp_gtor_QVhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgth.or")
+        },
+        "Q_vcmp_gtor_QVwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtw.or")
+        },
+        "Q_vcmp_gtor_QVbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtb.or.128B")
+        },
+        "Q_vcmp_gtor_QVhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgth.or.128B")
+        },
+        "Q_vcmp_gtor_QVwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtw.or.128B")
+        },
+        "Q_vcmp_gtor_QVubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U8x64, &::U8x64]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtub.or")
+        },
+        "Q_vcmp_gtor_QVuhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U16x32, &::U16x32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtuh.or")
+        },
+        "Q_vcmp_gtor_QVubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U8x128, &::U8x128]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtub.or.128B")
+        },
+        "Q_vcmp_gtor_QVuhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U16x64, &::U16x64]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtuh.or.128B")
+        },
+        "Q_vcmp_gtxacc_QVbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtb.xor")
+        },
+        "Q_vcmp_gtxacc_QVhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgth.xor")
+        },
+        "Q_vcmp_gtxacc_QVwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtw.xor")
+        },
+        "Q_vcmp_gtxacc_QVbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtb.xor.128B")
+        },
+        "Q_vcmp_gtxacc_QVhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgth.xor.128B")
+        },
+        "Q_vcmp_gtxacc_QVwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtw.xor.128B")
+        },
+        "Q_vcmp_gtxacc_QVubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U8x64, &::U8x64]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtub.xor")
+        },
+        "Q_vcmp_gtxacc_QVuhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U16x32, &::U16x32]; &INPUTS },
+            output: &::U32x2,
+            definition: Named("llvm.hexagon.V6.vgtuh.xor")
+        },
+        "Q_vcmp_gtxacc_QVubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U8x128, &::U8x128]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtub.xor.128B")
+        },
+        "Q_vcmp_gtxacc_QVuhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U16x64, &::U16x64]; &INPUTS },
+            output: &::U32x4,
+            definition: Named("llvm.hexagon.V6.vgtuh.xor.128B")
+        },
+        "Vw_vinsert_VwR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vinsertwr")
+        },
+        "Vw_vinsert_VwR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vinsertwr.128B")
+        },
+        "Vuh_vlsr_VuhR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vlsrh")
+        },
+        "Vuw_vlsr_VuwR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x16, &::U32]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.vlsrw")
+        },
+        "Vuh_vlsr_VuhR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U32]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vlsrh.128B")
+        },
+        "Vuw_vlsr_VuwR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x32, &::U32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vlsrw.128B")
+        },
+        "Vh_vlsr_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vlsrhv")
+        },
+        "Vw_vlsr_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vlsrwv")
+        },
+        "Vh_vlsr_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vlsrhv.128B")
+        },
+        "Vw_vlsr_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vlsrwv.128B")
+        },
+        "Vb_vlut32_VbVbR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I8x64, &::I8x64, &::U32]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vlutvvb")
+        },
+        "Vb_vlut32_VbVbR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I8x128, &::I8x128, &::U32]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vlutvvb.128B")
+        },
+        "Wh_vlut16_VbVhR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I8x64, &::I16x32, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vlutvwh")
+        },
+        "Wh_vlut16_VbVhR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I8x128, &::I16x64, &::U32]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vlutvwh.128B")
+        },
+        "Vb_vlut32or_VbVbVbR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 4] = [&::I8x64, &::I8x64, &::I8x64, &::U32]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vlutvvb.oracc")
+        },
+        "Vb_vlut32or_VbVbVbR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 4] = [&::I8x128, &::I8x128, &::I8x128, &::U32]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vlutvvb.oracc.128B")
+        },
+        "Wh_vlut16or_WhVbVhR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 4] = [&::I16x64, &::I8x64, &::I16x32, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vlutvwh.oracc")
+        },
+        "Wh_vlut16or_WhVbVhR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 4] = [&::I16x128, &::I8x128, &::I16x64, &::U32]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vlutvwh.oracc.128B")
+        },
+        "Vh_vmax_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vmaxh")
+        },
+        "Vw_vmax_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmaxw")
+        },
+        "Vh_vmax_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmaxh.128B")
+        },
+        "Vw_vmax_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmaxw.128B")
+        },
+        "Vub_vmax_VubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vmaxub")
+        },
+        "Vuh_vmax_VuhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vmaxuh")
+        },
+        "Vub_vmax_VubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vmaxub.128B")
+        },
+        "Vuh_vmax_VuhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vmaxuh.128B")
+        },
+        "Vh_vmin_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vminh")
+        },
+        "Vw_vmin_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vminw")
+        },
+        "Vh_vmin_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vminh.128B")
+        },
+        "Vw_vmin_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vminw.128B")
+        },
+        "Vub_vmin_VubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vminub")
+        },
+        "Vuh_vmin_VuhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vminuh")
+        },
+        "Vub_vmin_VubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vminub.128B")
+        },
+        "Vuh_vmin_VuhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vminuh.128B")
+        },
+        "Wh_vmpa_WubRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpabus")
+        },
+        "Wh_vmpa_WubRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U32]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vmpabus.128B")
+        },
+        "Wh_vmpaacc_WhWubRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::U8x128, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpabus.acc")
+        },
+        "Wh_vmpaacc_WhWubRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::U8x256, &::U32]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vmpabus.acc.128B")
+        },
+        "Wh_vmpa_WubWb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::I8x128]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpabusv")
+        },
+        "Wh_vmpa_WubWub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpabuuv")
+        },
+        "Wh_vmpa_WubWb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::I8x256]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vmpabusv.128B")
+        },
+        "Wh_vmpa_WubWub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U8x256]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vmpabuuv.128B")
+        },
+        "Ww_vmpa_WhRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpahb")
+        },
+        "Ww_vmpa_WhRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::U32]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vmpahb.128B")
+        },
+        "Ww_vmpaacc_WwWhRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpahb.acc")
+        },
+        "Ww_vmpaacc_WwWhRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::I16x128, &::U32]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vmpahb.acc.128B")
+        },
+        "Wh_vmpy_VbVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::U8x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpybus")
+        },
+        "Ww_vmpy_VhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U16x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyhus")
+        },
+        "Wh_vmpy_VbVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::U8x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vmpybus.128B")
+        },
+        "Ww_vmpy_VhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U16x64]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vmpyhus.128B")
+        },
+        "Wh_vmpyacc_WhVbVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I8x64, &::U8x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpybus.acc")
+        },
+        "Ww_vmpyacc_WwVhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x32, &::U16x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyhus.acc")
+        },
+        "Wh_vmpyacc_WhVbVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::I8x128, &::U8x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vmpybus.acc.128B")
+        },
+        "Ww_vmpyacc_WwVhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::I16x64, &::U16x64]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vmpyhus.acc.128B")
+        },
+        "Wh_vmpy_VubVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::I8x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpybusv")
+        },
+        "Wh_vmpy_VubVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::I8x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vmpybusv.128B")
+        },
+        "Wh_vmpyacc_WhVubVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::U8x64, &::I8x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpybusv.acc")
+        },
+        "Wh_vmpyacc_WhVubVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::U8x128, &::I8x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vmpybusv.acc.128B")
+        },
+        "Wh_vmpy_VbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpybv")
+        },
+        "Wuh_vmpy_VubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vmpyubv")
+        },
+        "Ww_vmpy_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyhv")
+        },
+        "Wuw_vmpy_VuhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vmpyuhv")
+        },
+        "Wh_vmpy_VbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vmpybv.128B")
+        },
+        "Wuh_vmpy_VubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U16x128,
+            definition: Named("llvm.hexagon.V6.vmpyubv.128B")
+        },
+        "Ww_vmpy_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vmpyhv.128B")
+        },
+        "Wuw_vmpy_VuhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vmpyuhv.128B")
+        },
+        "Wh_vmpyacc_WhVbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I8x64, &::I8x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpybv.acc")
+        },
+        "Wuh_vmpyacc_WuhVubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U16x64, &::U8x64, &::U8x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vmpyubv.acc")
+        },
+        "Ww_vmpyacc_WwVhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyhv.acc")
+        },
+        "Wuw_vmpyacc_WuwVuhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U16x32, &::U16x32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vmpyuhv.acc")
+        },
+        "Wh_vmpyacc_WhVbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::I8x128, &::I8x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vmpybv.acc.128B")
+        },
+        "Wuh_vmpyacc_WuhVubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U16x128, &::U8x128, &::U8x128]; &INPUTS },
+            output: &::U16x128,
+            definition: Named("llvm.hexagon.V6.vmpyubv.acc.128B")
+        },
+        "Ww_vmpyacc_WwVhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vmpyhv.acc.128B")
+        },
+        "Wuw_vmpyacc_WuwVuhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x64, &::U16x64, &::U16x64]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vmpyuhv.acc.128B")
+        },
+        "Vw_vmpye_VwVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U16x32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyewuh")
+        },
+        "Vw_vmpye_VwVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U16x64]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyewuh.128B")
+        },
+        "Ww_vmpy_VhRh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyh")
+        },
+        "Wuw_vmpy_VuhRuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vmpyuh")
+        },
+        "Ww_vmpy_VhRh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vmpyh.128B")
+        },
+        "Wuw_vmpy_VuhRuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U32]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vmpyuh.128B")
+        },
+        "Ww_vmpyacc_WwVhRh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x32, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyhsat.acc")
+        },
+        "Ww_vmpyacc_WwVhRh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::I16x64, &::U32]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vmpyhsat.acc.128B")
+        },
+        "Vw_vmpy_VhRh_s1_rnd_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyhsrs")
+        },
+        "Vw_vmpy_VhRh_s1_rnd_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyhsrs.128B")
+        },
+        "Vw_vmpy_VhRh_s1_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyhss")
+        },
+        "Vw_vmpy_VhRh_s1_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyhss.128B")
+        },
+        "Vh_vmpy_VhVh_s1_rnd_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vmpyhvsrs")
+        },
+        "Vh_vmpy_VhVh_s1_rnd_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpyhvsrs.128B")
+        },
+        "Vw_vmpyieo_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyieoh")
+        },
+        "Vw_vmpyieo_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyieoh.128B")
+        },
+        "Vw_vmpyieacc_VwVwVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::I16x32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyiewh.acc")
+        },
+        "Vw_vmpyieacc_VwVwVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U16x32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyiewuh.acc")
+        },
+        "Vw_vmpyieacc_VwVwVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::I16x64]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyiewh.acc.128B")
+        },
+        "Vw_vmpyieacc_VwVwVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U16x64]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyiewuh.acc.128B")
+        },
+        "Vw_vmpyie_VwVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U16x32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyiewuh")
+        },
+        "Vw_vmpyie_VwVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U16x64]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyiewuh.128B")
+        },
+        "Vh_vmpyi_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vmpyih")
+        },
+        "Vh_vmpyi_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpyih.128B")
+        },
+        "Vh_vmpyiacc_VhVhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vmpyih.acc")
+        },
+        "Vh_vmpyiacc_VhVhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpyih.acc.128B")
+        },
+        "Vh_vmpyi_VhRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vmpyihb")
+        },
+        "Vw_vmpyi_VwRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyiwb")
+        },
+        "Vh_vmpyi_VhRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpyihb.128B")
+        },
+        "Vw_vmpyi_VwRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyiwb.128B")
+        },
+        "Vh_vmpyiacc_VhVhRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::I16x32, &::U32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vmpyihb.acc")
+        },
+        "Vw_vmpyiacc_VwVwRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyiwb.acc")
+        },
+        "Vh_vmpyiacc_VhVhRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I16x64, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vmpyihb.acc.128B")
+        },
+        "Vw_vmpyiacc_VwVwRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyiwb.acc.128B")
+        },
+        "Vw_vmpyi_VwRh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyiwh")
+        },
+        "Vw_vmpyi_VwRh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyiwh.128B")
+        },
+        "Vw_vmpyiacc_VwVwRh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyiwh.acc")
+        },
+        "Vw_vmpyiacc_VwVwRh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyiwh.acc.128B")
+        },
+        "Vw_vmpyi_VwRub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyiwub")
+        },
+        "Vw_vmpyi_VwRub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyiwub.128B")
+        },
+        "Vw_vmpyiacc_VwVwRub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyiwub.acc")
+        },
+        "Vw_vmpyiacc_VwVwRub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyiwub.acc.128B")
+        },
+        "Vw_vmpyo_VwVh_s1_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I16x32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyowh")
+        },
+        "Vw_vmpyo_VwVh_s1_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I16x64]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyowh.128B")
+        },
+        "Vw_vmpyo_VwVh_s1_rnd_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I16x32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyowh.rnd")
+        },
+        "Vw_vmpyo_VwVh_s1_rnd_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I16x64]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyowh.rnd.128B")
+        },
+        "Vw_vmpyo_VwVh_s1_rnd_sat_shift64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I16x32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyowh.rnd.sacc")
+        },
+        "Vw_vmpyo_VwVh_s1_rnd_sat_shift128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I16x64]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyowh.rnd.sacc.128B")
+        },
+        "Vw_vmpyo_VwVh_s1_sat_shift64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I16x32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyowh.sacc")
+        },
+        "Vw_vmpyo_VwVh_s1_sat_shift128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I16x64]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyowh.sacc.128B")
+        },
+        "Vw_vmpyio_VwVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I16x32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vmpyiowh")
+        },
+        "Vw_vmpyio_VwVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I16x64]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vmpyiowh.128B")
+        },
+        "Wuh_vmpy_VubRub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U32]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vmpyub")
+        },
+        "Wuh_vmpy_VubRub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS },
+            output: &::U16x128,
+            definition: Named("llvm.hexagon.V6.vmpyub.128B")
+        },
+        "Wuh_vmpyacc_WuhVubRub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U16x64, &::U8x64, &::U32]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vmpyub.acc")
+        },
+        "Wuw_vmpyacc_WuwVuhRuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U16x32, &::U32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vmpyuh.acc")
+        },
+        "Wuh_vmpyacc_WuhVubRub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U16x128, &::U8x128, &::U32]; &INPUTS },
+            output: &::U16x128,
+            definition: Named("llvm.hexagon.V6.vmpyub.acc.128B")
+        },
+        "Wuw_vmpyacc_WuwVuhRuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x64, &::U16x64, &::U32]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vmpyuh.acc.128B")
+        },
+        "Vuw_vmux_QVV64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U32x16, &::U32x16]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.vmux")
+        },
+        "Vuw_vmux_QVV128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U32x32, &::U32x32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vmux.128B")
+        },
+        "Vh_vnavg_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vnavgh")
+        },
+        "Vuh_vnavg_VuhVuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vnavguh")
+        },
+        "Vw_vnavg_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vnavgw")
+        },
+        "Vuw_vnavg_VuwVuw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x16, &::U32x16]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.vnavguw")
+        },
+        "Vh_vnavg_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vnavgh.128B")
+        },
+        "Vuh_vnavg_VuhVuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vnavguh.128B")
+        },
+        "Vw_vnavg_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vnavgw.128B")
+        },
+        "Vuw_vnavg_VuwVuw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U32x32, &::U32x32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vnavguw.128B")
+        },
+        "Vub_vnavg_VubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vnavgub")
+        },
+        "Vub_vnavg_VubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vnavgub.128B")
+        },
+        "Vh_vnormamt_Vh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vnormamth")
+        },
+        "Vw_vnormamt_Vw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vnormamtw")
+        },
+        "Vh_vnormamt_Vh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vnormamth.128B")
+        },
+        "Vw_vnormamt_Vw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vnormamtw.128B")
+        },
+        "V_vnot_VV64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vnot")
+        },
+        "V_vnot_VV128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vnot.128B")
+        },
+        "V_vor_VV64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vor")
+        },
+        "V_vor_VV128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vor.128B")
+        },
+        "Vb_vpacke_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vpackhe")
+        },
+        "Vh_vpacke_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vpackwe")
+        },
+        "Vb_vpacke_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vpackhe.128B")
+        },
+        "Vh_vpacke_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vpackwe.128B")
+        },
+        "Vb_vpacko_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vpackho")
+        },
+        "Vh_vpacko_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vpackwo")
+        },
+        "Vb_vpacko_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vpackho.128B")
+        },
+        "Vh_vpacko_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vpackwo.128B")
+        },
+        "Vb_vpack_VhVh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vpackhb.sat")
+        },
+        "Vub_vpack_VhVh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vpackhub.sat")
+        },
+        "Vh_vpack_VwVw_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vpackwh.sat")
+        },
+        "Vuh_vpack_VwVw_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vpackwuh.sat")
+        },
+        "Vb_vpack_VhVh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vpackhb.sat.128B")
+        },
+        "Vub_vpack_VhVh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vpackhub.sat.128B")
+        },
+        "Vh_vpack_VwVw_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vpackwh.sat.128B")
+        },
+        "Vuh_vpack_VwVw_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vpackwuh.sat.128B")
+        },
+        "Vh_vpopcount_Vh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vpopcounth")
+        },
+        "Vh_vpopcount_Vh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vpopcounth.128B")
+        },
+        "V_vrdelta_VV64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vrdelta")
+        },
+        "V_vrdelta_VV128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vrdelta.128B")
+        },
+        "Vw_vrmpy_VubRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vrmpybus")
+        },
+        "Vw_vrmpy_VubRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vrmpybus.128B")
+        },
+        "Vw_vrmpyacc_VwVubRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::U8x64, &::U32]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vrmpybus.acc")
+        },
+        "Vw_vrmpyacc_VwVubRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::U8x128, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vrmpybus.acc.128B")
+        },
+        "Ww_vrmpy_WubRbI64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vrmpybusi")
+        },
+        "Ww_vrmpy_WubRbI128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U32]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vrmpybusi.128B")
+        },
+        "Ww_vrmpyacc_WwWubRbI64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::U8x128, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vrmpybusi.acc")
+        },
+        "Ww_vrmpyacc_WwWubRbI128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::U8x256, &::U32]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vrmpybusi.acc.128B")
+        },
+        "Vw_vrmpy_VubVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::I8x64]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vrmpybusv")
+        },
+        "Vw_vrmpy_VubVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::I8x128]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vrmpybusv.128B")
+        },
+        "Vw_vrmpyacc_VwVubVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::U8x64, &::I8x64]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vrmpybusv.acc")
+        },
+        "Vw_vrmpyacc_VwVubVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::U8x128, &::I8x128]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vrmpybusv.acc.128B")
+        },
+        "Vw_vrmpy_VbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vrmpybv")
+        },
+        "Vuw_vrmpy_VubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.vrmpyubv")
+        },
+        "Vw_vrmpy_VbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vrmpybv.128B")
+        },
+        "Vuw_vrmpy_VubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vrmpyubv.128B")
+        },
+        "Vw_vrmpyacc_VwVbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I8x64, &::I8x64]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vrmpywv.acc")
+        },
+        "Vuw_vrmpyacc_VuwVubVub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x16, &::U8x64, &::U8x64]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.vrmpyuwv.acc")
+        },
+        "Vw_vrmpyacc_VwVbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I8x128, &::I8x128]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vrmpywv.acc.128B")
+        },
+        "Vuw_vrmpyacc_VuwVubVub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U8x128, &::U8x128]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vrmpyuwv.acc.128B")
+        },
+        "Vuw_vrmpy_VubRub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U32]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.vrmpyub")
+        },
+        "Vuw_vrmpy_VubRub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vrmpyub.128B")
+        },
+        "Vuw_vrmpyacc_VuwVubRub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x16, &::U8x64, &::U32]; &INPUTS },
+            output: &::U32x16,
+            definition: Named("llvm.hexagon.V6.vrmpyub.acc")
+        },
+        "Vuw_vrmpyacc_VuwVubRub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U8x128, &::U32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vrmpyub.acc.128B")
+        },
+        "Wuw_vrmpy_WubRubI64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vrmpyubi")
+        },
+        "Wuw_vrmpy_WubRubI128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U32]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vrmpyubi.128B")
+        },
+        "Wuw_vrmpyacc_WuwWubRubI64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U8x128, &::U32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vrmpyubi.acc")
+        },
+        "Wuw_vrmpyacc_WuwWubRubI128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x64, &::U8x256, &::U32]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vrmpyubi.acc.128B")
+        },
+        "V_vror_VR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U32]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vror")
+        },
+        "V_vror_VR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vror.128B")
+        },
+        "Vb_vround_VhVh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vroundhb")
+        },
+        "Vub_vround_VhVh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vroundhub")
+        },
+        "Vh_vround_VwVw_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vroundwh")
+        },
+        "Vuh_vround_VwVw_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vroundwuh")
+        },
+        "Vb_vround_VhVh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vroundhb.128B")
+        },
+        "Vub_vround_VhVh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vroundhub.128B")
+        },
+        "Vh_vround_VwVw_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vroundwh.128B")
+        },
+        "Vuh_vround_VwVw_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vroundwuh.128B")
+        },
+        "Wuw_vrsad_WubRubI64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vrsadubi")
+        },
+        "Wuw_vrsad_WubRubI128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U32]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vrsadubi.128B")
+        },
+        "Wuw_vrsadacc_WuwWubRubI64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U8x128, &::U32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vrsadubi.acc")
+        },
+        "Wuw_vrsadacc_WuwWubRubI128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x64, &::U8x256, &::U32]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vrsadubi.acc.128B")
+        },
+        "Vub_vsat_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vsathub")
+        },
+        "Vub_vsat_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vsathub.128B")
+        },
+        "Vh_vsat_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vsatwh")
+        },
+        "Vh_vsat_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vsatwh.128B")
+        },
+        "Wh_vsxt_Vb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I8x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vsb")
+        },
+        "Ww_vsxt_Vh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vsh")
+        },
+        "Wh_vsxt_Vb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I8x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vsb.128B")
+        },
+        "Ww_vsxt_Vh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vsh.128B")
+        },
+        "Wuh_vzxt_Vub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U8x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vzb")
+        },
+        "Wuw_vzxt_Vuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U16x32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vzh")
+        },
+        "Wuh_vzxt_Vub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U8x128]; &INPUTS },
+            output: &::U16x128,
+            definition: Named("llvm.hexagon.V6.vzb.128B")
+        },
+        "Wuw_vzxt_Vuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U16x64]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vzh.128B")
+        },
+        "Vb_condacc_QVbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vaddbq")
+        },
+        "Vh_condacc_QVhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vaddhq")
+        },
+        "Vw_condacc_QVwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vaddwq")
+        },
+        "Vb_condacc_QVbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vaddbq.128B")
+        },
+        "Vh_condacc_QVhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vaddhq.128B")
+        },
+        "Vw_condacc_QVwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vaddwq.128B")
+        },
+        "Vb_condacc_QnVbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vaddbnq")
+        },
+        "Vh_condacc_QnVhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vaddhnq")
+        },
+        "Vw_condacc_QnVwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vaddwnq")
+        },
+        "Vb_condacc_QnVbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vaddbnq.128B")
+        },
+        "Vh_condacc_QnVhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vaddhnq.128B")
+        },
+        "Vw_condacc_QnVwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vaddwnq.128B")
+        },
+        "Vb_condnac_QVbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vsubbq")
+        },
+        "Vh_condnac_QVhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vsubhq")
+        },
+        "Vw_condnac_QVwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vsubwq")
+        },
+        "Vb_condnac_QVbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vsubbq.128B")
+        },
+        "Vh_condnac_QVhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vsubhq.128B")
+        },
+        "Vw_condnac_QVwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vsubwq.128B")
+        },
+        "Vb_condnac_QnVbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vsubbnq")
+        },
+        "Vh_condnac_QnVhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vsubhnq")
+        },
+        "Vw_condnac_QnVwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vsubwnq")
+        },
+        "Vb_condnac_QnVbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vsubbnq.128B")
+        },
+        "Vh_condnac_QnVhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vsubhnq.128B")
+        },
+        "Vw_condnac_QnVwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vsubwnq.128B")
+        },
+        "Vh_vshuffe_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vshufeh")
+        },
+        "Vh_vshuffe_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vshufeh.128B")
+        },
+        "Vh_vshuffo_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vshufoh")
+        },
+        "Vh_vshuffo_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vshufoh.128B")
+        },
+        "Vb_vshuff_Vb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I8x64]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vshuffb")
+        },
+        "Vh_vshuff_Vh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vshuffh")
+        },
+        "Vb_vshuff_Vb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vshuffb.128B")
+        },
+        "Vh_vshuff_Vh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vshuffh.128B")
+        },
+        "Vb_vshuffe_VbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vshuffeb")
+        },
+        "Vb_vshuffe_VbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vshuffeb.128B")
+        },
+        "Vb_vshuffo_VbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vshuffob")
+        },
+        "Vb_vshuffo_VbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vshuffob.128B")
+        },
+        "Vb_vshuffoe_VbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vshuffoeb")
+        },
+        "Vh_vshuffoe_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vshuffoeh")
+        },
+        "Vb_vshuffoe_VbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vshuffoeb.128B")
+        },
+        "Vh_vshuffoe_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vshuffoeh.128B")
+        },
+        "W_vshuff_VVR64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U8x64, &::U32]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vshufvvd")
+        },
+        "W_vshuff_VVR128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U8x128, &::U32]; &INPUTS },
+            output: &::U8x256,
+            definition: Named("llvm.hexagon.V6.vshufvvd.128B")
+        },
+        "Vb_vsub_VbVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS },
+            output: &::I8x64,
+            definition: Named("llvm.hexagon.V6.vsubb")
+        },
+        "Vh_vsub_VhVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vsubh")
+        },
+        "Vw_vsub_VwVw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vsubw")
+        },
+        "Vb_vsub_VbVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vsubb.128B")
+        },
+        "Vh_vsub_VhVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vsubh.128B")
+        },
+        "Vw_vsub_VwVw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vsubw.128B")
+        },
+        "Vh_vsub_VhVh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS },
+            output: &::I16x32,
+            definition: Named("llvm.hexagon.V6.vsubhsat")
+        },
+        "Vw_vsub_VwVw_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS },
+            output: &::I32x16,
+            definition: Named("llvm.hexagon.V6.vsubwsat")
+        },
+        "Vh_vsub_VhVh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vsubhsat.128B")
+        },
+        "Vw_vsub_VwVw_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vsubwsat.128B")
+        },
+        "Vub_vsub_VubVub_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS },
+            output: &::U8x64,
+            definition: Named("llvm.hexagon.V6.vsububsat")
+        },
+        "Vuh_vsub_VuhVuh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vsubuhsat")
+        },
+        "Vub_vsub_VubVub_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vsububsat.128B")
+        },
+        "Vuh_vsub_VuhVuh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vsubuhsat.128B")
+        },
+        "Wb_vsub_WbWb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS },
+            output: &::I8x128,
+            definition: Named("llvm.hexagon.V6.vsubb.dv")
+        },
+        "Wh_vsub_WhWh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vsubh.dv")
+        },
+        "Ww_vsub_WwWw64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vsubw.dv")
+        },
+        "Wb_vsub_WbWb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x256, &::I8x256]; &INPUTS },
+            output: &::I8x256,
+            definition: Named("llvm.hexagon.V6.vsubb.dv.128B")
+        },
+        "Wh_vsub_WhWh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::I16x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vsubh.dv.128B")
+        },
+        "Ww_vsub_WwWw128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x64, &::I32x64]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vsubw.dv.128B")
+        },
+        "Wh_vsub_WhWh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vsubhsat.dv")
+        },
+        "Ww_vsub_WwWw_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vsubwsat.dv")
+        },
+        "Wh_vsub_WhWh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::I16x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vsubhsat.dv.128B")
+        },
+        "Ww_vsub_WwWw_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x64, &::I32x64]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vsubwsat.dv.128B")
+        },
+        "Wub_vsub_WubWub_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vsububsat.dv")
+        },
+        "Wuh_vsub_WuhWuh_sat64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vsubuhsat.dv")
+        },
+        "Wub_vsub_WubWub_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U8x256]; &INPUTS },
+            output: &::U8x256,
+            definition: Named("llvm.hexagon.V6.vsububsat.dv.128B")
+        },
+        "Wuh_vsub_WuhWuh_sat128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x128, &::U16x128]; &INPUTS },
+            output: &::U16x128,
+            definition: Named("llvm.hexagon.V6.vsubuhsat.dv.128B")
+        },
+        "W_vswap_QVV64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U8x64, &::U8x64]; &INPUTS },
+            output: &::U8x128,
+            definition: Named("llvm.hexagon.V6.vswap")
+        },
+        "W_vswap_QVV128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U8x128, &::U8x128]; &INPUTS },
+            output: &::U8x256,
+            definition: Named("llvm.hexagon.V6.vswap.128B")
+        },
+        "Wh_vtmpy_WbRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vtmpyb")
+        },
+        "Wh_vtmpy_WbRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I8x256, &::U32]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vtmpyb.128B")
+        },
+        "Wh_vtmpyacc_WhWbRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I8x128, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vtmpyb.acc")
+        },
+        "Wh_vtmpyacc_WhWbRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::I8x256, &::U32]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vtmpyb.acc.128B")
+        },
+        "Wh_vtmpy_WubRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vtmpybus")
+        },
+        "Wh_vtmpy_WubRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U32]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vtmpybus.128B")
+        },
+        "Wh_vtmpyacc_WhWubRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::U8x128, &::U32]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vtmpybus.acc")
+        },
+        "Wh_vtmpyacc_WhWubRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::U8x256, &::U32]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vtmpybus.acc.128B")
+        },
+        "Ww_vtmpy_WhRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vtmpyhb")
+        },
+        "Ww_vtmpy_WhRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::U32]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vtmpyhb.128B")
+        },
+        "Wh_vunpack_Vb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I8x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vunpackb")
+        },
+        "Wuh_vunpack_Vub64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U8x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vunpackub")
+        },
+        "Ww_vunpack_Vh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vunpackh")
+        },
+        "Wuw_vunpack_Vuh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U16x32]; &INPUTS },
+            output: &::U32x32,
+            definition: Named("llvm.hexagon.V6.vunpackuh")
+        },
+        "Wh_vunpack_Vb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I8x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vunpackb.128B")
+        },
+        "Wuh_vunpack_Vub128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U8x128]; &INPUTS },
+            output: &::U16x128,
+            definition: Named("llvm.hexagon.V6.vunpackub.128B")
+        },
+        "Ww_vunpack_Vh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vunpackh.128B")
+        },
+        "Wuw_vunpack_Vuh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 1] = [&::U16x64]; &INPUTS },
+            output: &::U32x64,
+            definition: Named("llvm.hexagon.V6.vunpackuh.128B")
+        },
+        "Wh_vunpackoor_WhVb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I8x64]; &INPUTS },
+            output: &::I16x64,
+            definition: Named("llvm.hexagon.V6.vunpackob")
+        },
+        "Ww_vunpackoor_WwVh64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I16x32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vunpackoh")
+        },
+        "Wh_vunpackoor_WhVb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::I8x128]; &INPUTS },
+            output: &::I16x128,
+            definition: Named("llvm.hexagon.V6.vunpackob.128B")
+        },
+        "Ww_vunpackoor_WwVh128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::I32x64, &::I16x64]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vunpackoh.128B")
+        },
+        "Ww_vtmpyacc_WwWhRb64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::U32]; &INPUTS },
+            output: &::I32x32,
+            definition: Named("llvm.hexagon.V6.vtmpyhb.acc")
+        },
+        "Ww_vtmpyacc_WwWhRb128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::I16x128, &::U32]; &INPUTS },
+            output: &::I32x64,
+            definition: Named("llvm.hexagon.V6.vtmpyhb.acc.128B")
+        },
+        "V_vxor_VV64" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS },
+            output: &::U16x32,
+            definition: Named("llvm.hexagon.V6.vxor")
+        },
+        "V_vxor_VV128" => Intrinsic {
+            inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS },
+            output: &::U16x64,
+            definition: Named("llvm.hexagon.V6.vxor.128B")
+        },
+        _ => return None,
+    })
+}
index 296c133115f4eadd0e7e1cc1eda194ec47b1461a..dd2d60a1d22d6492dcb98729f1ae7254727d73be 100644 (file)
@@ -29,7 +29,7 @@ pub enum Type {
     Integer(/* signed */ bool, u8, /* llvm width */ u8),
     Float(u8),
     Pointer(&'static Type, Option<&'static Type>, /* const */ bool),
-    Vector(&'static Type, Option<&'static Type>, u8),
+    Vector(&'static Type, Option<&'static Type>, u16),
     Aggregate(bool, &'static [&'static Type]),
 }
 
@@ -56,6 +56,12 @@ pub enum IntrinsicDef {
 static U8x16: Type = Type::Vector(&U8, None, 16);
 static I8x32: Type = Type::Vector(&I8, None, 32);
 static U8x32: Type = Type::Vector(&U8, None, 32);
+static I8x64: Type = Type::Vector(&I8, None, 64);
+static U8x64: Type = Type::Vector(&U8, None, 64);
+static I8x128: Type = Type::Vector(&I8, None, 128);
+static U8x128: Type = Type::Vector(&U8, None, 128);
+static I8x256: Type = Type::Vector(&I8, None, 256);
+static U8x256: Type = Type::Vector(&U8, None, 256);
 
 static I16x4: Type = Type::Vector(&I16, None, 4);
 static U16x4: Type = Type::Vector(&U16, None, 4);
@@ -63,6 +69,12 @@ pub enum IntrinsicDef {
 static U16x8: Type = Type::Vector(&U16, None, 8);
 static I16x16: Type = Type::Vector(&I16, None, 16);
 static U16x16: Type = Type::Vector(&U16, None, 16);
+static I16x32: Type = Type::Vector(&I16, None, 32);
+static U16x32: Type = Type::Vector(&U16, None, 32);
+static I16x64: Type = Type::Vector(&I16, None, 64);
+static U16x64: Type = Type::Vector(&U16, None, 64);
+static I16x128: Type = Type::Vector(&I16, None, 128);
+static U16x128: Type = Type::Vector(&U16, None, 128);
 
 static I32x2: Type = Type::Vector(&I32, None, 2);
 static U32x2: Type = Type::Vector(&U32, None, 2);
@@ -70,6 +82,12 @@ pub enum IntrinsicDef {
 static U32x4: Type = Type::Vector(&U32, None, 4);
 static I32x8: Type = Type::Vector(&I32, None, 8);
 static U32x8: Type = Type::Vector(&U32, None, 8);
+static I32x16: Type = Type::Vector(&I32, None, 16);
+static U32x16: Type = Type::Vector(&U32, None, 16);
+static I32x32: Type = Type::Vector(&I32, None, 32);
+static U32x32: Type = Type::Vector(&U32, None, 32);
+static I32x64: Type = Type::Vector(&I32, None, 64);
+static U32x64: Type = Type::Vector(&U32, None, 64);
 
 static I64x1: Type = Type::Vector(&I64, None, 1);
 static U64x1: Type = Type::Vector(&U64, None, 1);
@@ -96,6 +114,7 @@ pub enum IntrinsicDef {
 mod arm;
 mod aarch64;
 mod nvptx;
+mod hexagon;
 
 impl Intrinsic {
     pub fn find(name: &str) -> Option<Intrinsic> {
@@ -107,6 +126,8 @@ pub fn find(name: &str) -> Option<Intrinsic> {
             aarch64::find(name)
         } else if name.starts_with("nvptx_") {
             nvptx::find(name)
+        } else if name.starts_with("Q6_") {
+            hexagon::find(name)
         } else {
             None
         }
index 82c91727293eddec09cc30f3b8ba3605f69b46ec..f63102433c1e6d5a6a51c2e0ea1ec65a1171694c 100644 (file)
@@ -433,7 +433,7 @@ fn check_field(&mut self, span: Span, def: &'tcx ty::AdtDef, field: &'tcx ty::Fi
         if !def.is_enum() && !field.vis.is_accessible_from(self.current_item, self.tcx) {
             struct_span_err!(self.tcx.sess, span, E0451, "field `{}` of {} `{}` is private",
                              field.name, def.variant_descr(), self.tcx.item_path_str(def.did))
-                .span_label(span, &format!("field `{}` is private", field.name))
+                .span_label(span, format!("field `{}` is private", field.name))
                 .emit();
         }
     }
@@ -926,7 +926,7 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
                     if self.has_pub_restricted || self.has_old_errors {
                         let mut err = struct_span_err!(self.tcx.sess, self.span, E0446,
                             "private type `{}` in public interface", ty);
-                        err.span_label(self.span, &format!("can't leak private type"));
+                        err.span_label(self.span, "can't leak private type");
                         err.emit();
                     } else {
                         self.tcx.sess.add_lint(lint::builtin::PRIVATE_IN_PUBLIC,
@@ -961,7 +961,7 @@ fn visit_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>) -> bool {
                 if self.has_pub_restricted || self.has_old_errors {
                     struct_span_err!(self.tcx.sess, self.span, E0445,
                                      "private trait `{}` in public interface", trait_ref)
-                        .span_label(self.span, &format!(
+                        .span_label(self.span, format!(
                                     "private trait can't be public"))
                         .emit();
                 } else {
index a4e9a8be49f4516670466e344e1898d62834a5da..ac556270886ac677dcb0247c2791345f6348e59b 100644 (file)
@@ -183,7 +183,7 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
                                            E0401,
                                            "can't use type parameters from outer function; \
                                            try using a local type parameter instead");
-            err.span_label(span, &format!("use of type variable from outer function"));
+            err.span_label(span, "use of type variable from outer function");
             err
         }
         ResolutionError::OuterTypeParameterContext => {
@@ -199,8 +199,8 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
                                             "the name `{}` is already used for a type parameter \
                                             in this type parameter list",
                                             name);
-             err.span_label(span, &format!("already used"));
-             err.span_label(first_use_span.clone(), &format!("first use of `{}`", name));
+             err.span_label(span, "already used");
+             err.span_label(first_use_span.clone(), format!("first use of `{}`", name));
              err
         }
         ResolutionError::MethodNotMemberOfTrait(method, trait_) => {
@@ -210,7 +210,7 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
                                            "method `{}` is not a member of trait `{}`",
                                            method,
                                            trait_);
-            err.span_label(span, &format!("not a member of trait `{}`", trait_));
+            err.span_label(span, format!("not a member of trait `{}`", trait_));
             err
         }
         ResolutionError::TypeNotMemberOfTrait(type_, trait_) => {
@@ -220,7 +220,7 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
                              "type `{}` is not a member of trait `{}`",
                              type_,
                              trait_);
-            err.span_label(span, &format!("not a member of trait `{}`", trait_));
+            err.span_label(span, format!("not a member of trait `{}`", trait_));
             err
         }
         ResolutionError::ConstNotMemberOfTrait(const_, trait_) => {
@@ -230,7 +230,7 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
                              "const `{}` is not a member of trait `{}`",
                              const_,
                              trait_);
-            err.span_label(span, &format!("not a member of trait `{}`", trait_));
+            err.span_label(span, format!("not a member of trait `{}`", trait_));
             err
         }
         ResolutionError::VariableNotBoundInPattern(binding_error) => {
@@ -239,11 +239,11 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
             let msg = format!("variable `{}` is not bound in all patterns", binding_error.name);
             let mut err = resolver.session.struct_span_err_with_code(msp, &msg, "E0408");
             for sp in target_sp {
-                err.span_label(sp, &format!("pattern doesn't bind `{}`", binding_error.name));
+                err.span_label(sp, format!("pattern doesn't bind `{}`", binding_error.name));
             }
             let origin_sp = binding_error.origin.iter().map(|x| *x).collect::<Vec<_>>();
             for sp in origin_sp {
-                err.span_label(sp, &"variable not in all patterns");
+                err.span_label(sp, "variable not in all patterns");
             }
             err
         }
@@ -255,8 +255,8 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
                              "variable `{}` is bound in inconsistent \
                              ways within the same match arm",
                              variable_name);
-            err.span_label(span, &format!("bound in different ways"));
-            err.span_label(first_binding_span, &format!("first binding"));
+            err.span_label(span, "bound in different ways");
+            err.span_label(first_binding_span, "first binding");
             err
         }
         ResolutionError::IdentifierBoundMoreThanOnceInParameterList(identifier) => {
@@ -265,7 +265,7 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
                              E0415,
                              "identifier `{}` is bound more than once in this parameter list",
                              identifier);
-            err.span_label(span, &format!("used as parameter more than once"));
+            err.span_label(span, "used as parameter more than once");
             err
         }
         ResolutionError::IdentifierBoundMoreThanOnceInSamePattern(identifier) => {
@@ -274,7 +274,7 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
                              E0416,
                              "identifier `{}` is bound more than once in the same pattern",
                              identifier);
-            err.span_label(span, &format!("used in a pattern more than once"));
+            err.span_label(span, "used in a pattern more than once");
             err
         }
         ResolutionError::UndeclaredLabel(name) => {
@@ -283,7 +283,7 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
                                            E0426,
                                            "use of undeclared label `{}`",
                                            name);
-            err.span_label(span, &format!("undeclared label `{}`",&name));
+            err.span_label(span, format!("undeclared label `{}`", name));
             err
         }
         ResolutionError::SelfImportsOnlyAllowedWithin => {
@@ -313,14 +313,14 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
             };
             let mut err = struct_span_err!(resolver.session, span, E0432, "{}", msg);
             if let Some((_, p)) = name {
-                err.span_label(span, &p);
+                err.span_label(span, p);
             }
             err
         }
         ResolutionError::FailedToResolve(msg) => {
             let mut err = struct_span_err!(resolver.session, span, E0433,
                                            "failed to resolve. {}", msg);
-            err.span_label(span, &msg);
+            err.span_label(span, msg);
             err
         }
         ResolutionError::CannotCaptureDynamicEnvironmentInFnItem => {
@@ -336,7 +336,7 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
                              span,
                              E0435,
                              "attempt to use a non-constant value in a constant");
-            err.span_label(span, &format!("non-constant used with constant"));
+            err.span_label(span, "non-constant used with constant");
             err
         }
         ResolutionError::BindingShadowsSomethingUnacceptable(what_binding, name, binding) => {
@@ -345,9 +345,9 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
                                            span,
                                            E0530,
                                            "{}s cannot shadow {}s", what_binding, shadows_what);
-            err.span_label(span, &format!("cannot be named the same as a {}", shadows_what));
+            err.span_label(span, format!("cannot be named the same as a {}", shadows_what));
             let participle = if binding.is_import() { "imported" } else { "defined" };
-            let msg = &format!("a {} `{}` is {} here", shadows_what, name, participle);
+            let msg = format!("a {} `{}` is {} here", shadows_what, name, participle);
             err.span_label(binding.span, msg);
             err
         }
@@ -355,7 +355,7 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
             let mut err = struct_span_err!(resolver.session, span, E0128,
                                            "type parameters with a default cannot use \
                                             forward declared identifiers");
-            err.span_label(span, &format!("defaulted type parameters \
+            err.span_label(span, format!("defaulted type parameters \
                                            cannot be forward declared"));
             err
         }
@@ -2256,13 +2256,13 @@ fn smart_resolve_path_fragment(&mut self,
             if is_self_type(path, ns) {
                 __diagnostic_used!(E0411);
                 err.code("E0411".into());
-                err.span_label(span, &format!("`Self` is only available in traits and impls"));
+                err.span_label(span, "`Self` is only available in traits and impls");
                 return err;
             }
             if is_self_value(path, ns) {
                 __diagnostic_used!(E0424);
                 err.code("E0424".into());
-                err.span_label(span, &format!("`self` value is only available in \
+                err.span_label(span, format!("`self` value is only available in \
                                                methods with `self` parameter"));
                 return err;
             }
@@ -2294,18 +2294,18 @@ fn smart_resolve_path_fragment(&mut self,
                     let self_is_available = this.self_value_is_available(path[0].ctxt);
                     match candidate {
                         AssocSuggestion::Field => {
-                            err.span_label(span, &format!("did you mean `self.{}`?", path_str));
+                            err.span_label(span, format!("did you mean `self.{}`?", path_str));
                             if !self_is_available {
-                                err.span_label(span, &format!("`self` value is only available in \
+                                err.span_label(span, format!("`self` value is only available in \
                                                                methods with `self` parameter"));
                             }
                         }
                         AssocSuggestion::MethodWithSelf if self_is_available => {
-                            err.span_label(span, &format!("did you mean `self.{}(...)`?",
+                            err.span_label(span, format!("did you mean `self.{}(...)`?",
                                                            path_str));
                         }
                         AssocSuggestion::MethodWithSelf | AssocSuggestion::AssocItem => {
-                            err.span_label(span, &format!("did you mean `Self::{}`?", path_str));
+                            err.span_label(span, format!("did you mean `Self::{}`?", path_str));
                         }
                     }
                     return err;
@@ -2316,7 +2316,7 @@ fn smart_resolve_path_fragment(&mut self,
 
             // Try Levenshtein.
             if let Some(candidate) = this.lookup_typo_candidate(path, ns, is_expected) {
-                err.span_label(ident_span, &format!("did you mean `{}`?", candidate));
+                err.span_label(ident_span, format!("did you mean `{}`?", candidate));
                 levenshtein_worked = true;
             }
 
@@ -2324,21 +2324,21 @@ fn smart_resolve_path_fragment(&mut self,
             if let Some(def) = def {
                 match (def, source) {
                     (Def::Macro(..), _) => {
-                        err.span_label(span, &format!("did you mean `{}!(...)`?", path_str));
+                        err.span_label(span, format!("did you mean `{}!(...)`?", path_str));
                         return err;
                     }
                     (Def::TyAlias(..), PathSource::Trait) => {
-                        err.span_label(span, &format!("type aliases cannot be used for traits"));
+                        err.span_label(span, "type aliases cannot be used for traits");
                         return err;
                     }
                     (Def::Mod(..), PathSource::Expr(Some(parent))) => match parent.node {
                         ExprKind::Field(_, ident) => {
-                            err.span_label(parent.span, &format!("did you mean `{}::{}`?",
+                            err.span_label(parent.span, format!("did you mean `{}::{}`?",
                                                                  path_str, ident.node));
                             return err;
                         }
                         ExprKind::MethodCall(ident, ..) => {
-                            err.span_label(parent.span, &format!("did you mean `{}::{}(...)`?",
+                            err.span_label(parent.span, format!("did you mean `{}::{}(...)`?",
                                                                  path_str, ident.node));
                             return err;
                         }
@@ -2349,12 +2349,12 @@ fn smart_resolve_path_fragment(&mut self,
                             if let Some((ctor_def, ctor_vis))
                                     = this.struct_constructors.get(&def_id).cloned() {
                                 if is_expected(ctor_def) && !this.is_accessible(ctor_vis) {
-                                    err.span_label(span, &format!("constructor is not visible \
+                                    err.span_label(span, format!("constructor is not visible \
                                                                    here due to private fields"));
                                 }
                             }
                         }
-                        err.span_label(span, &format!("did you mean `{} {{ /* fields */ }}`?",
+                        err.span_label(span, format!("did you mean `{} {{ /* fields */ }}`?",
                                                        path_str));
                         return err;
                     }
@@ -2364,7 +2364,7 @@ fn smart_resolve_path_fragment(&mut self,
 
             // Fallback label.
             if !levenshtein_worked {
-                err.span_label(base_span, &fallback_label);
+                err.span_label(base_span, fallback_label);
             }
             err
         };
@@ -3374,9 +3374,9 @@ fn report_conflict(&mut self,
             },
         };
 
-        err.span_label(span, &format!("`{}` already {}", name, participle));
+        err.span_label(span, format!("`{}` already {}", name, participle));
         if old_binding.span != syntax_pos::DUMMY_SP {
-            err.span_label(old_binding.span, &format!("previous {} of `{}` here", noun, name));
+            err.span_label(old_binding.span, format!("previous {} of `{}` here", noun, name));
         }
         err.emit();
         self.name_already_seen.insert(name, span);
index 030e3936de994fb24c436b5bb389e209855afd75..106f421f39e75b12a5b65e8da2b9c61f68525fa6 100644 (file)
@@ -630,7 +630,7 @@ fn suggest_macro_name(&mut self, name: &str, kind: MacroKind,
                     err.help(&format!("did you mean `{}`?", suggestion));
                 }
             } else {
-                err.help(&format!("have you added the `#[macro_use]` on the module/import?"));
+                err.help("have you added the `#[macro_use]` on the module/import?");
             }
         }
     }
index 43654c8ce6f6875b13aa5009fabec257024ae784..804e1ea740f50e4152c75fbc14a4ad03317ffddd 100644 (file)
@@ -539,7 +539,7 @@ fn resolve_import(&mut self, directive: &'b ImportDirective<'b>) -> bool {
                 Ok(binding) if !binding.is_importable() => {
                     let msg = format!("`{}` is not directly importable", target);
                     struct_span_err!(this.session, directive.span, E0253, "{}", &msg)
-                        .span_label(directive.span, &format!("cannot be imported directly"))
+                        .span_label(directive.span, "cannot be imported directly")
                         .emit();
                     // Do not import this illegal binding. Import a dummy binding and pretend
                     // everything is fine
@@ -701,7 +701,7 @@ fn finalize_import(&mut self, directive: &'b ImportDirective<'b>) -> Option<Stri
             } else if ns == TypeNS {
                 struct_span_err!(self.session, directive.span, E0365,
                                  "`{}` is private, and cannot be reexported", ident)
-                    .span_label(directive.span, &format!("reexport of private `{}`", ident))
+                    .span_label(directive.span, format!("reexport of private `{}`", ident))
                     .note(&format!("consider declaring type or module `{}` with `pub`", ident))
                     .emit();
             } else {
@@ -794,7 +794,7 @@ fn finalize_resolutions_in(&mut self, module: Module<'b>) {
                             let msg =
                                 format!("a macro named `{}` has already been exported", ident);
                             self.session.struct_span_err(span, &msg)
-                                .span_label(span, &format!("`{}` already exported", ident))
+                                .span_label(span, format!("`{}` already exported", ident))
                                 .span_note(binding.span, "previous macro export here")
                                 .emit();
                         }
index 33b0aa3dbfffe3bcb2df7c0ebc34f4562de967c4..adcb3d682ca238b7541a3ad584155562c6f80463 100644 (file)
@@ -163,7 +163,7 @@ pub fn ast_path_substs_for_ty(&self,
             hir::ParenthesizedParameters(..) => {
                 struct_span_err!(tcx.sess, span, E0214,
                           "parenthesized parameters may only be used with a trait")
-                    .span_label(span, &format!("only traits may use parentheses"))
+                    .span_label(span, "only traits may use parentheses")
                     .emit();
 
                 return Substs::for_item(tcx, def_id, |_, _| {
@@ -294,7 +294,7 @@ fn create_substs_for_ast_path(&self,
                     struct_span_err!(tcx.sess, span, E0393,
                                      "the type parameter `{}` must be explicitly specified",
                                      def.name)
-                        .span_label(span, &format!("missing reference to `{}`", def.name))
+                        .span_label(span, format!("missing reference to `{}`", def.name))
                         .note(&format!("because of the default `Self` reference, \
                                         type parameters must be specified on object types"))
                         .emit();
@@ -635,7 +635,7 @@ fn conv_object_ty_poly_trait_ref(&self,
             let span = b.trait_ref.path.span;
             struct_span_err!(self.tcx().sess, span, E0225,
                 "only Send/Sync traits can be used as additional traits in a trait object")
-                .span_label(span, &format!("non-Send/Sync additional trait"))
+                .span_label(span, "non-Send/Sync additional trait")
                 .emit();
         }
 
@@ -684,7 +684,7 @@ fn conv_object_ty_poly_trait_ref(&self,
                 "the value of the associated type `{}` (from the trait `{}`) must be specified",
                         name,
                         tcx.item_path_str(trait_def_id))
-                        .span_label(span, &format!(
+                        .span_label(span, format!(
                             "missing associated type `{}` value", name))
                         .emit();
         }
@@ -730,7 +730,7 @@ fn report_ambiguous_associated_type(&self,
                                         trait_str: &str,
                                         name: &str) {
         struct_span_err!(self.tcx().sess, span, E0223, "ambiguous associated type")
-            .span_label(span, &format!("ambiguous associated type"))
+            .span_label(span, "ambiguous associated type")
             .note(&format!("specify the type using the syntax `<{} as {}>::{}`",
                   type_str, trait_str, name))
             .emit();
@@ -784,7 +784,7 @@ fn one_bound_for_assoc_type<I>(&self,
                           "associated type `{}` not found for `{}`",
                           assoc_name,
                           ty_param_name)
-                  .span_label(span, &format!("associated type `{}` not found", assoc_name))
+                  .span_label(span, format!("associated type `{}` not found", assoc_name))
                   .emit();
                 return Err(ErrorReported);
             }
@@ -797,7 +797,7 @@ fn one_bound_for_assoc_type<I>(&self,
                 "ambiguous associated type `{}` in bounds of `{}`",
                 assoc_name,
                 ty_param_name);
-            err.span_label(span, &format!("ambiguous associated type `{}`", assoc_name));
+            err.span_label(span, format!("ambiguous associated type `{}`", assoc_name));
 
             for bound in bounds {
                 let bound_span = self.tcx().associated_items(bound.def_id()).find(|item| {
@@ -806,7 +806,7 @@ fn one_bound_for_assoc_type<I>(&self,
                 .and_then(|item| self.tcx().hir.span_if_local(item.def_id));
 
                 if let Some(span) = bound_span {
-                    err.span_label(span, &format!("ambiguous `{}` from `{}`",
+                    err.span_label(span, format!("ambiguous `{}` from `{}`",
                                                   assoc_name,
                                                   bound));
                 } else {
@@ -951,7 +951,7 @@ pub fn prohibit_type_params(&self, segments: &[hir::PathSegment]) {
             for typ in segment.parameters.types() {
                 struct_span_err!(self.tcx().sess, typ.span, E0109,
                                  "type parameters are not allowed on this type")
-                    .span_label(typ.span, &format!("type parameter not allowed"))
+                    .span_label(typ.span, "type parameter not allowed")
                     .emit();
                 break;
             }
@@ -959,7 +959,7 @@ pub fn prohibit_type_params(&self, segments: &[hir::PathSegment]) {
                 struct_span_err!(self.tcx().sess, lifetime.span, E0110,
                                  "lifetime parameters are not allowed on this type")
                     .span_label(lifetime.span,
-                                &format!("lifetime parameter not allowed on this type"))
+                                "lifetime parameter not allowed on this type")
                     .emit();
                 break;
             }
@@ -973,7 +973,7 @@ pub fn prohibit_type_params(&self, segments: &[hir::PathSegment]) {
     pub fn prohibit_projection(&self, span: Span) {
         let mut err = struct_span_err!(self.tcx().sess, span, E0229,
                                        "associated type bindings are not allowed here");
-        err.span_label(span, &format!("associate type not allowed here")).emit();
+        err.span_label(span, "associate type not allowed here").emit();
     }
 
     // Check a type Path and convert it to a Ty.
@@ -1214,7 +1214,7 @@ pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> {
             hir::TyTypeof(ref _e) => {
                 struct_span_err!(tcx.sess, ast_ty.span, E0516,
                                  "`typeof` is a reserved keyword but unimplemented")
-                    .span_label(ast_ty.span, &format!("reserved keyword"))
+                    .span_label(ast_ty.span, "reserved keyword")
                     .emit();
 
                 tcx.types.err
@@ -1426,7 +1426,7 @@ fn check_type_argument_count(tcx: TyCtxt, span: Span, supplied: usize,
                 "wrong number of type arguments: {} {}, found {}",
                 expected, required, supplied)
             .span_label(span,
-                &format!("{} {} type argument{}",
+                format!("{} {} type argument{}",
                     expected,
                     required,
                     arguments_plural))
@@ -1444,7 +1444,7 @@ fn check_type_argument_count(tcx: TyCtxt, span: Span, supplied: usize,
                 expected, supplied)
             .span_label(
                 span,
-                &format!("{} type argument{}",
+                format!("{} type argument{}",
                     if accepted == 0 { "expected no" } else { &expected },
                     arguments_plural)
             )
@@ -1470,7 +1470,7 @@ fn report_lifetime_number_error(tcx: TyCtxt, span: Span, number: usize, expected
     struct_span_err!(tcx.sess, span, E0107,
                      "wrong number of lifetime parameters: expected {}, found {}",
                      expected, number)
-        .span_label(span, &label)
+        .span_label(span, label)
         .emit();
 }
 
index ac10dfd36e25dba5034f9795e807d7e8e5991fc0..bbe34f37950dc6b7b9238092cf87891785b01654 100644 (file)
@@ -97,7 +97,7 @@ pub fn check_pat_arg(&self, pat: &'gcx hir::Pat, expected: Ty<'tcx>, is_arg: boo
 
                     struct_span_err!(tcx.sess, span, E0029,
                         "only char and numeric types are allowed in range patterns")
-                        .span_label(span, &format!("ranges require char or numeric types"))
+                        .span_label(span, "ranges require char or numeric types")
                         .note(&format!("start type: {}", self.ty_to_string(lhs_ty)))
                         .note(&format!("end type: {}", self.ty_to_string(rhs_ty)))
                         .emit();
@@ -263,7 +263,7 @@ pub fn check_pat_arg(&self, pat: &'gcx hir::Pat, expected: Ty<'tcx>, is_arg: boo
                                     tcx.sess, pat.span, E0527,
                                     "pattern requires {} elements but array has {}",
                                     min_len, size)
-                                    .span_label(pat.span, &format!("expected {} elements",size))
+                                    .span_label(pat.span, format!("expected {} elements",size))
                                     .emit();
                             }
                             (inner_ty, tcx.types.err)
@@ -274,7 +274,7 @@ pub fn check_pat_arg(&self, pat: &'gcx hir::Pat, expected: Ty<'tcx>, is_arg: boo
                                     "pattern requires at least {} elements but array has {}",
                                     min_len, size)
                                 .span_label(pat.span,
-                                    &format!("pattern cannot match array of {} elements", size))
+                                    format!("pattern cannot match array of {} elements", size))
                                 .emit();
                             (inner_ty, tcx.types.err)
                         }
@@ -297,7 +297,7 @@ pub fn check_pat_arg(&self, pat: &'gcx hir::Pat, expected: Ty<'tcx>, is_arg: boo
                             }
 
                             err.span_label( pat.span,
-                                &format!("pattern cannot match with input type `{}`", expected_ty)
+                                format!("pattern cannot match with input type `{}`", expected_ty)
                             ).emit();
                         }
                         (tcx.types.err, tcx.types.err)
@@ -379,7 +379,7 @@ pub fn check_dereferencable(&self, span: Span, expected: Ty<'tcx>, inner: &hir::
                     let type_str = self.ty_to_string(expected);
                     struct_span_err!(self.tcx.sess, span, E0033,
                               "type `{}` cannot be dereferenced", type_str)
-                        .span_label(span, &format!("type `{}` cannot be dereferenced", type_str))
+                        .span_label(span, format!("type `{}` cannot be dereferenced", type_str))
                         .emit();
                     return false
                 }
@@ -593,7 +593,7 @@ fn check_pat_tuple_struct(&self,
                               def.kind_name(),
                               hir::print::to_string(&tcx.hir, |s| s.print_qpath(qpath, false)));
             struct_span_err!(tcx.sess, pat.span, E0164, "{}", msg)
-                .span_label(pat.span, &format!("not a tuple variant or struct")).emit();
+                .span_label(pat.span, "not a tuple variant or struct").emit();
             on_error();
         };
 
@@ -642,7 +642,7 @@ fn check_pat_tuple_struct(&self,
                              "this pattern has {} field{}, but the corresponding {} has {} field{}",
                              subpats.len(), subpats_ending, def.kind_name(),
                              variant.fields.len(),  fields_ending)
-                .span_label(pat.span, &format!("expected {} field{}, found {}",
+                .span_label(pat.span, format!("expected {} field{}, found {}",
                                                variant.fields.len(), fields_ending, subpats.len()))
                 .emit();
             on_error();
@@ -683,8 +683,8 @@ fn check_struct_pat_fields(&self,
                                       in the pattern",
                                      field.name)
                         .span_label(span,
-                                    &format!("multiple uses of `{}` in pattern", field.name))
-                        .span_label(*occupied.get(), &format!("first use of `{}`", field.name))
+                                    format!("multiple uses of `{}` in pattern", field.name))
+                        .span_label(*occupied.get(), format!("first use of `{}`", field.name))
                         .emit();
                     tcx.types.err
                 }
@@ -703,7 +703,7 @@ fn check_struct_pat_fields(&self,
                                              tcx.item_path_str(variant.did),
                                              field.name)
                                 .span_label(span,
-                                            &format!("{} `{}` does not have field `{}`",
+                                            format!("{} `{}` does not have field `{}`",
                                                      kind_name,
                                                      tcx.item_path_str(variant.did),
                                                      field.name))
@@ -732,7 +732,7 @@ fn check_struct_pat_fields(&self,
                 struct_span_err!(tcx.sess, span, E0027,
                                 "pattern does not mention field `{}`",
                                 field.name)
-                                .span_label(span, &format!("missing field `{}`", field.name))
+                                .span_label(span, format!("missing field `{}`", field.name))
                                 .emit();
             }
         }
index c9584f1d9e1e0968a057f4c6875058788a6ebb75..f03451c04ed004a19d5d38c0bc0295b2fa84ce49 100644 (file)
@@ -62,7 +62,7 @@ fn next(&mut self) -> Option<Self::Item> {
                              E0055,
                              "reached the recursion limit while auto-dereferencing {:?}",
                              self.cur_ty)
-                .span_label(self.span, &format!("deref recursion limit reached"))
+                .span_label(self.span, "deref recursion limit reached")
                 .help(&format!(
                         "consider adding a `#[recursion_limit=\"{}\"]` attribute to your crate",
                         suggested_limit))
index 7a49309e005a11de55a0dbaadb085a1ccf4d309f..dde5f598a68329ec77a3e91c858fdcfb46575085 100644 (file)
@@ -27,7 +27,7 @@
 pub fn check_legal_trait_for_method_call(tcx: TyCtxt, span: Span, trait_id: DefId) {
     if tcx.lang_items.drop_trait() == Some(trait_id) {
         struct_span_err!(tcx.sess, span, E0040, "explicit use of destructor method")
-            .span_label(span, &format!("explicit destructor calls not allowed"))
+            .span_label(span, "explicit destructor calls not allowed")
             .emit();
     }
 }
index 32b363ed755f4cca5860c4f333b11db273e72386..72ce7d3b5ed711abe4cb6539cd5380fb19108af9 100644 (file)
@@ -155,7 +155,7 @@ fn report_cast_error(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>, e: CastError) {
                                        },
                                        self.expr_ty);
                 err.span_label(error_span,
-                               &format!("cannot cast `{}` as `{}`",
+                               format!("cannot cast `{}` as `{}`",
                                         fcx.ty_to_string(self.expr_ty),
                                         cast_ty));
                 if let Ok(snippet) = fcx.sess().codemap().span_to_snippet(self.expr.span) {
@@ -200,7 +200,7 @@ fn report_cast_error(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>, e: CastError) {
             }
             CastError::CastToBool => {
                 struct_span_err!(fcx.tcx.sess, self.span, E0054, "cannot cast as `bool`")
-                    .span_label(self.span, &format!("unsupported cast"))
+                    .span_label(self.span, "unsupported cast")
                     .help("compare with zero instead")
                     .emit();
             }
index b0b57aee5b2537c1652ef0e7dc7b72e26f7795cd..c228fc6b24abde730be51c16c4ae0618176e0a79 100644 (file)
@@ -1144,7 +1144,7 @@ fn coerce_inner<'a>(&mut self,
                         db = struct_span_err!(
                             fcx.tcx.sess, cause.span, E0069,
                             "`return;` in a function whose return type is not `()`");
-                        db.span_label(cause.span, &format!("return type is not ()"));
+                        db.span_label(cause.span, "return type is not ()");
                     }
                     _ => {
                         db = fcx.report_mismatched_types(cause, expected, found, err);
index 9ed5528e86783905c6e2c46e477c4c1aa6235778..0579bb15fd6d2d8e8098faab59077745d9efe463 100644 (file)
@@ -402,7 +402,7 @@ fn check_region_bounds_on_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                          "lifetime parameters or bounds on method `{}` do not match the \
                           trait declaration",
                          impl_m.name)
-            .span_label(span, &format!("lifetimes do not match trait"))
+            .span_label(span, "lifetimes do not match trait")
             .emit();
         return Err(ErrorReported);
     }
@@ -534,9 +534,9 @@ fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                             not in the trait",
                                            trait_m.name,
                                            self_descr);
-            err.span_label(impl_m_span, &format!("`{}` used in impl", self_descr));
+            err.span_label(impl_m_span, format!("`{}` used in impl", self_descr));
             if let Some(span) = tcx.hir.span_if_local(trait_m.def_id) {
-                err.span_label(span, &format!("trait declared without `{}`", self_descr));
+                err.span_label(span, format!("trait declared without `{}`", self_descr));
             }
             err.emit();
             return Err(ErrorReported);
@@ -552,9 +552,9 @@ fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                            trait_m.name,
                                            self_descr);
             err.span_label(impl_m_span,
-                           &format!("expected `{}` in impl", self_descr));
+                           format!("expected `{}` in impl", self_descr));
             if let Some(span) = tcx.hir.span_if_local(trait_m.def_id) {
-                err.span_label(span, &format!("`{}` used in trait", self_descr));
+                err.span_label(span, format!("`{}` used in trait", self_descr));
             }
             err.emit();
             return Err(ErrorReported);
@@ -606,7 +606,7 @@ fn compare_number_of_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
         if let Some(span) = trait_item_span {
             err.span_label(span,
-                           &format!("expected {}",
+                           format!("expected {}",
                                     &if num_trait_m_type_params != 1 {
                                         format!("{} type parameters", num_trait_m_type_params)
                                     } else {
@@ -617,7 +617,7 @@ fn compare_number_of_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         }
 
         err.span_label(span,
-                       &format!("found {}{}",
+                       format!("found {}{}",
                                 &if num_impl_m_type_params != 1 {
                                     format!("{} type parameters", num_impl_m_type_params)
                                 } else {
@@ -696,7 +696,7 @@ trait `{}` has {}",
                                        trait_number_args);
         if let Some(trait_span) = trait_span {
             err.span_label(trait_span,
-                           &format!("trait requires {}",
+                           format!("trait requires {}",
                                     &if trait_number_args != 1 {
                                         format!("{} parameters", trait_number_args)
                                     } else {
@@ -704,7 +704,7 @@ trait `{}` has {}",
                                     }));
         }
         err.span_label(impl_span,
-                       &format!("expected {}, found {}",
+                       format!("expected {}, found {}",
                                 &if trait_number_args != 1 {
                                     format!("{} parameters", trait_number_args)
                                 } else {
index 2a97bc1d98fe95e83326d218096dbe4bd3fdc36b..60067e6a6ec0238e9c8da62e73ec9f60ed71e31c 100644 (file)
@@ -57,7 +57,7 @@ fn equate_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                         "intrinsic has wrong number of type \
                         parameters: found {}, expected {}",
                         i_n_tps, n_tps)
-            .span_label(span, &format!("expected {} type parameter", n_tps))
+            .span_label(span, format!("expected {} type parameter", n_tps))
             .emit();
     } else {
         require_same_types(tcx,
@@ -101,7 +101,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             op => {
                 struct_span_err!(tcx.sess, it.span, E0092,
                       "unrecognized atomic operation function: `{}`", op)
-                  .span_label(it.span, &format!("unrecognized atomic operation"))
+                  .span_label(it.span, "unrecognized atomic operation")
                   .emit();
                 return;
             }
@@ -305,7 +305,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                 struct_span_err!(tcx.sess, it.span, E0093,
                                 "unrecognized intrinsic function: `{}`",
                                 *other)
-                                .span_label(it.span, &format!("unrecognized intrinsic"))
+                                .span_label(it.span, "unrecognized intrinsic")
                                 .emit();
                 return;
             }
@@ -505,7 +505,7 @@ fn match_intrinsic_type_to_type<'a, 'tcx>(
                     }
                 }
                 _ => simple_error(&format!("`{}`", t),
-                                  &format!("tuple")),
+                                  "tuple"),
             }
         }
     }
index 5cec71a7eb76982d8c92ae5b0866b94661d97de1..a9e82a0601feeafe8784bba5458cb49e51271399 100644 (file)
@@ -285,7 +285,7 @@ fn instantiate_method_substs(&mut self,
                                  self.span,
                                  E0035,
                                  "does not take type parameters")
-                    .span_label(self.span, &"called with unneeded type parameters")
+                    .span_label(self.span, "called with unneeded type parameters")
                     .emit();
             } else {
                 struct_span_err!(self.tcx.sess,
@@ -296,7 +296,7 @@ fn instantiate_method_substs(&mut self,
                                  num_method_types,
                                  num_supplied_types)
                     .span_label(self.span,
-                                &format!("Passed {} type argument{}, expected {}",
+                                format!("Passed {} type argument{}, expected {}",
                                          num_supplied_types,
                                          if num_supplied_types != 1 { "s" } else { "" },
                                          num_method_types))
index 4b975d7b324f99c492ef96ab3d2a448db289fadf..c7ec379b0de25d9fc1181a959ebe42a3407ebd8e 100644 (file)
@@ -209,9 +209,9 @@ pub fn report_method_error(&self,
                                                               expr_string,
                                                               item_name));
                                         }
-                                        err.span_label(span, &"field, not a method");
+                                        err.span_label(span, "field, not a method");
                                     } else {
-                                        err.span_label(span, &"private field, not a method");
+                                        err.span_label(span, "private field, not a method");
                                     }
                                     break;
                                 }
@@ -272,7 +272,7 @@ macro_rules! report_function {
                                                span,
                                                E0034,
                                                "multiple applicable items in scope");
-                err.span_label(span, &format!("multiple `{}` found", item_name));
+                err.span_label(span, format!("multiple `{}` found", item_name));
 
                 report_candidates(&mut err, sources);
                 err.emit();
index e22c198fdb4dd4ae945d1ac3e165ed8f8a0c762d..127ffc60cf4dd90ae66c0a0eccaa35ab19aaff6d 100644 (file)
@@ -1130,7 +1130,7 @@ fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             struct_span_err!(
                 tcx.sess, attr.span, E0232,
                 "this attribute must have a value")
-                .span_label(attr.span, &format!("attribute requires a value"))
+                .span_label(attr.span, "attribute requires a value")
                 .note(&format!("eg `#[rustc_on_unimplemented = \"foo\"]`"))
                 .emit();
         }
@@ -1146,12 +1146,12 @@ fn report_forbidden_specialization<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         "`{}` specializes an item from a parent `impl`, but \
          that item is not marked `default`",
         impl_item.name);
-    err.span_label(impl_item.span, &format!("cannot specialize default item `{}`",
+    err.span_label(impl_item.span, format!("cannot specialize default item `{}`",
                                             impl_item.name));
 
     match tcx.span_of_impl(parent_impl) {
         Ok(span) => {
-            err.span_label(span, &"parent `impl` is here");
+            err.span_label(span, "parent `impl` is here");
             err.note(&format!("to specialize, `{}` in the parent `impl` must be marked `default`",
                               impl_item.name));
         }
@@ -1226,11 +1226,11 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                   which doesn't match its trait `{}`",
                                   ty_impl_item.name,
                                   impl_trait_ref);
-                         err.span_label(impl_item.span, &format!("does not match trait"));
+                         err.span_label(impl_item.span, "does not match trait");
                          // We can only get the spans from local trait definition
                          // Same for E0324 and E0325
                          if let Some(trait_span) = tcx.hir.span_if_local(ty_trait_item.def_id) {
-                            err.span_label(trait_span, &format!("item in trait"));
+                            err.span_label(trait_span, "item in trait");
                          }
                          err.emit()
                     }
@@ -1262,9 +1262,9 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                   which doesn't match its trait `{}`",
                                   ty_impl_item.name,
                                   impl_trait_ref);
-                         err.span_label(impl_item.span, &format!("does not match trait"));
+                         err.span_label(impl_item.span, "does not match trait");
                          if let Some(trait_span) = tcx.hir.span_if_local(ty_trait_item.def_id) {
-                            err.span_label(trait_span, &format!("item in trait"));
+                            err.span_label(trait_span, "item in trait");
                          }
                          err.emit()
                     }
@@ -1280,9 +1280,9 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                   which doesn't match its trait `{}`",
                                   ty_impl_item.name,
                                   impl_trait_ref);
-                         err.span_label(impl_item.span, &format!("does not match trait"));
+                         err.span_label(impl_item.span, "does not match trait");
                          if let Some(trait_span) = tcx.hir.span_if_local(ty_trait_item.def_id) {
-                            err.span_label(trait_span, &format!("item in trait"));
+                            err.span_label(trait_span, "item in trait");
                          }
                          err.emit()
                     }
@@ -1331,13 +1331,13 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             missing_items.iter()
                   .map(|trait_item| trait_item.name.to_string())
                   .collect::<Vec<_>>().join("`, `"));
-        err.span_label(impl_span, &format!("missing `{}` in implementation",
+        err.span_label(impl_span, format!("missing `{}` in implementation",
                 missing_items.iter()
                     .map(|trait_item| trait_item.name.to_string())
                     .collect::<Vec<_>>().join("`, `")));
         for trait_item in missing_items {
             if let Some(span) = tcx.hir.span_if_local(trait_item.def_id) {
-                err.span_label(span, &format!("`{}` from trait", trait_item.name));
+                err.span_label(span, format!("`{}` from trait", trait_item.name));
             } else {
                 err.note(&format!("`{}` from trait: `{}`",
                                   trait_item.name,
@@ -1374,8 +1374,12 @@ fn check_representable<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     // contain themselves. For case 2, there must be an inner type that will be
     // caught by case 1.
     match rty.is_representable(tcx, sp) {
-        Representability::SelfRecursive => {
-            tcx.recursive_type_with_infinite_size_error(item_def_id).emit();
+        Representability::SelfRecursive(spans) => {
+            let mut err = tcx.recursive_type_with_infinite_size_error(item_def_id);
+            for span in spans {
+                err.span_label(span, "recursive without indirection");
+            }
+            err.emit();
             return false
         }
         Representability::Representable | Representability::ContainsRecursive => (),
@@ -1395,7 +1399,7 @@ pub fn check_simd<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: DefId
             let e = fields[0].ty(tcx, substs);
             if !fields.iter().all(|f| f.ty(tcx, substs) == e) {
                 struct_span_err!(tcx.sess, sp, E0076, "SIMD vector should be homogeneous")
-                                .span_label(sp, &format!("SIMD elements must have the same type"))
+                                .span_label(sp, "SIMD elements must have the same type")
                                 .emit();
                 return;
             }
@@ -1467,7 +1471,7 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         struct_span_err!(
             tcx.sess, sp, E0084,
             "unsupported representation for zero-variant enum")
-            .span_label(sp, &format!("unsupported enum representation"))
+            .span_label(sp, "unsupported enum representation")
             .emit();
     }
 
@@ -1501,8 +1505,8 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             };
             struct_span_err!(tcx.sess, span, E0081,
                              "discriminant value `{}` already exists", disr_vals[i])
-                .span_label(i_span, &format!("first use of `{}`", disr_vals[i]))
-                .span_label(span , &format!("enum already has `{}`", disr_vals[i]))
+                .span_label(i_span, format!("first use of `{}`", disr_vals[i]))
+                .span_label(span , format!("enum already has `{}`", disr_vals[i]))
                 .emit();
         }
         disr_vals.push(discr);
@@ -2397,12 +2401,12 @@ fn parameter_count_error<'tcx>(sess: &Session, sp: Span, expected_count: usize,
                     if arg_count == 1 {" was"} else {"s were"}),
                 error_code);
 
-            err.span_label(sp, &format!("expected {}{} parameter{}",
+            err.span_label(sp, format!("expected {}{} parameter{}",
                                         if variadic {"at least "} else {""},
                                         expected_count,
                                         if expected_count == 1 {""} else {"s"}));
             if let Some(def_s) = def_span {
-                err.span_label(def_s, &format!("defined here"));
+                err.span_label(def_s, "defined here");
             }
             err.emit();
         }
@@ -2934,10 +2938,10 @@ fn check_field(&self,
                     if let Some(suggested_field_name) =
                         Self::suggest_field_name(def.struct_variant(), field, vec![]) {
                             err.span_label(field.span,
-                                           &format!("did you mean `{}`?", suggested_field_name));
+                                           format!("did you mean `{}`?", suggested_field_name));
                         } else {
                             err.span_label(field.span,
-                                           &format!("unknown field"));
+                                           "unknown field");
                         };
                 }
                 ty::TyRawPtr(..) => {
@@ -3072,15 +3076,15 @@ fn report_unknown_field(&self,
                                                            &field.name,
                                                            skip_fields.collect()) {
             err.span_label(field.name.span,
-                           &format!("field does not exist - did you mean `{}`?", field_name));
+                           format!("field does not exist - did you mean `{}`?", field_name));
         } else {
             match ty.sty {
                 ty::TyAdt(adt, ..) if adt.is_enum() => {
-                    err.span_label(field.name.span, &format!("`{}::{}` does not have this field",
+                    err.span_label(field.name.span, format!("`{}::{}` does not have this field",
                                                              ty, variant.name));
                 }
                 _ => {
-                    err.span_label(field.name.span, &format!("`{}` does not have this field", ty));
+                    err.span_label(field.name.span, format!("`{}` does not have this field", ty));
                 }
             }
         };
@@ -3145,10 +3149,10 @@ fn check_expr_struct_fields(&self,
                                                 "field `{}` specified more than once",
                                                 field.name.node);
 
-                    err.span_label(field.name.span, &format!("used more than once"));
+                    err.span_label(field.name.span, "used more than once");
 
                     if let Some(prev_span) = seen_fields.get(&field.name.node) {
-                        err.span_label(*prev_span, &format!("first use of `{}`", field.name.node));
+                        err.span_label(*prev_span, format!("first use of `{}`", field.name.node));
                     }
 
                     err.emit();
@@ -3195,7 +3199,7 @@ fn check_expr_struct_fields(&self,
                         remaining_fields_names,
                         truncated_fields_error,
                         adt_ty)
-                        .span_label(span, &format!("missing {}{}",
+                        .span_label(span, format!("missing {}{}",
                             remaining_fields_names,
                             truncated_fields_error))
                         .emit();
@@ -3262,7 +3266,7 @@ pub fn check_struct_path(&self,
             struct_span_err!(self.tcx.sess, path_span, E0071,
                              "expected struct, variant or union type, found {}",
                              ty.sort_string(self.tcx))
-                .span_label(path_span, &format!("not a struct"))
+                .span_label(path_span, "not a struct")
                 .emit();
             None
         }
@@ -3621,7 +3625,7 @@ fn check_expr_kind(&self,
                     "invalid left-hand side expression")
                 .span_label(
                     expr.span,
-                    &format!("left-hand of expression not valid"))
+                    "left-hand of expression not valid")
                 .emit();
             }
 
@@ -4513,7 +4517,7 @@ fn check_path_parameter_count(&self,
                              "too many lifetime parameters provided: \
                               expected at most {}, found {}",
                              expected_text, actual_text)
-                .span_label(span, &format!("expected {}", expected_text))
+                .span_label(span, format!("expected {}", expected_text))
                 .emit();
         } else if lifetimes.len() > 0 && lifetimes.len() < lifetime_defs.len() {
             let expected_text = count_lifetime_params(lifetime_defs.len());
@@ -4522,7 +4526,7 @@ fn check_path_parameter_count(&self,
                              "too few lifetime parameters provided: \
                               expected {}, found {}",
                              expected_text, actual_text)
-                .span_label(span, &format!("expected {}", expected_text))
+                .span_label(span, format!("expected {}", expected_text))
                 .emit();
         }
 
@@ -4547,7 +4551,7 @@ fn check_path_parameter_count(&self,
                              "too many type parameters provided: \
                               expected at most {}, found {}",
                              expected_text, actual_text)
-                .span_label(span, &format!("expected {}", expected_text))
+                .span_label(span, format!("expected {}", expected_text))
                 .emit();
 
             // To prevent derived errors to accumulate due to extra
@@ -4561,7 +4565,7 @@ fn check_path_parameter_count(&self,
                              "too few type parameters provided: \
                               expected {}, found {}",
                              expected_text, actual_text)
-                .span_label(span, &format!("expected {}", expected_text))
+                .span_label(span, format!("expected {}", expected_text))
                 .emit();
         }
 
@@ -4650,7 +4654,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             struct_span_err!(tcx.sess, param.span, E0091,
                 "type parameter `{}` is unused",
                 param.name)
-                .span_label(param.span, &format!("unused type parameter"))
+                .span_label(param.span, "unused type parameter")
                 .emit();
         }
     }
index d3d65ce4a626e10f5d0ecc3faa7410b5883fdeae..59cb61d9b97f0b3196126eb3637a6daca34a0c29 100644 (file)
@@ -50,7 +50,7 @@ pub fn check_binop_assign(&self,
                 E0067, "invalid left-hand side expression")
             .span_label(
                 lhs_expr.span,
-                &format!("invalid expression for left-hand side"))
+                "invalid expression for left-hand side")
             .emit();
         }
         ty
@@ -203,7 +203,7 @@ fn check_overloaded_binop(&self,
                                          op.node.as_str(),
                                          lhs_ty)
                             .span_label(lhs_expr.span,
-                                        &format!("cannot use `{}=` on type `{}`",
+                                        format!("cannot use `{}=` on type `{}`",
                                         op.node.as_str(), lhs_ty))
                             .emit();
                     } else {
@@ -278,7 +278,7 @@ fn check_str_addition(&self,
             if let TyRef(_, r_ty) = rhs_ty.sty {
                 if l_ty.ty.sty == TyStr && r_ty.ty.sty == TyStr {
                     err.span_label(expr.span,
-                        &"`+` can't be used to concatenate two `&str` strings");
+                        "`+` can't be used to concatenate two `&str` strings");
                     let codemap = self.tcx.sess.codemap();
                     let suggestion =
                         match codemap.span_to_snippet(lhs_expr.span) {
index 1887eaef3604438340db63a690356cce992eec59..93529aecac039f883a39c9982543090002e819f4 100644 (file)
@@ -684,7 +684,7 @@ fn error_392<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: Span, param_name: ast:
                        -> DiagnosticBuilder<'tcx> {
     let mut err = struct_span_err!(tcx.sess, span, E0392,
                   "parameter `{}` is never used", param_name);
-    err.span_label(span, &format!("unused type parameter"));
+    err.span_label(span, "unused type parameter");
     err
 }
 
@@ -692,7 +692,7 @@ fn error_194(tcx: TyCtxt, span: Span, trait_decl_span: Span, name: ast::Name) {
     struct_span_err!(tcx.sess, span, E0194,
               "type parameter `{}` shadows another type parameter of the same name",
               name)
-        .span_label(span, &format!("shadows another type parameter"))
-        .span_label(trait_decl_span, &format!("first `{}` declared here", name))
+        .span_label(span, "shadows another type parameter")
+        .span_label(trait_decl_span, format!("first `{}` declared here", name))
         .emit();
 }
index 49785d8850f4de72595df5d4eb08904edef7e1d9..743bfbb44ab7504ef2af4017a9f35fea53b22ae8 100644 (file)
@@ -74,7 +74,7 @@ fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                          E0120,
                                          "the Drop trait may only be implemented on \
                                          structures")
-                            .span_label(span, &format!("implementing Drop requires a struct"))
+                            .span_label(span, "implementing Drop requires a struct")
                             .emit();
                     }
                     _ => {
@@ -130,7 +130,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                              "the trait `Copy` may not be implemented for this type")
                 .span_label(
                     tcx.def_span(field.did),
-                    &"this field does not implement `Copy`")
+                    "this field does not implement `Copy`")
                 .emit()
         }
         Err(CopyImplementationError::NotAnAdt) => {
@@ -145,7 +145,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                              span,
                              E0206,
                              "the trait `Copy` may not be implemented for this type")
-                .span_label(span, &format!("type is not a structure or enumeration"))
+                .span_label(span, "type is not a structure or enumeration")
                 .emit();
         }
         Err(CopyImplementationError::HasDestructor) => {
@@ -154,7 +154,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                              E0184,
                              "the trait `Copy` may not be implemented for this type; the \
                               type has a destructor")
-                .span_label(span, &format!("Copy not allowed on types with destructors"))
+                .span_label(span, "Copy not allowed on types with destructors")
                 .emit();
         }
     }
@@ -310,7 +310,7 @@ pub fn coerce_unsized_info<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                           })
                                           .collect::<Vec<_>>()
                                           .join(", ")));
-                    err.span_label(span, &format!("requires multiple coercions"));
+                    err.span_label(span, "requires multiple coercions");
                     err.emit();
                     return err_info;
                 }
index 238952865c7bd91e3525e19fc3e6b5e8e8471c37..f7ebc21044222d28c90c309c62903e235656018c 100644 (file)
@@ -259,7 +259,7 @@ fn visit_item(&mut self, item: &hir::Item) {
                                  ty.span,
                                  E0118,
                                  "no base type found for inherent implementation")
-                    .span_label(ty.span, &format!("impl requires a base type"))
+                    .span_label(ty.span, "impl requires a base type")
                     .note(&format!("either implement a trait on it or create a newtype \
                                     to wrap it instead"))
                     .emit();
@@ -296,7 +296,7 @@ fn check_def_id(&mut self, item: &hir::Item, def_id: DefId) {
                              "cannot define inherent `impl` for a type outside of the crate \
                               where the type is defined")
                 .span_label(item.span,
-                            &format!("impl for type defined outside of crate."))
+                            "impl for type defined outside of crate.")
                 .note("define and implement a trait or new type instead")
                 .emit();
         }
index 34aec8ef1ac8c1f8e9961228ecdad38afd357aed..2751e1ff38a5090620344d49ded167658087a8e5 100644 (file)
@@ -56,9 +56,9 @@ enum Namespace {
                                      "duplicate definitions with name `{}`",
                                      name)
                         .span_label(self.tcx.span_of_impl(item1).unwrap(),
-                                    &format!("duplicate definitions for `{}`", name))
+                                    format!("duplicate definitions for `{}`", name))
                         .span_label(self.tcx.span_of_impl(item2).unwrap(),
-                                    &format!("other definition for `{}`", name))
+                                    format!("other definition for `{}`", name))
                         .emit();
                 }
             }
index 56ae9d545751f56c1eae0aed72d6e8592ca70a87..8b9dc20315d25fff85ee0a9bf6a2b51cb6907a59 100644 (file)
@@ -62,7 +62,7 @@ fn enforce_trait_manually_implementable(tcx: TyCtxt, impl_def_id: DefId, trait_d
                          span,
                          E0322,
                          "explicit impls for the `Sized` trait are not permitted")
-            .span_label(span, &format!("impl of 'Sized' not allowed"))
+            .span_label(span, "impl of 'Sized' not allowed")
             .emit();
         return;
     }
index 8ded3003c78eb312fa943f79f6f287d71156b5d8..097720adad447ee15bcee5fa4daf5c6d47345d6c 100644 (file)
@@ -48,7 +48,7 @@ fn visit_item(&mut self, item: &hir::Item) {
                                          E0117,
                                          "only traits defined in the current crate can be \
                                           implemented for arbitrary types")
-                            .span_label(item.span, &format!("impl doesn't use types inside crate"))
+                            .span_label(item.span, "impl doesn't use types inside crate")
                             .note(&format!("the impl does not reference any types defined in \
                                             this crate"))
                             .note("define and implement a trait or new type instead")
@@ -153,7 +153,7 @@ fn visit_item(&mut self, item: &hir::Item) {
                                      "cannot create default implementations for traits outside \
                                       the crate they're defined in; define a new trait instead")
                         .span_label(item_trait_ref.path.span,
-                                    &format!("`{}` trait not defined in this crate",
+                                    format!("`{}` trait not defined in this crate",
                             self.tcx.hir.node_to_pretty_string(item_trait_ref.ref_id)))
                         .emit();
                     return;
index 383a9e0e69542caeadd47d406d3d3d76f90d69b5..f479dc2e6ab617a60a52a60f8bf091d6b05b0834 100644 (file)
@@ -60,9 +60,9 @@ pub fn check_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, node_id: ast::NodeId) {
 
         match tcx.span_of_impl(overlap.with_impl) {
             Ok(span) => {
-                err.span_label(span, &format!("first implementation here"));
+                err.span_label(span, "first implementation here");
                 err.span_label(tcx.span_of_impl(impl_def_id).unwrap(),
-                               &format!("conflicting implementation{}",
+                               format!("conflicting implementation{}",
                                         overlap.self_desc
                                             .map_or(String::new(),
                                                     |ty| format!(" for `{}`", ty))));
index f44f74830cbb99849d144c48585feaa882a2e818..ec200241ee695cc4a5f635b481cc6d0fe0cdc416 100644 (file)
@@ -220,7 +220,7 @@ fn ty_infer(&self, span: Span) -> Ty<'tcx> {
             span,
             E0121,
             "the type placeholder `_` is not allowed within types on item signatures"
-        ).span_label(span, &format!("not allowed in type signatures"))
+        ).span_label(span, "not allowed in type signatures")
         .emit();
         self.tcx().types.err
     }
@@ -568,7 +568,7 @@ fn convert_enum_variant_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         } else {
             struct_span_err!(tcx.sess, variant.span, E0370,
                              "enum discriminant overflowed")
-                .span_label(variant.span, &format!("overflowed on value after {}",
+                .span_label(variant.span, format!("overflowed on value after {}",
                                                    prev_discr.unwrap()))
                 .note(&format!("explicitly set `{} = {}` if that is desired outcome",
                                variant.node.name, wrapped_discr))
@@ -604,8 +604,8 @@ fn convert_struct_variant<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             struct_span_err!(tcx.sess, f.span, E0124,
                              "field `{}` is already declared",
                              f.name)
-                .span_label(f.span, &"field already declared")
-                .span_label(prev_span, &format!("`{}` first declared here", f.name))
+                .span_label(f.span, "field already declared")
+                .span_label(prev_span, format!("`{}` first declared here", f.name))
                 .emit();
         } else {
             seen_fields.insert(f.name, f.span);
index 1c44572fbb4af3e828d23e25254788202e710c00..6b4f08d3d4c8d73aca47443d934014ec687f4d07 100644 (file)
@@ -166,7 +166,7 @@ fn report_unused_parameter(tcx: TyCtxt,
         "the {} parameter `{}` is not constrained by the \
         impl trait, self type, or predicates",
         kind, name)
-        .span_label(span, &format!("unconstrained {} parameter", kind))
+        .span_label(span, format!("unconstrained {} parameter", kind))
         .emit();
 }
 
@@ -188,9 +188,9 @@ fn enforce_impl_items_are_distinct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                                "duplicate definitions with name `{}`:",
                                                impl_item.name);
                 err.span_label(*entry.get(),
-                               &format!("previous definition of `{}` here",
+                               format!("previous definition of `{}` here",
                                         impl_item.name));
-                err.span_label(impl_item.span, &format!("duplicate definition"));
+                err.span_label(impl_item.span, "duplicate definition");
                 err.emit();
             }
             Vacant(entry) => {
index c1456e7978280cce003fbe8e6f855a36600653f9..84de4ff2b7b69203b32cb09ba36c42231bd68c86 100644 (file)
@@ -143,7 +143,7 @@ fn require_c_abi_if_variadic(tcx: TyCtxt,
     if decl.variadic && abi != Abi::C {
         let mut err = struct_span_err!(tcx.sess, span, E0045,
                   "variadic function must have C calling convention");
-        err.span_label(span, &("variadics require C calling conventions").to_string())
+        err.span_label(span, "variadics require C calling conventions")
             .emit();
     }
 }
@@ -190,7 +190,7 @@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                 struct_span_err!(tcx.sess, generics.span, E0131,
                                          "main function is not allowed to have type parameters")
                                     .span_label(generics.span,
-                                                &format!("main cannot have type parameters"))
+                                                "main cannot have type parameters")
                                     .emit();
                                 return;
                             }
@@ -240,7 +240,7 @@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                             struct_span_err!(tcx.sess, ps.span, E0132,
                                 "start function is not allowed to have type parameters")
                                 .span_label(ps.span,
-                                            &format!("start function cannot have type parameters"))
+                                            "start function cannot have type parameters")
                                 .emit();
                             return;
                         }
index 0f47265a1aa6630e3620a8da230aff5141b91e87..5db82e23bbf1eb0244d6500e8c0533f21e6f0105 100644 (file)
@@ -687,9 +687,9 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, use_absolute: bool,
             }
         }
         clean::Vector(ref t) if is_not_debug => {
-            primitive_link(f, PrimitiveType::Slice, &format!("["))?;
+            primitive_link(f, PrimitiveType::Slice, "[")?;
             fmt::Display::fmt(t, f)?;
-            primitive_link(f, PrimitiveType::Slice, &format!("]"))
+            primitive_link(f, PrimitiveType::Slice, "]")
         }
         clean::Vector(ref t) => write!(f, "[{:?}]", t),
         clean::FixedVector(ref t, ref s) if is_not_debug => {
index 6b1267d89b6d5730246c2f7d0ce6d797ded38968..528d903b8b0187ba155995fb79754ed302ff043e 100644 (file)
@@ -2412,7 +2412,7 @@ fn unicode_path_exists() {
 
         let tmpdir = tmpdir();
         let unicode = tmpdir.path();
-        let unicode = unicode.join(&format!("test-각丁ー再见"));
+        let unicode = unicode.join("test-각丁ー再见");
         check!(fs::create_dir(&unicode));
         assert!(unicode.exists());
         assert!(!Path::new("test/unicode-bogus-path-각丁ー再见").exists());
index 4cbcfdbc2d7f677d5c44f232d508c41f6965de5a..04cd28df4459d09d7dd5389e56e4bc488a47565f 100644 (file)
@@ -458,6 +458,16 @@ pub fn yield_now() {
 
 /// Determines whether the current thread is unwinding because of panic.
 ///
+/// A common use of this feature is to poison shared resources when writing
+/// unsafe code, by checking `panicking` when the `drop` is called.
+///
+/// This is usually not needed when writing safe code, as [`Mutex`es][Mutex]
+/// already poison themselves when a thread panics while holding the lock.
+///
+/// This can also be used in multithreaded applications, in order to send a
+/// message to other threads warning that a thread has panicked (e.g. for
+/// monitoring purposes).
+///
 /// # Examples
 ///
 /// ```should_panic
@@ -486,6 +496,8 @@ pub fn yield_now() {
 ///     panic!()
 /// }
 /// ```
+///
+/// [Mutex]: ../../std/sync/struct.Mutex.html
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn panicking() -> bool {
index 97d37266130af750a304561f1eb0ec33ae06f5e7..82e7cfa0032ce5ed9221e12b4f9610857260ab92 100644 (file)
@@ -11,7 +11,7 @@ crate-type = ["dylib"]
 [dependencies]
 serialize = { path = "../libserialize" }
 log = "0.3"
-rustc_bitflags = { path = "../librustc_bitflags" }
+bitflags = "0.8"
 syntax_pos = { path = "../libsyntax_pos" }
 rustc_errors = { path = "../librustc_errors" }
 rustc_data_structures = { path = "../librustc_data_structures" }
index 82492d976276e05d6ed6d758872c48acc17405ee..0980b73e80c5c5d8125973de01fb8586db045b2d 100644 (file)
@@ -511,8 +511,7 @@ pub fn find_export_name_attr(diag: &Handler, attrs: &[Attribute]) -> Option<Symb
             } else {
                 struct_span_err!(diag, attr.span, E0558,
                                  "export_name attribute has invalid format")
-                    .span_label(attr.span,
-                                &format!("did you mean #[export_name=\"*\"]?"))
+                    .span_label(attr.span, "did you mean #[export_name=\"*\"]?")
                     .emit();
                 None
             }
index fda026fec64ef3d1ebf3e7da501c5aa98b42bd0f..f731c5abdd6a1f7e0ad275f45460e047e1f5779f 100644 (file)
@@ -24,6 +24,7 @@
 use symbol::Symbol;
 use util::small_vector::SmallVector;
 
+use std::collections::HashMap;
 use std::path::PathBuf;
 use std::rc::Rc;
 use std::default::Default;
@@ -643,6 +644,7 @@ pub struct ExtCtxt<'a> {
     pub resolver: &'a mut Resolver,
     pub resolve_err_count: usize,
     pub current_expansion: ExpansionData,
+    pub expansions: HashMap<Span, Vec<String>>,
 }
 
 impl<'a> ExtCtxt<'a> {
@@ -662,6 +664,7 @@ pub fn new(parse_sess: &'a parse::ParseSess,
                 module: Rc::new(ModuleData { mod_path: Vec::new(), directory: PathBuf::new() }),
                 directory_ownership: DirectoryOwnership::Owned,
             },
+            expansions: HashMap::new(),
         }
     }
 
@@ -765,6 +768,15 @@ pub fn span_unimpl(&self, sp: Span, msg: &str) -> ! {
     pub fn span_bug(&self, sp: Span, msg: &str) -> ! {
         self.parse_sess.span_diagnostic.span_bug(sp, msg);
     }
+    pub fn trace_macros_diag(&self) {
+        for (sp, notes) in self.expansions.iter() {
+            let mut db = self.parse_sess.span_diagnostic.span_note_diag(*sp, &"trace_macro");
+            for note in notes {
+                db.note(&note);
+            }
+            db.emit();
+        }
+    }
     pub fn bug(&self, msg: &str) -> ! {
         self.parse_sess.span_diagnostic.bug(msg);
     }
index e811afffb2a5ee11b2354c863222aee7ffbc0bc0..a8aa103f80a8e4a7c0f150d59ebfd2a427cd7517 100644 (file)
@@ -231,7 +231,7 @@ pub fn expand_crate(&mut self, mut krate: ast::Crate) -> ast::Crate {
             },
             _ => unreachable!(),
         };
-
+        self.cx.trace_macros_diag();
         krate
     }
 
index be979960725a91cfe6c7786ee0eb1d9150b9c2fb..f959ccc989e2e9e9d55643966f0fe4648b8bd17b 100644 (file)
@@ -27,8 +27,8 @@
 use tokenstream::{TokenStream, TokenTree};
 
 use std::cell::RefCell;
-use std::collections::{HashMap};
-use std::collections::hash_map::{Entry};
+use std::collections::HashMap;
+use std::collections::hash_map::Entry;
 use std::rc::Rc;
 
 pub struct ParserAnyMacro<'a> {
@@ -85,7 +85,7 @@ fn expand<'cx>(&self,
 }
 
 /// Given `lhses` and `rhses`, this is the new macro we create
-fn generic_extension<'cx>(cx: &'cx ExtCtxt,
+fn generic_extension<'cx>(cx: &'cx mut ExtCtxt,
                           sp: Span,
                           name: ast::Ident,
                           arg: TokenStream,
@@ -93,7 +93,9 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
                           rhses: &[quoted::TokenTree])
                           -> Box<MacResult+'cx> {
     if cx.trace_macros() {
-        println!("{}! {{ {} }}", name, arg);
+        let sp = sp.macro_backtrace().last().map(|trace| trace.call_site).unwrap_or(sp);
+        let mut values: &mut Vec<String> = cx.expansions.entry(sp).or_insert(vec![]);
+        values.push(format!("expands to `{}! {{ {} }}`", name, arg));
     }
 
     // Which arm's failure should we report? (the one furthest along)
index 86ee1c5336dfeb3f6a46038d524ac92c14cdd4e6..89c67b88cbde6dccaa7c0006cefc9152aac9a747 100644 (file)
        test(attr(deny(warnings))))]
 #![deny(warnings)]
 
-#![feature(associated_consts)]
-#![feature(const_fn)]
-#![feature(optin_builtin_traits)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
-#![feature(str_escape)]
 #![feature(unicode)]
 #![feature(rustc_diagnostic_macros)]
-#![feature(specialization)]
 #![feature(i128_type)]
 
 extern crate serialize;
 #[macro_use] extern crate log;
-#[macro_use] #[no_link] extern crate rustc_bitflags;
+#[macro_use] extern crate bitflags;
 extern crate std_unicode;
 pub extern crate rustc_errors as errors;
 extern crate syntax_pos;
index 7d2a1b3c4a4d21084689fc507f21aaa8c102b3b4..ded1f0b599a61d6ba5bd6ae274f15d625d0979a6 100644 (file)
@@ -504,7 +504,7 @@ fn scan_comment(&mut self) -> Option<TokenAndSpan> {
                     self.bump();
 
                     // line comments starting with "///" or "//!" are doc-comments
-                    let doc_comment = self.ch_is('/') || self.ch_is('!');
+                    let doc_comment = (self.ch_is('/') && !self.nextch_is('/')) || self.ch_is('!');
                     let start_bpos = self.pos - BytePos(2);
 
                     while !self.is_eof() {
index 9d8f3b3d039d2ef60768d0a46f00116f40a07878..fe3ca1cf2305c0341ae3fb50db3616cb0e581c1b 100644 (file)
@@ -261,10 +261,14 @@ pub fn char_lit(lit: &str) -> (char, isize) {
     }
 }
 
+pub fn escape_default(s: &str) -> String {
+    s.chars().map(char::escape_default).flat_map(|x| x).collect()
+}
+
 /// Parse a string representing a string literal into its final form. Does
 /// unescaping.
 pub fn str_lit(lit: &str) -> String {
-    debug!("parse_str_lit: given {}", lit.escape_default());
+    debug!("parse_str_lit: given {}", escape_default(lit));
     let mut res = String::with_capacity(lit.len());
 
     // FIXME #8372: This could be a for-loop if it didn't borrow the iterator
@@ -339,7 +343,7 @@ fn eat<'a>(it: &mut iter::Peekable<str::CharIndices<'a>>) {
 /// Parse a string representing a raw string literal into its final form. The
 /// only operation this does is convert embedded CRLF into a single LF.
 pub fn raw_str_lit(lit: &str) -> String {
-    debug!("raw_str_lit: given {}", lit.escape_default());
+    debug!("raw_str_lit: given {}", escape_default(lit));
     let mut res = String::with_capacity(lit.len());
 
     // FIXME #8372: This could be a for-loop if it didn't borrow the iterator
index 268b3d08a8056adbb8f67f7b63de15a90ec60eaf..ca1351e3b4158c89793b06bd622f4e54f22aad99 100644 (file)
@@ -64,7 +64,7 @@
 use std::slice;
 
 bitflags! {
-    flags Restrictions: u8 {
+    pub flags Restrictions: u8 {
         const RESTRICTION_STMT_EXPR         = 1 << 0,
         const RESTRICTION_NO_STRUCT_LITERAL = 1 << 1,
     }
@@ -602,10 +602,10 @@ fn tokens_to_string(tokens: &[TokenType]) -> String {
                 label_sp
             };
             if self.span.contains(sp) {
-                err.span_label(self.span, &label_exp);
+                err.span_label(self.span, label_exp);
             } else {
-                err.span_label(sp, &label_exp);
-                err.span_label(self.span, &"unexpected token");
+                err.span_label(sp, label_exp);
+                err.span_label(self.span, "unexpected token");
             }
             Err(err)
         }
@@ -1512,10 +1512,10 @@ fn maybe_recover_from_bad_type_plus(&mut self, allow_plus: bool, ty: &Ty) -> PRe
                 err.span_suggestion(sum_span, "try adding parentheses:", sum_with_parens);
             }
             TyKind::Ptr(..) | TyKind::BareFn(..) => {
-                err.span_label(sum_span, &"perhaps you forgot parentheses?");
+                err.span_label(sum_span, "perhaps you forgot parentheses?");
             }
             _ => {
-                err.span_label(sum_span, &"expected a path");
+                err.span_label(sum_span, "expected a path");
             },
         }
         err.emit();
@@ -2291,7 +2291,7 @@ fn parse_bottom_expr(&mut self) -> PResult<'a, P<Expr>> {
                     let e = if self.token.can_begin_expr()
                                && !(self.token == token::OpenDelim(token::Brace)
                                     && self.restrictions.contains(
-                                           Restrictions::RESTRICTION_NO_STRUCT_LITERAL)) {
+                                           RESTRICTION_NO_STRUCT_LITERAL)) {
                         Some(self.parse_expr()?)
                     } else {
                         None
@@ -2318,7 +2318,7 @@ fn parse_bottom_expr(&mut self) -> PResult<'a, P<Expr>> {
                         // This is a struct literal, unless we're prohibited
                         // from parsing struct literals here.
                         let prohibited = self.restrictions.contains(
-                            Restrictions::RESTRICTION_NO_STRUCT_LITERAL
+                            RESTRICTION_NO_STRUCT_LITERAL
                         );
                         if !prohibited {
                             return self.parse_struct_expr(lo, pth, attrs);
@@ -2556,7 +2556,7 @@ fn parse_dot_or_call_expr_with_(&mut self, e0: P<Expr>, lo: Span) -> PResult<'a,
                     let fstr = n.as_str();
                     let mut err = self.diagnostic().struct_span_err(self.prev_span,
                         &format!("unexpected token: `{}`", n));
-                    err.span_label(self.prev_span, &"unexpected token");
+                    err.span_label(self.prev_span, "unexpected token");
                     if fstr.chars().all(|x| "0123456789.".contains(x)) {
                         let float = match fstr.parse::<f64>().ok() {
                             Some(f) => f,
@@ -2708,7 +2708,7 @@ pub fn parse_prefix_expr(&mut self,
                 let span_of_tilde = lo;
                 let mut err = self.diagnostic().struct_span_err(span_of_tilde,
                         "`~` can not be used as a unary operator");
-                err.span_label(span_of_tilde, &"did you mean `!`?");
+                err.span_label(span_of_tilde, "did you mean `!`?");
                 err.help("use `!` instead of `~` if you meant to perform bitwise negation");
                 err.emit();
                 (span, self.mk_unary(UnOp::Not, e))
@@ -2735,7 +2735,7 @@ pub fn parse_prefix_expr(&mut self,
             token::Ident(..) if self.token.is_keyword(keywords::In) => {
                 self.bump();
                 let place = self.parse_expr_res(
-                    Restrictions::RESTRICTION_NO_STRUCT_LITERAL,
+                    RESTRICTION_NO_STRUCT_LITERAL,
                     None,
                 )?;
                 let blk = self.parse_block()?;
@@ -2798,7 +2798,7 @@ pub fn parse_assoc_expr_with(&mut self,
 
             let cur_op_span = self.span;
             let restrictions = if op.is_assign_like() {
-                self.restrictions & Restrictions::RESTRICTION_NO_STRUCT_LITERAL
+                self.restrictions & RESTRICTION_NO_STRUCT_LITERAL
             } else {
                 self.restrictions
             };
@@ -2848,13 +2848,13 @@ pub fn parse_assoc_expr_with(&mut self,
 
             let rhs = match op.fixity() {
                 Fixity::Right => self.with_res(
-                    restrictions - Restrictions::RESTRICTION_STMT_EXPR,
+                    restrictions - RESTRICTION_STMT_EXPR,
                     |this| {
                         this.parse_assoc_expr_with(op.precedence(),
                             LhsExpr::NotYetParsed)
                 }),
                 Fixity::Left => self.with_res(
-                    restrictions - Restrictions::RESTRICTION_STMT_EXPR,
+                    restrictions - RESTRICTION_STMT_EXPR,
                     |this| {
                         this.parse_assoc_expr_with(op.precedence() + 1,
                             LhsExpr::NotYetParsed)
@@ -2862,7 +2862,7 @@ pub fn parse_assoc_expr_with(&mut self,
                 // We currently have no non-associative operators that are not handled above by
                 // the special cases. The code is here only for future convenience.
                 Fixity::None => self.with_res(
-                    restrictions - Restrictions::RESTRICTION_STMT_EXPR,
+                    restrictions - RESTRICTION_STMT_EXPR,
                     |this| {
                         this.parse_assoc_expr_with(op.precedence() + 1,
                             LhsExpr::NotYetParsed)
@@ -2972,7 +2972,7 @@ fn is_at_start_of_range_notation_rhs(&self) -> bool {
         if self.token.can_begin_expr() {
             // parse `for i in 1.. { }` as infinite loop, not as `for i in (1..{})`.
             if self.token == token::OpenDelim(token::Brace) {
-                return !self.restrictions.contains(Restrictions::RESTRICTION_NO_STRUCT_LITERAL);
+                return !self.restrictions.contains(RESTRICTION_NO_STRUCT_LITERAL);
             }
             true
         } else {
@@ -2986,7 +2986,7 @@ pub fn parse_if_expr(&mut self, attrs: ThinVec<Attribute>) -> PResult<'a, P<Expr
             return self.parse_if_let_expr(attrs);
         }
         let lo = self.prev_span;
-        let cond = self.parse_expr_res(Restrictions::RESTRICTION_NO_STRUCT_LITERAL, None)?;
+        let cond = self.parse_expr_res(RESTRICTION_NO_STRUCT_LITERAL, None)?;
         let thn = self.parse_block()?;
         let mut els: Option<P<Expr>> = None;
         let mut hi = thn.span;
@@ -3005,7 +3005,7 @@ pub fn parse_if_let_expr(&mut self, attrs: ThinVec<Attribute>)
         self.expect_keyword(keywords::Let)?;
         let pat = self.parse_pat()?;
         self.expect(&token::Eq)?;
-        let expr = self.parse_expr_res(Restrictions::RESTRICTION_NO_STRUCT_LITERAL, None)?;
+        let expr = self.parse_expr_res(RESTRICTION_NO_STRUCT_LITERAL, None)?;
         let thn = self.parse_block()?;
         let (hi, els) = if self.eat_keyword(keywords::Else) {
             let expr = self.parse_else_expr()?;
@@ -3059,7 +3059,7 @@ pub fn parse_for_expr(&mut self, opt_ident: Option<ast::SpannedIdent>,
 
         let pat = self.parse_pat()?;
         self.expect_keyword(keywords::In)?;
-        let expr = self.parse_expr_res(Restrictions::RESTRICTION_NO_STRUCT_LITERAL, None)?;
+        let expr = self.parse_expr_res(RESTRICTION_NO_STRUCT_LITERAL, None)?;
         let (iattrs, loop_block) = self.parse_inner_attrs_and_block()?;
         attrs.extend(iattrs);
 
@@ -3074,7 +3074,7 @@ pub fn parse_while_expr(&mut self, opt_ident: Option<ast::SpannedIdent>,
         if self.token.is_keyword(keywords::Let) {
             return self.parse_while_let_expr(opt_ident, span_lo, attrs);
         }
-        let cond = self.parse_expr_res(Restrictions::RESTRICTION_NO_STRUCT_LITERAL, None)?;
+        let cond = self.parse_expr_res(RESTRICTION_NO_STRUCT_LITERAL, None)?;
         let (iattrs, body) = self.parse_inner_attrs_and_block()?;
         attrs.extend(iattrs);
         let span = span_lo.to(body.span);
@@ -3088,7 +3088,7 @@ pub fn parse_while_let_expr(&mut self, opt_ident: Option<ast::SpannedIdent>,
         self.expect_keyword(keywords::Let)?;
         let pat = self.parse_pat()?;
         self.expect(&token::Eq)?;
-        let expr = self.parse_expr_res(Restrictions::RESTRICTION_NO_STRUCT_LITERAL, None)?;
+        let expr = self.parse_expr_res(RESTRICTION_NO_STRUCT_LITERAL, None)?;
         let (iattrs, body) = self.parse_inner_attrs_and_block()?;
         attrs.extend(iattrs);
         let span = span_lo.to(body.span);
@@ -3118,7 +3118,7 @@ pub fn parse_catch_expr(&mut self, span_lo: Span, mut attrs: ThinVec<Attribute>)
     fn parse_match_expr(&mut self, mut attrs: ThinVec<Attribute>) -> PResult<'a, P<Expr>> {
         let match_span = self.prev_span;
         let lo = self.prev_span;
-        let discriminant = self.parse_expr_res(Restrictions::RESTRICTION_NO_STRUCT_LITERAL,
+        let discriminant = self.parse_expr_res(RESTRICTION_NO_STRUCT_LITERAL,
                                                None)?;
         if let Err(mut e) = self.expect(&token::OpenDelim(token::Brace)) {
             if self.token == token::Token::Semi {
@@ -3159,7 +3159,7 @@ pub fn parse_arm(&mut self) -> PResult<'a, Arm> {
             guard = Some(self.parse_expr()?);
         }
         self.expect(&token::FatArrow)?;
-        let expr = self.parse_expr_res(Restrictions::RESTRICTION_STMT_EXPR, None)?;
+        let expr = self.parse_expr_res(RESTRICTION_STMT_EXPR, None)?;
 
         let require_comma =
             !classify::expr_is_simple_block(&expr)
@@ -3740,7 +3740,7 @@ fn is_catch_expr(&mut self) -> bool {
         self.look_ahead(2, |t| *t == token::OpenDelim(token::Brace)) &&
 
         // prevent `while catch {} {}`, `if catch {} {} else {}`, etc.
-        !self.restrictions.contains(Restrictions::RESTRICTION_NO_STRUCT_LITERAL)
+        !self.restrictions.contains(RESTRICTION_NO_STRUCT_LITERAL)
     }
 
     fn is_union_item(&self) -> bool {
@@ -3812,7 +3812,7 @@ fn parse_stmt_without_recovery(&mut self,
                     self.mk_expr(lo.to(hi), ExprKind::Path(None, pth), ThinVec::new())
                 };
 
-                let expr = self.with_res(Restrictions::RESTRICTION_STMT_EXPR, |this| {
+                let expr = self.with_res(RESTRICTION_STMT_EXPR, |this| {
                     let expr = this.parse_dot_or_call_expr_with(expr, lo, attrs.into())?;
                     this.parse_assoc_expr_with(0, LhsExpr::AlreadyParsed(expr))
                 })?;
@@ -3952,7 +3952,7 @@ fn parse_stmt_without_recovery(&mut self,
 
                     // Remainder are line-expr stmts.
                     let e = self.parse_expr_res(
-                        Restrictions::RESTRICTION_STMT_EXPR, Some(attrs.into()))?;
+                        RESTRICTION_STMT_EXPR, Some(attrs.into()))?;
                     Stmt {
                         id: ast::DUMMY_NODE_ID,
                         span: lo.to(e.span),
@@ -3965,7 +3965,7 @@ fn parse_stmt_without_recovery(&mut self,
 
     /// Is this expression a successfully-parsed statement?
     fn expr_is_complete(&mut self, e: &Expr) -> bool {
-        self.restrictions.contains(Restrictions::RESTRICTION_STMT_EXPR) &&
+        self.restrictions.contains(RESTRICTION_STMT_EXPR) &&
             !classify::expr_requires_semi_to_be_stmt(e)
     }
 
@@ -4792,7 +4792,7 @@ fn missing_assoc_item_kind_err(&mut self, item_type: &str, prev_span: Span)
             sp,
             &format!("missing `fn`, `type`, or `const` for {}-item declaration",
                      item_type));
-        err.span_label(sp, &"missing `fn`, `type`, or `const`");
+        err.span_label(sp, "missing `fn`, `type`, or `const`");
         err
     }
 
index a911c21ed98d05e890c3c84e0c2b86667567c9e7..0c7e8fda83766cbdbc8f4f0df87c1e42b5f9c523 100644 (file)
@@ -677,7 +677,7 @@ fn print_string(&mut self, st: &str,
                     style: ast::StrStyle) -> io::Result<()> {
         let st = match style {
             ast::StrStyle::Cooked => {
-                (format!("\"{}\"", st.escape_default()))
+                (format!("\"{}\"", parse::escape_default(st)))
             }
             ast::StrStyle::Raw(n) => {
                 (format!("r{delim}\"{string}\"{delim}",
index d3c15763eb00e57ca85b1877706bfca6f95f1af3..7ca6d9301a689349dd12362f1cd55184b1385003 100644 (file)
@@ -8,9 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-enum foo { foo_(bar) }
-enum bar { bar_none, bar_some(bar) }
-//~^ ERROR recursive type `bar` has infinite size
+enum Foo {
+    Foo_(Bar)
+}
+
+enum Bar {
+    //~^ ERROR recursive type `Bar` has infinite size
+    //~| NOTE recursive type has infinite size
+    BarNone,
+    BarSome(Bar)  //~ NOTE recursive without indirection
+}
 
 fn main() {
 }
index 3bc8413cbca73b1a16a9ca3137e576bfdebb6e9b..061d1facda0ca7cf13232e389b8e89b775a5824d 100644 (file)
@@ -12,6 +12,7 @@ enum foo { foo_(bar) }
 struct bar { x: bar }
 //~^ ERROR E0072
 //~| NOTE recursive type has infinite size
+//~| NOTE recursive without indirection
 
 fn main() {
 }
index afffe2a2c8d03d057a95eb4296f5dea955e1598e..70a7cd8b9702128acfaaf0e373c5c9fcbc0cb95e 100644 (file)
@@ -15,6 +15,8 @@
 enum Expr { //~ ERROR E0072
             //~| NOTE recursive type has infinite size
     Plus(Expr, Expr),
+    //~^ NOTE recursive without indirection
+    //~| NOTE recursive without indirection
     Literal(i64),
 }
 
index 71e9325ab75d135dfb7823e967f0f48d5b74466e..10f73dc086288aed40084f0bb3e441dc20a33f60 100644 (file)
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct S { //~ ERROR E0072
-           //~| NOTE recursive type has infinite size
+struct S {
+    //~^ ERROR E0072
+    //~| NOTE recursive type has infinite size
     element: Option<S>
+    //~^ NOTE recursive without indirection
 }
 
 fn main() {
diff --git a/src/test/compile-fail/issue-41255.rs b/src/test/compile-fail/issue-41255.rs
new file mode 100644 (file)
index 0000000..a4585f7
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Matching against float literals should result in a linter error
+
+#![feature(slice_patterns)]
+#![feature(exclusive_range_pattern)]
+#![allow(unused)]
+#![forbid(illegal_floating_point_literal_pattern)]
+
+fn main() {
+    let x = 42.0;
+    match x {
+        5.0 => {}, //~ ERROR floating-point literals cannot be used
+                   //~| WARNING hard error
+        5.0f32 => {}, //~ ERROR floating-point literals cannot be used
+                      //~| WARNING hard error
+        -5.0 => {}, //~ ERROR floating-point literals cannot be used
+                    //~| WARNING hard error
+        1.0 .. 33.0 => {}, //~ ERROR floating-point literals cannot be used
+                           //~| WARNING hard error
+                           //~| ERROR floating-point literals cannot be used
+                           //~| WARNING hard error
+        39.0 ... 70.0 => {}, //~ ERROR floating-point literals cannot be used
+                             //~| WARNING hard error
+                             //~| ERROR floating-point literals cannot be used
+                             //~| WARNING hard error
+        _ => {},
+    };
+    let y = 5.0;
+    // Same for tuples
+    match (x, 5) {
+        (3.14, 1) => {}, //~ ERROR floating-point literals cannot be used
+                         //~| WARNING hard error
+                         //~| ERROR floating-point literals cannot be used
+                         //~| WARNING hard error
+        _ => {},
+    }
+    // Or structs
+    struct Foo { x: f32 };
+    match (Foo { x }) {
+        Foo { x: 2.0 } => {}, //~ ERROR floating-point literals cannot be used
+                              //~| WARNING hard error
+                              //~| ERROR floating-point literals cannot be used
+                              //~| WARNING hard error
+        _ => {},
+    }
+}
index 74e728d713b1d27e8aa00899b3aa981ad332615e..13b62429f46930d3c67a17cc9d1bf63022ee9dd0 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(slice_patterns)]
+#![allow(illegal_floating_point_literal_pattern)]
 
 enum t { a, b, }
 
index 7b56c6c15ebb308b68b959338bacc1730a665cc5..5dd76ce32c7a401ab0d47f1d674cee2fe8386154 100644 (file)
@@ -11,7 +11,7 @@
 struct t1 { //~ ERROR E0072
             //~| NOTE recursive type has infinite size
     foo: isize,
-    foolish: t1
+    foolish: t1  //~ NOTE recursive without indirection
 }
 
 fn main() { }
index f894305754319d20880407201cf6f158bfdbbc2a..ac085d475114e6b4e08233ed03fc8a0c34b04c5a 100644 (file)
@@ -21,6 +21,12 @@ pub fn bar() {}
 //~^^ ERROR: bare CR not allowed in block doc-comment
 
 fn main() {
+    //! doc comment with bare CR: '\r'
+    //~^ ERROR: bare CR not allowed in doc-comment
+
+    /*! block doc comment with bare CR: '\r' */
+    //~^ ERROR: bare CR not allowed in block doc-comment
+
     // the following string literal has a bare CR in it
     let _s = "foo\rbar"; //~ ERROR: bare CR not allowed in string
 
diff --git a/src/test/run-make/trace-macros-flag/Makefile b/src/test/run-make/trace-macros-flag/Makefile
deleted file mode 100644 (file)
index 3338e39..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# This test verifies that "-Z trace-macros"  works as it should. The traditional
-# "hello world" program provides a small example of this as not only println! is
-# listed, but also print! (since println! expands to this)
-
--include ../tools.mk
-
-all:
-       $(RUSTC) -Z trace-macros hello.rs > $(TMPDIR)/hello.out
-       diff -u $(TMPDIR)/hello.out hello.trace
diff --git a/src/test/run-make/trace-macros-flag/hello.rs b/src/test/run-make/trace-macros-flag/hello.rs
deleted file mode 100644 (file)
index 42d3d4c..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    println!("Hello, World!");
-}
diff --git a/src/test/run-make/trace-macros-flag/hello.trace b/src/test/run-make/trace-macros-flag/hello.trace
deleted file mode 100644 (file)
index cf73333..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-println! { "Hello, World!" }
-print! { concat ! ( "Hello, World!" , "\n" ) }
index e3d1761dfffdbe6f3ce1c9029f211fea9e693f95..b276589f0c47b1ed0b4136853d07799664f34238 100644 (file)
@@ -27,6 +27,12 @@ impl Foo for Def {
     const X: i32 = 97;
 }
 
+struct Proxy<T>(T);
+
+impl<T: Foo> Foo for Proxy<T> {
+    const X: i32 = T::X;
+}
+
 fn sub<A: Foo, B: Foo>() -> i32 {
     A::X - B::X
 }
@@ -38,4 +44,7 @@ fn main() {
     assert_eq!(97, Def::get_x());
     assert_eq!(-86, sub::<Abc, Def>());
     assert_eq!(86, sub::<Def, Abc>());
+    assert_eq!(-86, sub::<Proxy<Abc>, Def>());
+    assert_eq!(-86, sub::<Abc, Proxy<Def>>());
+    assert_eq!(86, sub::<Proxy<Def>, Proxy<Abc>>());
 }
diff --git a/src/test/run-pass/lex-bare-cr-nondoc-comment.rs b/src/test/run-pass/lex-bare-cr-nondoc-comment.rs
new file mode 100644 (file)
index 0000000..ba949ca
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-cr
+
+// nondoc comment with bare CR: '\r'
+//// nondoc comment with bare CR: '\r'
+/* block nondoc comment with bare CR: '\r' */
+
+fn main() {
+}
diff --git a/src/test/ui/macros/trace-macro.rs b/src/test/ui/macros/trace-macro.rs
new file mode 100644 (file)
index 0000000..34f674a
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z trace-macros
+
+fn main() {
+    println!("Hello, World!");
+}
diff --git a/src/test/ui/macros/trace-macro.stderr b/src/test/ui/macros/trace-macro.stderr
new file mode 100644 (file)
index 0000000..09117a4
--- /dev/null
@@ -0,0 +1,9 @@
+note: trace_macro
+  --> $DIR/trace-macro.rs:14:5
+   |
+14 |     println!("Hello, World!");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: expands to `println! { "Hello, World!" }`
+   = note: expands to `print! { concat ! ( "Hello, World!" , "/n" ) }`
+
index 5204390ef9d2a8ace3ca0ff18d4c7b47859462e0..1f6dd6b1d165f52c9eb3f5e257ccce7dcafd4718 100644 (file)
@@ -3,6 +3,9 @@ error[E0072]: recursive type `ListNode` has infinite size
    |
 11 | struct ListNode {
    | ^^^^^^^^^^^^^^^ recursive type has infinite size
+12 |     head: u8,
+13 |     tail: Option<ListNode>,
+   |     ---------------------- recursive without indirection
    |
    = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ListNode` representable
 
index 9c6816e736313c534e6bc6df1579a47e9bfcbcce..a06cbd04deb4fb4a32bc030387426608e8a913fd 100644 (file)
@@ -6,6 +6,7 @@ error[E0072]: recursive type `ListNode` has infinite size
 14 | | {
 15 | |     head: u8,
 16 | |     tail: Option<ListNode>,
+   | |     ---------------------- recursive without indirection
 17 | | }
    | |_^ recursive type has infinite size
    |
diff --git a/src/test/ui/span/recursive-type-field.rs b/src/test/ui/span/recursive-type-field.rs
new file mode 100644 (file)
index 0000000..6fef4d3
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::rc::Rc;
+
+struct Foo<'a> {
+    bar: Bar<'a>,
+    b: Rc<Bar<'a>>,
+}
+
+struct Bar<'a> {
+    y: (Foo<'a>, Foo<'a>),
+    z: Option<Bar<'a>>,
+    a: &'a Foo<'a>,
+    c: &'a [Bar<'a>],
+    d: [Bar<'a>; 1],
+    e: Foo<'a>,
+    x: Bar<'a>,
+}
+
+fn main() {}
diff --git a/src/test/ui/span/recursive-type-field.stderr b/src/test/ui/span/recursive-type-field.stderr
new file mode 100644 (file)
index 0000000..b4d0b5a
--- /dev/null
@@ -0,0 +1,31 @@
+error[E0072]: recursive type `Foo` has infinite size
+  --> $DIR/recursive-type-field.rs:13:1
+   |
+13 | struct Foo<'a> {
+   | ^^^^^^^^^^^^^^ recursive type has infinite size
+14 |     bar: Bar<'a>,
+   |     ------------ recursive without indirection
+   |
+   = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
+
+error[E0072]: recursive type `Bar` has infinite size
+  --> $DIR/recursive-type-field.rs:18:1
+   |
+18 | struct Bar<'a> {
+   | ^^^^^^^^^^^^^^ recursive type has infinite size
+19 |     y: (Foo<'a>, Foo<'a>),
+   |     --------------------- recursive without indirection
+20 |     z: Option<Bar<'a>>,
+   |     ------------------ recursive without indirection
+...
+23 |     d: [Bar<'a>; 1],
+   |     --------------- recursive without indirection
+24 |     e: Foo<'a>,
+   |     ---------- recursive without indirection
+25 |     x: Bar<'a>,
+   |     ---------- recursive without indirection
+   |
+   = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable
+
+error: aborting due to 2 previous errors
+