Commit Graph

3522 Commits

Author SHA1 Message Date
David Tolnay
9113ad0887
Help infer may_dangle on type parameter of Punctuated iterator Drop impls 2022-11-30 23:30:51 -08:00
David Tolnay
3eaa443c3a
Add regression test for issue 1246
error[E0505]: cannot move out of `p` because it is borrowed
      --> tests/test_iterators.rs:56:18
       |
    54 |     for element in &p {
       |                    --
       |                    |
       |                    borrow of `p` occurs here
       |                    a temporary with access to the borrow is created here ...
    55 |         if *element == 2 {
    56 |             drop(p);
       |                  ^ move out of `p` occurs here
    ...
    59 |     }
       |     - ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `syn::punctuated::Iter<'_, i32>`

    error[E0505]: cannot move out of `p` because it is borrowed
      --> tests/test_iterators.rs:64:18
       |
    62 |     for element in &mut p {
       |                    ------
       |                    |
       |                    borrow of `p` occurs here
       |                    a temporary with access to the borrow is created here ...
    63 |         if *element == 2 {
    64 |             drop(p);
       |                  ^ move out of `p` occurs here
    ...
    67 |     }
       |     - ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `syn::punctuated::IterMut<'_, i32>`
2022-11-30 22:37:38 -08:00
David Tolnay
17f9a5c566
Merge pull request #1245 from dtolnay/bounds
Improve dyn/impl-related parse errors
2022-11-30 22:11:53 -08:00
David Tolnay
db874ddf9b
Improve dyn/impl-related parse errors 2022-11-30 22:01:54 -08:00
David Tolnay
b8b0761cb8
Move TypeParamBound parse loop to associated function 2022-11-30 21:50:15 -08:00
David Tolnay
3e915e5c98
Clean up naming in rustc syntax tree manipulation 2022-11-28 19:15:42 -08:00
David Tolnay
ecacc475dd
Import token::Lit now there's no conflict with MetaItemLit 2022-11-28 19:11:45 -08:00
David Tolnay
2647b2a189
Update test suite to nightly-2022-11-29 2022-11-28 19:10:13 -08:00
David Tolnay
78fa618e96
Release 1.0.104 2022-11-27 17:42:18 -08:00
David Tolnay
e054b03a3b
Merge pull request #1244 from dtolnay/isnone
Make PathArguments::is_none() public
2022-11-27 17:41:41 -08:00
David Tolnay
3a0406db04
Make PathArguments::is_none() public 2022-11-27 17:32:31 -08:00
David Tolnay
ac1dbf5d85
Time out workflows after 45 minutes
GitHub's default timeout is 6 hours. Recently some of my GitHub Actions
jobs have started randomly stalling for that long, which is inconvenient
because it ties up a chunk of my runner quota. It apepars to be very
rare for a job to recover after stalling. It's better to time out
quicker and retry on a different runner.
2022-11-25 18:56:19 -08:00
David Tolnay
f510eb0ba9
Update test suite to nightly-2022-11-25 2022-11-24 18:53:32 -08:00
David Tolnay
20087fc51c
Update test suite to nightly-2022-11-24 2022-11-23 19:49:39 -08:00
David Tolnay
dbc86fe1ed
Suppress "emit":"dep-info" json from syn-test-suite-feature-check
Previously:

    NOTE:  use --release
      Syn's test suite has some tests that run on every source file
      and test case in the rust-lang/rust repo, which can be pretty
      slow in debug mode. Consider running cargo test with `--release`
      to speed things up.
    {"artifact":"/git/syn/target/debug/deps/syn_test_suite-695bcafef2321389.d","emit":"dep-info"}
2022-11-22 22:47:28 -08:00
David Tolnay
1e8227295e
Fix renamed let_underscore_drop lint
warning: lint `clippy::let_underscore_drop` has been renamed to `let_underscore_drop`
       --> src/lib.rs:270:5
        |
    270 |     clippy::let_underscore_drop,
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `let_underscore_drop`
        |
        = note: `#[warn(renamed_and_removed_lints)]` on by default

    warning: lint `clippy::let_underscore_drop` has been renamed to `let_underscore_drop`
      --> tests/crates/main.rs:13:10
       |
    13 | #![allow(clippy::let_underscore_drop)]
       |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `let_underscore_drop`
       |
       = note: `#[warn(renamed_and_removed_lints)]` on by default

    warning: lint `clippy::let_underscore_drop` has been renamed to `let_underscore_drop`
     --> tests/features/macro/lib.rs:1:10
      |
    1 | #![allow(clippy::let_underscore_drop, clippy::toplevel_ref_arg)]
      |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `let_underscore_drop`
      |
      = note: `#[warn(renamed_and_removed_lints)]` on by default

    warning: lint `clippy::let_underscore_drop` has been renamed to `let_underscore_drop`
     --> tests/regression.rs:1:10
      |
    1 | #![allow(clippy::let_underscore_drop)]
      |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `let_underscore_drop`
      |
      = note: `#[warn(renamed_and_removed_lints)]` on by default
2022-11-22 22:38:08 -08:00
David Tolnay
754236dbe6
Update test suite to nightly-2022-11-23 2022-11-22 22:36:23 -08:00
David Tolnay
4245c41f22
Update test suite to nightly-2022-11-19 2022-11-18 22:11:00 -08:00
David Tolnay
1043106dc8
Update test suite to nightly-2022-11-18 2022-11-17 23:10:59 -08:00
David Tolnay
df8b10aa64
Update test suite to nightly-2022-11-13 2022-11-12 21:32:46 -08:00
David Tolnay
4c0ddcc84c
Ignore items_after_statements pedantic clippy lint
error: adding items after statements is confusing, since items exist from the start of the scope
       --> src/error.rs:139:9
        |
    139 | /         fn new(span: Span, message: String) -> Error {
    140 | |             Error {
    141 | |                 messages: vec![ErrorMessage {
    142 | |                     start_span: ThreadBound::new(span),
    ...   |
    146 | |             }
    147 | |         }
        | |_________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
        = note: `-D clippy::items-after-statements` implied by `-D clippy::pedantic`

    error: adding items after statements is confusing, since items exist from the start of the scope
       --> src/error.rs:167:9
        |
    167 | /         fn new_spanned(tokens: TokenStream, message: String) -> Error {
    168 | |             let mut iter = tokens.into_iter();
    169 | |             let start = iter.next().map_or_else(Span::call_site, |t| t.span());
    170 | |             let end = iter.last().map_or(start, |t| t.span());
    ...   |
    177 | |             }
    178 | |         }
        | |_________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements

    error: adding items after statements is confusing, since items exist from the start of the scope
       --> src/error.rs:301:5
        |
    301 | /     fn new2(start: Span, end: Span, message: String) -> Error {
    302 | |         Error {
    303 | |             messages: vec![ErrorMessage {
    304 | |                 start_span: ThreadBound::new(start),
    ...   |
    308 | |         }
    309 | |     }
        | |_____^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
2022-10-24 21:54:47 -07:00
David Tolnay
f4c1822b93
Move code of Error functions to non-generic functions 2022-10-24 21:52:01 -07:00
David Tolnay
4510c1b1ef
Resolve needless_borrow pedantic clippy lint
error: the borrowed expression implements the required traits
       --> tests/repo/mod.rs:191:43
        |
    191 |     let response = reqwest::blocking::get(&url)?.error_for_status()?;
        |                                           ^^^^ help: change this to: `url`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
        = note: `-D clippy::needless-borrow` implied by `-D clippy::all`
2022-10-24 21:25:53 -07:00
David Tolnay
c29c2abf1b
Release 1.0.103 2022-10-20 14:38:12 -07:00
David Tolnay
8e81cad736
Merge pull request #1237 from dtolnay/partialord
Restrict PartialOrd comparison to only tokens in the same buffer
2022-10-20 14:36:53 -07:00
David Tolnay
8db5adbb2b
Ignore cast_possible_wrap pedantic clippy lint
error: casting `usize` to `isize` may wrap around the value
      --> src/buffer.rs:56:46
       |
    56 |                     entries.push(Entry::End(-(group_end_index as isize)));
       |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
       = note: `-D clippy::cast-possible-wrap` implied by `-D clippy::pedantic`

    error: casting `usize` to `isize` may wrap around the value
      --> src/buffer.rs:82:34
       |
    82 |         entries.push(Entry::End(-(entries.len() as isize)));
       |                                  ^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
2022-10-20 14:17:08 -07:00
David Tolnay
f6f7d8a6b3
Restrict PartialOrd comparison to only tokens in the same buffer 2022-10-20 14:07:35 -07:00
David Tolnay
8dd9b01c58
Touch up PR 1236 2022-10-20 13:41:59 -07:00
David Tolnay
2b3f742696
Merge pull request #1236 from CAD97/cursor-cmp
Implement `PartialOrd` for `Cursor`
2022-10-20 13:34:34 -07:00
Christopher Durham
f6a43aa4d6 Handle the case where verbatim enters a None group
Fixes #1235. As seen in that issue, a syntax node can actually cross the
border of a None-delimited group, due to such groups being transparent
to the parser in most cases. In the cases that this can occur, the
presence of the group is known to be semantically irrelevant, so we just
explicitly ignore the presence of the group.

It's important that we only ignore None-delimited groups when the
verbatim end requires entering the group, as such groups can have semantic
impact (such as grouping binary operator chains) in other positions.
2022-10-20 15:14:33 -05:00
Christopher Durham
e9fb6a9ea5 Implement PartialOrd for Cursor 2022-10-20 15:14:33 -05:00
Christopher Durham
26a605e565 Add test for Item::Verbatim splitting a None group
(see issue #1235)
2022-10-20 15:13:52 -05:00
David Tolnay
a807b16011
Update test suite to nightly-2022-10-13 2022-10-13 09:13:00 -07:00
David Tolnay
711cd8c3d4
Update test suite to nightly-2022-10-11 2022-10-10 22:11:03 -07:00
David Tolnay
e4127c706c
Release 1.0.102 2022-10-06 17:43:35 -07:00
David Tolnay
691fc0676c
Merge pull request #1230 from dtolnay/groupgeneric
Fix left shift after macro metavariable in type position
2022-10-06 17:42:47 -07:00
David Tolnay
61ece4ca3c
Fix left shift after macro metavariable in type position 2022-10-06 17:36:06 -07:00
David Tolnay
7909596ae8
Rename TokenBuffer's recursive construction logic 2022-09-29 09:15:43 -07:00
David Tolnay
f169b98e29
Delete TokenBuffer's empty Drop impl
See https://github.com/dtolnay/syn/pull/1223#pullrequestreview-1124705030
2022-09-29 09:13:28 -07:00
David Tolnay
65ee83a0ad
Simplify Cursor::lifetime using a question mark 2022-09-28 22:47:08 -07:00
David Tolnay
502968cc68
Implement skip and token_tree using the 'len' of entries being stepped over 2022-09-28 22:12:55 -07:00
David Tolnay
f895b8aa3f
Inline some of the logic for entering a Group 2022-09-28 21:58:17 -07:00
David Tolnay
71260defc6
Touch up PR 1223 2022-09-28 21:41:37 -07:00
David Tolnay
296e0469b8
Merge pull request #1226 from dtolnay/bom
Pull in proc-macro2 1.0.46 for byte order mark fix
2022-09-28 19:10:14 -07:00
David Tolnay
5f8ddfb5a8
Pull in proc-macro2 1.0.46 for byte order mark fix
Without this, our benchmarks fail against the current contents of the
rust-lang/rust repo.

    $ cargo test --release --bench rust --features full,test
    871050 lines in 12914 files
    read_from_disk:     elapsed=0.170s
    tokenstream_parse:  FAIL tests/rust/src/test/ui/json/json-bom-plus-crlf-multifile-aux.rs
    thread 'main' panicked at 'assertion failed: `(left == right)`
      left: `12913`,
     right: `12914`', benches/rust.rs:122:5
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2022-09-28 19:02:05 -07:00
David Tolnay
ce00ab0755
Merge pull request #1225 from dtolnay/benchtest
Fix instruction for running benchmarks
2022-09-28 18:56:41 -07:00
David Tolnay
b0fcbabe5b
Fix instruction for running benchmarks 2022-09-28 18:24:19 -07:00
David Tolnay
91f01419b7
Merge pull request #1223 from CAD97/flat-tokenbuffer
Use a flat layout for TokenBuffer
2022-09-28 16:55:27 -07:00
David Tolnay
b74703d9d5
Merge pull request #1224 from dtolnay/fuzz
Add fuzz target for TokenBuffer and file parse
2022-09-28 14:04:16 -07:00
David Tolnay
f199b225f0
Check for outdated deps in fuzz target 2022-09-28 13:55:48 -07:00