こんにちは、R&Dチームの齋藤(@aznhe21)です。 もうじきOculus Quest 2が発売されるということでドキがムネムネしています。 単体で動くVRヘッドセットなのに解像度はハイエンドレベルということで期待が膨らむばかりです。
さて、本日、日本時間10/9(金)、Rust 1.47がリリースされました。 この記事ではRust 1.47での変更点を詳しく紹介します。
ピックアップ
個人的に注目する変更点を「ピックアップ」としてまとめました。 全ての変更点を網羅したリストは変更点リストをご覧ください。
あらゆる要素数の配列で標準トレイト実装が使えるようになった
配列に対する標準ライブラリのトレイト実装は、これまで要素数が32までの配列に限って実装されていました。 それもそのはず、配列の型は要素数ごとに異なるものであるため、トレイト実装はそれぞれの要素数に対して行わなければなりません。
impl<T> Trait for [T; 0] { ... } impl<T> Trait for [T; 1] { ... } impl<T> Trait for [T; 2] { ... } impl<T> Trait for [T; 3] { ... } impl<T> Trait for [T; 4] { ... } // ...
マクロで簡略化して大量に定義が出来るとは言え、メモリの制限もありますし、この方法では結局のところある程度の数までしか定義することは出来ません。 標準ライブラリはこの数を32までとして定義していました。
fn main() { // 例えばPartialEqの実装は要素数32までは定義されていた assert_eq!([0; 32], [0; 32]); // しかし要素数33では定義されておらず、Rust 1.46まではエラー assert_eq!([0; 33], [0; 33]); }
Rust 1.47からは(今のところ標準ライブラリ内部だけで使える、定数ジェネリクスという機能を使い)あらゆる要素数で標準トレイト実装が使えるようになりました。
fn main() { // 要素数100万でも平気へっちゃら println!("{:?}", [(); 1_000_000]); }
パニック時のバックトレースがコンパクトになった
パニック時に表示されるバックトレースは(RUST_BACKTRACE=1が必要とは言え)バグの箇所を発見するのにとても便利です。
ただ、これまではランタイム内部の関数まで表示されており、実際にはどこでパニックしていたかを目で探す必要がありました。
Rust 1.47からはほとんどの内部関数が非表示になり、どこでパニックしたかが一目瞭然となりました。
なお、RUST_BACKTRACE=fullとすれば全てのバックトレースが表示されます。
fn main() { panic!(); }
Rust 1.47のバックトレース
thread 'main' panicked at 'explicit panic', src/main.rs:2:5
stack backtrace:
0: std::panicking::begin_panic
at /rustc/d6646f64790018719caebeafd352a92adfa1d75a/library/std/src/panicking.rs:497
1: playground::main
at ./src/main.rs:2
2: core::ops::function::FnOnce::call_once
at /rustc/d6646f64790018719caebeafd352a92adfa1d75a/library/core/src/ops/function.rs:227
Rust 1.46のバックトレース
thread 'main' panicked at 'explicit panic', src/main.rs:2:5
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1076
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1537
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:198
9: std::panicking::default_hook
at src/libstd/panicking.rs:217
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:526
11: std::panicking::begin_panic
at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libstd/panicking.rs:456
12: playground::main
at src/main.rs:2
13: std::rt::lang_start::{{closure}}
at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libstd/rt.rs:67
14: std::rt::lang_start_internal::{{closure}}
at src/libstd/rt.rs:52
15: std::panicking::try::do_call
at src/libstd/panicking.rs:348
16: std::panicking::try
at src/libstd/panicking.rs:325
17: std::panic::catch_unwind
at src/libstd/panic.rs:394
18: std::rt::lang_start_internal
at src/libstd/rt.rs:51
19: std::rt::lang_start
at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libstd/rt.rs:67
20: main
21: __libc_start_main
22: _start
ビルド用依存クレートが最適化されなくなった
Cargo.tomlのbuild-dependenciesに指定していたクレートが、デフォルトでは最適化ビルドでも最適化されなくなりました。
これによりビルド時間が短縮される可能性があります。
そもそもbuild-dependenciesというのは「ビルド時のみに使うクレート」であり、例えばクレートの中でCMakeプロジェクトをビルドできるcmakeクレートなどがあります。
これらのクレートは最終的に出力されるバイナリとは違って多少遅くても、またデバッグ情報が残っていても問題にはなりません。
むしろ最適化というのは時間が掛かる処理であるため、実行時間よりもビルド時間のほうが長くなることが往々にしてあります。
Rust 1.47からはデフォルトでこれらビルド用依存クレートのビルドは最適化されなくなり、ビルド時間の短縮が期待できるようになりました。
もし最適化したい場合、以下のような設定をCargo.tomlに指定することで、Rust 1.46以前と同じく最適化することが出来ます。
[profile.release.build-override] opt-level = 3
安定化されたAPIのドキュメント
安定化されたAPIのドキュメントを独自に訳して紹介します。リストだけ見たい方は安定化されたAPIをご覧ください。
Ident::new_raw
impl Ident { #[stable(feature = "proc_macro_raw_ident", since = "1.47.0")] pub fn new_raw(string: &str, span: Span) -> Ident }
Ident::newと同じだが、生識別子(r#ident)を生成する。引数のstringは言語として許容される(fnなどのキーワードも含む)識別子である。
パスの一部分として使われる(selfやsuperなどの)キーワードはサポートされず、使った場合はパニックする。
Range::is_empty
impl<Idx: PartialOrd<Idx>> Range<Idx> { #[stable(feature = "range_is_empty", since = "1.47.0")] pub fn is_empty(&self) -> bool }
範囲がアイテムを含まない場合、trueを返す。
サンプル
assert!(!(3..5).is_empty()); assert!( (3..3).is_empty()); assert!( (3..2).is_empty());
値が他方と比較できない場合、その範囲は空と見做される。
assert!(!(3.0..5.0).is_empty()); assert!( (3.0..f32::NAN).is_empty()); assert!( (f32::NAN..5.0).is_empty());
RangeInclusive::is_empty
impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> { #[stable(feature = "range_is_empty", since = "1.47.0")] #[inline] pub fn is_empty(&self) -> bool }
範囲がアイテムを含まない場合、trueを返す。
サンプル
assert!(!(3..=5).is_empty()); assert!(!(3..=3).is_empty()); assert!( (3..=2).is_empty());
値が他方と比較できない場合、その範囲は空と見做される。
assert!(!(3.0..=5.0).is_empty()); assert!( (3.0..=f32::NAN).is_empty()); assert!( (f32::NAN..=5.0).is_empty());
繰り返しが終了した後も、このメソッドはtrueを返す。
let mut r = 3..=5; for _ in r.by_ref() {} // ループ後のstartとendの値は未定義だが、is_emptyはtrueとなる assert!(r.is_empty());
Result::as_deref
impl<T: Deref, E> Result<T, E> { #[stable(feature = "inner_deref", since = "1.47.0")] pub fn as_deref(&self) -> Result<&T::Target, &E> }
Result<T, E>(もしくは&Result<T, E>)をResult<&<T as Deref>::Target, &E>に変換する。
元々のResultのOkバリアントの値をDerefによって型強制し、新しいResultを返す。
サンプル
let x: Result<String, u32> = Ok("hello".to_string()); let y: Result<&str, &u32> = Ok("hello"); assert_eq!(x.as_deref(), y); let x: Result<String, u32> = Err(42); let y: Result<&str, &u32> = Err(&42); assert_eq!(x.as_deref(), y);
Result::as_deref_mut
impl<T: DerefMut, E> Result<T, E> { #[stable(feature = "inner_deref", since = "1.47.0")] pub fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E> }
Result<T, E>(もしくは&mut Result<T, E>)をResult<&mut <T as DerefMut>::Target, &mut E>に変換する。
元々のResultのOkバリアントの値をDerefMutによって型強制し、新しいResultを返す。
サンプル
let mut s = "HELLO".to_string(); let mut x: Result<String, u32> = Ok("hello".to_string()); let y: Result<&mut str, &mut u32> = Ok(&mut s); assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y); let mut i = 42; let mut x: Result<String, u32> = Err(42); let y: Result<&mut str, &mut u32> = Err(&mut i); assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
Vec::leak
impl<T> Vec<T> { #[stable(feature = "vec_leak", since = "1.47.0")] #[inline] pub fn leak<'a>(self) -> &'a mut [T] where T: 'a, // 技術的には不要だが明示しておく }
Vecを消費・リークさせ、中身への可変参照を&'a mut [T]として返す。ここで、型Tがライフタイム'aより長生きする必要があることに注意されたい。
とある型に含まれる参照が'staticしかない、あるいはその型に参照が含まれない場合、その型のライフタイムは'staticとなる。
この関数はBoxのleak関数と同類である。
この関数は、主にプログラムが終了するまで生き続けるデータのために使われる。そのため、戻り値の参照をドロップした場合はメモリリークが起こる。
サンプル
単純な使用例:
let x = vec![1, 2, 3]; let static_ref: &'static mut [usize] = x.leak(); static_ref[0] += 1; assert_eq!(static_ref, &[2, 2, 3]);
pointer::offset_from
#[lang = "const_ptr"] impl<T: ?Sized> *const T { #[stable(feature = "ptr_offset_from", since = "1.47.0")] #[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079")] #[inline] pub const unsafe fn offset_from(self, origin: *const T) -> isize where T: Sized, }
2つのポインタの距離を計算する。戻り値の単位はTであり、バイト単位での距離をmem::size_of::<T>()で除されている。
この関数はoffsetと対を成す。
安全性
以下の条件を1つでも破る場合、結果は未定義動作となる。
- 開始ポインタと他のポインタが、両方とも同一の確保済オブジェクトの領域内にある、または1バイト後ろである。 ここで、Rustの全ての(スタックに確保された)変数は別々に確保されたオブジェクトと見做されることに注意されたい
- 両方のポインタが同一の確保済オブジェクトから派生していること(下記サンプルを参照)
- バイト単位でのポインタ間の距離が
isizeの範囲を超えないこと - バイト単位でのポインタ間の距離が
Tの大きさの倍数であること - 領域内の距離がアドレス空間のラップアラウンドに依拠しないこと
コンパイラ及び標準ライブラリは一般的に、オフセットに懸念があるようなサイズの確保をしないよう努めている。
例えばVecやBoxはisize::MAXバイトを超える確保をしないため、ptr_into_vec.offset_from(vec.as_ptr())は常に安全である。
ほとんどのプラットフォームではそのようなメモリ確保をすることすら難しい。
今のところ全ての64ビット環境ではページテーブルの制限やアドレス空間の分割などの制約により263バイトの要求を処理できない。
ただ、いくつかの32ビット環境や16ビット環境では、PAEなどによってisize::MAXバイトを超える要求が成功することもある。
そのため、アロケータやメモリマップドファイルから直接取得したメモリは、この関数で扱うには大きすぎるかもしれない。
パニック
この関数は、Tがゼロサイズ型(ZST)の場合パニックする。
サンプル
基本的な使い方:
let a = [0; 5]; let ptr1: *const i32 = &a[1]; let ptr2: *const i32 = &a[3]; unsafe { assert_eq!(ptr2.offset_from(ptr1), 2); assert_eq!(ptr1.offset_from(ptr2), -2); assert_eq!(ptr1.offset(2), ptr2); assert_eq!(ptr2.offset(-2), ptr1); }
間違った使い方:
let ptr1 = Box::into_raw(Box::new(0u8)) as *const u8; let ptr2 = Box::into_raw(Box::new(1u8)) as *const u8; let diff = (ptr2 as isize).wrapping_sub(ptr1 as isize); // ptr2_otherを、ptr1から派生しつつptr2へのエイリアスとして宣言する let ptr2_other = (ptr1 as *const u8).wrapping_offset(diff); assert_eq!(ptr2 as usize, ptr2_other as usize); // ptr2_otherとptr2は別のオブジェクトから派生したポインタであるため、 // それらが同じアドレスを指していたとしても、 // それらのオフセット計算は未定義動作である unsafe { let zero = ptr2_other.offset_from(ptr2); // Undefined Behavior }
f32::consts::TAU
#[stable(feature = "tau_constant", since = "1.47.0")] pub const TAU: f32 = 6.28318530717958647692528676655900577_f32;
全円定数(τ)。
2πに等しい。
f64::consts::TAU
#[stable(feature = "tau_constant", since = "1.47.0")] pub const TAU: f64 = 6.28318530717958647692528676655900577_f64;
全円定数(τ)。
2πに等しい。
変更点リスト
公式リリースノートをベースに意訳・編集・追記をした変更点リストです。
言語
コンパイラ
- コード生成のオプション
-C control-flow-guardが安定化された。 これはWindowsにおいてControl Flow Guardを有効化するもので、他の環境では無視される - LLVMのバージョンが11になった
- 次のターゲットをTier 3でサポートした:
thumbv4t-none-eabi - FreeBSDツールチェーンをバージョン11.4に更新した
RUST_BACKTRACEの出力がコンパクトになった
※RustのTierによるプラットフォームサポートの詳細はプラットフォームサポートのページを参照 ※訳注:英語ページ
ライブラリ
CStrがIndex<RangeFrom<usize>>を実装するようになった- 配列向けの
std/core内のトレイト実装が、(33未満の要素に限らず)あらゆる要素数に実装されるようになった ops::RangeFullとops::RangeがDefaultを実装するようになっpanic::LocationがCopy・Clone・Eq・Hash・Ord・PartialEq・PartialOrdを実装するようになった
安定化されたAPI
※各APIのドキュメントを独自に訳しています。安定化されたAPIのドキュメントもご参照ください。
Ident::new_rawRange::is_emptyRangeInclusive::is_emptyResult::as_derefResult::as_deref_mutVec::leakpointer::offset_fromf32::TAUf64::TAU
また、以前から安定化されていたAPIのうち以下のAPIが定数化された。
- 全ての
NonZero数値型のnewメソッド - 全ての数値型における、
checked_add・checked_sub・checked_mul・checked_neg・checked_shl・checked_shr・saturating_add・saturating_sub・saturating_mulメソッド - 全ての符号付き整数型の
checked_abs・saturating_abs・saturating_neg・signumメソッド char及びu8のis_ascii_alphabetic・is_ascii_uppercase・is_ascii_lowercase・is_ascii_alphanumeric・is_ascii_digit・is_ascii_hexdigit・is_ascii_punctuation・is_ascii_graphic・is_ascii_whitespace・is_ascii_controlメソッド
Cargo
build-dependenciesが、デフォルトでは最適化レベル0でビルドされるようになったcargo-helpが--helpの文字列を出力するのではなくmanページを表示するようになったcargo-metadataが、ターゲットに有効なテストが含まれるかを示すtestsフィールドを出力するようになったworkspace.default-membersの動作がworkspace.excludeの設定に基づくようになったcargo-publishが、package.publishに代替レジストリが1つしか設定されていない場合にそのレジストリを使うようになった
その他
互換性メモ
- Emscriptenの最小サポートバージョンを1.39.20に引き上げた
- 末尾の式において、
{} && falseのパースの後退バグを修正 macro_rules!内の手続きマクロの展開方法を変更し、より多くのスパンの情報を保持する助けとした。 この変更により、非衛生的、あるいはDelimiter::Noneを正しく処理していないマクロはコンパイルエラーになる可能性がある- CloudABIのサポートをtier 3に移行した
- 補足:これまでCloudABIのtierは2だった
linux-gnuターゲットが、最小でもカーネル2.6.32及びglibc 2.11を要求するようになった- 補足:RHEL 5の延長サポートが切れ、バージョンを上げても問題なくなるため
rustc-docsコンポーネントを追加した。これにより、コンパイラの内部APIのドキュメントをインストールし、 読むことが出来るようになる(現在はx86_64-unknown-linux-gnuのみサポート)
内部の変更
- ブートストラップスクリプト
x.pyのデフォルト設定を改善した。 この変更についての詳細はInside Rust BlogのエントリChanges tox.pydefaultsを参照。 ※訳注:英語ページ
関連リンク
さいごに
前回紹介したTypeIdを定数として取得する機能は、TypeIdの大きさが変わりうるとして却下されてしまいました。
残念です。
次のRust 1.48は2020/11/20(金)に予定されています。
Rustdocの中で、ファイルを[`std::fs::read_to_string`]で読み込むのようにリンクをアイテム名で簡単に張れるようになったり、
TryFromでVec<T>から[T; N]への変換が出来るようになったりするようです。
オプティムではVimmerを募集しています。
ライセンス表記
- この記事はApache 2/MITのデュアルライセンスで公開されている公式リリースノートを翻訳・追記をしています
- 冒頭の画像中にはRust公式サイトで配布されているロゴを使用しており、 このロゴはMozillaによってCC-BYの下で配布されています
- 冒頭の画像はいらすとやさんの画像を使っています。いつもありがとうございます
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Apache License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.