Commit Graph

1532 Commits

Author SHA1 Message Date
Sergio Benitez 56a6172625 Enable compilation with stable Rust.
To the Rust teams, Rust's contributors, Rocket's contributors, the
entire Rust and Rocket communities, my colleagues at Stanford and
beyond, and Jeb: thank you all. Sincerely.

To the next ~4 years of Rocket!

Closes #19.
2020-07-21 16:30:45 -07:00
Sergio Benitez b47d1b8f0f Rework docs for stable and async support. 2020-07-21 16:15:13 -07:00
Sergio Benitez cd7e99a535 Use 'bencher' for benchmarks on stable. 2020-07-21 15:31:44 -07:00
Sergio Benitez 9a2149b43d Test guide and README using stable 'doc_comment'. 2020-07-21 15:31:44 -07:00
Sergio Benitez 4a1a4c0e45 Support cargo '+' flags in testing script. 2020-07-21 15:31:44 -07:00
Sergio Benitez 67efe143c5 Improve diagnostics, especially on stable. 2020-07-21 15:31:42 -07:00
Sergio Benitez 1858403203 Implement codegen testing on stable.
This commits migrates to 'trybuild' from 'compiletest' for codegen
diagnostic testing.
2020-07-21 15:11:07 -07:00
Sergio Benitez 95a4b442cc Update Pear to 0.2. 2020-07-21 15:11:07 -07:00
Jeb Rosen 27b26188c4 Update 'toml' to '0.5'. 2020-07-21 15:11:07 -07:00
Sergio Benitez 949b01cb9d Remove 'redis' integration from 'contrib'.
The latest version of 'redis' is async and implements its own connection
retrieval.
2020-07-21 15:11:07 -07:00
Jeb Rosen 9d4fea2937 Remove 'mongodb' integration from 'contrib'.
The latest version of 'mongodb' is async and implements its own internal
connection pooling.
2020-07-21 10:54:07 -07:00
Jeb Rosen 3a40d1071c Remove 'rusted_cypher' integration from 'contrib'. 2020-07-21 10:54:07 -07:00
Jeb Rosen 62113abcd2 Upgrade 'redis' to 0.15 in 'contrib'. 2020-07-21 10:54:07 -07:00
Jeb Rosen fbe6c1081f Upgrade 'rusqlite' to 0.23 in 'contrib'. 2020-07-21 10:54:07 -07:00
Jeb Rosen 2879f44148 Upgrade 'mysql' to 18.0 in 'contrib'. 2020-07-21 10:54:07 -07:00
Jeb Rosen fb42bf9ee2 Upgrade 'tokio-rustls' to 0.14. 2020-07-21 10:54:07 -07:00
Jeb Rosen cde0b1cefd Upgrade 'parking_lot' to 0.11 in the 'todo' example.
Also remove the use of the 'nightly' feature.
2020-07-21 10:54:07 -07:00
Jakub Wieczorek 6f1cefff10 Upgrade 'percent-encoding' to 2.
Co-authored-by: Jeb Rosen <jeb@jebrosen.com>
2020-07-21 10:54:07 -07:00
Jeb Rosen 7f276eb2fc Update 'devise' to the latest commit. 2020-07-20 23:26:36 -07:00
Sergio Benitez 0909ba2ef6 Only enable testing features on 'cfg(test)'. 2020-07-16 05:49:38 -07:00
Sergio Benitez 3f2b8f6006 Remove 'proc_macro' features. 2020-07-16 05:46:39 -07:00
Sergio Benitez 7bcf82a199 Improve catcher mismatched type errors. 2020-07-14 02:48:46 -07:00
Sergio Benitez dfca18d307 Generate 'uri!' macro names independently of span.
Prior to this commit, codegen used 'Span' information to generate a
unique id for a given route. This commit changes the id generation to
instead use 1) the route's name and path, 2) a an per-generation
atomically increasing ID, and 3) the ids of the process/thread the
proc-macro is running in. Together, these values should provide a unique
id for a given route, even in the face of the reused processes and
threads, while also removing the dependence on unstable Span features.

