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

Expand macros in extern {} blocks #49350

Merged
merged 1 commit into from
Apr 5, 2018

Conversation

abonander
Copy link
Contributor

@abonander abonander commented Mar 25, 2018

This permits macro and proc-macro and attribute invocations (the latter only with the proc_macro feature of course) in extern {} blocks, gated behind a new macros_in_extern feature.

A tracking issue is now open at #49476

closes #48747

@abonander
Copy link
Contributor Author

@petrochenkov Feel free to assign another reviewer if you have too much on your plate.

@petrochenkov petrochenkov self-assigned this Mar 25, 2018
@petrochenkov petrochenkov added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 26, 2018
@@ -6802,7 +6802,7 @@ impl<'a> Parser<'a> {
}

/// Parse a foreign item.
fn parse_foreign_item(&mut self) -> PResult<'a, Option<ForeignItem>> {
pub fn parse_foreign_item(&mut self) -> PResult<'a, Option<ForeignItem>> {
Copy link
Contributor

@petrochenkov petrochenkov Mar 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parser support for macros in foreign blocks is missing (the disambiguation is a bit tricky, but the approach can be copied from macros in traits/impls as well).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had covered this already but I lost a bunch of work somewhere.

@@ -1599,6 +1599,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
gate_feature_post!(&self, extern_types, i.span,
"extern types are experimental");
}
ast::ForeignItemKind::Macro(..) => {
// FIXME: do we allow macro invocs in `extern {}`?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this should be feature gated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the feature gate is checked in the expansion code since this visitor is post-expansion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought it was, at least. Must have forgotten to push some changes from my laptop.

@petrochenkov
Copy link
Contributor

LGTM, but tests are missing and some existing tests fail.

@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 Mar 26, 2018
@petrochenkov
Copy link
Contributor

Minimal set of tests: invocation of macro_rules!, macro and a !-style procedural macro in a foreign block, expansion of a proc-macro attribute attached to a foreign item.

@abonander
Copy link
Contributor Author

@petrochenkov I'm wondering the best way to add items to an extern {} block that won't cause an error in the linker. I'd rather not link to any real symbols cause that'd be OS-dependent.

Should I add a second crate that exports some symbols to link to, maybe? Or do you think this would be a reason to wait for #49321?

@petrochenkov
Copy link
Contributor

@abonander

I'm wondering the best way to add items to an extern {} block that won't cause an error in the linker.

Refer to something from src/test/auxiliary/rust_test_helpers.c?
Example - https://github.com/rust-lang/rust/blob/master/src/test/run-pass/union/union-c-interop.rs

@abonander
Copy link
Contributor Author

I've got the compile-fail tests passing but I'm getting an ICE on the run-pass. Apparently there's a macro invoc making it through expansion, though it strangely has an empty path and invocation:
image

I think it's getting parsed that way but I'm not sure. I need to rebuild in debug mode so there's not a load of intermediates optimized out.

@abonander
Copy link
Contributor Author

The ForeignMod is leaving expansion with the original macro invocations intact.
image

However, expansion seems to work; I'm seeing two ForeignItemKind::Fn getting parsed from parse_foreign_item(). They're just not getting slotted into the AST for some reason.

@abonander
Copy link
Contributor Author

Okay, someone should leave a note somewhere to make sure to override the relevant Folder method on PlaceholderExpander when adding a new item kind to expand macros on.

@abonander
Copy link
Contributor Author

@petrochenkov there's the prototype, I need to implement a UI feature-gate test still. And I should open a tracking issue, yeah?

@abonander
Copy link
Contributor Author

Added a UI test but the spans are wrong, I'll work on that.

@petrochenkov
Copy link
Contributor

And I should open a tracking issue, yeah?

Yes, it'll need to be created sooner or later so it's better to do it now.

@abonander
Copy link
Contributor Author

@petrochenkov should be ready for review now. I'll squash afterwards.

@TimNN
Copy link
Contributor

TimNN commented Mar 30, 2018

Your PR failed on Travis. 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.
Receiving objects:  16% (124114/751321), 34.44 MiB | 907.00 KiB/s
Receiving objects:  16% (125153/751321), 35.11 MiB | 714.00 KiB/s
Receiving objects:  16% (125648/751321), 35.94 MiB | 694.00 KiB/s
Receiving objects:  16% (126032/751321), 36.74 MiB | 697.00 KiB/s
Receiving objects:  16% (126782/751321), 37.59 MiB | 767.00 KiB/s
Receiving objects:  16% (127473/751321), 38.54 MiB | 836.00 KiB/s
Receiving objects:  17% (127725/751321), 38.54 MiB | 836.00 KiB/s
Receiving objects:  17% (127814/751321), 39.60 MiB | 906.00 KiB/s
Receiving objects:  17% (128090/751321), 40.85 MiB | 1001.00 KiB/s
---
Receiving objects:  19% (147031/751321), 60.80 MiB | 876.00 KiB/s
Receiving objects:  19% (148453/751321), 61.92 MiB | 862.00 KiB/s
---
Receiving objects:  23% (172804/751321), 81.29 MiB | 1000.00 KiB/s
Receiving objects:  23% (173051/751321), 81.68 MiB | 900.00 KiB/s
Receiving objects:  23% (174258/751321), 82.55 MiB | 762.00 KiB/s
Receiving objects:  23% (175556/751321), 83.52 MiB | 793.00 KiB/s
Receiving objects:  23% (178772/751321), 84.70 MiB | 911.00 KiB/s
Receiving objects:  24% (180318/751321), 85.49 MiB | 1008.00 KiB/s
---
Receiving objects:  28% (214390/751321), 100.15 MiB | 1020.00 KiB/s
Receiving objects:  29% (217884/751321), 101.06 MiB | 992.00 KiB/s
Receiving objects:  29% (219268/751321), 101.06 MiB | 992.00 KiB/s
Receiving objects:  29% (223660/751321), 101.99 MiB | 974.00 KiB/s
Receiving objects:  30% (225397/751321), 102.47 MiB | 953.00 KiB/s
Receiving objects:  30% (228170/751321), 102.91 MiB | 942.00 KiB/s
Receiving objects:  30% (232449/751321), 103.86 MiB | 933.00 KiB/s
Receiving objects:  31% (232910/751321), 104.28 MiB | 912.00 KiB/s
Receiving objects:  31% (234264/751321), 104.80 MiB | 922.00 KiB/s
Receiving objects:  31% (234289/751321), 105.89 MiB | 964.00 KiB/s
Receiving objects:  31% (234313/751321), 106.90 MiB | 982.00 KiB/s
Receiving objects:  31% (234341/751321), 107.92 MiB | 1003.00 KiB/s
Receiving objects:  31% (235609/751321), 108.93 MiB | 1024.00 KiB/s
Receiving objects:  31% (238537/751321), 109.60 MiB | 940.00 KiB/s
Receiving objects:  32% (240423/751321), 109.60 MiB | 940.00 KiB/s
Receiving objects:  32% (243389/751321), 110.47 MiB | 901.00 KiB/s
Receiving objects:  32% (247122/751321), 111.28 MiB | 853.00 KiB/s
Receiving objects:  33% (247936/751321), 111.28 MiB | 853.00 KiB/s
Receiving objects:  33% (251521/751321), 112.18 MiB | 826.00 KiB/s
Receiving objects:  34% (255450/751321), 112.68 MiB | 833.00 KiB/s
Receiving objects:  34% (256586/751321), 113.19 MiB | 870.00 KiB/s
Receiving objects:  34% (260170/751321), 114.15 MiB | 921.00 KiB/s
Receiving objects:  35% (262963/751321), 114.68 MiB | 934.00 KiB/s
Receiving objects:  35% (264657/751321), 114.68 MiB | 934.00 KiB/s
Receiving objects:  35% (269914/751321), 115.72 MiB | 979.00 KiB/s
Receiving objects:  36% (270476/751321), 116.11 MiB | 962.00 KiB/s
Receiving objects:  36% (271119/751321), 116.50 MiB | 950.00 KiB/s
Receiving objects:  36% (272974/751321), 117.44 MiB | 931.00 KiB/s
Receiving objects:  36% (274316/751321), 118.55 MiB | 959.00 KiB/s
Receiving objects:  36% (275357/751321), 119.64 MiB | 967.00 KiB/s
Receiving objects:  36% (276374/751321), 120.70 MiB | 1019.00 KiB/s
---
Receiving objects:  40% (300529/751321), 125.21 MiB | 1008.00 KiB/s
Receiving objects:  40% (301694/751321), 125.58 MiB | 975.00 KiB/s
Receiving objects:  40% (302023/751321), 126.40 MiB | 895.00 KiB/s
Receiving objects:  40% (302466/751321), 127.31 MiB | 866.00 KiB/s
Receiving objects:  40% (305745/751321), 128.25 MiB | 839.00 KiB/s
Receiving objects:  41% (308042/751321), 128.70 MiB | 847.00 KiB/s
Receiving objects:  41% (308733/751321), 129.21 MiB | 883.00 KiB/s
Receiving objects:  41% (311350/751321), 130.21 MiB | 932.00 KiB/s
Receiving objects:  41% (313133/751321), 131.12 MiB | 945.00 KiB/s
Receiving objects:  42% (315555/751321), 131.12 MiB | 945.00 KiB/s
Receiving objects:  42% (316034/751321), 131.61 MiB | 945.00 KiB/s
Receiving objects:  42% (316070/751321), 132.41 MiB | 910.00 KiB/s
Receiving objects:  42% (316122/751321), 133.07 MiB | 849.00 KiB/s
Receiving objects:  42% (316746/751321), 133.78 MiB | 784.00 KiB/s
Receiving objects:  42% (320356/751321), 134.69 MiB | 788.00 KiB/s
Receiving objects:  43% (323069/751321), 135.18 MiB | 794.00 KiB/s
Receiving objects:  43% (325364/751321), 135.76 MiB | 825.00 KiB/s
Receiving objects:  43% (326813/751321), 137.04 MiB | 954.00 KiB/s
---
Receiving objects:  48% (367830/751321), 157.29 MiB | 919.00 KiB/s
Receiving objects:  48% (367903/751321), 158.10 MiB | 876.00 KiB/s
Receiving objects:  49% (368148/751321), 158.53 MiB | 852.00 KiB/s
Receiving objects:  49% (368468/751321), 158.88 MiB | 805.00 KiB/s
Receiving objects:  49% (368506/751321), 159.25 MiB | 783.00 KiB/s
Receiving objects:  49% (368612/751321), 159.96 MiB | 745.00 KiB/s
Receiving objects:  49% (369302/751321), 160.79 MiB | 768.00 KiB/s
Receiving objects:  49% (369803/751321), 161.79 MiB | 810.00 KiB/s
Receiving objects:  49% (370391/751321), 162.96 MiB | 899.00 KiB/s
Receiving objects:  49% (370630/751321), 164.09 MiB | 988.00 KiB/s
---
Receiving objects:  50% (380215/751321), 170.36 MiB | 1002.00 KiB/s
Receiving objects:  51% (383174/751321), 170.79 MiB | 966.00 KiB/s
Receiving objects:  51% (386709/751321), 171.22 MiB | 919.00 KiB/s
Receiving objects:  52% (390687/751321), 171.64 MiB | 881.00 KiB/s
Receiving objects:  52% (392256/751321), 172.07 MiB | 862.00 KiB/s
Receiving objects:  52% (395731/751321), 172.98 MiB | 884.00 KiB/s
Receiving objects:  53% (398201/751321), 173.97 MiB | 908.00 KiB/s
Receiving objects:  53% (398356/751321), 173.97 MiB | 908.00 KiB/s
Receiving objects:  53% (399512/751321), 175.13 MiB | 958.00 KiB/s
Receiving objects:  53% (401870/751321), 175.70 MiB | 988.00 KiB/s
Receiving objects:  53% (402837/751321), 176.74 MiB | 1.00 MiB/s
Receiving objects:  53% (405575/751321), 177.62 MiB | 1023.00 KiB/s
Receiving objects:  54% (405714/751321), 178.63 MiB | 1021.00 KiB/s
Receiving objects:  54% (405953/751321), 178.63 MiB | 1021.00 KiB/s
Receiving objects:  54% (406589/751321), 179.56 MiB | 970.00 KiB/s
Receiving objects:  54% (409348/751321), 180.56 MiB | 939.00 KiB/s
Receiving objects:  54% (410984/751321), 181.48 MiB | 938.00 KiB/s
Receiving objects:  54% (411019/751321), 182.07 MiB | 867.00 KiB/s
Receiving objects:  54% (411344/751321), 182.82 MiB | 812.00 KiB/s
Receiving objects:  54% (411369/751321), 183.65 MiB | 799.00 KiB/s
Receiving objects:  54% (411388/751321), 184.29 MiB | 712.00 KiB/s
Receiving objects:  54% (411412/751321), 185.05 MiB | 721.00 KiB/s
Receiving objects:  54% (411442/751321), 185.95 MiB | 784.00 KiB/s
Receiving objects:  54% (411477/751321), 187.02 MiB | 836.00 KiB/s
Receiving objects:  54% (411513/751321), 188.02 MiB | 894.00 KiB/s
Receiving objects:  54% (411553/751321), 188.60 MiB | 949.00 KiB/s
Receiving objects:  54% (411598/751321), 189.64 MiB | 1009.00 KiB/s
---
Receiving objects:  55% (415995/751321), 201.55 MiB | 979.00 KiB/s
Receiving objects:  55% (416027/751321), 202.53 MiB | 920.00 KiB/s
Receiving objects:  55% (416078/751321), 203.61 MiB | 924.00 KiB/s
Receiving objects:  56% (420740/751321), 204.18 MiB | 958.00 KiB/s
Receiving objects:  56% (420938/751321), 204.18 MiB | 958.00 KiB/s
Receiving objects:  56% (421620/751321), 205.17 MiB | 992.00 KiB/s
Receiving objects:  56% (422427/751321), 206.11 MiB | 1001.00 KiB/s
Receiving objects:  56% (422747/751321), 207.10 MiB | 1009.00 KiB/s
Receiving objects:  56% (423179/751321), 207.82 MiB | 930.00 KiB/s
Receiving objects:  56% (423961/751321), 208.53 MiB | 853.00 KiB/s
Receiving objects:  56% (426959/751321), 209.35 MiB | 821.00 KiB/s
Receiving objects:  57% (428253/751321), 209.82 MiB | 822.00 KiB/s
Receiving objects:  57% (432147/751321), 210.36 MiB | 830.00 KiB/s
Receiving objects:  58% (435767/751321), 210.95 MiB | 852.00 KiB/s
Receiving objects:  58% (437695/751321), 211.58 MiB | 910.00 KiB/s
Receiving objects:  58% (441990/751321), 212.71 MiB | 1010.00 KiB/s
---
Receiving objects:  61% (460420/751321), 221.36 MiB | 960.00 KiB/s
Receiving objects:  61% (460447/751321), 221.79 MiB | 929.00 KiB/s
Receiving objects:  61% (460483/751321), 222.77 MiB | 959.00 KiB/s
Receiving objects:  61% (461193/751321), 223.88 MiB | 991.00 KiB/s
---
Receiving objects:  66% (495872/751321), 236.89 MiB | 1013.00 KiB/s
Receiving objects:  66% (499264/751321), 237.46 MiB | 1001.00 KiB/s
Receiving objects:  67% (503386/751321), 238.08 MiB | 1.00 MiB/s
Receiving objects:  67% (505691/751321), 238.64 MiB | 1.00 MiB/s
Receiving objects:  67% (509059/751321), 239.57 MiB | 1020.00 KiB/s
Receiving objects:  67% (509812/751321), 240.42 MiB | 992.00 KiB/s
Receiving objects:  68% (510899/751321), 240.82 MiB | 985.00 KiB/s
Receiving objects:  68% (511323/751321), 241.25 MiB | 970.00 KiB/s
Receiving objects:  68% (513833/751321), 242.32 MiB | 942.00 KiB/s
Receiving objects:  68% (514770/751321), 243.62 MiB | 997.00 KiB/s
---
Receiving objects:  79% (593544/751321), 288.26 MiB | 992.00 KiB/s
Receiving objects:  79% (593979/751321), 288.68 MiB | 949.00 KiB/s
Receiving objects:  79% (595972/751321), 289.64 MiB | 903.00 KiB/s
Receiving objects:  79% (598392/751321), 290.75 MiB | 888.00 KiB/s
Receiving objects:  79% (598392/751321), 292.00 MiB | 1000.00 KiB/s
---
Receiving objects:  84% (635020/751321), 304.42 MiB | 935.00 KiB/s
Receiving objects:  84% (638053/751321), 305.36 MiB | 884.00 KiB/s
Receiving objects:  85% (638623/751321), 305.36 MiB | 884.00 KiB/s
Receiving objects:  85% (644097/751321), 306.29 MiB | 888.00 KiB/s
Receiving objects:  86% (646137/751321), 306.72 MiB | 863.00 KiB/s
Receiving objects:  86% (647178/751321), 307.07 MiB | 833.00 KiB/s
Receiving objects:  86% (651395/751321), 307.86 MiB | 842.00 KiB/s
Receiving objects:  87% (653650/751321), 308.27 MiB | 850.00 KiB/s
Receiving objects:  87% (656075/751321), 308.71 MiB | 848.00 KiB/s
Receiving objects:  88% (661163/751321), 309.13 MiB | 835.00 KiB/s
Receiving objects:  88% (661331/751321), 309.59 MiB | 832.00 KiB/s
Receiving objects:  88% (663417/751321), 310.31 MiB | 801.00 KiB/s
Receiving objects:  88% (666511/751321), 311.01 MiB | 799.00 KiB/s
Receiving objects:  89% (668676/751321), 311.43 MiB | 796.00 KiB/s
Receiving objects:  89% (669014/751321), 311.43 MiB | 796.00 KiB/s
Receiving objects:  89% (672152/751321), 312.27 MiB | 791.00 KiB/s
Receiving objects:  90% (676189/751321), 313.30 MiB | 825.00 KiB/s
Receiving objects:  90% (677916/751321), 313.30 MiB | 825.00 KiB/s
Receiving objects:  90% (681660/751321), 314.31 MiB | 883.00 KiB/s
Receiving objects:  91% (683703/751321), 315.14 MiB | 910.00 KiB/s
Receiving objects:  91% (683936/751321), 315.14 MiB | 910.00 KiB/s
Receiving objects:  91% (691096/751321), 316.07 MiB | 938.00 KiB/s
Receiving objects:  92% (691216/751321), 316.07 MiB | 938.00 KiB/s
Receiving objects:  92% (694516/751321), 316.98 MiB | 936.00 KiB/s
Receiving objects:  92% (698397/751321), 317.98 MiB | 924.00 KiB/s
Receiving objects:  93% (698729/751321), 317.98 MiB | 924.00 KiB/s
Receiving objects:  93% (702988/751321), 319.11 MiB | 975.00 KiB/s
---
Resolving deltas: 100% (612161/612161), completed with 4843 local objects.
---
[00:00:42] configure: rust.quiet-tests     := True
---
[00:35:04] .........................................................................i..........................
[00:35:09] ................i.............................F.....................................................
---
[00:35:41] .............................................................................................i......
[00:35:48] .................................................................i..................................
---
[00:36:07] - error: missing `fn`, `type`, or `const` for impl-item declaration
[00:36:07] + error: missing `fn`, `type` or `const` for impl-item declaration
[00:36:07] 2   --> $DIR/issue-40006.rs:11:9
[00:36:07] 3    |
[00:36:07] 4 LL |   impl X { //~ ERROR cannot be made into an object
[00:36:07]
[00:36:07] 5    |  _________^
[00:36:07] 6 LL | | //~^ ERROR missing
[00:36:07] 7 LL | |     Y
[00:36:07] -    | |____^ missing `fn`, `type`, or `const`
[00:36:07] +    | |____^ `fn`, `type` or `const`
[00:36:07] 9
[00:36:07] - error: missing `fn`, `type`, or `const` for trait-item declaration
[00:36:07] + error: missing `fn`, `type` or `const` for trait-item declaration
[00:36:07] 11   --> $DIR/issue-40006.rs:18:10
[00:36:07] 12    |
[00:36:07] 13 LL |   trait X { //~ ERROR missing
[00:36:07]
[00:36:07] 14    |  __________^
[00:36:07] 15 LL | |     X() {}
[00:36:07] -    | |____^ missing `fn`, `type`, or `const`
[00:36:07] +    | |____^ `fn`, `type` or `const`
[00:36:07] 17
[00:36:07] 18 error: expected `[`, found `#`
[00:36:07] 19   --> $DIR/issue-40006.rs:20:17
[00:36:07]
[00:36:07] 21 LL |     fn xxx() { ### } //~ ERROR missing
[00:36:07] 22    |                 ^ expected `[`
[00:36:07] 23
[00:36:07] - error: missing `fn`, `type`, or `const` for trait-item declaration
[00:36:07] + error: missing `fn`, `type` or `const` for trait-item |  __________^\nLL | |     X() {}\n   | |____^ `fn`, `type` or `const`\n\n"}
[00:36:07] {"message":"expected `[`, found `#`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":610,"byte_end":611,"line_start":20,"line_end":20,"column_start":17,"column_end":18,"is_primary":true,"text":[{"text":"    fn xxx() { ### } //~ ERROR missing","highlight_start":17,"highlight_end":18}],"label":"expected `[`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: expected `[`, found `#`\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:20:17\n   |\nLL |     fn xxx() { ### } //~ ERROR missing\n   |                 ^ expected `[`\n\n"}
[00:36:07] {"message":"missing `fn`, `type` or `const` for trait-item declaration","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":614,"byte_end":661,"line_start":20,"line_end":22,"column_start":21,"column_end":5,"is_primary":true,"text":[{"text":"    fn xxx() { ### } //~ ERROR missing","highlight_start":21,"highlight_end":39},{"text":"    //~^ ERROR expected","highlight_start":1,"highlight_end":24},{"text":"    L = M; //~ ERROR missing","highlight_start":1,"highlight_end":5}],"label":"`fn`, `type` or `const`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: missing `fn`, `type` or `const` for trait-item declaration\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:20:21\n   |\nLL |       fn xxx() { ### } //~ ERROR missing\n   |  _____________________^\nLL | |     //~^ ERROR expected\nLL | |     L = M; //~ ER3:18\n   |\nLL |     Z = { 2 + 3 }; //~ ERROR expected one of\n   |                  ^ expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}` here\n\n"}
[00:36:07] {"message":"expected one of `!` or `::`, found `(`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":739,"byte_end":740,"line_start":24,"line_end":24,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    ::Y (); //~ ERROR expected one of","highlight_start":9,"highlight_end":10}],"label":"expected one of `!` or `::` here","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: expected one of `!` or `::`, found `(`\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:24:9\n   |\nLL |     ::Y (); //~ ERROR expected one of\n   |         ^ expected one of `!` or `::` here\n\n"}
[00:36:07] {"message":"missing `fn`, `type` or `const` for impl-item declaration","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":788,"byte_end":789,"line_start":28,"line_end":28,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":"    pub hello_method(&self) { //~ ERROR missing","highlight_start":8,"highlight_end":9}],"label":"`fn`, `type` or `const`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: missing `fn`, `type` or `const` for impl-item declaration\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:28:8\n   |\nLL |     pub hello_method(&self) { //~ ERROR missing\n   |        ^ `fn`, `type` or `const`\n\n"}
[00:36:07] {"message":"the trait `X` cannot be made into an object","code":{"code":"E0038","explanation":"\nTrait objects like `Box<Trait>` can only be constructed when certain\nrequirements are satisfied by the trait in question.\n\nTrait objects are a form of dynamic dispatch and use a dynamically sized type\nfor the inner type. So, for a given trait `Trait`, when `Trait` is treated as a\ntype, as in `Box<Trait>`, the inner type is 'unsized'. In such cases the boxed\npointer is a 'fat pointer' that contains an extra pointer to a table of methods\n(among other things) for dynamic dispatch. This design mandates some\nrestrictions on the types of traits that are allowed to be used in trait\nobjects, which are collectively termed as 'object safety' rules.\n\nAttempting to create a trait object for a non object-safe trait will trigger\nthis error.\n\nThere are various rules:\n\n### The trait cannot require `Self: Sized`\n\nWhen `Trait` is treated as a type, the type does not implement the special\n`Sized` trait, because the type does not have a known size at compile time and\ncan only be accessed behind a pointer. Thus, if we have a trait like the\nfollowing:\n\n```\ntrait Foo where Self: Sized {\n\n}\n```\n\nWe cannot create an object of type `Box<Foo>` or `&Foo` since in this case\n`Self` would not be `Sized`.\n\nGenerally, `Self : Sized` is used to indicate that the trait should not be used\nas a trait object. If the trait comes from your own crate, consider removing\nthis restriction.\n\n### Method references the `Self` type in its arguments or return type\n\nThis happens when a trait has a method like the following:\n\n```\ntrait Trait {\n    fn foo(&self) -> Self;\n}\n\nimpl Trait for String {\n    fn foo(&self) -> Self {\n        \"hi\".to_owned()\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) -> Self {\n        1\n    }\n}\n```\n\n(Note that `&self` and `&mut self` are okay, it's additional `Self` types which\ncause this problem.)\n\nIn such a case, the compiler cannot predict the return type of `foo()` in a\nsituation like the following:\n\n```compile_fail\ntrait Trait {\n    fn foo(&self) -> Self;\n}\n\nfn call_foo(x: Box<Trait>) {\n    let y = x.foo(); // What type is y?\n    // ...\n}\n```\n\nIf only some methods aren't object-safe, you can add a `where Self: Sized` bound\non them to mark them as explicitly unavailable to trait objects. The\nfunctionality will still be available to all other implementers, including\n`Box<Trait>` which is itself sized (assuming you `impl Trait for Box<Trait>`).\n\n```\ntrait Trait {\n    fn foo(&self) -> Self where Self: Sized;\n    // more functions\n}\n```\n\nNow, `foo()` can no longer be called on a trait object, but you will now be\nallowed to make a trait object, and that will be able to call any object-safe\nmethods. With such a bound, one can still call `foo()` on types implementing\nthat trait that aren't behind trait objects.\n\n### Method has generic type parameters\n\nAs mentioned before, trait objects contain pointers to method tables. So, if we\nhave:\n\n```\ntrait Trait {\n    fn foo(&self);\n}\n\nimpl Trait for String {\n    fn foo(&self) {\n        // implementation 1\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) {\n        // implementation 2\n    }\n}\n// ...\n```\n\nAt compile time each implementation of `Trait` will produce a table containing\nthe various methods (and other items) related to the implementation.\n\nThis works fine, but when the method gains generic parameters, we can have a\nproblem.\n\nUsually, generic parameters get _monomorphized_. For example, if I have\n\n```\nfn foo<T>(x: T) {\n    // ...\n}\n```\n\nThe machine code for `foo::<u8>()`, `foo::<bool>()`, `foo::<String>()`, or any\nother type substitution is different. Hence the compiler generates the\nimplementation on-demand. If you call `foo()` with a `bool` parameter, the\ncompiler will only generate code for `foo::<bool>()`. When we have additional\ntype parameters, the number of monomorphized implementations the compiler\ngenerates does not grow drastically, since the compiler will only generate an\nimplementation if the function is called with unparametrized substitutions\n(i.e., substitutions where none of the substituted types are themselves\nparametrized).\n\nHowever, with trait objects we have to make a table containing _every_ object\nthat implements the trait. Now, if it has type parameters, we need to add\nimplementations for every type that implements the trait, and there could\ntheoretically be an infinite number of types.\n\nFor example, with:\n\n```\ntrait Trait {\n    fn foo<T>(&self, on: T);\n    // more methods\n}\n\nimpl Trait for String {\n    fn foo<T>(&self, on: T) {\n        // implementation 1\n    }\n}\n\nimpl Trait for u8 {\n    fn foo<T>(&self, on: T) {\n        // implementation 2\n    }\n}\n\n// 8 more implementations\n```\n\nNow, if we have the following code:\n\n```compile_fail,E0038\n# trait Trait { fn foo<T>(&self, on: T); }\n# im foo() -> u8 where Self: Sized;\n}\n```\n\n### The trait cannot contain associated constants\n\nJust like static functions, associated constants aren't stored on the method\ntable. If the trait or any subtrait contain an associated constant, they cannot\nbe made into an object.\n\n```compile_fail,E0038\ntrait Foo {\n    const X: i32;\n}\n\nimpl Foo {}\n```\n\nA simple workaround is to use a helper method instead:\n\n```\ntrait Foo {\n    fn x(&self) -> i32;\n}\n```\n\n### The trait cannot use `Self` as a type parameter in the supertrait listing\n\nThis is similar to the second sub-error, but subtler. It happens in situations\nlike the following:\n\n```compile_fail\ntrait Super<A> {}\n\ntrait Trait: Super<Self> {\n}\n\nstruct Foo;\n\nimpl Super<Foo> for Foo{}\n\nimpl Trait for Foo {}\n```\n\nHere, the supertrait might have methods as follows:\n\n```\ntrait Super<A> {\n    fn get_a(&self) -> A; // note that this is object safe!\n}\n```\n\nIf the trait `Foo` was deriving from something like `Super<String>` or\n`Super<T>` (where `Foo` itself is `Foo<T>`), this is okay, because given a type\n`get_a()` will definitely return an object of that type.\n\nHowever, if it derives from `Super<Self>`, even though `Super` is object safe,\nthe method `get_a()` would return an object of unknown type when called on the\nfunction. `Self` type parameters let us make object safe traits no longer safe,\nso they are forbidden when specifying supertraits.\n\nThere's no easy fix for this, generally code will need to be refactored so that\nyou no longer need to derive from `Super<Self>`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/uil. (see issue #49476)
[00:36:07] -   --> $DIR/feature-gate-macros_in_extern.rs:31:5
[00:36:07] +   --> $DIR/feature-gate-macros_in_extern.rs:29:5
[00:36:07] 3    |
[00:36:07] 4 LL |     returns_isize!(rust_get_test_int);
[00:36:07] 5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:36:07]
[00:36:07] 7    = help: add #![feature(macros_in_extern)] to the crate attributes to enable
[00:36:07] 8
[00:36:07] 9 error[E0658]: Macro invocations in `extern {}` blocks are experimental. (see issue #49476)
[00:36:07] -   --> $DIR/feature-gate-macros_in_extern.rs:33:5
[00:36:07] +   --> $DIR/feature-gate-macros_in_extern.rs:31:5
[00:36:07] 11    |
[00:36:07] 12 LL |     takes_u32_returns_u32!(rust_dbg_extern_identity_u32);
[00:36:07] 13    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:36:07]
[00:36:07] 15    = help: add #![feature(macros_in_extern)] to the crate attributes to enable
[00:36:07] 16
[00:36:07] 17 error[E0658]: Macro invocations in `extern {}` blocks are experimental. (see issue #49476)
[00:36:07] -   --> $DIR/feature-gate-macros_in_extern.rs:35:5
[00:36:07] +   --> $DIR/feature-gate-macros_in_extern.rs:33:5
[00:36:07] 19    |
[00:36:07] 20 LL |     emits_nothing!();
---
[00:36:07] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'feature-gate-macros_in_extern.rs'
[00:36:07]
[00:36:07] error: 1 errors occurred comparing output.
[00:36:07] status: exit code: 101
[00:36:07] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/feature-gate-macros_in_extern.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gate-macros_in_extern.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gate-macros_in_extern.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
---
[00:36:07] {"message":"Macro invocations in `extern {}` blocks are experimental. (see issue #49476)","code":{"code":"E0658","explanation":"\nAn unstable feature was used.\n\nErroneous code example:\n\n```compile_fail,E658\n#[repr(u128)] // error: use of unstable library feature 'repr128'\nenum Foo {\n    Bar(u64),\n}\n```\n\nIf you're using a stable or a beta version of rustc, you won't be able to use\nany unstable features. In order to do so, please switch to a nightly version of\nrustc (by using rustup).\n\nIf you're using a nightly version of rustc, just add the corresponding feature\nto be able to use it:\n\n```\n#![feature(repr128)]\n\n#[repr(u128)] // ok!\nenum Foo {\n    Bar(u64),\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/feature-gate-macros_in_extern.rs","byte_start":775,"byte_end":809,"line_start":29,"line_end":29,"column_start":5,"column_end":39,"is_primary":true,"text":[{"text":"    returns_isize!(rust_get_test_int);","highlight_start":5,"highlight_end":39}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"add #![feature(macros_in_extern)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0658]: Macro invocations in `extern {}` blocks are experimental. (see issue #49476)\n  --> /checkout/src/test/ui/feature-gate-macros_in_extern.rs:29:5\n   |\nLL |     returns_isize!(rust_get_test_int);\n   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\n   = help: add #![feature(macros_in_extern)] to the crate attributes to enable\n\n"}
[00:36:07] {"message":"Macro invocations in `extern {}` blocks are experimental. (see issue #49476)","code":{"code":"E0658","explanation":"\nAn unstable feature was used.\n\nErroneous code example:\n\n```compile_fail,E658\n#[repr(u128)] // error: use of unstable library feature 'repr128'\nenum Foo {\n    Bar(u64),\n}\n```\n\nIf you're using a stable or a beta version of rustc, you won't be able to use\nany unstable features. In order to do so, please switch to a nightly version of\nrustc (by using rustup).\n\nIf you're using a nightly version of rustc, just add the corresponding feature\nto be able to use it:\n\n```\n#![feature(repr128)]\n\n\n#[repr(u128)] // ok!\nenum Foo {\n    Bar(u64),\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/feature-gate-macros_in_extern.rs","byte_start":1018,"byte_end":1035,"line_start":33,"line_end":33,"column_start":5,"column_end":22,"is_primary":true,"text":[{"text":"    emits_nothing!();","highlight_start":5,"highlight_end":22}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"add #![feature(macros_in_extern)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0658]: Macro invocations in `extern {}` blocks are experimental. (see issue #49476)\n  --> /checkout/src/test/ui/feature-gate-macros_in_extern.rs:33:5\n   |\nLL |     emits_nothing!();\n   |     ^^^^^^^^^^^^^^^^^\n   |\n   = help: add #![feature(macros_in_extern)] to the crate attributes to enable\n\n"}
[00:36:07] {"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 3 previous errors\n\n"}
[00:36:07] {"message":"For more information about this error, try `rustc --explain E0658`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0658`.\n"}
---
[00:36:07] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zmiri -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zmiri -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:36:07] expected success, got: exit code: 101
[00:36:07]
[00:36:07]
[00:36:07] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:36:07] Build completed unsuccessfully in 0:01:49
[00:36:07] make: *** [check] Error 1
[00:36:07] Mak3545748 .
---
$ cat obj/tmp/sccache.log
---
$ ls -lat $HOME/Library/Logs

If this was not helpful or you have suggestes for improvements, please ping or otherwise contact @TimNN.

@TimNN
Copy link
Contributor

TimNN commented Mar 30, 2018

Your PR failed on Travis. 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.
Resolving deltas: 100% (612167/612167), completed with 4847 local objects.
---
[00:00:44] configure: rust.quiet-tests     := True
---
[00:39:29] .........................................................................i..........................
[00:39:35] ................i.............................F.....................................................
---
[00:40:10] .............................................................................................i......
[00:40:17] .................................................................i..................................
---
[00:40:38] 5    |  _________^
[00:40:38] 6 LL | | //~^ ERROR missing
[00:40:38] 7 LL | |     Y
[00:40:38] -    | |____^ missing `fn`, `type`, or `const`
[00:40:38] +    | |____^ `fn`, `type`, or `const`
[00:40:38] 9
[00:40:38] 10 error: missing `fn`, `type`, or `const` for trait-item declaration
[00:40:38] 11   --> $DIR/issue-40006.rs:18:10
[00:40:38]
[00:40:38] 13 LL |   trait X { //~ ERROR missing
[00:40:38] 14    |  __________^
[00:40:38] 15 LL | |     X() {}
[00:40:38] -    | |____^ missing `fn`, `type`, or `const`
[00:40:38] +    | |____^ `fn`, `type`, or `const`
[00:40:38] 17
[00:40:38] 18 error: expected `[`, found `#`
[00:40:38] 19   --> $DIR/issue-40006.rs:20:17
[00:40:38]
[00:40:38] 28    |  _____________________^
[00:40:38] 29 LL | |     //~^ ERROR expected
[00:40:38] 30 LL | |     L = M; //~ ERROR missing
[00:40:38] -    | |____^ missing `fn`, `type`, or `const`
[00:40:38] +    | |____^ `fn`, `type`, or `const`
[00:40:38] 32
[00:40:38] 33 error: missing `fn`, `type`, or `const` for trait-item declaration
[00:40:38] 34   --> $DIR/issue-40006.rs:22:11
[00:40:38]
[00:40:38] 36 LL |       L = M; //~ ERROR missing
[00:40:38] 37    |  ___________^
[00:40:38] 38 LL | |     Z = { 2 + 3 }; //~ ERROR expected one of
[00:40:38] -    | |____^ missing `fn`, `type`, or `const`
[00:40:38] +    | |____^ `fn`, `type`, or `const`
[00:40:38] 40
[00:40:38] 41 error: expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;`
[00:40:38] 42   --> $DIR/issue-40006.rs:23:18
[00:40:38]
[00:40:38] 54   --> $DIR/issue-40006.rs:28:8
[00:40:38] 55    |
[00:40:38] 56 LL |     pub hello_method(&self) { //~ ERROR missing
[00:40:38] -    |        ^ missing `fn`, `type`, or `const`
[00:40:38] +    |        ^ `fn`, `type`, or `const`
[00:40:38] 58
[00:40:38] 59 error[E0038]: the trait `X` cannot be made into an object
[00:40:38] 60   --> $DIR/issue-40006.rs:11:6
[00:40:38]
[00:40:38]
[00:40:38] The actual stderr differed from the expected stderr.
[00:40:38] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/did_you_mean/issue-40006.stderr
[00:40:38] To update references, run this command from build directory:
[00:40:38] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'did_you_mean/issue-40006.rs'
[00:40:38]
[00:40:38] error: 1 errors occurred comparing output.
[00:40:38] status: exit code: 101
[00:40:38] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/did_you_mean/issue-40006.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/did_you_mean/issue-40006.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj"text":"trait X { //~ ERROR missing","highlight_start":10,"highlight_end":28},{"text":"    X() {}","highlight_start":1,"highlight_end":5}],"label":"`fn`, `type`, or `const`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: missing `fn`, `type`, or `const` for trait-item declaration\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:18:10\n   |\nLL |   trait X { //~ ERROR missing\n   |  __________^\nLL | |     X() {}\n   | |____^ `fn`, `type`, or `const`\n\n"}
[00:40:38] {"message":"expected `[`, found `#`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":610,"byte_end":611,"line_start":20,"line_end":20,"column_start":17,"column_end":18,"is_primary":true,"text":[{"text":"    fn xxx() { ### } //~ ERROR missing","highlight_start":17,"highlight_end":18}],"label":"expected `[`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: expected `[`, found `#`\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:20:17\n   |\nLL |     fn xxx() { ### } //~ ERROR missing\n   |                 ^ expected `[`\n\n"}
[00:40:38] {"message":"missing `fn`, `type`, or `const` for trait-item declaration","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":614,"byte_end":661,"line_start":20,"line_end":22,"column_start":21,"column_end":5,"is_primary":true,"text":[{"text":"    fn xxx() { ### } //~ ERROR missing","highlight_start":21,"highlight_end":39},{"text":"    //~^ ERROR expected","highlight_start":1,"highlight_end":24},{"text":"    L = M; //~ ERROR missing","highlight_start":1,"highlight_end":5}],"label":"`fn`, `type`, or `const`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: missing `fn`, `type`, or `const` for trait-item declaration\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:20:21\n   |\nLL |       fn xxx() { ### } //~ ERROR missing\n   |  _____________________^\nLL | |     //~^ ERROR expected\nLL | |     L = M; //~ ERROR missing\n   | |____^ `fn`, `type`, or `const`\n\n"}
[00:40:38] {"message":"missing `fn`, `type`, or `const` for trait-item declaration","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":667,"byte_end":690,"line_start":22,"line_end":23,"column_start":11,"column_end":5,"is_primary":true,"text":[{"text":"    L = M; //~ ERROR missing","highlight_start":11,"highlight_end":29},{"text":"    Z = { 2 + 3 }; //~ ERROR expected one of","highlight_start":1,"highlight_end":5}],"label":"`fn`, `type`, or `const`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: missing `fn`, `type`, or `const` for trait-item declaration\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:22:11\n   |\nLL |       L = M; //~ ERROR missing\n   |  ___________^\nLL | |     Z = { 2 + 3 }; //~ ERROR expected one of\n   | |____^ `fn`, `type`, or `const`\n\n"}
[00:40:38] {"message":"expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":703,"byte_end":704,"line_start":23,"line_end":23,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":"    Z = { 2 + 3 }; //~ ERROR expected one of","highlight_start":18,"highlight_end":19}],"label":"expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}` here","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;`\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:23:18\n   |\nLL |     Z = { 2 + 3 }; //~ ERROR expected one of\n   |                  ^ expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}` here\n\n"}
[00:40:38] {"message":"expected one of `!` or `::`, found `(`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":739,"byte_end":740,"line_start":24,"line_end":24,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    ::Y (); //~ ERROR expected one of","highlight_start":9,"highlight_end":10}],"label":"expected one of `!` or `::` here","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: expected one of `!` or `::`, found `(`\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:24:9\n   |\nLL |     ::Y (); //~ ERROR expected one of\n   |         ^ expected one of `!` or `::` here\n\n"}
[00:40:38] {"message":"missing `fn`, `type`, or `const` for impl-item declaration","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":788,"byte_end":789,"line_start":28,"line_end":28,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":"    pub hello_method(&self) { //~ E types.\n\n### Method has no receiver\n\nMethods that do not take a `self` parameter can't be called since there won't be\na way to get a pointer to the method table for them.\n\n```\ntrait Foo {\n    fn foo() -> u8;\n}\n```\n\nThis could be called as `<Foo as Foo>::foo()`, which would not be able to pick\nan implementation.\n\nAdding a `Self: Sized` bound to these methods will generally make this compile.\n\n```\ntrait Foo {\n    fn foo() -> u8 where Self: Sized;\n}\n```\n\n### The trait cannot contain associated constants\n\nJust like static functions, associated constants aren't stored on the method\ntable. If the trait or any subtrait contain an associated constant, they cannot\nbe made into an object.\n\n```compile_fail,E0038\ntrait Foo {\n    const X: i32;\n}\n\nimpl Foo {}\n```\n\nA simple workaround is to use a helper method instead:\n\n```\ntrait Foo {\n    fn x(&self) -> i32;\n}\n```\n\n### The trait cannot use `Self` as a type parameter in the supertrait listing\n\nThis is similar to the second sub-error, but subtler. It happens in situations\nlike the following:\n\n```compile_fail\ntrait Super<A> {}\n\ntrait Trait: Super<Self> {\n}\n\nstruct Foo;\n\nimpl Super<Foo> for Foo{}\n\nimpl Trait for Foo {}\n```\n\nHere, the supertrait might have methods as follows:\n\n```\ntrait Super<A> {\n    fn get_a(&self) -> A; // note that this is object safe!\n}\n```\n\nIf the trait `Foo` was deriving from something like `Super<String>` or\n`Super<T>` (where `Foo` itself is `Foo<T>`), this is okay, because given a type\n`get_a()` will definitely return an object of that type.\n\nHowever, if it derives from `Super<Self>`, even thounothing!();
---
[00:40:38] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'feature-gate-macros_in_extern.rs'
[00:40:38]
[00:40:38] error: 1 errors occurred comparing output.
[00:40:38] status: exit code: 101
[00:40:38] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/feature-gate-macros_in_extern.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gate-macros_in_extern.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gate-macros_in_extern.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
---
[00:40:38] {"message":"Macro invocations in `extern {}` blocks are experimental. (see issue #49476)","code":{"code":"E0658","explanation":"\nAn unstable feale_fail,E658\n#[repr(u128)] // error: use of unstable library feature 'repr128'\nenum Foo {\n    Bar(u64),\n}\n```\n\nIf you're using a stable or a beta version of rustc, you won't be able to use\nany unstable features. In order to do so, please switch to a nightly version of\nrustc (by using rustup).\n\nIf you're using a nightly version of rustc, just add the corresponding feature\nto be able to use it:\n\n```\n#![feature(repr128)]\n\n#[repr(u128)] // ok!\nenum Foo {\n    Bar(u64),\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/feature-gate-macros_in_extern.rs","byte_start":1018,"byte_end":1035,"line_start":33,"line_end":33,"column_start":5,"column_end":22,"is_primary":true,"text":[{"text":"    emits_nothing!();","highlight_start":5,"highlight_end":22}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"add #![feature(macros_in_extern)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0658]: Macro invocations in `extern {}` blocks are experimental. (see issue #49476)\n  --> /checkout/src/test/ui/feature-gate-macros_in_extern.rs:33:5\n   |\nLL |     emits_nothing!();\n   |     ^^^^^^^^^^^^^^^^^\n   |\n   = help: add #![feature(macros_in_extern)] to the crate attributes to enable\n\n"}
[00:40:38] {"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 3 previous errors\n\n"}
[00:40:38] {"message":"For more information about this error, try `rustc --explain E0658`.","code":null,"level":"","spans":[],"children":[],"r
---
$ find $HOME/Library/Logs/DiagnosticReports -type f -name '*.crash' -not -name '*.stage2-*.crash' -not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash' -exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \; -exec head -750 {} \; -exec echo travis_fold":"end:crashlog \; || true
find: `/home/travis/Library/Logs/DiagnosticReports': No such file or directory
travis_time:end:231e57bc:start=1522405636595811149,finish=1522405636605991184,duration=10180035
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:26856690
$ dmesg | grep -i kill
[   11.135934] init: failsafe main process (1092) killed by TERM signal

If this was not helpful or you have suggestes for improvements, please ping or otherwise contact @TimNN.

@TimNN
Copy link
Contributor

TimNN commented Mar 30, 2018

Your PR failed on Travis. 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.
127.0.1.1 travis-job-b3f52cdc-eb5f-476a-9fd3-a3b389ef6aeb travis-job-b3f52cdc-eb5f-476a-9fd3-a3b389ef6aeb ip4-loopback trusty64
---
Receiving objects:  72% (545201/751331), 270.00 MiB | 962.00 KiB/s
Receiving objects:  72% (545823/751331), 270.96 MiB | 964.00 KiB/s
Receiving objects:  73% (548472/751331), 271.53 MiB | 996.00 KiB/s
---
Resolving deltas: 100% (612168/612168), completed with 4842 local objects.
---
[00:00:49] configure: rust.quiet-tests     := True
---
[00:39:44] .........................................................................i..........................
[00:39:50] ................i...................................................................................
---
[00:40:25] .............................................................................................i......
[00:40:32] .................................................................i..................................
---
[00:41:27] .............................................i......................................................
---
[00:45:20] .............................i......................................................................
[00:45:34] ..............................................................i.....................................
[00:45:49] ...............................................i....................................................
[00:46:09] ....................................................................................................
[00:46:30] ....................................................................................................
[00:46:51] ....................................................................................................
[00:47:15] ..i................................................................................................i
[00:47:43] ......................................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:47:51] ..............
[00:48:21] ....................................................................................................
[00:48:56] ................................................................ii..................................
[00:49:44] ...........................i....................................................i.ii................
[00:50:23] ........................................................................................iiiiiii.....
---
[00:52:23] ....................................i...............................................................
[00:52:30] ....................................................................................................
[00:52:38] ..................i.............................................................iiiii...............
[00:52:45] ....................................................................................................
[00:52:53] ........i..............................i............................................................
[00:53:00] ....................................................................................................
[00:53:07] .....................i..............................................................................
[00:53:15] ....................................................................................................
[00:53:24] ....................................................................................................
[00:53:35] ....................................................................................................
[00:53:45] ....................................................................................................
[00:53:59] ....................................................................................................
[00:54:07] ..............i.....................................................................................
[00:54:16] ..................i..ii.............................................................................
[00:54:26] ....................................................................................................
[00:54:36] ....................................................................................................
[00:54:45] .....................................................................................i..............
[00:54:56] ...............................i....................................................................
---
[00:55:32] ........F...................i.........F......F......F...............................................
[00:55:33] ....................................................................i...............................
[00:55:34] ................i.......................................................
---
[00:55:34] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/parse-fail/attrs-after-extern-mod.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail/attrs-after-extern-mod.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "parse-only" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail/attrs-after-extern-mod.stage2-x86_64-unknown-linux-gnu.aux"
---
[00:55:34] thread '[parse-fail] parse-fail/attrs-after-extern-mod.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2901:9
---
[00:55:34] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/parse-fail/doc-before-extern-rbrace.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail/doc-before-extern-rbrace.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "parse-only" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail/doc-before-extern-rbrace.stage2-x86_64-unknown-linux-gnu.aux"
---
[00:55:34] error: error pattern 'unmatched visibility `pub`' not found!
[00:55:34] status: exit code: 101
[00:55:34] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/parse-fail/duplicate-visibility.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail" "--target=x86_64-unknown-linux-gnu" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail/duplicate-visibility.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "parse-only" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail/duplicate-visibility.stage2-x86_64-unknown-linux-gnu.aux"
---
[00:55:34] error: expected one of `(`, `fn`, `static`, `type`, or `}`, found `pub`
[00:55:34]   --> /checkout/src/test/parse-fail/duplicate-visibility.rs:15:9
[00:55:34]    |
[00:55:34] LL |     pub pub fn foo();
[00:55:34]    |         ^^^ expected one of `(`, `fn`, `static`, `type`, or `}` here
---
[00:55:34] thread '[parse-fail] parse-fail/duplicate-visibility.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2901:9
[00:55:34]
[00:55:34] ---- [parse-fail] parse-fail/extern-no-fn.rs stdout ----
[00:55:34]
[00:55:34] error: /checkout/src/test/parse-fail/extern-no-fn.rs:13: unexpected error: '13:9: 14:5: missing `fn`, `type`, or `static` for extern-item declaration'
[00:55:34]
[00:55:34] error: /checkout/src/test/parse-fail/extern-no-fn.rs:14: expected error not found: expected one of `!` or `::`, found `(`
[00:55:34]
[00:55:34] error: 1 unexpected errors found, 1 expected errors not found
[00:55:34] status: exit code: 101
[00:55:34] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/parse-fail/extern-no-fn.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail/extern-no-fn.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "parse-only" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail/extern-no-fn.stage2-x86_64-unknown-linux-gnu.aux"
[00:55:34] unexpected errors (from JSON output): [
[00:55:34]     Error {
[00:55:34]         line_num: 13,
[00:55:34]         kind: Some(
[00:55:34]             Error
[00:55:34]         ),
[00:55:34]         msg: "13:9: 14:5: missing `fn`, `type`, or `static` for extern-item declaration"
---
[00:55:34]         msg: "expected one of `!` or `::`, found `(`"
[00:55:34]     }
[00:55:34] ]
[00:55:34]
[00:55:34] thread '[parse-fail] parse-fail/extern-no-fn.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:1253:13
---
[00:55:34] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/parse-fail" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "parse-fail" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zmiri -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zmiri -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:55:34] expected success, got: exit code: 101
[00:55:34]
[00:55:34]
[00:55:34] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:55:34] Build completed unsuccessfully in 0:16:42
[00:55:34] make: *** [check] Error 1
[00:55:34] Makefile:58: recipe for target 'check' failed
---
$ cat obj/tmp/sccache.log
---
$ ls -lat $HOME/Library/Logs/DiagnosticReports/
ls: cannot access /home/travis/Library/Logs/DiagnosticReports/: No such file or directory
travis_time:end:0c9b9d25:start=1522416986934316585,finish=1522416986941367951,duration=7051366
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:00368c0c
$ find $HOME/Library/Logs/DiagnosticReports -type f -name '*.crash' -not -name '*.stage2-*.crash' -not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash' -exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \; -exec head -750 {} \; -exec echo travis_fold":"end:crashlog \; || true
find: `/home/travis/Library/Logs/DiagnosticReports': No such file or directory
travis_time:end:00368c0c:start=1522416986947945312,finish=1522416986954974910,duration=7029598
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0026eea2
$ dmesg | grep -i kill
[   10.548655] init: failsafe main process (1094) killed by TERM signal

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.

@abonander
Copy link
Contributor Author

abonander commented Mar 30, 2018

@petrochenkov the first two errors are parse breakages, but the last two changed error messages seem to be significant improvements. Thoughts?

@abonander
Copy link
Contributor Author

@TimNN there's some irrelevant information in that last log, and missing errors from two other tests. However, I don't need the bot in this thread as I'm checking the build at every opportunity.

@petrochenkov
Copy link
Contributor

the first two errors are parse breakages, but the last two changed error messages seem to be significant improvements. Thoughts?

(I'll look at this PR tomorrow.)
From my reviewer's point of view it's more convenient to look at GitHub diffs than at Travis logs, so it's better to update all tests and push the changes into this PR until Travis is green.
Then I can look at diffs, r+ immediately if everything looks good or leave a comment if some changes in diagnostics look like a regression.

@TimNN
Copy link
Contributor

TimNN commented Mar 31, 2018

Your PR failed on Travis. 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.
Resolving deltas: 100% (612179/612179), completed with 4844 local objects.
---
[00:00:43] configure: rust.quiet-tests     := True
---
[00:40:43] .........................................................................i..........................
[00:40:49] ................i...................................................................................
---
[00:41:25] .............................................................................................i......
[00:41:32] .................................................................i..................................
---
[00:42:26] .............................................i......................................................
---
[00:46:20] .............................i......................................................................
[00:46:34] ..............................................................i.....................................
[00:46:50] ...............................................i....................................................
[00:47:09] ....................................................................................................
[00:47:31] ....................................................................................................
[00:47:53] ....................................................................................................
[00:48:18] ..i................................................................................................i
[00:48:45] ...................................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:48:55] .................
[00:49:25] ....................................................................................................
[00:50:00] ................................................................ii..................................
[00:50:46] ...........................i....................................................i.ii.....test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:50:50] ...........
[00:51:29] ........................................................................................iiiiiii.....
---
[00:53:29] ....................................i...............................................................
[00:53:37] ....................................................................................................
[00:53:44] ..................i............................................................ii.iii...............
[00:53:51] ....................................................................................................
[00:53:59] ........i..............................i............................................................
[00:54:06] ....................................................................................................
[00:54:13] .....................i..............................................................................
[00:54:21] ....................................................................................................
[00:54:31] ....................................................................................................
[00:54:42] ....................................................................................................
[00:54:52] ....................................................................................................
[00:55:06] ....................................................................................................
[00:55:14] ..............i.....................................................................................
[00:55:24] ..................i..ii.............................................................................
[00:55:34] ....................................................................................................
[00:55:44] ....................................................................................................
[00:55:53] .....................................................................................i..............
[00:56:04] ...............................i....................................................................
---
[00:56:40] ...........................i.........................F..............................................
0:56:43]
[00:56:43]
[00:56:43]
[00:56:43] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/parse-fail" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "parse-fail" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zmiri -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zmiri -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:56:43] expected success, got: exit code: 101
[00:56:43]
[00:56:43]
[00:56:43] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:56:43] Build completed unsuccessfully in 0:16:51
[00:56:43] Makefile:58: recipe for target 'check' failed
[00:56:43] make: *** [check] Error 1

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.

@TimNN
Copy link
Contributor

TimNN commented Mar 31, 2018

Your PR failed on Travis. 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.
Resolving deltas: 100% (612184/612184), completed with 4844 local objects.
---
[00:00:44] configure: rust.quiet-tests     := True
---
[00:42:40] .........................................................................i..........................
[00:42:46] ................i...................................................................................
---
[00:43:22] .............................................................................................i......
[00:43:30] .................................................................i..................................
---
[00:44:27] .............................................i......................................................
---
[00:48:28] .............................i......................................................................
[00:48:43] ..............................................................i.....................................
[00:48:59] ...............................................i....................................................
[00:49:20] ....................................................................................................
[00:49:42] ....................................................................................................
[00:50:04] ....................................................................................................
[00:50:30] ..i................................................................................................i
[00:50:56] .............................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:51:08] .......................
[00:51:39] ....................................................................................................
[00:52:17] ................................................................ii..................................
[00:53:01] ...........................i..................................................test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:53:09] ..i.ii................
[00:53:51] ........................................................................................iiiiiii.....
---
[00:55:54] ....................................i...............................................................
[00:56:02] ....................................................................................................
[00:56:10] ..................i............................................................ii.iii...............
[00:56:17] ....................................................................................................
[00:56:25] ........i..............................i............................................................
[00:56:33] ....................................................................................................
[00:56:40] .....................i..............................................................................
[00:56:48] ....................................................................................................
[00:56:59] ....................................................................................................
[00:57:09] ....................................................................................................
[00:57:20] ....................................................................................................
[00:57:35] ....................................................................................................
[00:57:43] ..............i.....................................................................................
[00:57:53] ..................i..ii.............................................................................
[00:58:03] ....................................................................................................
[00:58:13] ....................................................................................................
[00:58:23] .....................................................................................i..............
[00:58:34] ...............................i....................................................................
---
[00:59:12] ...........................i........................F...............................................
[00:59:13] ....................................................................i...............................
[00:59:15] ................i.......................................................
[00:59:15] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:478:22
[00:59:15] failures:
[00:59:15]
[00:59:15] ---- [parse-fail] parse-fail/extern-no-fn.rs stdout ----
[00:59:15]
[00:59:15] error: /checkout/src/test/parse-fail/extern-no-fn.rs:13: unexpected error: '13:9: 14:5: missing `fn`, `type`, or `static` for extern-item declaration'
[00:59:15]
[00:59:15] error: /checkout/src/test/parse-fail/extern-no-fn.rs:14: expected error not found: missing `fn`, `type`, or `static` for extern-item declaration
[00:59:15]
[00:59:15] error: 1 unexpected errors found, 1 expected errors not found
[00:59:15] status: exit code: 101
[00:59:15] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/par9:15]
[00:59:15]
[00:59:15]
[00:59:15] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/parse-fail" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "parse-fail" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zmiri -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zmiri -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:59:15] expected success, got: exit code: 101
[00:59:15]
[00:59:15]
[00:59:15] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:59:15] Build completed unsuccessfully in 0:17:30
[00:59:15] make: *** [check] Error 1
[00:59:15] Makefile:58: recipe for target 'check' failed
travis_time:end:01de2d6e:start=1522460826380941489,finish=15224643817build/bootstrap/debug/incremental/bootstrap-qe1dy92fk757/s-ezo0wc0cds-p4a1s1-8h0vqcli171p
108032 ./obj/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends
102276 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental/core-1sv8kuz0m8z0z
102272 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental/core-1sv8kuz0m8z0z/s-ezo1xqigq6-ttfv7y-vvf53ylimdvz
---
$ cat obj/tmp/sccache.log

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.

@TimNN
Copy link
Contributor

TimNN commented Mar 31, 2018

Your PR failed on Travis. 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.
Resolving deltas: 100% (612195/612195), completed with 4844 local objects.
---
[00:00:46] configure: rust.quiet-tests     := True
---
[00:42:06] .........................................................................i..........................
[00:42:12] ................i.............................F.....................................................
---
[00:42:48] .............................................................................................i......
[00:42:55] .................................................................i..................................
---
[00:43:17] 1 error: missing `fn`, `type`, or `const` for impl-item declaration
[00:43:17] -   --> $DIR/issue-40006.rs:11:9
[00:43:17] +   --> $DIR/issue-40006.rs:13:5
[00:43:17] 3    |
[00:43:17] - LL |   impl X { //~ ERROR cannot be made into an object
[00:43:17] -    |  _________^
[00:43:17] - LL | | //~^ ERROR missing
[00:43:17] - LL | |     Y
[00:43:17] -    | |____^ missing `fn`, `type`, or `const`
[00:43:17] + LL |     Y
[00:43:17] +    |     ^ missing `fn`, `type`, or `const`
[00:43:17] 9
[00:43:17] 10 error: missing `fn`, `type`, or `const` for trait-item declaration
[00:43:17] -   --> $DIR/issue-40006.rs:18:10
[00:43:17] +   --> $DIR/issue-40006.rs:19:5
[00:43:17] 12    |
[00:43:17] - LL |   trait X { //~ ERROR missing
[00:43:17] -    |  __________^
[00:43:17] - LL | |     X() {}
[00:43:17] -    | |____^ missing `fn`, `type`, or `const`
[00:43:17] + LL |     X() {}
[00:43:17] +    |     ^ missing `fn`, `type`, or `const`
[00:43:17] 17
[00:43:17] 18 error: expected `[`, found `#`
[00:43:17] 19   --> $DIR/issue-40006.rs:20:17
[00:43:17]
[00:43:17] 22    |                 ^ expected `[`
[00:43:17] 23
[00:43:17] 24 error: missing `fn`, `type`, or `const` for trait-item declaration
[00:43:17] -   --> $DIR/issue-40006.rs:20:21
[00:43:17] +   --> $DIR/issue-40006.rs:22:5
[00:43:17] 26    |
[00:43:17] - LL |       fn xxx() { ### } //~ ERROR missing
[00:43:17] -    |  _____________________^
[00:43:17] - LL | |     //~^ ERROR expected
[00:43:17] - LL | |     L = M; //~ ERROR missing
[00:43:17] -    | |____^ missing `fn`, `type`, or `const`
[00:43:17] + LL |     L = M; //~ ERROR missing
[00:43:17] +    |     ^ missing `fn`, `type`, or `const`
[00:43:17] 32
[00:43:17] 33 error: missing `fn`, `type`, or `const` for trait-item declaration
[00:43:17] -   --> $DIR/issue-40006.rs:22:11
[00:43:17] +   --> $DIR/issue-40006.rs:23:5
[00:43:17] 35    |
[00:43:17] - LL |       L = M; //~ ERROR missing
[00:43:17] -    |  ___________^
[00:43:17] - LL | |     Z = { 2 + 3 }; //~ ERROR expected one of
[00:43:17] -    | |____^ missing `fn`, `type`, or `const`
[00:43:17] + LL |     Z = { 2 + 3 }; //~ ERROR expected one of
[00:43:17] +    |     ^ missing `fn`, `type`, or `const`
[00:43:17] 40
[00:43:17] 41 error: expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;`
[00:43:17] 42   --> $DIR/issue-40006.rs:23:18
[00:43:17]
[00:43:17] 51    |         ^ expected one of `!` or `::` here
[00:43:17] 52
[00:43:17] 53 error: missing `fn`, `type`, or `const` for impl-item declaration
[00:43:17] -   --> $DIR/issue-40006.rs:28:8
[00:43:17] +   --> $DIR/issue-40006.rs:28:9
[00:43:17] 55    |
[00:43:17] 56 LL |     pub hello_method(&self) { //~ ERROR missing
[00:43:17] -    |        ^ missing `fn`, `type`, or `const`
[00:43:17] +    |         ^^^^^^^^^^^^ missing `fn`, `type`, or `const`
[00:43:17] 58
[00:43:17] 59 error[E0038]: the trait `X` cannot be made into an object
[00:43:17] 60   --> $DIR/issue-40006.rs:11:6
[00:43:17]
[00:43:17]
[00:43:17] The actual stderr differed from the expected stderr.
[00:43:17] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/did_you_mean/issue-40006.stderr
[00:43:17] To update references, run this command from build directory:
[00:43:17] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'did_you_mean/issue-40006.rs'
[00:43:17]
[00:43:17] error: 1 errors occurred comparing output.
[00:43:17] status: exit code: 101
[00:43:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/did_you_mean/issue-40006.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/did_you_mean/issue-40006.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/did_you_mean/issue-40006.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
---
[00:43:17] {"message":"missing `fn`, `type`, or `const` for impl-item declaration","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":539,"byte_end":540,"line_start":13,"line_end":13,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":"    Y","highlight_start":5,"highlight_end":6}],"label":"missing `fn`, `type`, or `const`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: missing `fn`, `type`, or `const` for impl-item declaration\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:13:5\n   |\nLL |     Y\n   |     ^ missing `fn`, `type`, or `const`\n\n"}
[00:43:17] {"message":"missing `fn`, `type`, or `const` for trait-item declaration","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":587,"byte_end":588,"line_start":19,"line_end":19,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":"    X() {}","highlight_start":5,"highlight_end":6}],"label":"missing `fn`, `type`, or `const`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: missing `fn`, `type`, or `const` for trait-item declaration\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:19:5\n   |\nLL |     X() {}\n   |     ^ missing `fn`, `type`, or `const`\n\n"}
[00:43:17] {"message":"expected `[`, found `#`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":610,"byte_end":611,"line_start":20,"line_end":20,"column_start":17,"column_end":18,"is_primary":true,"text":[{"text":"    fn xxx() { ### } //~ ERROR missing","highlight_start":17,"highlight_end":18}],"label":"expected `[`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: expected `[`, found `#`\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:20:17\n   |\nLL |     fn xxx() { ### } //~ ERROR missing\n   |                 ^ expected `[`\n\n"}
[00:43:17] {"message":"missing `fn`, `type`, or `const` for trait-item declaration","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":661,"byte_end":662,"line_start":22,"line_end":22,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":"    L = M; //~ ERROR missing","highlight_start":5,"highlight_end":6}],"label":"missing `fn`, `type`, or `const`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: missing `fn`, `type`, or `const` for trait-item declaration\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:22:5\n   |\nLL |     L = M; //~ ERROR missing\n   |     ^ missing `fn`, `type`, or `const`\n\n"}
[00:43:17] {"message":"missing `fn`, `type`, or `const` for trait-item declaration","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":690,"byte_end":691,"line_start":23,"line_end":23,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":"    Z = { 2 + 3 }; //~ ERROR expected one of","highlight_start":5,"highlight_end":6}],"label":"missing `fn`, `type`, or `const`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: missing `fn`, `type`, or `const` for trait-item declaration\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:23:5\n   |\nLL |     Z = { 2 + 3 }; //~ ERROR expected one of\n   |     ^ missing `fn`, `type`, or `const`\n\n"}
[00:43:17] {"message":"expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":703,"byte_end":704,"line_start":23,"line_end":23,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":"    Z = { 2 + 3 }; //~ ERROR expected one of","highlight_start":18,"highlight_end":19}],"label":"expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}` here","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;`\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:23:18\n   |\nLL |     Z = { 2 + 3 }; //~ ERROR expected one of\n   |                  ^ expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}` here\n\n"}
[00:43:17] {"message":"expected one of `!` or `::`, found `(`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":739,"byte_end":740,"line_start":24,"line_end":24,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    ::Y (); //~ ERROR expected one of","highlight_start":9,"highlight_end":10}],"label":"expected one of `!` or `::` here","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: expected one of `!` or `::`, found `(`\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:24:9\n   |\nLL |     ::Y (); //~ ERROR expected one of\n   |         ^ expected one of `!` or `::` here\n\n"}
[00:43:17] {"message":"missing `fn`, `type`, or `const` for impl-item declaration","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":789,"byte_end":801,"line_start":28,"line_end":28,"column_start":9,"column_end":21,"is_primary":true,"text":[{"text":"    pub hello_method(&self) { //~ ERROR missing","highlight_start":9,"highlight_end":21}],"label":"missing `fn`, `type`, or `const`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error: missing `fn`, `type`, or `const` for impl-item declaration\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:28:9\n   |\nLL |     pub hello_method(&self) { //~ ERROR missing\n   |         ^^^^^^^^^^^^ missing `fn`, `type`, or `const`\n\n"}
[00:43:17] {"message":"the trait `X` cannot be made into an object","code":{"code":"E0038","explanation":"\nTrait objects like `Box<Trait>` can only be constructed when certain\nrequirements are satisfied by the trait in question.\n\nTrait objects are a form of dynamic dispatch and use a dynamically sized type\nfor the inner type. So, for a given trait `Trait`, when `Trait` is treated as a\ntype, as in `Box<Trait>`, the inner type is 'unsized'. In such cases the boxed\npointer is a 'fat pointer' that contains an extra pointer to a table of methods\n(among other things) for dynamic dispatch. This design mandates some\nrestrictions on the types of traits that are allowed to be used in trait\nobjects, which are collectively termed as 'object safety' rules.\n\nAttempting to create a trait object for a non object-safe trait will trigger\nthis error.\n\nThere are various rules:\n\n### The trait cannot require `Self: Sized`\n\nWhen `Trait` is treated as a type, the type does not implement the special\n`Sized` trait, because the type does not have a known size at compile time and\ncan only be accessed behind a pointer. Thus, if we have a trait like the\nfollowing:\n\n```\ntrait Foo where Self: Sized {\n\n}\n```\n\nWe cannot create an object of type `Box<Foo>` or `&Foo` since in this case\n`Self` would not be `Sized`.\n\nGenerally, `Self : Sized` is used to indicate that the trait should not be used\nas a trait object. If the trait comes from your own crate, consider removing\nthis restriction.\n\n### Method references the `Self` type in its arguments or return type\n\nThis happens when a trait has a method like the following:\n\n```\ntrait Trait {\n    fn foo(&self) -> Self;\n}\n\nimpl Trait for String {\n    fn foo(&self) -> Self {\n        \"hi\".to_owned()\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) -> Self {\n        1\n    }\n}\n```\n\n(Note that `&self` and `&mut self` are okay, it's additional `Self` types which\ncause this problem.)\n\nIn such a case, the compiler cannot predict the return type of `foo()` in a\nsituation like the following:\n\n```compile_fail\ntrait Trait {\n    fn foo(&self) -> Self;\n}\n\nfn call_foo(x: Box<Trait>) {\n    let y = x.foo(); // What type is y?\n    // ...\n}\n```\n\nIf only some methods aren't object-safe, you can add a `where Self: Sized` bound\non them to mark them as explicitly unavailable to trait objects. The\nfunctionality will still be available to all other implementers, including\n`Box<Trait>` which is itself sized (assuming you `impl Trait for Box<Trait>`).\n\n```\ntrait Trait {\n    fn foo(&self) -> Self where Self: Sized;\n    // more functions\n}\n```\n\nNow, `foo()` can no longer be called on a trait object, but you will now be\nallowed to make a trait object, and that will be able to call any object-safe\nmethods. With such a bound, one can still call `foo()` on types implementing\nthat trait that aren't behind trait objects.\n\n### Method has generic type parameters\n\nAs mentioned before, trait objects contain pointers to method tables. So, if we\nhave:\n\n```\ntrait Trait {\n    fn foo(&self);\n}\n\nimpl Trait for String {\n    fn foo(&self) {\n        // implementation 1\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) {\n        // implementation 2\n    }\n}\n// ...\n```\n\nAt compile time each implementation of `Trait` will produce a table containing\nthe various methods (and other items) related to the implementation.\n\nThis works fine, but when the method gains generic parameters, we can have a\nproblem.\n\nUsually, generic parameters get _monomorphized_. For example, if I have\n\n```\nfn foo<T>(x: T) {\n    // ...\n}\n```\n\nThe machine code for `foo::<u8>()`, `foo::<bool>()`, `foo::<String>()`, or any\nother type substitution is different. Hence the compiler generates the\nimplementation on-demand. If you call `foo()` with a `bool` parameter, the\ncompiler will only generate code for `foo::<bool>()`. When we have additional\ntype parameters, the number of monomorphized implementations the compiler\ngenerates does not grow drastically, since the compiler will only generate an\nimplementation if the function is called with unparametrized substitutions\n(i.e., substitutions where none of the substituted types are themselves\nparametrized).\n\nHowever, with trait objects we have to make a table containing _every_ object\nthat implements the trait. Now, if it has type parameters, we need to add\nimplementations for every type that implements the trait, and there could\ntheoretically be an infinite number of types.\n\nFor example, with:\n\n```\ntrait Trait {\n    fn foo<T>(&self, on: T);\n    // more methods\n}\n\nimpl Trait for String {\n    fn foo<T>(&self, on: T) {\n        // implementation 1\n    }\n}\n\nimpl Trait for u8 {\n    fn foo<T>(&self, on: T) {\n        // implementation 2\n    }\n}\n\n// 8 more implementations\n```\n\nNow, if we have the following code:\n\n```compile_fail,E0038\n# trait Trait { fn foo<T>(&self, on: T); }\n# impl Trait for String { fn foo<T>(&self, on: T) {} }\n# impl Trait for u8 { fn foo<T>(&self, on: T) {} }\n# impl Trait for bool { fn foo<T>(&self, on: T) {} }\n# // etc.\nfn call_foo(thing: Box<Trait>) {\n    thing.foo(true); // this could be any one of the 8 types above\n    thing.foo(1);\n    thing.foo(\"hello\");\n}\n```\n\nWe don't just need to create a table of all implementations of all methods of\n`Trait`, we need to create such a table, for each different type fed to\n`foo()`. In this case this turns out to be (10 types implementing `Trait`)*(3\ntypes being fed to `foo()`) = 30 implementations!\n\nWith real world traits these numbers can grow drastically.\n\nTo fix this, it is suggested to use a `where Self: Sized` bound similar to the\nfix for the sub-error above if you do not intend to call the method with type\nparameters:\n\n```\ntrait Trait {\n    fn foo<T>(&self, on: T) where Self: Sized;\n    // more methods\n}\n```\n\nIf this is not an option, consider replacing the type parameter with another\ntrait object (e.g. if `T: OtherTrait`, use `on: Box<OtherTrait>`). If the number\nof types you intend to feed to this method is limited, consider manually listing\nout the methods of different types.\n\n### Method has no receiver\n\nMethods that do not take a `self` parameter can't be called since there won't be\na way to get a pointer to the method table for them.\n\n```\ntrait Foo {\n    fn foo() -> u8;\n}\n```\n\nThis could be called as `<Foo as Foo>::foo()`, which would not be able to pick\nan implementation.\n\nAdding a `Self: Sized` bound to these methods will generally make this compile.\n\n```\ntrait Foo {\n    fn foo() -> u8 where Self: Sized;\n}\n```\n\n### The trait cannot contain associated constants\n\nJust like static functions, associated constants aren't stored on the method\ntable. If the trait or any subtrait contain an associated constant, they cannot\nbe made into an object.\n\n```compile_fail,E0038\ntrait Foo {\n    const X: i32;\n}\n\nimpl Foo {}\n```\n\nA simple workaround is to use a helper method instead:\n\n```\ntrait Foo {\n    fn x(&self) -> i32;\n}\n```\n\n### The trait cannot use `Self` as a type parameter in the supertrait listing\n\nThis is similar to the second sub-error, but subtler. It happens in situations\nlike the following:\n\n```compile_fail\ntrait Super<A> {}\n\ntrait Trait: Super<Self> {\n}\n\nstruct Foo;\n\nimpl Super<Foo> for Foo{}\n\nimpl Trait for Foo {}\n```\n\nHere, the supertrait might have methods as follows:\n\n```\ntrait Super<A> {\n    fn get_a(&self) -> A; // note that this is object safe!\n}\n```\n\nIf the trait `Foo` was deriving from something like `Super<String>` or\n`Super<T>` (where `Foo` itself is `Foo<T>`), this is okay, because given a type\n`get_a()` will definitely return an object of that type.\n\nHowever, if it derives from `Super<Self>`, even though `Super` is object safe,\nthe method `get_a()` would return an object of unknown type when called on the\nfunction. `Self` type parameters let us make object safe traits no longer safe,\nso they are forbidden when specifying supertraits.\n\nThere's no easy fix for this, generally code will need to be refactored so that\nyou no longer need to derive from `Super<Self>`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/did_you_mean/issue-40006.rs","byte_start":472,"byte_end":473,"line_start":11,"line_end":11,"column_start":6,"column_end":7,"is_primary":true,"text":[{"text":"impl X { //~ ERROR cannot be made into an object","highlight_start":6,"highlight_end":7}],"label":"the trait `X` cannot be made into an object","suggested_replacement":null,"expansion":null}],"children":[{"message":"method `xxx` has no receiver","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0038]: the trait `X` cannot be made into an object\n  --> /checkout/src/test/ui/did_you_mean/issue-40006.rs:11:6\n   |\nLL | impl X { //~ ERROR cannot be made into an object\n   |      ^ the trait `X` cannot be made into an object\n   |\n   = note: method `xxx` has no receiver\n\n"}
[00:43:17] {"message":"aborting due to 9 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 9 previous errors\n\n"}
[00:43:17] {"message":"For more information about this error, try `rustc --explain E0038`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0038`.\n"}
---
[00:43:17] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zmiri -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zmiri -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:43:17] expected success, got: exit code: 101
[00:43:17]
[00:43:17]
[00:43:17] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:43:17] Build completed unsuccessfully in 0:02:08
[00:43:17] make: *** [check] Error 1
[00:43:17] Makefile:58: recipe for target 'check' failed
---
$ cat obj/tmp/sccache.log
---
$ ls -lat $HOME/Library/Logs/DiagnosticReports/
ls: cannot access /home/travis/Library/Logs/DiagnosticReports/: No such file or directory
travis_time:end:18ce1ffa:start=1522487559984616300,finish=1522487559994137371,duration=9521071
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:217d89aa
$ find $HOME/Library/Logs/DiagnosticReports -type f -name '*.crash' -not -name '*.stage2-*.crash' -not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash' -exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \; -exec head -750 {} \; -exec echo travis_fold":"end:crashlog \; || true
find: `/home/travis/Library/Logs/DiagnosticReports': No such file or directory
travis_time:end:217d89aa:start=1522487560007037380,finish=1522487560015300316,duration=8262936
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0373cbe1
$ dmesg | grep -i kill
[   10.895741] init: failsafe main process (1094) killed by TERM signal

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.

@petrochenkov
Copy link
Contributor

r=me after squashing and removing WIP from PR title (otherwise bors will reject it)
@bors delegate+

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Apr 2, 2018

📌 Commit 5be72bd has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 2, 2018
@bors
Copy link
Contributor

bors commented Apr 2, 2018

🔒 Merge conflict

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 2, 2018
@bors
Copy link
Contributor

bors commented Apr 2, 2018

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

@abonander
Copy link
Contributor Author

@petrochenkov conflicts resolved

@TimNN
Copy link
Contributor

TimNN commented Apr 3, 2018

Your PR failed on Travis. 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.
[00:00:45] configure: rust.quiet-tests     := True
---
[00:41:28] .........................................................................i..........................
[00:41:34] ................i...................................................................................
---
[00:42:09] .............................................................................................i......
[00:42:16] .................................................................i..................................
---
[00:43:10] .............................................i......................................................
---
[00:47:01] .............................i......................................................................
[00:47:15] ..............................................................i.....................................
[00:47:30] ...............................................i....................................................
[00:47:50] ....................................................................................................
[00:48:12] ....................................................................................................
[00:48:33] ....................................................................................................
[00:48:58] ..i................................................................................................i
[00:49:25] ...................................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:49:34] .................
[00:50:05] ....................................................................................................
[00:50:41] ................................................................ii..................................
[00:51:26] ...........................i....................................................i.ii...test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:51:31] .............
[00:52:10] ........................................................................................iiiiiii.....
---
[00:54:07] ....................................i...............................................................
[00:54:15] ....................................................................................................
[00:54:22] ..................i............................................................ii.iii...............
[00:54:29] ....................................................................................................
[00:54:37] ........i..............................i............................................................
[00:54:44] ....................................................................................................
[00:54:51] .....................i..............................................................................
[00:54:59] ....................................................................................................
[00:55:09] ....................................................................................................
[00:55:19] ....................................................................................................
[00:55:30] ....................................................................................................
[00:55:43] ....................................................................................................
[00:55:51] ..............i.....................................................................................
[00:56:01] ..................i..ii.............................................................................
[00:56:11] ....................................................................................................
[00:56:21] ....................................................................................................
[00:56:30] .....................................................................................i..............
[00:56:40] ...............................i....................................................................
---
[00:57:16] ............................i.......................................................................
[00:57:18] ....................................................................i...............................
[00:57:19] ................i.......................................................
---
[00:57:33] ...........i........................
---
[00:58:03] i...i..ii....i.............ii........iii......i..i...i...ii..i..i..ii.....
---
[00:58:06] i.......i......................i......
---
[00:58:42] iiii.......i..i........i..i.i.............i..........iiii...........i...i..........ii.i.i.......ii..
[00:58:43] ....ii...
---
86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail-fulldeps/proc-macro/macros-in-extern.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[01:04:00] unexpected errors (from JSON output): [
[01:04:00]     Error {
[01:04:00]         line_num: 22,
[01:04:00]         kind: Some(
[01:04:00]             Error
[01:04:00]         ),
[01:04:00]         msg: "22:5: 22:17: attributes on expressions are experimental. (see issue #15701) [E0658]"
[01:04:00]     }
[01:04:00] ]
[01:04:00]
[01:04:00] thread '[compile-fail] compile-fail-fulldeps/proc-macro/macros-in-extern.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:1253:13
---
[01:04:00] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/compile-fail-fulldeps" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail-fulldeps" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "compile-fail" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zmiri -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zmiri -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:04:00] expected success, got: exit code: 101
[01:04:00]
[01:04:00]
[01:04:00] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:04:00] Build completed unsuccessfully in 0:23:18
[01:04:00] Makefile:58: recipe for target 'check' failed
[01:04:00] make: *** [check] Error 1
---
$ cat obj/tmp/sccache.log

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.

use test_macros::{nop_attr, no_output, emit_input};

fn main() {
#[no_output]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrochenkov possible regression introduced by #49124? This invocation is being feature-gated by stmt_expr_attributes but I don't think it should be.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I thought the idea was to additionally gate macro expansions on statements/expressions with stmt_expr_attributes (in this case this error is correct).
I think we should pretend this is a "feature, not a bug" for now, land this PR and then possibly tweak feature gates so that #49124 becomes gated only by proc_macro.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I saw Serde relying on this, but I realize now it had to have been using #[cfg] which has been allowed and is probably being tested elsewhere already. So it's not an issue for now.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Apr 3, 2018

📌 Commit 5d74990 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 3, 2018
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Apr 5, 2018
…chenkov

Expand macros in `extern {}` blocks

This permits macro and proc-macro and attribute invocations (the latter only with the `proc_macro` feature of course) in `extern {}` blocks, gated behind a new `macros_in_extern` feature.

A tracking issue is now open at rust-lang#49476

closes rust-lang#48747
bors added a commit that referenced this pull request Apr 5, 2018
Rollup of 8 pull requests

Successful merges:

 - #49045 (Make queries thread safe)
 - #49350 (Expand macros in `extern {}` blocks)
 - #49497 (Chalkify - Tweak `Clause` definition and HRTBs)
 - #49597 (proc_macro: Reorganize public API)
 - #49686 (typos)
- #49621
- #49697
- #49705

Failed merges:
@alexcrichton alexcrichton merged commit 5d74990 into rust-lang:master Apr 5, 2018
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Apr 30, 2018
ExpansionKind::ForeignItems was added in rust-lang#49350, which is not included
in the 1.26 beta.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

proc_macro_attribute doesn't work on extern functions
5 participants