Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syntax: use MetaPath (a simpler version of Path) for Attribute and MetaItem. #56492

Closed
wants to merge 3 commits into from

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Dec 4, 2018

This is the simpler alternative to #56480, and has two advantages:

  • doesn't introduce so many abstractions
  • no more {ast,hir}::PathSegment in attribute paths
    • that could've contained generic arguments even if it never did for use and attributes

r? @petrochenkov cc @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 4, 2018
@eddyb eddyb force-pushed the ast-attr-simple-path branch from a3f5490 to 778e1b6 Compare December 4, 2018 08:12
@eddyb eddyb force-pushed the ast-attr-simple-path branch from 778e1b6 to 3b5f818 Compare December 4, 2018 08:34
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:17748f7c:start=1543912563515235839,finish=1543912632080453342,duration=68565217503
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:56:38] 
[00:56:38] running 120 tests
[00:56:41] i..ii...iii..iiii.....i...i..........i..iii.............i.....i.....ii...i..i.ii..............i...ii 100/120
[00:56:41] ..ii.i.....iiii.....
[00:56:41] 
[00:56:41]  finished in 3.537
[00:56:41] travis_fold:end:test_codegen

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:56:56] 
[00:56:56] running 118 tests
[00:57:21] .iiiii...i.....i..i...i..i.i..i.i..i.....i..i....i..........iiii.........i.i....i...i.......ii.i.i.i 100/118
[00:57:25] ......iii.i.....ii
[00:57:25] 
[00:57:25]  finished in 29.022
[00:57:25] travis_fold:end:test_debuginfo