Fixes #1373.
2020-07-14 00:44:59 -07:00
Sergio Benitez 816b8c44ab Ignore 'snake_case' warnings for 'tmp' variables. 2020-07-14 00:43:48 -07:00
Sergio Benitez a87e3ad9f5 Remove superfluous empty lines. 2020-07-12 02:38:28 -07:00
Sergio Benitez 33e95f4900 Rename 'FromDataSimple' to 'FromData'. Make async.
The 'FromData' trait becomes 'FromTransformedData'.
2020-07-12 02:23:00 -07:00
Sergio Benitez 854e90d39f Migrate CI to Github Actions. 2020-07-11 14:59:33 -07:00
Sergio Benitez f4c82d7ffe Remove unnecessary 'dev-dependencies'. 2020-07-11 11:27:23 -07:00
Sergio Benitez 62355b424f Remove use of stable 'proc_macro_hygiene' feature. 2020-07-11 10:48:08 -07:00
Jeb Rosen 114a733d70 Use 'tokio::fs::File' in the 'pastebin' example. 2020-07-11 10:07:37 -07:00
Jeb Rosen 2b3d8110f1 Use '#[rocket::launch]' in guide examples. 2020-07-11 10:07:37 -07:00
Jeb Rosen 2c82b3e1d5 Update and fix guide tests. 2020-07-11 10:07:37 -07:00
Sergio Benitez 08b34e8263 Fix and re-enable UI tests. 2020-07-11 09:24:30 -07:00
Sergio Benitez 832408ea9b Add example requiring async testing. 2020-07-11 09:24:30 -07:00
Jeb Rosen 96bafd8ac5 Mention async testing in the testing guide. 2020-07-11 09:24:30 -07:00
Jeb Rosen 06975bfaea Use the blocking testing API everywhere.
Co-authored-by: Sergio Benitez <sb@sergio.bz>
2020-07-11 09:24:30 -07:00
Sergio Benitez 6482fa2fba Rework 'local' module. Add 'LocalResponse' methods.
This completes the 'local' blocking client implementation.
2020-07-11 09:24:30 -07:00
Jeb Rosen 050a2c6461 Document new 'local' structures. 2020-07-11 09:24:30 -07:00
Sergio Benitez 03127f4dae Add blocking variant of 'local'.
This commit adds the 'local::blocking' module and moves the existing
asynchronous testing to 'local::asynchronous'. It also includes several
changes to improve the local API, bringing it to parity (and beyond)
with master. These changes are:

  * 'LocalRequest' implements 'Clone'.
  * 'LocalResponse' doesn't implement 'DerefMut<Target=Response>'.
    Instead, direct methods on the type, such as 'into_string()', can
    be used to read the 'Response'.
  * 'Response::body()' returns an '&ResponseBody' as opposed to '&mut
    ResponseBody', which is returned by a new 'Response::body_mut()'.
  * '&ResponseBody' implements 'known_size()` to retrieve a body's size,
    if it is known.

Co-authored-by: Jeb Rosen <jeb@jebrosen.com>
2020-07-11 09:24:30 -07:00
Sergio Benitez 824de061c3 Enable configurable 'ctrl-c' shutdown by default.
This removes the 'ctrl_c_shutdown' feature opting instead for a 'ctrlc'
configuration option. To avoid further merge conflicts with the master
branch, the option is currently read as an extra.

Co-authored-by: Jeb Rosen <jeb@jebrosen.com>
2020-07-11 09:24:30 -07:00
Sergio Benitez 9277ddafdf Swap 'Rocket' manually without using 'replace_with'. 2020-07-11 09:24:30 -07:00
Sergio Benitez 3ced188f7d Use 'ref-cast' for safer transparent casting. 2020-07-11 09:24:30 -07:00
Sergio Benitez d89c7024ed Replace 'Manifest' with 'Cargo'.
This is largely an internal change. Prior to this commit, the 'Manifest'
type, now replaced with the 'Cargo' type, robbed responsibility from the
core 'Rocket' type. This new construction restores the previous
responsibility and makes it clear that 'Cargo' is _only_ for freezing,
and representing the stability of, Rocket's internal state.
2020-07-11 09:24:30 -07:00
Sergio Benitez dd5b518cc2 Ignore 'unused_imports' warning on cfg-based 'FutureExt'. 2020-07-11 09:24:30 -07:00
Sergio Benitez 1704ff7743 Asyncify 'Handler'. Rename 'ErrorHandlerFuture' to 'CatcherFuture'. 2020-07-11 09:24:30 -07:00
Sergio Benitez f7cd455558 Make 'NamedFile' async. Fix 'Handler' trait.
Previously, 'NamedFile::open()' called a synchronous I/O method. This
commit changes it to instead use tokio's 'File' for async I/O.

To allow this to change, the 'Handler' trait was fixed to enforce that
the lifetime of '&self', the reference to the handler, outlives the
incoming request. As a result, futures returned from a handler can hold
a reference to 'self'.
2020-07-11 09:24:30 -07:00
Sergio Benitez 2465e2f136 Make 'Responder' trait sync; fix its lifetimes.
In summary, this commit modifies 'Responder' so that:

  * ..it is no longer 'async'. To accommodate, the 'sized_body' methods
    in 'Response' and 'ResponseBuilder' are no longer 'async' and accept
    an optional size directly. If none is supplied, Rocket will attempt
    to compute the size, by seeking, before writing out the response.
    The 'Body' type was also changed to differentiate between its sized
    'Seek' and chunked body variants.

  * ..'&Request' gains a lifetime: 'r, and the returned 'Response' is
    parameterized by a new 'o: 'r. This allows responders to return
    references from the request or those that live longer.
2020-07-11 09:24:29 -07:00
Sergio Benitez 12308b403f Add '#[rocket::launch]' attribute.
The attribute is applied everywhere it can be across the codebase and is
the newly preferred method for launching an application. This commit
also makes '#[rocket::main]` stricter by warning when it is applied to
functions other than 'main'.
2020-07-11 09:24:29 -07:00
Jeb Rosen c7c371910b Remove extraneous dependency on 'futures-util'. 2020-07-11 09:24:29 -07:00
Jeb Rosen bc1b90cbdb Add '#[rocket::main]' attribute and make 'launch()' an 'async fn'.
'#[rocket::main]' works like '#[rocket::async_test]', but it uses
tokio's multithreaded scheduler.
2020-07-11 09:24:29 -07:00