Skip to content

Commit 18edc8a

Browse files
ehussjasonwilliams
authored andcommitted
Remove -Z no-trans support and update tests (rust-lang#286)
- Remove support for -Z no-trans on-save checking (fixes rust-lang#281). - Update some tests for latest nightly. - Pin nightly and clippy to a known-good version for Travis. This should ensure that minor issues don't cause unrelated PRs to fail. This also configures the beta/nightly jobs to allow failure. I have a cron job on my own repository set up so I will be notified whenever things break, and I'll send PRs when necessary.
1 parent 761796f commit 18edc8a

16 files changed

+92
-215
lines changed

.travis.yml

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,56 @@
11
env:
2-
global:
3-
- PACKAGE="Rust Enhanced"
4-
- SUBLIME_TEXT_VERSION="3"
2+
global:
3+
- PACKAGE="Rust Enhanced"
4+
- SUBLIME_TEXT_VERSION="3"
55

66
language: rust
77

8-
matrix:
9-
include:
10-
- os: linux
11-
rust: stable
12-
13-
- os: osx
14-
rust: stable
15-
16-
- os: linux
17-
rust: beta
18-
19-
- os: osx
20-
rust: beta
8+
os:
9+
- linux
10+
- osx
2111

22-
- os: linux
23-
rust: nightly
24-
25-
- os: osx
26-
rust: nightly
12+
rust:
13+
- stable
14+
- beta
15+
- nightly
2716

17+
matrix:
18+
allow_failures:
19+
- rust: beta
20+
- rust: nightly
2821

2922
before_install:
30-
- curl -OL https://raw.githubusercontent.com/SublimeText/UnitTesting/master/sbin/travis.sh
23+
- curl -OL https://raw.githubusercontent.com/SublimeText/UnitTesting/master/sbin/travis.sh
3124

32-
# enable gui, see https://docs.travis-ci.com/user/gui-and-headless-browsers
33-
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
34-
export DISPLAY=:99.0;
35-
sh -e /etc/init.d/xvfb start;
36-
fi
25+
# enable gui, see https://docs.travis-ci.com/user/gui-and-headless-browsers
26+
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
27+
export DISPLAY=:99.0;
28+
sh -e /etc/init.d/xvfb start;
29+
fi
3730

3831

3932
install:
40-
# Install Sublime and Sublime Unittesting.
41-
- sh travis.sh bootstrap
42-
# Install Package Control, needed for dependencies.
43-
- sh travis.sh install_package_control
44-
45-
# Ensure nightly is installed to run no-trans, benchmarks, and Clippy.
46-
- rustup install nightly
47-
# Install Rust packages needed by integration tests.
48-
- cargo +nightly install clippy || export RE_SKIP_CLIPPY=1
49-
- cargo install cargo-script
33+
# Install Sublime and Sublime Unittesting.
34+
- sh travis.sh bootstrap
35+
# Install Package Control, needed for dependencies.
36+
- sh travis.sh install_package_control
37+
38+
# Ensure nightly is installed to run benchmarks and Clippy.
39+
# Pin a known good version of nightly and clippy.
40+
- >
41+
if [ "$TRAVIS_RUST_VERSION" != "nightly" ]; then
42+
rustup install nightly-2018-05-26;
43+
host=$(rustc -Vv | grep ^host: | sed -e "s/host: //g");
44+
toolchains=$(dirname $(dirname $(dirname $(rustup which rustc))));
45+
mv $toolchains/nightly-* $toolchains/nightly-$host;
46+
cargo +nightly install --version 0.0.205 clippy || export RE_SKIP_CLIPPY=1;
47+
else
48+
cargo +nightly install clippy || export RE_SKIP_CLIPPY=1;
49+
fi
50+
# Install Rust packages needed by integration tests.
51+
- cargo install cargo-script
5052

5153

5254
script:
53-
- sh travis.sh run_syntax_tests
54-
- sh travis.sh run_tests
55+
- sh travis.sh run_syntax_tests
56+
- sh travis.sh run_tests

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,13 @@ This relies on Cargo and Rust (>= 1.8.0) being installed and on your system path
6161
| :------ | :------ | :---------- |
6262
| `rust_syntax_checking` | `true` | Enable the on-save syntax checking. |
6363
| `rust_syntax_checking_method` | `"check"` | The method used for checking your code (see below). |
64-
| `rust_syntax_checking_include_tests` | `true` | Enable checking of test code within `#[cfg(test)]` sections (only for `no-trans` method). |
64+
| `rust_syntax_checking_include_tests` | `true` | Enable checking of test code within `#[cfg(test)]` sections. |
6565
| `rust_syntax_hide_warnings` | `false` | Don't show warnings when syntax checking |
6666

6767
The available checking methods are:
6868

6969
| Method | Description |
7070
| :----- | :---------- |
71-
| `no-trans` | Runs the rustc compiler with the `-Zno-trans` option. This will be deprecated soon, however it has the benefit of supporting `#[test]` sections. |
7271
| `check` | Uses `cargo check` (requires at least Rust 1.16). |
7372
| `clippy` | Uses `cargo clippy`. This requires [Clippy](https://github.com/Manishearth/rust-clippy) to be installed. This also may be a little slower since it must check every target in your package. |
7473

RustEnhanced.sublime-settings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"rust_syntax_checking": true,
55

66
// The method used to check code on-save.
7-
// "check", "no-trans", or "clippy" (see README.md)
7+
// "check" or "clippy" (see README.md)
88
"rust_syntax_checking_method": "check",
99

1010
// Enable checking of test code within #[cfg(test)] sections.

SyntaxCheckPlugin.py

Lines changed: 17 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,6 @@
1212
whenever you save a Rust file.
1313
"""
1414

15-
# Notes:
16-
# - -Zno-trans has been deprecated, and will only be available with the
17-
# nightly compiler starting with rust 1.19. Using "cargo check" is the
18-
# preferred alternative, though it currently has some limitations. See:
19-
#
20-
# - Unstable flags removed:
21-
# https://github.com/rust-lang/rust/issues/31847
22-
#
23-
# - Cargo check added in rust 1.16:
24-
# https://github.com/rust-lang/cargo/pull/3296 (based on original
25-
# "cargo check" addon https://github.com/rsolomo/cargo-check/)
26-
#
27-
# - RLS was recently released
28-
# (https://github.com/rust-lang-nursery/rls). It's unclear to me if
29-
# this will perform full-linting that could replace this or not.
30-
#
31-
# - "cargo check" ignores #[test]:
32-
# https://github.com/rust-lang/cargo/issues/3431
33-
#
34-
# - "cargo check" will not re-issue errors/warnings if nothing has
35-
# changed. This generally should not be a problem since on-save
36-
# syntax only runs after the file has been saved which updates the
37-
# timestamp, but it's something to be careful about. See:
38-
# https://github.com/rust-lang/cargo/issues/3624
39-
#
40-
# - -Zno-trans prevents some warnings and errors from being generated. For
41-
# example, see const-err.rs. "cargo check" does not have this problem.
42-
# Other issues:
43-
# - Errors generated by compiling an extern crate do not not output as
44-
# json.
45-
4615

4716
class RustSyntaxCheckEvent(sublime_plugin.EventListener):
4817

@@ -134,28 +103,30 @@ def get_rustc_messages(self):
134103
p.wait()
135104
return
136105

137-
# "no-trans" or "check" methods.
106+
if method == 'no-trans':
107+
print('rust_syntax_checking_method == "no-trans" is no longer supported.')
108+
print('Please change the config setting to "check".')
109+
method = 'check'
110+
111+
if method != 'check':
112+
print('Unknown setting for `rust_syntax_checking_method`: %r' % (method,))
113+
return
114+
138115
td = target_detect.TargetDetector(self.window)
139116
targets = td.determine_targets(self.triggered_file_name)
140117
for (target_src, target_args) in targets:
141118
cmd = settings.get_command(method, command_info, self.cwd, self.cwd,
142119
initial_settings={'target': ' '.join(target_args)},
143120
force_json=True)
144121
self.msg_rel_path = cmd['msg_rel_path']
145-
if method == 'no-trans':
146-
cmd['command'].extend(['--', '-Zno-trans', '-Zunstable-options'])
147-
if (util.get_setting('rust_syntax_checking_include_tests', True) and
148-
not ('--test' in target_args or '--bench' in target_args)):
149-
# Including the test harness has a few drawbacks.
150-
# missing_docs lint is disabled (see
151-
# https://github.com/rust-lang/sublime-rust/issues/156)
152-
# It also disables the "main function not found" error for
153-
# binaries.
154-
cmd['command'].append('--test')
155-
elif method == 'check':
156-
if (util.get_setting('rust_syntax_checking_include_tests', True) and
157-
semver.match(cmd['rustc_version'], '>=1.23.0')):
158-
cmd['command'].append('--profile=test')
122+
if (util.get_setting('rust_syntax_checking_include_tests', True) and
123+
semver.match(cmd['rustc_version'], '>=1.23.0')):
124+
# Including the test harness has a few drawbacks.
125+
# missing_docs lint is disabled (see
126+
# https://github.com/rust-lang/sublime-rust/issues/156)
127+
# It also disables the "main function not found" error for
128+
# binaries.
129+
cmd['command'].append('--profile=test')
159130
p = rust_proc.RustProc()
160131
self.current_target_src = target_src
161132
p.run(self.window, cmd['command'], self.cwd, self, env=cmd['env'])

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ install:
1818
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
1919
- rustup-init.exe -y --default-toolchain %RUST_VERSION%
2020
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
21-
# Ensure nightly is installed to run no-trans, benchmarks, and Clippy.
21+
# Ensure nightly is installed to run benchmarks and Clippy.
2222
- rustup install nightly
2323
# Install Rust packages needed by integration tests.
2424
- cargo +nightly install clippy || set RE_SKIP_CLIPPY=1

rust/cargo_config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,7 @@ def items_variant(self):
278278
def filter_variant(self, x):
279279
"""Subclasses override this to filter variants from the variant
280280
list."""
281-
# no-trans is a special, hidden, internal command. In theory, a user
282-
# can configure it, but since it is deprecated, just hide it for now.
283-
return x['name'] != 'no-trans'
281+
return True
284282

285283
def items_which(self):
286284
"""Choice to select at which level the setting should be saved at."""

rust/cargo_settings.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,6 @@
110110
'requires_view_path': True,
111111
'requires_manifest': False,
112112
},
113-
# This is a special command (not exposed) used by on-save syntax checking.
114-
'no-trans': {
115-
'name': 'no-trans',
116-
'command': 'rustc',
117-
'allows_target': True,
118-
'allows_target_triple': True,
119-
'allows_release': True,
120-
'allows_features': True,
121-
'allows_json': True,
122-
'requires_view_path': False,
123-
'requires_manifest': False,
124-
}
125113
}
126114

127115

rust/target_detect.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ def determine_targets(self, file_name):
5858
if result:
5959
return result
6060

61-
# TODO: Alternatively, could run rustc directly without cargo.
62-
# rustc -Zno-trans -Zunstable-options --error-format=json file_name
6361
print('Rust Enhanced: Failed to find target for %r' % file_name)
6462
return []
6563

tests/error-tests/examples/no_main.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Should display error about no main.
22

33
mod no_main_mod;
4-
// Not sure why no-trans doesn't handle this properly.
54
// When --profile=test is used with `cargo check`, this error will not happen
65
// due to the synthesized main created by the test harness.
7-
// end-msg: ERR(rust_syntax_checking_include_tests=False OR <1.23.0,rust_syntax_checking_include_tests=True,check) /`?main`? function not found/
8-
// end-msg: NOTE(rust_syntax_checking_include_tests=False OR <1.23.0,rust_syntax_checking_include_tests=True,check) the main function must be defined
9-
// end-msg: MSG(rust_syntax_checking_include_tests=False OR <1.23.0,rust_syntax_checking_include_tests=True,check) See Also: no_main_mod.rs:4
6+
// end-msg: ERR(rust_syntax_checking_include_tests=False OR <1.23.0,rust_syntax_checking_include_tests=True) /`?main`? function not found/
7+
// end-msg: NOTE(rust_syntax_checking_include_tests=False OR <1.23.0,rust_syntax_checking_include_tests=True) the main function must be defined
8+
// end-msg: MSG(rust_syntax_checking_include_tests=False OR <1.23.0,rust_syntax_checking_include_tests=True) See Also: no_main_mod.rs:4

tests/error-tests/examples/no_main_mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
// ^^^^^^^^^WARN(>=1.23.0,rust_syntax_checking_include_tests=True) function is never used
33
// ^^^^^^^^^NOTE(>=1.23.0,rust_syntax_checking_include_tests=True) #[warn(dead_code)]
44
}/*END*/
5-
// ~NOTE(rust_syntax_checking_include_tests=False OR <1.23.0,rust_syntax_checking_include_tests=True,check) here is a function named 'main'
6-
// ~MSG(rust_syntax_checking_include_tests=False OR <1.23.0,rust_syntax_checking_include_tests=True,check) See Primary: no_main.rs
7-
// ~WARN(<1.19.0,no-trans,rust_syntax_checking_include_tests=True) function is never used
8-
// ~NOTE(>=1.17.0,<1.19.0,no-trans,rust_syntax_checking_include_tests=True) #[warn(dead_code)]
5+
// ~NOTE(rust_syntax_checking_include_tests=False OR <1.23.0,rust_syntax_checking_include_tests=True) here is a function named 'main'
6+
// ~MSG(rust_syntax_checking_include_tests=False OR <1.23.0,rust_syntax_checking_include_tests=True) See Primary: no_main.rs

tests/error-tests/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ mod tests {
44
// ^^^^^^^^^^^^ERR(<1.16.0,rust_syntax_checking_include_tests=True) type name
55
// ^^^^^^^^^^^^ERR(<1.16.0,rust_syntax_checking_include_tests=True) undefined or not in scope
66
// ^^^^^^^^^^^^HELP(<1.16.0,rust_syntax_checking_include_tests=True) no candidates
7-
// ^^^^^^^^^^^^ERR(>=1.16.0,<1.19.0,rust_syntax_checking_include_tests=True,no-trans OR >=1.23.0,rust_syntax_checking_include_tests=True) cannot find type `DoesNotExist`
8-
// ^^^^^^^^^^^^ERR(>=1.16.0,<1.19.0,rust_syntax_checking_include_tests=True,no-trans OR >=1.23.0,rust_syntax_checking_include_tests=True) not found in this scope
7+
// ^^^^^^^^^^^^ERR(>=1.23.0,rust_syntax_checking_include_tests=True) cannot find type `DoesNotExist`
8+
// ^^^^^^^^^^^^ERR(>=1.23.0,rust_syntax_checking_include_tests=True) not found in this scope
99
}
1010

1111
#[test]
1212
fn it_works() {
1313
asdf
1414
// ^^^^ERR(<1.16.0,rust_syntax_checking_include_tests=True) unresolved name
1515
// ^^^^ERR(<1.16.0,rust_syntax_checking_include_tests=True) unresolved name
16-
// ^^^^ERR(>=1.16.0,<1.19.0,rust_syntax_checking_include_tests=True,no-trans OR >=1.23.0,rust_syntax_checking_include_tests=True) cannot find value
17-
// ^^^^ERR(>=1.16.0,<1.19.0,rust_syntax_checking_include_tests=True,no-trans OR >=1.23.0,rust_syntax_checking_include_tests=True) not found in this scope
16+
// ^^^^ERR(>=1.23.0,rust_syntax_checking_include_tests=True) cannot find value
17+
// ^^^^ERR(>=1.23.0,rust_syntax_checking_include_tests=True) not found in this scope
1818
}
1919
}

tests/error-tests/tests/const-err.rs

Lines changed: 0 additions & 56 deletions
This file was deleted.

tests/error-tests/tests/macro-expansion-outside-1.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ extern crate dcrate;
1515
// ~ERR(>=1.20.0) this error originates in a macro outside of the current crate
1616
// ~ERR(>=1.20.0) expected one of
1717
// ~ERR(>=1.20.0,<1.24.0-beta) unexpected token
18-
// end-msg: ERR(check,>=1.19.0,<1.20.0-beta) /expected one of .*, found `:`/
19-
// end-msg: ERR(check,>=1.19.0,<1.20.0-beta) Errors occurred in macro <example_bad_syntax macros> from external crate
20-
// end-msg: ERR(check,>=1.19.0,<1.20.0-beta) Macro text: ( ) => { enum E { Kind ( x : u32 ) } }
21-
// end-msg: ERR(check,>=1.19.0,<1.20.0-beta) /expected one of .* here/
22-
// end-msg: ERR(check,>=1.19.0,<1.20.0-beta) unexpected token
23-
// end-msg: ERR(check,>=1.19.0,<1.20.0-beta) /expected one of .*, found `:`/
24-
// end-msg: ERR(check,>=1.19.0,<1.20.0-beta) Errors occurred in macro <example_bad_syntax macros> from external crate
25-
// end-msg: ERR(check,>=1.19.0,<1.20.0-beta) Macro text: ( ) => { enum E { Kind ( x : u32 ) } }
26-
// end-msg: ERR(check,>=1.19.0,<1.20.0-beta) expected one of 7 possible tokens here
27-
// end-msg: ERR(check,>=1.19.0,<1.20.0-beta) unexpected token
18+
// end-msg: ERR(>=1.19.0,<1.20.0-beta) /expected one of .*, found `:`/
19+
// end-msg: ERR(>=1.19.0,<1.20.0-beta) Errors occurred in macro <example_bad_syntax macros> from external crate
20+
// end-msg: ERR(>=1.19.0,<1.20.0-beta) Macro text: ( ) => { enum E { Kind ( x : u32 ) } }
21+
// end-msg: ERR(>=1.19.0,<1.20.0-beta) /expected one of .* here/
22+
// end-msg: ERR(>=1.19.0,<1.20.0-beta) unexpected token
23+
// end-msg: ERR(>=1.19.0,<1.20.0-beta) /expected one of .*, found `:`/
24+
// end-msg: ERR(>=1.19.0,<1.20.0-beta) Errors occurred in macro <example_bad_syntax macros> from external crate
25+
// end-msg: ERR(>=1.19.0,<1.20.0-beta) Macro text: ( ) => { enum E { Kind ( x : u32 ) } }
26+
// end-msg: ERR(>=1.19.0,<1.20.0-beta) expected one of 7 possible tokens here
27+
// end-msg: ERR(>=1.19.0,<1.20.0-beta) unexpected token
2828
// end-msg: ERR(<1.19.0) /expected one of .*, found `:`/
2929
// end-msg: ERR(<1.19.0) Errors occurred in macro <example_bad_syntax macros> from external crate
3030
// end-msg: ERR(<1.19.0) Macro text: ( ) => { enum E { Kind ( x : u32 ) } }

0 commit comments

Comments
 (0)