---
travis_time:start:test_run-pass-fulldeps
Check compiletest suite=run-pass-fulldeps mode=run-pass (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:57:28] 
[00:57:28] running 60 tests
[00:58:45] .F.FF......................F......FFFF.......FF............test [run-pass] run-pass-fulldeps/myriad-closures.rs has been running for over 60 seconds
[01:00:47] failures:
[01:00:47] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:503:22
[01:00:47] 
[01:00:47] ---- [run-pass] run-pass-fulldeps/custom-derive-partial-eq.rs stdout ----
[01:00:47] ---- [run-pass] run-pass-fulldeps/custom-derive-partial-eq.rs stdout ----
[01:00:47] 
[01:00:47] error: auxiliary build of "/checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs" failed to compile: 
[01:00:47] status: exit code: 1
[01:00:47] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/custom-derive-partial-eq/auxiliary" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--crate-type" "dylib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/custom-derive-partial-eq/auxiliary"
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] ------------------------------------------
[01:00:47] stderr:
[01:00:47] stderr:
[01:00:47] ------------------------------------------
[01:00:47] {"message":"cannot find value `mitem` in this scope","code":{"code":"E0425","explanation":"\nAn unresolved name was used.\n\nErroneous code examples:\n\n```compile_fail,E0425\nsomething_that_doesnt_exist::foo;\n// error: unresolved name `something_that_doesnt_exist::foo`\n\n// or:\n\ntrait Foo {\n    fn bar() {\n        Self; // error: unresolved name `Self`\n    }\n}\n\n// or:\n\nlet x = unknown_variable;  // error: unresolved name `unknown_variable`\n```\n\nPlease verify that the name wasn't misspelled and ensure that the\nidentifier being referred to is valid for the given situation. Example:\n\n```\nenum something_that_does_exist {\n    Foo,\n}\n```\n\nOr:\n\n```\nmod something_that_does_exist {\n    pub static foo : i32 = 0i32;\n}\n\nsomething_that_does_exist::foo; // ok!\n```\n\nOr:\n\n```\nlet unknown_variable = 12u32;\nlet x = unknown_variable; // ok!\n```\n\nIf the item is not defined in the current module, it must be imported using a\n`use` statement, like so:\n\n```\n# mod foo { pub fn bar() {} }\n# fn main() {\nuse foo::bar;\nbar();\n# }\n```\n\nIf the item you are importing is not defined in some super-module of the\ncurrent module, then it must also be declared as public (e.g., `pub fn`).\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs","byte_start":2939,"byte_end":2944,"line_start":80,"line_end":80,"column_start":26,"column_end":31,"is_primary":true,"text":[{"text":"    trait_def.expand(cx, mitem, item, push)","highlight_start":26,"highlight_end":31}],"label":"did you mean `item`?","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0425]: cannot find value `mitem` in this scope\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs:80:26\n   |\nLL |     trait_def.expand(cx, mitem, item, push)\n   |                          ^^^^^ did you mean `item`?\n\n"}
[01:00:47] {"message":"function is expected to take 5 argumentsxpr> {","highlight_start":1,"highlight_end":79},{"text":"        cs_fold(true,","highlight_start":1,"highlight_end":22},{"text":"                |cx, span, subexpr, self_f, other_fs| {","highlight_start":1,"highlight_end":56},{"text":"                    let other_f = (other_fs.len(), other_fs.get(0)).1.unwrap();","highlight_start":1,"highlight_end":80},{"text":"                    let eq = cx.expr_binary(span, BinOpKind::Eq, self_f, other_f.clone());","highlight_start":1,"highlight_end":91},{"text":"                    cx.expr_binary(span, BinOpKind::And, subexpr, eq)","highlight_start":1,"highlight_end":70},{"text":"                },","highlight_start":1,"highlight_end":19},{"text":"                cx.expr_bool(span, true),","highlight_start":1,"highlight_end":42},{"text":"                Box::new(|cx, span, _, _| cx.expr_bool(span, false)),","highlight_start":1,"highlight_end":70},{"text":"                cx,","highlight_start":1,"highlight_end":20},{"text":"                span,","highlight_start":1,"highlight_end":22},{"text":"                substr)","highlight_start":1,"highlight_end":24},{"text":"    }","highlight_start":1,"highlight_end":6},{"text":"","highlight_start":1,"highlight_end":1},{"text":"    let inline = cx.meta_word(span, Symbol::intern(\"inline\"));","highlight_start":1,"highlight_end":63},{"text":"    let attrs = vec![cx.attribute(span, inline)];","highlight_start":1,"highlight_end":50},{"text":"    let methods = vec![MethodDef {","highlight_start":1,"highlight_end":35},{"text":"        name: \"eq\",","highlight_start":1,"highlight_end":20},{"text":"        generics: LifetimeBounds::empty(),","highlighhlight_start":1,"highlight_end":38},{"text":"    };","highlight_start":1,"highlight_end":7},{"text":"    trait_def.expand(cx, mitem, item, push)","highlight_start":1,"highlight_end":44},{"text":"}","highlight_start":1,"highlight_end":2}],"label":"takes 4 arguments","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"required because of the requirements on the impl of `syntax::ext::base::MultiItemDecorator` for `for<'r, 's, 't0, 't1> fn(&'r mut syntax::ext::base::ExtCtxt<'s>, syntax::source_map::Span, &'t0 syntax::ext::base::Annotatable, &'t1 mut (dyn std::ops::FnMut(syntax::ext::base::Annotatable) + 't1)) {expand_deriving_partial_eq}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"required for the cast to the object type `dyn syntax::ext::base::MultiItemDecorator + rustc_data_structures::sync::Send + rustc_data_structures::sync::Sync`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0593]: function is expected to take 5 arguments, but it takes 4 arguments\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs:34:50\n   |\nLL |                                     MultiDecorator(Box::new(expand_deriving_partial_eq)));\n   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected function that takes 5 arguments\n...\nLL | / fn expand_deriving_partial_eq(cx: &mut ExtCtxt, span: Span, item: &Annotatable,\nLL | |                               push: &mut FnMut(Annotatable)) {\nLL | |     // structures are equal if all fields are equal, and "expansion":null}],"children":[],"rendered":"error[E0061]: this function takes 3 parameters but 4 parameters were supplied\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs:80:15\n   |\nLL |     trait_def.expand(cx, mitem, item, push)\n   |               ^^^^^^ expected 3 parameters\n\n"}
[01:00:47] {"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 3 previous errors\n\n"}
[01:00:47] {"message":"Some errors occurred: E0061, E0425, E0593.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0061, E0425, E0593.\n"}
[01:00:47] {"message":"For more information about an error, try `rustc --explain E0061`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0061`.\n"}
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] thread '[run-pass] run-pass-fulldeps/custom-derive-partial-eq.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3282:9
[01:00:47] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:00:47] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:00:47] 
[01:00:47] ---- [run-pass] run-pass-fulldeps/derive-totalsum-attr.rs stdout ----
[01:00:47] 
[01:00:47] error: auxiliary build of "/checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs" failed to compile: 
[01:00:47] status: exit code: 1
[01:00:47] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/derive-totalsum-attr/auxiliary" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--crate-type" "dylib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/derive-totalsum-attr/auxiliary"
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] ------------------------------------------
[01:00:47] stderr:
[01:00:47] stderr:
[01:00:47] ------------------------------------------
[01:00:47] {"message":"this function takes 3 parameters but 4 parameters were supplied","code":{"code":"E0061","explanation":"\nThe number of arguments passed to a function must match the number of arguments\nspecified in the function signature.\n\nFor example, a function like:\n\n```\nfn f(a: u16, b: &str) {}\n```\n\nMust always be called with exactly two arguments, e.g. `f(2, \"test\")`.\n\nNote that Rust does not have a notion of optional function arguments or\nvariadic functions (except for its C-FFI).\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs","byte_start":2341,"byte_end":2347,"line_start":71,"line_end":71,"column_start":15,"column_end":21,"is_primary":true,"text":[{"text":"    trait_def.expand(cx, mitem, item, push)","highlight_start":15,"highlight_end":21}],"label":"expected 3 parameters","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0061]: thL" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/derive-totalsum/auxiliary"
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] ------------------------------------------
[01:00:47] stderr:
[01:00:47] stderr:
[01:00:47] ------------------------------------------
[01:00:47] {"message":"this function takes 3 parameters but 4 parameters were supplied","code":{"code":"E0061","explanation":"\nThe number of arguments passed to a function must match the number of arguments\nspecified in the function signature.\n\nFor example, a function like:\n\n```\nfn f(a: u16, b: &str) {}\n```\n\nMust always be called with exactly two arguments, e.g. `f(2, \"test\")`.\n\nNote that Rust does not have a notion of optional function arguments or\nvariadic functions (except for its C-FFI).\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs","byte_start":3032,"byte_end":3038,"line_start":85,"line_end":85,"column_start":15,"column_end":21,"is_primary":true,"text":[{"text":"    trait_def.expand(cx, mitem, item, push)","highlight_start":15,"highlight_end":21}],"label":"expected 3 parameters","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0061]: this function takes 3 parameters but 4 parameters were supplied\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs:85:15\n   |\nLL |     trait_def.expand(cx, mitem, item, push)\n   |               ^^^^^^ expected 3 parameters\n\n"}
[01:00:47] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[01:00:47] {"message":"For more information about this error, try `rustc --explain E0061`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0061`.\n"}
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] thread '[run-pass] run-pass-fulldeps/derive-totalsum.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3282:9
[01:00:47] 
[01:00:47] 
[01:00:47] ---- [run-pass] run-pass-fulldeps/issue-40663.rs stdout ----
[01:00:47] 
[01:00:47] error: auxiliary build of "/checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs" failed to compile: 
[01:00:47] status: exit code: 1
[01:00:47] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/issue-40663/auxiliary" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--crate-type" "dylib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/issue-40663/auxiliary"
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] ------------------------------------------
[01:00:47] stderr:
[01:00:47] stderr:
[01:00:47] ------------------------------------------
[01:00:47] {"message":"this function takes 3 parameters but 4 parameters were supplied","code":{"code":"E0061","explanation":"\nThe number of arguments passed to a function must match the number of arguments\nspecified in the function signature.\n\nFor example, a function like:\n\n```\nfn f(a: u16, b: &str) {}\n```\n\nMust always be called with exactly two arguments, e.g. `f(2, \"test\")`.\n\nNote that Rust does not have a notion of optional function arguments or\nvariadic functions (except for its C-FFI).\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs","byte_start":3032,"byte_end":3038,"line_start":85,"line_end":85,"column_start":15,"column_end":21,"is_primary":true,"text":[{"text":"    trait_def.expand(cx, mitem, item, push)","highlight_start":15,"highlight_end":21}],"label":"expected 3 parameters","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0061]: this function takes 3 parameters but 4 parameters were supplied\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs:85:15\n   |\nLL |     trait_def.expand(cx, mitem, item, push)\n   |               ^^^^^^ expected 3 parameters\n\n"}
[01:00:47] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[01:00:47] {"message":"For more information about this error, try `rustc --explain E0061`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0061`.\n"}
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] thread '[run-pass] run-pass-fulldeps/issue-40663.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3282:9
[01:00:47] 
[01:00:47] 
[01:00:47] ---- [run-pass] run-pass-fulldeps/macro-crate-does-hygiene-work.rs stdout ----
[01:00:47] 
[01:00:47] error: auxiliary build of "/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs" failed to compile: 
[01:00:47] status: exit code: 1
[01:00:47] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/macro-crate-does-hygiene-work/auxiliary" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--crate-type" "dylib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/macro-crate-does-hygiene-work/auxiliary"
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] ------------------------------------------
[01:00:47] stderr:
[01:00:47] stderr:
[01:00:47] ------------------------------------------
[01:00:47] {"message":"unused macro definition","code":{"code":"unused_macros","explanation":null},"level":"warning","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs","byte_start":1010,"byte_end":1053,"line_start":33,"line_end":33,"column_start":1,"column_end":44,"is_primary":true,"text":[{"text":"macro_rules! unexported_macro { () => (3) }","highlight_start":1,"highlight_end":44}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"#[warn(unused_macros)] on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"warning: unused macro definition\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs:33:1\n   |\nLL | macro_rules! unexported_macro { () => (3) }\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\n   = note: #[warn(unused_macros)] on by default\n\n"}
[01:00:47] {"message":"no field `ident` on type `&syntax::ast::MetaItem`","code":{"code":"E0609","explanation":"\nAttempted to access a non-existent field in a struct.\n\nErroneous code example:\n\n```compile_fail,E0609\nstruct StructWithFields {\n    x: u32,\n}\n\nlet s = StructWithFields { x: 0 };\nprintln!(\"{}\", s.foo); // error: no field `foo` on type `StructWithFields`\n```\n\nTo fix this error, check that you didn't misspell the field's name or that the\nfield actually exists. Example:\n\n```\nstruct StructWithFields {\n    x: u32,\n}\n\nlet s = StructWithFields { x: 0 };\nprintln!(\"{}\", s.x); // ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs","byte_start":4406,"byte_end":4411,"line_start":115,"line_end":115,"column_start":22,"column_end":27,"is_primary":true,"text":[{"text":"                word.ident.segments.last().unwrap().ident","highlight_start":22,"highlight_end":27}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0609]: no field `ident` on type `&syntax::ast::MetaItem`\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs:115:22\n   |\nLL |                 word.ident.segments.last().unwrap().ident\n   |                      ^^^^^\n\n"}
[01:00:47] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[01:00:47] {"message":"For more information about this error, try `rustc --explain E0609`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0609`.\n"}
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] thread '[run-pass] run-pass-fulldeps/macro-crate-does-hygiene-work.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3282:9
[01:00:47] 
[01:00:47] 
[01:00:47] ---- [run-pass] run-pass-fulldeps/macro-crate-multi-decorator-literals.rs stdout ----
[01:00:47] 
[01:00:47] error: auxiliary build of "/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs" failed to compile: 
[01:00:47] status: exit code: 1
[01:00:47] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/macro-crate-multi-decorator-literals/auxiliary" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown!(\"{}\", s.foo); // error: no field `foo` on type `StructWithFields`\n```\n\nTo fix this error, check that you didn't misspell the field's name or that the\nfield actually exists. Example:\n\n```\nstruct StructWithFields {\n    x: u32,\n}\n\nlet s = StructWithFields { x: 0 };\nprintln!(\"{}\", s.x); // ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs","byte_start":4406,"byte_end":4411,"line_start":115,"line_end":115,"column_start":22,"column_end":27,"is_primary":true,"text":[{"text":"                word.ident.segments.last().unwrap().ident","highlight_start":22,"highlight_end":27}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0609]: no field `ident` on type `&syntax::ast::MetaItem`\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs:115:22\n   |\nLL |                 word.ident.segments.last().unwrap().ident\n   |                      ^^^^^\n\n"}
[01:00:47] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[01:00:47] {"message":"For more information about this error, try `rustc --explain E0609`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0609`.\n"}
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] thread '[run-pass] run-pass-fulldeps/macro-crate-multi-decorator-literals.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3282:9
[01:00:47] 
[01:00:47] 
[01:00:47] ---- [run-pass] run-pass-fulldeps/macro-crate-multi-decorator.rs stdout ----
[01:00:47] 
[01:00:47] error: auxiliary build of "/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs" failed to compile: 
[01:00:47] status: exit code: 1
[01:00:47] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/macro-crate-multi-decorator/auxiliary" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--crate-type" "dylib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/macro-crate-multi-decorator/auxiliary"
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] ------------------------------------------
[01:00:47] stderr:
[01:00:47] stderr:
[01:00:47] ------------------------------------------
[01:00:47] {"message":"unused macro definition","code":{"code":"unused_macros","explanation":null},"level":"warning","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs","byte_start":1010,"byte_end":1053,"line_start":33,"line_end":33,"column_start":1,"column_end":44,"is_primary":true,"text":[{"text":"macro_rules! unexported_macro { () => (3) }","highlight_start":1,"highlight_end":44}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"#[warn(unused_macros)] on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"warning: unused macro definition\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs:33:1\n   |\nLL | macro_rules! unexported_macro { () => (3) }\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\n   = note: #[warn(unused_macros)] on by default\n\n"}
[01:00:47] {"message":"no field `ident` on type `&syntax::ast::MetaItem`","code":{"code":"E0609","explanation":"\nAttempted to access a non-existent field in a struct.\n\nErroneous code example:\n\n```compile_fail,E0609\nstruct StructWithFields {\n    x: u32,\n}\n\nlet s = StructWithFields { x: 0 };\nprintln!(\"{}\", s.foo); // error: no field `foo` on type `StructWithFields`\n```\n\nTo fix this error, check that you didn't misspell the field's name or that the\nfield actually exists. Example:\n\n```\nstruct StructWithFields {\n    x: u32,\n}\n\nlet s = StructWithFields { x: 0 };\nprintln!(\"{}\", s.x); // ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs","byte_start":4406,"byte_end":4411,"line_start":115,"line_end":115,"column_start":22,"column_end":27,"is_primary":true,"text":[{"text":"                word.ident.segments.last().unwrap().ident","highlight_start":22,"highlight_end":27}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0609]: no field `ident` on type `&syntax::ast::MetaItem`\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs:115:22\n   |\nLL |                 word.ident.segments.last().unwrap().ident\n   |                      ^^^^^\n\n"}
[01:00:47] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[01:00:47] {"message":"For more information about this error, try `rustc --explain E0609`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0609`.\n"}
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] thread '[run-pass] run-pass-fulldeps/macro-crate-multi-decorator.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3282:9
[01:00:47] 
[01:00:47] 
[01:00:47] ---- [run-pass] run-pass-fulldeps/macro-crate.rs stdout ----
[01:00:47] 
[01:00:47] error: auxiliary build of "/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs" failed to compile: 
[01:00:47] status: exit code: 1
[01:00:47] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/macro-crate/auxiliary" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--crate-type" "dylib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/macro-crate/auxiliary"
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] ------------------------------------------
[01:00:47] stderr:
[01:00:47] stderr:
[01:00:47] ------------------------------------------
[01:00:47] {"message":"unused macro definition","code":{"code":"unused_macros","explanation":null},"level":"warning","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs","byte_start":1010,"byte_end":1053,"line_start":33,"line_end":33,"column_start":1,"column_end":44,"is_primary":true,"text":[{"text":"macro_rules! unexported_macro { () => (3) }","highlight_start":1,"highlight_end":44}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"#[warn(unused_macros)] on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"warning: unused macro definition\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs:33:1\n   |\nLL | macro_rules! unexported_macro { () => (3) }\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\n   = note: #[warn(unused_macros)] on by default\n\n"}
[01:00:47] {"message":"no field `ident` on type `&syntax::ast::MetaItem`","code":{"code":"E0609","explanation":"\nAttempted to access a non-existent field in a struct.\n\nErroneous code example:\n\n```compile_fail,E0609\nstruct StructWithFields {\n    x: u32,\n}\n\nlet s = StructWithFields { x: 0 };\nprintln!(\"{}\", s.foo); // error: no field `foo` on type `StructWithFields`\n```\n\nTo fix this error, check that you didn't misspell the field's name or that the\nfield actually exists. Example:\n\n```\nstruct StructWithFields {\n    x: u32,\n}\n\nlet s = StructWithFields { x: 0 };\nprintln!(\"{}\", s.x); // ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs","byte_start":4406,"byte_end":4411,"line_start":115,"line_end":115,"column_start":22,"column_end":27,"is_primary":true,"text":[{"text":"                word.ident.segments.last().unwrap().ident","highlight_start":22,"highlight_end":27}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0609]: no field `ident` on type `&syntax::ast::MetaItem`\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs:115:22\n   |\nLL |                 word.ident.segments.last().unwrap().ident\n   |                      ^^^^^\n\n"}
[01:00:47] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[01:00:47] {"message":"For more information about this error, try `rustc --explain E0609`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0609`.\n"}
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] thread '[run-pass] run-pass-fulldeps/macro-crate.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3282:9
[01:00:47] 
[01:00:47] 
[01:00:47] ---- [run-pass] run-pass-fulldeps/plugin-lib-ok-in-plugin.rs stdout ----
[01:00:47] 
[01:00:47] error: auxiliary build of "/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs" failed to compile: 
[01:00:47] status: exit code: 1
[01:00:47] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/plugin-lib-ok-in-plugin/auxiliary" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--crate-type" "dylib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps/plugin-lib-ok-in-plugin/auxiliary"
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] ------------------------------------------
[01:00:47] stderr:
[01:00:47] stderr:
[01:00:47] ------------------------------------------
[01:00:47] {"message":"unused macro definition","code":{"code":"unused_macros","explanation":null},"level":"warning","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs","byte_start":1010,"byte_end":1053,"line_start":33,"line_end":33,"column_start":1,"column_end":44,"is_primary":true,"text":[{"text":"macro_rules! unexported_macro { () => (3) }","highlight_start":1,"highlight_end":44}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"#[warn(unused_macros)] on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"warning: unused macro definition\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs:33:1\n   |\nLL | macro_rules! unexported_macro { () => (3) }\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\n   = note: #[warn(unused_macros)] on by default\n\n"}
[01:00:47] {"message":"no field `ident` on type `&syntax::ast::MetaItem`","code":{"code":"E0609","explanation":"\nAttempted to access a non-existent field in a struct.\n\nErroneous code example:\n\n```compile_fail,E0609\nstruct StructWithFields {\n    x: u32,\n}\n\nlet s = StructWithFields { x: 0 };\nprintln!(\"{}\", s.foo); // error: no field `foo` on type `StructWithFields`\n```\n\nTo fix this error, check that you didn't misspell the field's name or that the\nfield actually exists. Example:\n\n```\nstruct StructWithFields {\n    x: u32,\n}\n\nlet s = StructWithFields { x: 0 };\nprintln!(\"{}\", s.x); // ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs","byte_start":4406,"byte_end":4411,"line_start":115,"line_end":115,"column_start":22,"column_end":27,"is_primary":true,"text":[{"text":"                word.ident.segments.last().unwrap().ident","highlight_start":22,"highlight_end":27}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0609]: no field `ident` on type `&syntax::ast::MetaItem`\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs:115:22\n   |\nLL |                 word.ident.segments.last().unwrap().ident\n   |                      ^^^^^\n\n"}
[01:00:47] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[,"column_start":22,"column_end":27,"is_primary":true,"text":[{"text":"                word.ident.segments.last().unwrap().ident","highlight_start":22,"highlight_end":27}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0609]: no field `ident` on type `&syntax::ast::MetaItem`\n  --> /checkout/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs:115:22\n   |\nLL |                 word.ident.segments.last().unwrap().ident\n   |                      ^^^^^\n\n"}
[01:00:47] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[01:00:47] {"message":"For more information about this error, try `rustc --explain E0609`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0609`.\n"}
[01:00:47] ------------------------------------------
[01:00:47] 
[01:00:47] thread '[run-pass] run-pass-fulldeps/plugin-plus-extern-crate.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3282:9
[01:00:47] 

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@petrochenkov
Copy link
Contributor

petrochenkov commented Dec 5, 2018

Didn't have a chance to look at this in detail today, but I'm pretty skeptical about the idea in general.

With two kinds of paths there's now a chance to visit/fold all paths, but forget attribute paths accidentally.
Macro paths (and maybe import paths as well?) have exactly the same properties and restrictions as attribute paths, but they still use Path and not MetaPath.
What is the ultimate motivation/goal? I suspect it's somehow related to #56511?

@eddyb
Copy link
Member Author

eddyb commented Dec 5, 2018

What is the ultimate motivation/goal?

The description for #56480 covers that a bit. The problem is we have ast::Path in ast::Attribute but we use ast::Attribute in the HIR (and therefore have the risk of AST fragments in HIR).
For my purposes, a newtype of ast::Path that Derefs to ast::Path, but can only be created from a path with no generic arguments, would probably be enough, I think.

With two kinds of paths there's now a chance to visit/fold all paths, but forget attribute paths accidentally.

This is already an issue, e.g. MetaItem's path wasn't being folded.

@petrochenkov
Copy link
Contributor

petrochenkov commented Dec 5, 2018

r=me for the first two commits, see #56480 regarding the third one.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 5, 2018
@bors
Copy link
Contributor

bors commented Dec 6, 2018

☔ The latest upstream changes (presumably #54517) made this pull request unmergeable. Please resolve the merge conflicts.

@eddyb
Copy link
Member Author

eddyb commented Dec 6, 2018

@petrochenkov What do you think of the newtype of ast::Path instead of introducing a new struct? It would make most of the changes in the third commit go away and still work for me.

@petrochenkov
Copy link
Contributor

@eddyb

What do you think of the newtype of ast::Path instead of introducing a new struct? It would make most of the changes in the third commit go away and still work for me.

Seems ok.
I'm still interested why having AST pieces in HIR is a problem (#56480 (comment)) and why you can't bug!() on generic arguments (#56480 (comment)).

@eddyb
Copy link
Member Author

eddyb commented Dec 6, 2018

@petrochenkov Just customize ast::Path's non-serde encoding? I guess it's okay, it just needs to come with a caveat to never use it with generic arguments.
And I'd still need to parser change from the third commit of this PR, to strip off generic arguments when emitting an error that they're not supported, to avoid anything falling apart later on in the compilation.

@XAMPPRocky
Copy link
Member

Triage; @eddyb Hello, have you been able to get back to this PR?

@TimNN
Copy link
Contributor

TimNN commented Jan 22, 2019

Ping from triage @eddyb: What is the status of this PR?

@Dylan-DPC-zz
Copy link

ping from triage @eddyb Unfortunately we haven't heard from you on this in a while, so I'm closing the PR to keep things tidy. Don't worry though, if you'll have time again in the future please reopen this PR, we'll be happy to review it again!

@Dylan-DPC-zz Dylan-DPC-zz added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants